From 850abfde7f0d985ba01526c346bcd0d733562943 Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Mon, 28 Aug 2000 22:07:37 +0000 Subject: [PATCH] * All Files have been modified for inclusion of namespace cln; I am too lazy for a detailed discussion of all the changes. Many identifiers got their `cl_' stripped off. Ok, this is a clumpsy CVS log-entry. Promise: more will soon go into the file ChangeLog. I apologize for the inconvenience. :-( --- FILES | 2 +- INSTALL | 12 +- Makefile.devel | 2 +- Makefile.in | 15 +- NEWS | 14 + README | 18 +- autoconf/aclocal.m4 | 2 +- autoconf/config.guess | 24 +- autoconf/config.sub | 45 +- benchmarks/timebench1.cc | 84 +- benchmarks/timebench2a.cc | 39 +- benchmarks/timebench2ap.cc | 19 +- benchmarks/timebench2b.cc | 73 +- cln-config.in | 57 + configure | 209 +- configure.in | 31 +- doc/cln.dvi | Bin 258864 -> 263296 bytes doc/cln.html | 1106 ++--- doc/cln.info | 704 +-- doc/cln.ps | 4106 +++++++++-------- doc/cln.tex | 516 ++- doc/cln.texi | 525 ++- doc/cln_1.html | 7 +- doc/cln_10.html | 14 +- doc/cln_11.html | 201 +- doc/cln_12.html | 42 +- doc/cln_13.html | 4 +- doc/cln_2.html | 44 +- doc/cln_3.html | 74 +- doc/cln_4.html | 431 +- doc/cln_5.html | 42 +- doc/cln_6.html | 18 +- doc/cln_7.html | 74 +- doc/cln_8.html | 24 +- doc/cln_9.html | 134 +- doc/cln_toc.html | 23 +- examples/Makefile.in | 1 + examples/atan_recip.cc | 19 +- examples/atanh_recip.cc | 22 +- examples/contfrac.cc | 24 +- examples/e.cc | 40 +- examples/fibonacci.cc | 84 +- examples/legendre.cc | 34 +- examples/lucaslehmer.cc | 26 +- examples/nextprime.cc | 22 +- examples/perfnum.cc | 12 +- include/cl_config.h.in | 127 - include/cl_floatformat.h | 16 - include/cln.h | 141 - include/{cl_GV.h => cln/GV.h} | 8 +- include/{cl_GV_complex.h => cln/GV_complex.h} | 16 +- include/{cl_GV_integer.h => cln/GV_integer.h} | 16 +- .../GV_modinteger.h} | 7 +- include/{cl_GV_number.h => cln/GV_number.h} | 8 +- .../{cl_GV_rational.h => cln/GV_rational.h} | 16 +- include/{cl_GV_real.h => cln/GV_real.h} | 16 +- include/{cl_SV.h => cln/SV.h} | 8 +- include/{cl_SV_complex.h => cln/SV_complex.h} | 16 +- include/{cl_SV_integer.h => cln/SV_integer.h} | 16 +- include/{cl_SV_number.h => cln/SV_number.h} | 10 +- .../{cl_SV_rational.h => cln/SV_rational.h} | 16 +- include/{cl_SV_real.h => cln/SV_real.h} | 16 +- include/{cl_SV_ringelt.h => cln/SV_ringelt.h} | 10 +- include/{cl_V.h => cln/V.h} | 6 +- include/{cl_abort.h => cln/abort.h} | 4 + include/cln/cln.h | 141 + include/{cl_complex.h => cln/complex.h} | 22 +- .../complex_class.h} | 8 +- include/{cl_complex_io.h => cln/complex_io.h} | 10 +- .../{cl_complex_ring.h => cln/complex_ring.h} | 8 +- include/{cl_condition.h => cln/condition.h} | 23 +- include/{cl_dfloat.h => cln/dfloat.h} | 42 +- .../{cl_dfloat_class.h => cln/dfloat_class.h} | 10 +- include/{cl_dfloat_io.h => cln/dfloat_io.h} | 14 +- include/{cl_ffloat.h => cln/ffloat.h} | 42 +- .../{cl_ffloat_class.h => cln/ffloat_class.h} | 10 +- include/{cl_ffloat_io.h => cln/ffloat_io.h} | 14 +- include/{cl_float.h => cln/float.h} | 172 +- .../{cl_float_class.h => cln/float_class.h} | 10 +- include/{cl_float_io.h => cln/float_io.h} | 12 +- include/cln/floatformat.h | 20 + include/{cl_input.h => cln/input.h} | 14 +- include/{cl_integer.h => cln/integer.h} | 44 +- .../integer_class.h} | 10 +- include/{cl_integer_io.h => cln/integer_io.h} | 14 +- .../{cl_integer_ring.h => cln/integer_ring.h} | 8 +- include/{cl_io.h => cln/io.h} | 84 +- include/{cl_lfloat.h => cln/lfloat.h} | 42 +- .../{cl_lfloat_class.h => cln/lfloat_class.h} | 10 +- include/{cl_lfloat_io.h => cln/lfloat_io.h} | 14 +- include/{cl_malloc.h => cln/malloc.h} | 8 +- include/{cl_modinteger.h => cln/modinteger.h} | 46 +- include/{cl_modules.h => cln/modules.h} | 0 include/{cl_null_ring.h => cln/null_ring.h} | 6 +- include/{cl_number.h => cln/number.h} | 8 +- include/{cl_number_io.h => cln/number_io.h} | 8 +- include/{cl_numtheory.h => cln/numtheory.h} | 12 +- include/{cl_object.h => cln/object.h} | 19 +- include/{cl_output.h => cln/output.h} | 18 +- include/{cl_proplist.h => cln/proplist.h} | 16 +- include/{cl_random.h => cln/random.h} | 22 +- include/{cl_rational.h => cln/rational.h} | 36 +- .../rational_class.h} | 10 +- .../{cl_rational_io.h => cln/rational_io.h} | 10 +- .../rational_ring.h} | 8 +- include/{cl_real.h => cln/real.h} | 60 +- include/{cl_real_class.h => cln/real_class.h} | 11 +- include/{cl_real_io.h => cln/real_io.h} | 10 +- include/{cl_real_ring.h => cln/real_ring.h} | 8 +- include/{cl_ring.h => cln/ring.h} | 36 +- include/{cl_sfloat.h => cln/sfloat.h} | 42 +- .../{cl_sfloat_class.h => cln/sfloat_class.h} | 10 +- include/{cl_sfloat_io.h => cln/sfloat_io.h} | 14 +- include/{cl_string.h => cln/string.h} | 14 +- include/{cl_symbol.h => cln/symbol.h} | 6 +- include/{cl_timing.h => cln/timing.h} | 18 +- include/{cl_types.h => cln/types.h} | 4 +- include/{cl_univpoly.h => cln/univpoly.h} | 54 +- .../univpoly_complex.h} | 28 +- .../univpoly_integer.h} | 32 +- .../univpoly_modint.h} | 24 +- .../univpoly_rational.h} | 30 +- .../univpoly_real.h} | 28 +- .../src/interfaces/integers/cln/bigint_def.h | 4 +- src/Makefile.in | 9 +- src/base/cl_N.h | 6 +- src/base/cl_N_err_d0.cc | 10 +- src/base/cl_abort.cc | 6 +- src/base/cl_alloca.cc | 11 +- src/base/cl_alloca.h | 4 + src/base/cl_as_err.cc | 34 +- src/base/cl_condition.cc | 9 +- src/base/cl_debug.cc | 16 +- src/base/cl_debugout.cc | 18 +- src/base/cl_free.cc | 12 +- src/base/cl_immclasses.cc | 6 +- src/base/cl_iterator.h | 2 +- src/base/cl_low.h | 2 + src/base/cl_macros.h | 12 +- src/base/cl_malloc.cc | 17 +- src/base/cl_notreached.cc | 20 +- src/base/cl_sysdep.h | 8 +- src/base/digit/cl_2D.h | 6 +- src/base/digit/cl_2D_div.cc | 4 + src/base/digit/cl_2D_exptpos.cc | 4 + src/base/digit/cl_D.h | 7 +- src/base/digitseq/cl_2DS.h | 4 + src/base/digitseq/cl_2DS_div.cc | 5 +- src/base/digitseq/cl_2DS_recip.cc | 3 + src/base/digitseq/cl_DS.h | 7 +- src/base/digitseq/cl_DS_div.cc | 5 +- src/base/digitseq/cl_DS_mul.cc | 11 +- src/base/digitseq/cl_DS_mul_fftc.h | 12 +- src/base/digitseq/cl_DS_mul_fftcs.h | 13 +- src/base/digitseq/cl_DS_mul_fftr.h | 13 +- src/base/digitseq/cl_DS_mul_kara.h | 1 - src/base/digitseq/cl_DS_mul_kara_sqr.h | 1 - src/base/digitseq/cl_DS_random.cc | 8 +- src/base/digitseq/cl_DS_recip.cc | 6 +- src/base/digitseq/cl_DS_recipsqrt.cc | 5 +- src/base/digitseq/cl_DS_sqrt.cc | 18 +- src/base/digitseq/cl_DS_trandom.cc | 8 +- src/base/digitseq/cl_asm.h | 2 +- src/base/digitseq/cl_asm_.cc | 2 +- src/base/hash/cl_hash.h | 17 +- src/base/hash/cl_hash1.h | 12 +- src/base/hash/cl_hash1weak.h | 8 +- src/base/hash/cl_hash2.h | 12 +- src/base/hash/cl_hash2weak.h | 8 +- src/base/hash/cl_hashset.h | 12 +- src/base/hash/cl_hashuniq.h | 12 +- src/base/hash/cl_hashuniqweak.h | 8 +- .../hash/cl_rcpointer2_hashweak_rcpointer.cc | 3 + .../hash/cl_rcpointer2_hashweak_rcpointer.h | 6 +- .../hash/cl_rcpointer_hashweak_rcpointer.cc | 3 + .../hash/cl_rcpointer_hashweak_rcpointer.h | 6 +- src/base/input/cl_read_err_bad.cc | 16 +- src/base/input/cl_read_err_eof.cc | 12 +- src/base/input/cl_read_err_junk.cc | 20 +- src/base/input/cl_read_globals.cc | 12 + src/base/low/cl_low_div.cc | 3 + src/base/low/cl_low_isqrt.cc | 4 + src/base/low/cl_low_isqrt2.cc | 4 + src/base/low/cl_low_mul.cc | 4 + src/base/output/cl_output_dec.cc | 20 +- src/base/output/cl_output_hex.cc | 17 +- src/base/output/cl_prin_globals.cc | 27 +- src/base/proplist/cl_pl_add.cc | 8 +- src/base/proplist/cl_pl_d.cc | 6 +- src/base/proplist/cl_pl_get.cc | 6 +- src/base/random/cl_UL_random.cc | 8 +- src/base/random/cl_random_def.cc | 10 +- src/base/random/cl_random_from.cc | 16 +- src/base/random/cl_random_impl.h | 10 +- src/base/ring/cl_no_ring.cc | 22 +- src/base/ring/cl_ring_debug.cc | 16 +- src/base/string/cl_spushstring.h | 16 +- src/base/string/cl_spushstring_append.cc | 8 +- src/base/string/cl_spushstring_push.cc | 8 +- src/base/string/cl_sstring.cc | 8 +- src/base/string/cl_sstring.h | 6 +- src/base/string/cl_st_c2.cc | 6 +- src/base/string/cl_st_concat1.cc | 6 +- src/base/string/cl_st_concat2.cc | 8 +- src/base/string/cl_st_concat3.cc | 8 +- src/base/string/cl_st_debug.cc | 10 +- src/base/string/cl_st_hashcode.cc | 8 +- src/base/string/cl_st_make0.cc | 10 +- src/base/string/cl_st_make1.cc | 12 +- src/base/string/cl_st_make2.cc | 10 +- src/base/string/cl_st_null.cc | 10 +- src/base/string/input/cl_st_get1.cc | 15 +- src/base/string/input/cl_st_get2.cc | 20 +- src/base/string/input/cl_st_getline1.cc | 12 +- src/base/string/input/cl_st_getline2.cc | 22 +- src/base/string/input/cl_st_gettoken.cc | 13 +- src/base/string/misc/cl_st_class.cc | 6 +- src/base/string/output/cl_st_print.cc | 18 +- src/base/symbol/cl_sy_hashcode.cc | 8 +- src/base/symbol/cl_symbol.cc | 6 +- src/complex/algebraic/cl_C_abs.cc | 8 +- src/complex/algebraic/cl_C_abs_aux.cc | 6 +- src/complex/algebraic/cl_C_signum.cc | 8 +- src/complex/algebraic/cl_C_sqrt.cc | 8 +- src/complex/algebraic/cl_DF_hypot.cc | 6 +- src/complex/algebraic/cl_FF_hypot.cc | 6 +- src/complex/algebraic/cl_LF_hypot.cc | 6 +- src/complex/algebraic/cl_R_hypot.cc | 8 +- src/complex/algebraic/cl_SF_hypot.cc | 6 +- src/complex/cl_C.h | 19 +- src/complex/elem/cl_C_equal.cc | 22 +- src/complex/elem/cl_C_from_R_R_complex.cc | 4 + src/complex/elem/cl_C_from_R_R_complex1.cc | 4 + src/complex/elem/cl_C_imagpart.cc | 6 +- src/complex/elem/cl_C_minus.cc | 8 +- src/complex/elem/cl_C_minus1.cc | 8 +- src/complex/elem/cl_C_mul.cc | 8 +- src/complex/elem/cl_C_plus.cc | 8 +- src/complex/elem/cl_C_plus1.cc | 8 +- src/complex/elem/cl_C_realpart.cc | 6 +- src/complex/elem/cl_C_square.cc | 8 +- src/complex/elem/cl_C_uminus.cc | 8 +- src/complex/elem/cl_C_zerop.cc | 8 +- src/complex/elem/division/cl_C_DF_recip.cc | 6 +- src/complex/elem/division/cl_C_FF_recip.cc | 6 +- src/complex/elem/division/cl_C_LF_recip.cc | 6 +- src/complex/elem/division/cl_C_SF_recip.cc | 6 +- src/complex/elem/division/cl_C_div.cc | 8 +- src/complex/elem/division/cl_C_recip.cc | 10 +- src/complex/input/cl_N_from_string.cc | 12 +- src/complex/input/cl_N_read.cc | 48 +- src/complex/input/cl_N_read_stream.cc | 10 +- src/complex/misc/cl_C_class.cc | 6 +- src/complex/misc/cl_C_conjugate.cc | 8 +- src/complex/misc/cl_C_debug.cc | 12 +- src/complex/misc/cl_C_eqhashcode.cc | 18 +- src/complex/misc/cl_C_expt.cc | 8 +- src/complex/misc/cl_C_expt_I.cc | 8 +- src/complex/misc/cl_N_as.cc | 6 +- src/complex/output/cl_N_aprint.cc | 8 +- src/complex/output/cl_N_bprint.cc | 12 +- src/complex/ring/cl_C_ring.cc | 14 +- src/complex/transcendental/cl_C_acos.cc | 30 +- src/complex/transcendental/cl_C_acosh.cc | 22 +- src/complex/transcendental/cl_C_asin.cc | 8 +- src/complex/transcendental/cl_C_asinh.cc | 8 +- src/complex/transcendental/cl_C_asinh_aux.cc | 20 +- src/complex/transcendental/cl_C_atan.cc | 8 +- src/complex/transcendental/cl_C_atanh.cc | 8 +- src/complex/transcendental/cl_C_atanh_aux.cc | 8 +- src/complex/transcendental/cl_C_cis.cc | 12 +- src/complex/transcendental/cl_C_cos.cc | 12 +- src/complex/transcendental/cl_C_cosh.cc | 12 +- src/complex/transcendental/cl_C_exp.cc | 10 +- src/complex/transcendental/cl_C_expt_C.cc | 10 +- src/complex/transcendental/cl_C_log.cc | 8 +- src/complex/transcendental/cl_C_log2.cc | 8 +- src/complex/transcendental/cl_C_phase.cc | 8 +- src/complex/transcendental/cl_C_sin.cc | 12 +- src/complex/transcendental/cl_C_sinh.cc | 12 +- src/complex/transcendental/cl_C_tan.cc | 14 +- src/complex/transcendental/cl_C_tanh.cc | 14 +- src/complex/transcendental/cl_R_cis.cc | 10 +- src/float/algebraic/cl_F_sqrt.cc | 14 +- src/float/base/cl_F_err_nan.cc | 10 +- src/float/base/cl_F_err_ov.cc | 10 +- src/float/base/cl_F_err_un.cc | 10 +- src/float/base/cl_F_globals.cc | 7 +- src/float/base/cl_ieee.cc | 4 + src/float/base/cl_ieee.h | 4 + src/float/cl_F.h | 14 +- src/float/conv/cl_DF_to_FF.cc | 4 + src/float/conv/cl_DF_to_LF.cc | 4 + src/float/conv/cl_DF_to_SF.cc | 4 + src/float/conv/cl_DF_to_double.cc | 8 +- src/float/conv/cl_DF_to_float.cc | 8 +- src/float/conv/cl_FF_to_DF.cc | 4 + src/float/conv/cl_FF_to_LF.cc | 4 + src/float/conv/cl_FF_to_SF.cc | 4 + src/float/conv/cl_FF_to_double.cc | 8 +- src/float/conv/cl_FF_to_float.cc | 8 +- src/float/conv/cl_F_from_F.cc | 6 +- src/float/conv/cl_F_from_F_f.cc | 8 +- src/float/conv/cl_F_from_I.cc | 6 +- src/float/conv/cl_F_from_I_def.cc | 8 +- src/float/conv/cl_F_from_I_f.cc | 8 +- src/float/conv/cl_F_from_RA.cc | 6 +- src/float/conv/cl_F_from_RA_def.cc | 8 +- src/float/conv/cl_F_from_RA_f.cc | 8 +- src/float/conv/cl_F_to_DF.cc | 6 +- src/float/conv/cl_F_to_FF.cc | 6 +- src/float/conv/cl_F_to_LF.cc | 6 +- src/float/conv/cl_F_to_SF.cc | 6 +- src/float/conv/cl_F_to_double.cc | 24 +- src/float/conv/cl_F_to_float.cc | 24 +- src/float/conv/cl_LF_to_DF.cc | 4 + src/float/conv/cl_LF_to_FF.cc | 4 + src/float/conv/cl_LF_to_SF.cc | 4 + src/float/conv/cl_LF_to_double.cc | 8 +- src/float/conv/cl_LF_to_float.cc | 8 +- src/float/conv/cl_SF_to_DF.cc | 4 + src/float/conv/cl_SF_to_FF.cc | 4 + src/float/conv/cl_SF_to_LF.cc | 4 + src/float/conv/cl_SF_to_double.cc | 8 +- src/float/conv/cl_SF_to_float.cc | 8 +- src/float/dfloat/algebraic/cl_DF_sqrt.cc | 6 +- src/float/dfloat/cl_DF.h | 19 +- src/float/dfloat/conv/cl_DF_from_double.cc | 4 + src/float/dfloat/conv/cl_DF_to_doublej.cc | 4 + src/float/dfloat/conv/cl_I_to_double.cc | 10 +- src/float/dfloat/conv/cl_RA_to_double.cc | 14 +- src/float/dfloat/division/cl_DF_ceil22.cc | 6 +- src/float/dfloat/division/cl_DF_fceil.cc | 6 +- src/float/dfloat/division/cl_DF_floor22.cc | 6 +- src/float/dfloat/division/cl_DF_recip.cc | 6 +- src/float/dfloat/division/cl_DF_round22.cc | 6 +- src/float/dfloat/division/cl_DF_trunc22.cc | 6 +- src/float/dfloat/elem/cl_DF_compare.cc | 10 +- src/float/dfloat/elem/cl_DF_div.cc | 9 +- src/float/dfloat/elem/cl_DF_ffloor.cc | 6 +- src/float/dfloat/elem/cl_DF_from_I.cc | 6 +- src/float/dfloat/elem/cl_DF_from_RA.cc | 6 +- src/float/dfloat/elem/cl_DF_fround.cc | 6 +- src/float/dfloat/elem/cl_DF_ftrunc.cc | 6 +- src/float/dfloat/elem/cl_DF_futrunc.cc | 4 + src/float/dfloat/elem/cl_DF_globals.cc | 4 + src/float/dfloat/elem/cl_DF_minus.cc | 7 +- src/float/dfloat/elem/cl_DF_minusp.cc | 6 +- src/float/dfloat/elem/cl_DF_mul.cc | 9 +- src/float/dfloat/elem/cl_DF_plus.cc | 9 +- src/float/dfloat/elem/cl_DF_plusp.cc | 6 +- src/float/dfloat/elem/cl_DF_scale.cc | 6 +- src/float/dfloat/elem/cl_DF_scale_I.cc | 6 +- src/float/dfloat/elem/cl_DF_to_I.cc | 6 +- src/float/dfloat/elem/cl_DF_uminus.cc | 6 +- src/float/dfloat/elem/cl_DF_zerop.cc | 6 +- src/float/dfloat/input/cl_DF_from_string.cc | 14 +- src/float/dfloat/misc/cl_DF_abs.cc | 6 +- src/float/dfloat/misc/cl_DF_as.cc | 6 +- src/float/dfloat/misc/cl_DF_class.cc | 6 +- src/float/dfloat/misc/cl_DF_debug.cc | 12 +- src/float/dfloat/misc/cl_DF_decode.cc | 16 +- src/float/dfloat/misc/cl_DF_digits.cc | 6 +- src/float/dfloat/misc/cl_DF_eqhashcode.cc | 8 +- src/float/dfloat/misc/cl_DF_exponent.cc | 6 +- src/float/dfloat/misc/cl_DF_idecode.cc | 6 +- src/float/dfloat/misc/cl_DF_max.cc | 6 +- src/float/dfloat/misc/cl_DF_min.cc | 6 +- src/float/dfloat/misc/cl_DF_precision.cc | 6 +- src/float/dfloat/misc/cl_DF_sign.cc | 6 +- src/float/dfloat/misc/cl_DF_signum.cc | 6 +- src/float/division/cl_F_ceil1.cc | 14 +- src/float/division/cl_F_ceil2.cc | 14 +- src/float/division/cl_F_ceil22.cc | 6 +- src/float/division/cl_F_fceil1.cc | 14 +- src/float/division/cl_F_fceil2.cc | 14 +- src/float/division/cl_F_ffloor1.cc | 14 +- src/float/division/cl_F_ffloor2.cc | 14 +- src/float/division/cl_F_floor1.cc | 14 +- src/float/division/cl_F_floor2.cc | 14 +- src/float/division/cl_F_floor22.cc | 6 +- src/float/division/cl_F_fround1.cc | 14 +- src/float/division/cl_F_fround2.cc | 14 +- src/float/division/cl_F_ftrunc1.cc | 14 +- src/float/division/cl_F_ftrunc2.cc | 14 +- src/float/division/cl_F_round1.cc | 14 +- src/float/division/cl_F_round2.cc | 14 +- src/float/division/cl_F_round22.cc | 6 +- src/float/division/cl_F_trunc1.cc | 14 +- src/float/division/cl_F_trunc2.cc | 14 +- src/float/division/cl_F_trunc22.cc | 6 +- src/float/elem/cl_F_I_div.cc | 14 +- src/float/elem/cl_F_I_mul.cc | 14 +- src/float/elem/cl_F_RA_div.cc | 14 +- src/float/elem/cl_F_RA_mul.cc | 14 +- src/float/elem/cl_F_compare.cc | 20 +- src/float/elem/cl_F_div.cc | 14 +- src/float/elem/cl_F_minus.cc | 14 +- src/float/elem/cl_F_minusp.cc | 6 +- src/float/elem/cl_F_mul.cc | 14 +- src/float/elem/cl_F_plus.cc | 14 +- src/float/elem/cl_F_plusp.cc | 6 +- src/float/elem/cl_F_recip.cc | 14 +- src/float/elem/cl_F_scale.cc | 14 +- src/float/elem/cl_F_scale_I.cc | 14 +- src/float/elem/cl_F_square.cc | 14 +- src/float/elem/cl_F_uminus.cc | 14 +- src/float/elem/cl_F_zerop.cc | 6 +- src/float/elem/cl_I_F_div.cc | 14 +- src/float/elem/cl_RA_F_div.cc | 14 +- src/float/ffloat/algebraic/cl_FF_sqrt.cc | 6 +- src/float/ffloat/cl_FF.h | 17 +- src/float/ffloat/conv/cl_FF_from_float.cc | 3 + src/float/ffloat/conv/cl_FF_to_floatj.cc | 3 + src/float/ffloat/conv/cl_I_to_float.cc | 10 +- src/float/ffloat/conv/cl_RA_to_float.cc | 14 +- src/float/ffloat/division/cl_FF_ceil22.cc | 6 +- src/float/ffloat/division/cl_FF_fceil.cc | 6 +- src/float/ffloat/division/cl_FF_floor22.cc | 6 +- src/float/ffloat/division/cl_FF_recip.cc | 6 +- src/float/ffloat/division/cl_FF_round22.cc | 6 +- src/float/ffloat/division/cl_FF_trunc22.cc | 6 +- src/float/ffloat/elem/cl_FF_compare.cc | 10 +- src/float/ffloat/elem/cl_FF_div.cc | 9 +- src/float/ffloat/elem/cl_FF_ffloor.cc | 6 +- src/float/ffloat/elem/cl_FF_from_I.cc | 6 +- src/float/ffloat/elem/cl_FF_from_RA.cc | 6 +- src/float/ffloat/elem/cl_FF_fround.cc | 6 +- src/float/ffloat/elem/cl_FF_ftrunc.cc | 6 +- src/float/ffloat/elem/cl_FF_futrunc.cc | 4 + src/float/ffloat/elem/cl_FF_globals.cc | 4 + src/float/ffloat/elem/cl_FF_minus.cc | 7 +- src/float/ffloat/elem/cl_FF_minusp.cc | 6 +- src/float/ffloat/elem/cl_FF_mul.cc | 9 +- src/float/ffloat/elem/cl_FF_plus.cc | 9 +- src/float/ffloat/elem/cl_FF_plusp.cc | 6 +- src/float/ffloat/elem/cl_FF_scale.cc | 6 +- src/float/ffloat/elem/cl_FF_scale_I.cc | 6 +- src/float/ffloat/elem/cl_FF_to_I.cc | 6 +- src/float/ffloat/elem/cl_FF_uminus.cc | 6 +- src/float/ffloat/elem/cl_FF_zerop.cc | 6 +- src/float/ffloat/input/cl_FF_from_string.cc | 14 +- src/float/ffloat/misc/cl_FF_abs.cc | 6 +- src/float/ffloat/misc/cl_FF_as.cc | 6 +- src/float/ffloat/misc/cl_FF_class.cc | 6 +- src/float/ffloat/misc/cl_FF_debug.cc | 12 +- src/float/ffloat/misc/cl_FF_decode.cc | 12 +- src/float/ffloat/misc/cl_FF_digits.cc | 6 +- src/float/ffloat/misc/cl_FF_eqhashcode.cc | 8 +- src/float/ffloat/misc/cl_FF_exponent.cc | 6 +- src/float/ffloat/misc/cl_FF_idecode.cc | 10 +- src/float/ffloat/misc/cl_FF_max.cc | 6 +- src/float/ffloat/misc/cl_FF_min.cc | 6 +- src/float/ffloat/misc/cl_FF_precision.cc | 6 +- src/float/ffloat/misc/cl_FF_sign.cc | 6 +- src/float/ffloat/misc/cl_FF_signum.cc | 6 +- src/float/input/cl_F_from_string.cc | 14 +- src/float/input/cl_F_read.cc | 32 +- src/float/input/cl_F_read_stream.cc | 10 +- src/float/input/cl_F_readparsed.cc | 22 +- src/float/lfloat/algebraic/cl_LF_sqrt.cc | 7 +- src/float/lfloat/cl_LF.h | 10 +- src/float/lfloat/cl_LF_impl.h | 10 +- src/float/lfloat/division/cl_LF_ceil22.cc | 6 +- src/float/lfloat/division/cl_LF_fceil.cc | 6 +- src/float/lfloat/division/cl_LF_floor22.cc | 6 +- src/float/lfloat/division/cl_LF_recip.cc | 6 +- src/float/lfloat/division/cl_LF_round22.cc | 6 +- src/float/lfloat/division/cl_LF_trunc22.cc | 6 +- src/float/lfloat/elem/cl_I_LF_div.cc | 8 +- src/float/lfloat/elem/cl_LF_1minus.cc | 4 + src/float/lfloat/elem/cl_LF_1plus.cc | 4 + src/float/lfloat/elem/cl_LF_2minus.cc | 6 +- src/float/lfloat/elem/cl_LF_2plus.cc | 6 +- src/float/lfloat/elem/cl_LF_I_div.cc | 7 +- src/float/lfloat/elem/cl_LF_I_mul.cc | 5 +- src/float/lfloat/elem/cl_LF_RA_div.cc | 8 +- src/float/lfloat/elem/cl_LF_RA_mul.cc | 6 +- src/float/lfloat/elem/cl_LF_compare.cc | 10 +- src/float/lfloat/elem/cl_LF_div.cc | 17 +- src/float/lfloat/elem/cl_LF_ffloor.cc | 6 +- src/float/lfloat/elem/cl_LF_from_I.cc | 6 +- src/float/lfloat/elem/cl_LF_from_RA.cc | 6 +- src/float/lfloat/elem/cl_LF_fround.cc | 6 +- src/float/lfloat/elem/cl_LF_ftrunc.cc | 6 +- src/float/lfloat/elem/cl_LF_futrunc.cc | 4 + src/float/lfloat/elem/cl_LF_globals.cc | 6 +- src/float/lfloat/elem/cl_LF_minus1.cc | 6 +- src/float/lfloat/elem/cl_LF_minusp.cc | 6 +- src/float/lfloat/elem/cl_LF_mul.cc | 5 +- src/float/lfloat/elem/cl_LF_plus1.cc | 6 +- src/float/lfloat/elem/cl_LF_plusp.cc | 6 +- src/float/lfloat/elem/cl_LF_scale.cc | 6 +- src/float/lfloat/elem/cl_LF_scale_I.cc | 6 +- src/float/lfloat/elem/cl_LF_square.cc | 5 +- src/float/lfloat/elem/cl_LF_to_I.cc | 6 +- src/float/lfloat/elem/cl_LF_uminus.cc | 6 +- src/float/lfloat/elem/cl_LF_zerop.cc | 6 +- src/float/lfloat/elem/cl_RA_LF_div.cc | 6 +- src/float/lfloat/input/cl_LF_from_string.cc | 14 +- src/float/lfloat/misc/cl_LF_abs.cc | 6 +- src/float/lfloat/misc/cl_LF_as.cc | 6 +- src/float/lfloat/misc/cl_LF_class.cc | 6 +- src/float/lfloat/misc/cl_LF_debug.cc | 12 +- src/float/lfloat/misc/cl_LF_decode.cc | 12 +- src/float/lfloat/misc/cl_LF_digits.cc | 6 +- src/float/lfloat/misc/cl_LF_eqhashcode.cc | 8 +- src/float/lfloat/misc/cl_LF_exponent.cc | 6 +- src/float/lfloat/misc/cl_LF_extend.cc | 4 + src/float/lfloat/misc/cl_LF_idecode.cc | 6 +- src/float/lfloat/misc/cl_LF_leninc.cc | 4 + src/float/lfloat/misc/cl_LF_lenincx.cc | 4 + src/float/lfloat/misc/cl_LF_max.cc | 6 +- src/float/lfloat/misc/cl_LF_min.cc | 6 +- src/float/lfloat/misc/cl_LF_precision.cc | 6 +- src/float/lfloat/misc/cl_LF_shorten.cc | 4 + src/float/lfloat/misc/cl_LF_shortenrel.cc | 6 +- src/float/lfloat/misc/cl_LF_shortenwith.cc | 6 +- src/float/lfloat/misc/cl_LF_sign.cc | 6 +- src/float/lfloat/misc/cl_LF_signum.cc | 6 +- src/float/lfloat/misc/cl_LF_to_LF.cc | 4 + src/float/misc/cl_F_abs.cc | 14 +- src/float/misc/cl_F_as.cc | 6 +- src/float/misc/cl_F_decode.cc | 36 +- src/float/misc/cl_F_digits.cc | 6 +- src/float/misc/cl_F_epsneg.cc | 8 +- src/float/misc/cl_F_epspos.cc | 8 +- src/float/misc/cl_F_eqhashcode.cc | 16 +- src/float/misc/cl_F_exponent.cc | 6 +- src/float/misc/cl_F_extendsqrt.cc | 4 + src/float/misc/cl_F_extendsqrtx.cc | 4 + src/float/misc/cl_F_idecode.cc | 6 +- src/float/misc/cl_F_leastneg.cc | 8 +- src/float/misc/cl_F_leastpos.cc | 8 +- src/float/misc/cl_F_max.cc | 6 +- src/float/misc/cl_F_min.cc | 6 +- src/float/misc/cl_F_mostneg.cc | 8 +- src/float/misc/cl_F_mostpos.cc | 8 +- src/float/misc/cl_F_precision.cc | 6 +- src/float/misc/cl_F_rational.cc | 8 +- src/float/misc/cl_F_shortenrel.cc | 6 +- src/float/misc/cl_F_sign.cc | 6 +- src/float/misc/cl_F_sign2.cc | 6 +- src/float/misc/cl_F_signum.cc | 6 +- src/float/misc/cl_float_format.cc | 12 +- src/float/output/cl_F_aprint.cc | 8 +- src/float/output/cl_F_bprint.cc | 8 +- src/float/output/cl_F_cprint.cc | 8 +- src/float/output/cl_F_dprint.cc | 24 +- src/float/output/cl_F_printb.cc | 10 +- src/float/random/cl_F_random.cc | 8 +- src/float/sfloat/algebraic/cl_SF_sqrt.cc | 6 +- src/float/sfloat/cl_SF.h | 6 +- src/float/sfloat/division/cl_SF_ceil22.cc | 6 +- src/float/sfloat/division/cl_SF_fceil.cc | 6 +- src/float/sfloat/division/cl_SF_ffloor.cc | 6 +- src/float/sfloat/division/cl_SF_floor22.cc | 6 +- src/float/sfloat/division/cl_SF_recip.cc | 6 +- src/float/sfloat/division/cl_SF_round22.cc | 6 +- src/float/sfloat/division/cl_SF_trunc22.cc | 6 +- src/float/sfloat/elem/cl_SF_compare.cc | 10 +- src/float/sfloat/elem/cl_SF_div.cc | 6 +- src/float/sfloat/elem/cl_SF_from_I.cc | 6 +- src/float/sfloat/elem/cl_SF_from_RA.cc | 6 +- src/float/sfloat/elem/cl_SF_fround.cc | 6 +- src/float/sfloat/elem/cl_SF_ftrunc.cc | 6 +- src/float/sfloat/elem/cl_SF_futrunc.cc | 4 + src/float/sfloat/elem/cl_SF_minus.cc | 6 +- src/float/sfloat/elem/cl_SF_minusp.cc | 6 +- src/float/sfloat/elem/cl_SF_mul.cc | 6 +- src/float/sfloat/elem/cl_SF_plus.cc | 6 +- src/float/sfloat/elem/cl_SF_plusp.cc | 6 +- src/float/sfloat/elem/cl_SF_scale.cc | 6 +- src/float/sfloat/elem/cl_SF_scale_I.cc | 6 +- src/float/sfloat/elem/cl_SF_to_I.cc | 6 +- src/float/sfloat/elem/cl_SF_uminus.cc | 6 +- src/float/sfloat/elem/cl_SF_zerop.cc | 6 +- src/float/sfloat/input/cl_SF_from_string.cc | 14 +- src/float/sfloat/misc/cl_SF_abs.cc | 6 +- src/float/sfloat/misc/cl_SF_as.cc | 6 +- src/float/sfloat/misc/cl_SF_class.cc | 6 +- src/float/sfloat/misc/cl_SF_debug.cc | 12 +- src/float/sfloat/misc/cl_SF_decode.cc | 12 +- src/float/sfloat/misc/cl_SF_digits.cc | 6 +- src/float/sfloat/misc/cl_SF_eqhashcode.cc | 8 +- src/float/sfloat/misc/cl_SF_exponent.cc | 6 +- src/float/sfloat/misc/cl_SF_idecode.cc | 6 +- src/float/sfloat/misc/cl_SF_max.cc | 6 +- src/float/sfloat/misc/cl_SF_min.cc | 6 +- src/float/sfloat/misc/cl_SF_precision.cc | 6 +- src/float/sfloat/misc/cl_SF_sign.cc | 6 +- src/float/sfloat/misc/cl_SF_signum.cc | 6 +- src/float/transcendental/cl_F_atanhx.cc | 8 +- src/float/transcendental/cl_F_atanx.cc | 9 +- src/float/transcendental/cl_F_catalanconst.cc | 12 +- .../transcendental/cl_F_catalanconst_def.cc | 14 +- .../transcendental/cl_F_catalanconst_f.cc | 12 +- .../transcendental/cl_F_catalanconst_var.cc | 8 +- src/float/transcendental/cl_F_cos.cc | 10 +- src/float/transcendental/cl_F_cosh.cc | 10 +- src/float/transcendental/cl_F_coshsinh.cc | 28 +- src/float/transcendental/cl_F_cossin.cc | 22 +- src/float/transcendental/cl_F_eulerconst.cc | 12 +- .../transcendental/cl_F_eulerconst_def.cc | 14 +- src/float/transcendental/cl_F_eulerconst_f.cc | 12 +- .../transcendental/cl_F_eulerconst_var.cc | 8 +- src/float/transcendental/cl_F_exp.cc | 10 +- src/float/transcendental/cl_F_exp1.cc | 12 +- src/float/transcendental/cl_F_exp1_def.cc | 14 +- src/float/transcendental/cl_F_exp1_f.cc | 12 +- src/float/transcendental/cl_F_exp1_var.cc | 8 +- src/float/transcendental/cl_F_expx.cc | 10 +- src/float/transcendental/cl_F_ln.cc | 14 +- src/float/transcendental/cl_F_ln10.cc | 4 + src/float/transcendental/cl_F_ln10_f.cc | 6 +- src/float/transcendental/cl_F_ln10_var.cc | 8 +- src/float/transcendental/cl_F_ln2.cc | 4 + src/float/transcendental/cl_F_ln2_f.cc | 6 +- src/float/transcendental/cl_F_ln2_var.cc | 8 +- src/float/transcendental/cl_F_lnx.cc | 10 +- src/float/transcendental/cl_F_pi.cc | 12 +- src/float/transcendental/cl_F_pi_def.cc | 14 +- src/float/transcendental/cl_F_pi_f.cc | 12 +- src/float/transcendental/cl_F_pi_var.cc | 8 +- src/float/transcendental/cl_F_roundpi.cc | 6 +- src/float/transcendental/cl_F_roundpi2.cc | 6 +- src/float/transcendental/cl_F_sin.cc | 10 +- src/float/transcendental/cl_F_sinh.cc | 10 +- src/float/transcendental/cl_F_sinhx.cc | 9 +- src/float/transcendental/cl_F_sinx.cc | 9 +- src/float/transcendental/cl_F_tan.cc | 8 +- src/float/transcendental/cl_F_tanh.cc | 8 +- src/float/transcendental/cl_F_tran.h | 24 +- src/float/transcendental/cl_F_zeta_int.cc | 18 +- src/float/transcendental/cl_F_zeta_int_def.cc | 20 +- src/float/transcendental/cl_F_zeta_int_f.cc | 18 +- src/float/transcendental/cl_LF_atan_recip.cc | 12 +- src/float/transcendental/cl_LF_atanh_recip.cc | 12 +- .../transcendental/cl_LF_catalanconst.cc | 16 +- src/float/transcendental/cl_LF_coshsinh.cc | 8 +- .../transcendental/cl_LF_coshsinh_aux.cc | 15 +- src/float/transcendental/cl_LF_cossin.cc | 8 +- src/float/transcendental/cl_LF_cossin_aux.cc | 15 +- src/float/transcendental/cl_LF_eulerconst.cc | 14 +- src/float/transcendental/cl_LF_exp1.cc | 18 +- src/float/transcendental/cl_LF_exp_aux.cc | 15 +- src/float/transcendental/cl_LF_ln10.cc | 6 +- src/float/transcendental/cl_LF_ln2.cc | 6 +- src/float/transcendental/cl_LF_pi.cc | 28 +- src/float/transcendental/cl_LF_ratseries.cc | 4 + src/float/transcendental/cl_LF_ratseries_.cc | 10 +- src/float/transcendental/cl_LF_ratseries_a.cc | 10 +- .../transcendental/cl_LF_ratseries_ab.cc | 10 +- src/float/transcendental/cl_LF_ratseries_b.cc | 10 +- src/float/transcendental/cl_LF_ratseries_p.cc | 10 +- .../transcendental/cl_LF_ratseries_pa.cc | 10 +- .../transcendental/cl_LF_ratseries_pab.cc | 10 +- .../transcendental/cl_LF_ratseries_pb.cc | 10 +- .../transcendental/cl_LF_ratseries_pq.cc | 10 +- .../transcendental/cl_LF_ratseries_pqa.cc | 10 +- .../transcendental/cl_LF_ratseries_pqab.cc | 10 +- .../transcendental/cl_LF_ratseries_pqb.cc | 10 +- src/float/transcendental/cl_LF_ratseries_q.cc | 10 +- .../transcendental/cl_LF_ratseries_qa.cc | 10 +- .../transcendental/cl_LF_ratseries_qab.cc | 10 +- .../transcendental/cl_LF_ratseries_qb.cc | 10 +- .../cl_LF_ratseries_stream_pq.cc | 10 +- .../cl_LF_ratseries_stream_pqa.cc | 10 +- .../cl_LF_ratseries_stream_pqab.cc | 10 +- .../cl_LF_ratseries_stream_pqb.cc | 10 +- .../transcendental/cl_LF_ratsumseries_pqcd.cc | 10 +- .../cl_LF_ratsumseries_pqcd_aux.cc | 8 +- .../transcendental/cl_LF_ratsumseries_pqd.cc | 10 +- .../cl_LF_ratsumseries_pqd_aux.cc | 8 +- src/float/transcendental/cl_LF_tran.h | 6 +- src/float/transcendental/cl_LF_zeta3.cc | 12 +- src/float/transcendental/cl_LF_zeta_int.cc | 14 +- src/integer/2adic/cl_I_2adic_div.cc | 5 +- src/integer/2adic/cl_I_2adic_recip.cc | 5 +- src/integer/algebraic/cl_I_rootp.cc | 6 +- src/integer/algebraic/cl_I_rootp_I.cc | 6 +- src/integer/algebraic/cl_I_rootp_aux.cc | 6 +- src/integer/algebraic/cl_I_sqrt.cc | 19 +- src/integer/algebraic/cl_I_sqrtp.cc | 5 +- src/integer/bitwise/cl_I_ash.cc | 6 +- src/integer/bitwise/cl_I_ash.h | 8 +- src/integer/bitwise/cl_I_ash_I.cc | 6 +- src/integer/bitwise/cl_I_asherr.cc | 18 +- src/integer/bitwise/cl_I_boole.cc | 6 +- src/integer/bitwise/cl_I_byte.h | 8 +- src/integer/bitwise/cl_I_dpb.cc | 8 +- src/integer/bitwise/cl_I_dpf.cc | 8 +- src/integer/bitwise/cl_I_fullbyte.cc | 6 +- src/integer/bitwise/cl_I_ilength.cc | 6 +- src/integer/bitwise/cl_I_ldb.cc | 8 +- src/integer/bitwise/cl_I_ldbtest.cc | 8 +- src/integer/bitwise/cl_I_ldbx.cc | 6 +- src/integer/bitwise/cl_I_ldbxtest.cc | 5 +- src/integer/bitwise/cl_I_log.h | 6 +- src/integer/bitwise/cl_I_log_aux.cc | 7 +- src/integer/bitwise/cl_I_logand.cc | 6 +- src/integer/bitwise/cl_I_logandc2.cc | 6 +- src/integer/bitwise/cl_I_logbitp.cc | 6 +- src/integer/bitwise/cl_I_logbitp_I.cc | 18 +- src/integer/bitwise/cl_I_logcount.cc | 6 +- src/integer/bitwise/cl_I_logeqv.cc | 6 +- src/integer/bitwise/cl_I_logior.cc | 6 +- src/integer/bitwise/cl_I_lognand.cc | 6 +- src/integer/bitwise/cl_I_lognor.cc | 6 +- src/integer/bitwise/cl_I_lognot.cc | 6 +- src/integer/bitwise/cl_I_logorc2.cc | 6 +- src/integer/bitwise/cl_I_logtest.cc | 6 +- src/integer/bitwise/cl_I_logxor.cc | 6 +- src/integer/bitwise/cl_I_mkf.cc | 8 +- src/integer/bitwise/cl_I_mkfx.cc | 6 +- src/integer/cl_I.h | 13 +- src/integer/conv/cl_I_digits_need.cc | 4 + src/integer/conv/cl_I_from_DS.cc | 6 +- src/integer/conv/cl_I_from_L.cc | 6 +- src/integer/conv/cl_I_from_L2.cc | 6 +- src/integer/conv/cl_I_from_NDS.cc | 6 +- src/integer/conv/cl_I_from_NUDS.cc | 6 +- src/integer/conv/cl_I_from_Q.cc | 6 +- src/integer/conv/cl_I_from_UDS.cc | 6 +- src/integer/conv/cl_I_from_UL.cc | 6 +- src/integer/conv/cl_I_from_UL2.cc | 6 +- src/integer/conv/cl_I_from_UQ.cc | 6 +- src/integer/conv/cl_I_from_digits.cc | 4 + src/integer/conv/cl_I_mul10plus.cc | 6 +- src/integer/conv/cl_I_to_L.cc | 20 +- src/integer/conv/cl_I_to_Q.cc | 18 +- src/integer/conv/cl_I_to_UL.cc | 20 +- src/integer/conv/cl_I_to_UQ.cc | 18 +- src/integer/conv/cl_I_to_digits.cc | 7 +- src/integer/division/cl_I_ceil1.cc | 6 +- src/integer/division/cl_I_ceil2.cc | 6 +- src/integer/division/cl_I_exquo.cc | 6 +- src/integer/division/cl_I_exquoerr.cc | 20 +- src/integer/division/cl_I_exquopos.cc | 6 +- src/integer/division/cl_I_floor1.cc | 6 +- src/integer/division/cl_I_floor2.cc | 6 +- src/integer/division/cl_I_mod.cc | 6 +- src/integer/division/cl_I_rem.cc | 6 +- src/integer/division/cl_I_round1.cc | 6 +- src/integer/division/cl_I_round2.cc | 6 +- src/integer/division/cl_I_trunc1.cc | 6 +- src/integer/division/cl_I_trunc2.cc | 6 +- src/integer/elem/cl_I_compare.cc | 10 +- src/integer/elem/cl_I_div.cc | 3 + src/integer/elem/cl_I_equal.cc | 10 +- src/integer/elem/cl_I_minus.cc | 6 +- src/integer/elem/cl_I_minus1.cc | 6 +- src/integer/elem/cl_I_minusp.cc | 6 +- src/integer/elem/cl_I_mul.cc | 5 +- src/integer/elem/cl_I_plus.cc | 6 +- src/integer/elem/cl_I_plus1.cc | 6 +- src/integer/elem/cl_I_plusp.cc | 6 +- src/integer/elem/cl_I_square.cc | 5 +- src/integer/elem/cl_I_uminus.cc | 6 +- src/integer/elem/cl_I_zerop.cc | 6 +- src/integer/gcd/cl_I_gcd.cc | 8 +- src/integer/gcd/cl_I_gcd_aux.cc | 6 +- src/integer/gcd/cl_I_gcd_aux2.cc | 6 +- src/integer/gcd/cl_I_lcm.cc | 6 +- src/integer/gcd/cl_I_xgcd.cc | 8 +- src/integer/gcd/cl_low_gcd.cc | 6 +- src/integer/hash/cl_I_hash_gcobject.cc | 3 + src/integer/hash/cl_I_hash_gcobject.h | 14 +- src/integer/hash/cl_I_hash_gcpointer.cc | 3 + src/integer/hash/cl_I_hash_gcpointer.h | 14 +- src/integer/hash/cl_I_hash_pointer.cc | 3 + src/integer/hash/cl_I_hash_pointer.h | 14 +- src/integer/hash/cl_I_hash_rcobject.cc | 3 + src/integer/hash/cl_I_hash_rcobject.h | 14 +- src/integer/hash/cl_I_hash_rcpointer.cc | 3 + src/integer/hash/cl_I_hash_rcpointer.h | 14 +- src/integer/hash/cl_I_hashcode.cc | 4 + src/integer/hash/cl_I_hashweak_rcpointer.cc | 3 + src/integer/hash/cl_I_hashweak_rcpointer.h | 14 +- src/integer/input/cl_I_from_string.cc | 12 +- src/integer/input/cl_I_read.cc | 22 +- src/integer/input/cl_I_read_stream.cc | 10 +- src/integer/input/cl_I_readparsed.cc | 6 +- src/integer/misc/cl_BN_class.cc | 6 +- src/integer/misc/cl_FN_class.cc | 6 +- src/integer/misc/cl_I_abs.cc | 6 +- src/integer/misc/cl_I_as.cc | 6 +- src/integer/misc/cl_I_debug.cc | 12 +- src/integer/misc/cl_I_eqhashcode.cc | 16 +- src/integer/misc/cl_I_exptpos.cc | 5 +- src/integer/misc/cl_I_exptpos_I.cc | 5 +- src/integer/misc/cl_I_max.cc | 6 +- src/integer/misc/cl_I_min.cc | 6 +- src/integer/misc/cl_I_oddp.cc | 6 +- src/integer/misc/cl_I_ord2.cc | 6 +- src/integer/misc/cl_I_power2p.cc | 6 +- src/integer/misc/cl_I_signum.cc | 6 +- src/integer/misc/combin/cl_I_binomial.cc | 6 +- src/integer/misc/combin/cl_I_combin.h | 8 +- .../misc/combin/cl_I_doublefactorial.cc | 6 +- src/integer/misc/combin/cl_I_factorial.cc | 6 +- src/integer/misc/combin/cl_I_factorial_aux.cc | 4 + src/integer/output/cl_I_aprint.cc | 8 +- src/integer/output/cl_I_bprint.cc | 8 +- src/integer/output/cl_I_cprint.cc | 8 +- src/integer/output/cl_I_decstring.cc | 6 +- src/integer/output/cl_I_dprint.cc | 8 +- src/integer/output/cl_I_print.cc | 8 +- src/integer/output/cl_I_print_string.cc | 6 +- src/integer/random/cl_I_random.cc | 8 +- src/integer/random/cl_I_trandom.cc | 8 +- src/integer/ring/cl_0_ring.cc | 8 +- src/integer/ring/cl_I_ring.cc | 14 +- src/modinteger/cl_MI.cc | 23 +- src/modinteger/cl_MI.h | 6 +- src/modinteger/cl_MI_cond_composite.cc | 10 +- src/modinteger/cl_MI_debug.cc | 12 +- src/modinteger/cl_MI_err_comp.cc | 8 +- src/modinteger/cl_MI_fix16.h | 4 + src/modinteger/cl_MI_fix29.h | 4 + src/modinteger/cl_MI_fix32.h | 4 + src/modinteger/cl_MI_int.h | 8 +- src/modinteger/cl_MI_int32.h | 4 + src/modinteger/cl_MI_lshift.cc | 8 +- src/modinteger/cl_MI_montgom.h | 4 + src/modinteger/cl_MI_pow2.h | 10 +- src/modinteger/cl_MI_pow2m1.h | 10 +- src/modinteger/cl_MI_pow2p1.h | 10 +- src/modinteger/cl_MI_rshift.cc | 8 +- src/modinteger/cl_MI_std.h | 6 +- src/numtheory/cl_IF.h | 7 +- src/numtheory/cl_IF_millerrabin.cc | 8 +- src/numtheory/cl_IF_smallprimes.cc | 4 + src/numtheory/cl_IF_trialdiv.cc | 4 + src/numtheory/cl_IF_trialdiv1.cc | 4 + src/numtheory/cl_IF_trialdiv2.cc | 4 + src/numtheory/cl_nt_cornacchia1.cc | 8 +- src/numtheory/cl_nt_cornacchia4.cc | 8 +- src/numtheory/cl_nt_isprobprime.cc | 8 +- src/numtheory/cl_nt_jacobi.cc | 10 +- src/numtheory/cl_nt_jacobi_low.cc | 8 +- src/numtheory/cl_nt_nextprobprime.cc | 8 +- src/numtheory/cl_nt_sqrtmodp.cc | 16 +- src/polynomial/cl_UP.h | 10 +- src/polynomial/elem/cl_UP.cc | 12 +- src/polynomial/elem/cl_UP_GF2.h | 11 +- src/polynomial/elem/cl_UP_MI.h | 10 +- src/polynomial/elem/cl_UP_gen.h | 10 +- src/polynomial/elem/cl_UP_named.cc | 13 +- src/polynomial/elem/cl_UP_no_ring.cc | 22 +- src/polynomial/elem/cl_UP_number.h | 12 +- src/polynomial/elem/cl_UP_unnamed.cc | 10 +- src/polynomial/elem/cl_asm_GF2.cc | 2 +- src/polynomial/misc/cl_UP_I_hermite.cc | 14 +- src/polynomial/misc/cl_UP_I_laguerre.cc | 14 +- src/polynomial/misc/cl_UP_I_tchebychev.cc | 14 +- src/polynomial/misc/cl_UP_RA_legendre.cc | 16 +- src/polynomial/misc/cl_UP_debug.cc | 8 +- src/polynomial/misc/cl_UP_deriv.cc | 8 +- src/rational/algebraic/cl_RA_rootp.cc | 8 +- src/rational/algebraic/cl_RA_rootp_I.cc | 8 +- src/rational/algebraic/cl_RA_sqrtp.cc | 8 +- src/rational/cl_RA.h | 11 +- src/rational/division/cl_RA_ceil1.cc | 8 +- src/rational/division/cl_RA_ceil12.cc | 8 +- src/rational/division/cl_RA_ceil2.cc | 8 +- src/rational/division/cl_RA_ceil22.cc | 8 +- src/rational/division/cl_RA_floor1.cc | 8 +- src/rational/division/cl_RA_floor12.cc | 8 +- src/rational/division/cl_RA_floor2.cc | 8 +- src/rational/division/cl_RA_floor22.cc | 8 +- src/rational/division/cl_RA_round1.cc | 8 +- src/rational/division/cl_RA_round12.cc | 8 +- src/rational/division/cl_RA_round2.cc | 8 +- src/rational/division/cl_RA_round22.cc | 8 +- src/rational/division/cl_RA_trunc1.cc | 8 +- src/rational/division/cl_RA_trunc12.cc | 8 +- src/rational/division/cl_RA_trunc2.cc | 8 +- src/rational/division/cl_RA_trunc22.cc | 8 +- src/rational/elem/cl_RA_compare.cc | 20 +- src/rational/elem/cl_RA_denominator.cc | 6 +- src/rational/elem/cl_RA_div.cc | 8 +- src/rational/elem/cl_RA_equal.cc | 18 +- src/rational/elem/cl_RA_from_I_I_div.cc | 4 + src/rational/elem/cl_RA_from_I_posI.cc | 4 + src/rational/elem/cl_RA_from_I_posI1.cc | 4 + src/rational/elem/cl_RA_from_I_posI_div.cc | 6 +- src/rational/elem/cl_RA_minus.cc | 8 +- src/rational/elem/cl_RA_minus1.cc | 8 +- src/rational/elem/cl_RA_minusp.cc | 6 +- src/rational/elem/cl_RA_mul.cc | 8 +- src/rational/elem/cl_RA_numerator.cc | 6 +- src/rational/elem/cl_RA_plus.cc | 8 +- src/rational/elem/cl_RA_plus1.cc | 8 +- src/rational/elem/cl_RA_plusp.cc | 6 +- src/rational/elem/cl_RA_recip.cc | 6 +- src/rational/elem/cl_RA_square.cc | 8 +- src/rational/elem/cl_RA_uminus.cc | 8 +- src/rational/elem/cl_RA_zerop.cc | 6 +- src/rational/input/cl_RA_from_string.cc | 12 +- src/rational/input/cl_RA_read.cc | 24 +- src/rational/input/cl_RA_read_stream.cc | 10 +- src/rational/input/cl_RA_readparsed.cc | 6 +- src/rational/misc/cl_RA_abs.cc | 8 +- src/rational/misc/cl_RA_as.cc | 6 +- src/rational/misc/cl_RA_class.cc | 6 +- src/rational/misc/cl_RA_debug.cc | 12 +- src/rational/misc/cl_RA_eqhashcode.cc | 14 +- src/rational/misc/cl_RA_expt.cc | 6 +- src/rational/misc/cl_RA_expt_I.cc | 8 +- src/rational/misc/cl_RA_exptpos.cc | 8 +- src/rational/misc/cl_RA_exptpos_I.cc | 8 +- src/rational/misc/cl_RA_max.cc | 6 +- src/rational/misc/cl_RA_min.cc | 6 +- src/rational/misc/cl_RA_signum.cc | 6 +- src/rational/output/cl_RA_aprint.cc | 8 +- src/rational/output/cl_RA_bprint.cc | 8 +- src/rational/output/cl_RA_cprint.cc | 8 +- src/rational/output/cl_RA_dprint.cc | 12 +- src/rational/output/cl_RA_print.cc | 10 +- src/rational/ring/cl_RA_ring.cc | 14 +- src/rational/transcendental/cl_I_logp.cc | 6 +- src/rational/transcendental/cl_RA_logp.cc | 6 +- src/real/algebraic/cl_RA_sqrt.cc | 10 +- src/real/algebraic/cl_R_sqrt.cc | 10 +- src/real/cl_R.h | 8 +- src/real/conv/cl_F_from_R.cc | 10 +- src/real/conv/cl_F_from_R_def.cc | 6 +- src/real/conv/cl_F_from_R_f.cc | 10 +- src/real/conv/cl_R_to_DF.cc | 10 +- src/real/conv/cl_R_to_FF.cc | 10 +- src/real/conv/cl_R_to_LF.cc | 10 +- src/real/conv/cl_R_to_SF.cc | 10 +- src/real/conv/cl_R_to_double.cc | 44 +- src/real/conv/cl_R_to_float.cc | 44 +- src/real/division/cl_R_ceil1.cc | 10 +- src/real/division/cl_R_ceil12.cc | 8 +- src/real/division/cl_R_ceil2.cc | 10 +- src/real/division/cl_R_ceil22.cc | 8 +- src/real/division/cl_R_div_t.h | 8 +- src/real/division/cl_R_fceil1.cc | 16 +- src/real/division/cl_R_fceil12.cc | 6 +- src/real/division/cl_R_fceil2.cc | 24 +- src/real/division/cl_R_fceil22.cc | 6 +- src/real/division/cl_R_ffloor1.cc | 16 +- src/real/division/cl_R_ffloor12.cc | 6 +- src/real/division/cl_R_ffloor2.cc | 24 +- src/real/division/cl_R_ffloor22.cc | 6 +- src/real/division/cl_R_floor1.cc | 10 +- src/real/division/cl_R_floor12.cc | 8 +- src/real/division/cl_R_floor2.cc | 10 +- src/real/division/cl_R_floor22.cc | 8 +- src/real/division/cl_R_fround1.cc | 16 +- src/real/division/cl_R_fround12.cc | 6 +- src/real/division/cl_R_fround2.cc | 24 +- src/real/division/cl_R_fround22.cc | 6 +- src/real/division/cl_R_ftrunc1.cc | 16 +- src/real/division/cl_R_ftrunc12.cc | 6 +- src/real/division/cl_R_ftrunc2.cc | 24 +- src/real/division/cl_R_ftrunc22.cc | 6 +- src/real/division/cl_R_mod.cc | 8 +- src/real/division/cl_R_rem.cc | 8 +- src/real/division/cl_R_round1.cc | 10 +- src/real/division/cl_R_round12.cc | 8 +- src/real/division/cl_R_round2.cc | 10 +- src/real/division/cl_R_round22.cc | 8 +- src/real/division/cl_R_trunc1.cc | 10 +- src/real/division/cl_R_trunc12.cc | 8 +- src/real/division/cl_R_trunc2.cc | 10 +- src/real/division/cl_R_trunc22.cc | 8 +- src/real/elem/cl_R_compare.cc | 26 +- src/real/elem/cl_R_div.cc | 18 +- src/real/elem/cl_R_equal.cc | 28 +- src/real/elem/cl_R_minus.cc | 10 +- src/real/elem/cl_R_minus1.cc | 10 +- src/real/elem/cl_R_minusp.cc | 6 +- src/real/elem/cl_R_mul.cc | 18 +- src/real/elem/cl_R_plus.cc | 10 +- src/real/elem/cl_R_plus1.cc | 10 +- src/real/elem/cl_R_plusp.cc | 6 +- src/real/elem/cl_R_recip.cc | 10 +- src/real/elem/cl_R_square.cc | 20 +- src/real/elem/cl_R_uminus.cc | 20 +- src/real/elem/cl_R_zerop.cc | 6 +- src/real/format-output/cl_fmt_cardinal.cc | 16 +- src/real/format-output/cl_fmt_floatstring.cc | 14 +- src/real/format-output/cl_fmt_integer.cc | 14 +- src/real/format-output/cl_fmt_newroman.cc | 16 +- src/real/format-output/cl_fmt_oldroman.cc | 16 +- src/real/format-output/cl_fmt_ordinal.cc | 6 +- src/real/format-output/cl_fmt_paddedstring.cc | 6 +- src/real/format-output/cl_fmt_scaleexp.cc | 18 +- src/real/format-output/cl_fmt_tens.cc | 4 + src/real/format-output/cl_format.h | 13 +- src/real/input/cl_R_from_string.cc | 12 +- src/real/input/cl_R_read.cc | 46 +- src/real/input/cl_R_read_stream.cc | 10 +- src/real/misc/cl_R_abs.cc | 6 +- src/real/misc/cl_R_as.cc | 6 +- src/real/misc/cl_R_contagion.cc | 4 + src/real/misc/cl_R_debug.cc | 6 +- src/real/misc/cl_R_eqhashcode.cc | 10 +- src/real/misc/cl_R_expt.cc | 10 +- src/real/misc/cl_R_expt_I.cc | 10 +- src/real/misc/cl_R_max.cc | 6 +- src/real/misc/cl_R_min.cc | 6 +- src/real/misc/cl_R_rational.cc | 6 +- src/real/misc/cl_R_rationalize.cc | 12 +- src/real/misc/cl_R_signum.cc | 6 +- src/real/output/cl_R_aprint.cc | 8 +- src/real/output/cl_R_bprint.cc | 8 +- src/real/output/cl_R_cprint.cc | 12 +- src/real/random/cl_R_random.cc | 20 +- src/real/ring/cl_R_ring.cc | 16 +- src/real/transcendental/cl_R_atan.cc | 6 +- src/real/transcendental/cl_R_atan2.cc | 22 +- src/real/transcendental/cl_R_cos.cc | 8 +- src/real/transcendental/cl_R_cosh.cc | 8 +- src/real/transcendental/cl_R_coshsinh.cc | 18 +- src/real/transcendental/cl_R_cossin.cc | 18 +- src/real/transcendental/cl_R_exp.cc | 8 +- src/real/transcendental/cl_R_ln.cc | 8 +- src/real/transcendental/cl_R_log.cc | 10 +- src/real/transcendental/cl_R_sin.cc | 8 +- src/real/transcendental/cl_R_sinh.cc | 8 +- src/real/transcendental/cl_R_tan.cc | 8 +- src/real/transcendental/cl_R_tanh.cc | 8 +- src/timing/cl_t_c1.cc | 6 +- src/timing/cl_t_c2.cc | 24 +- src/timing/cl_t_current.cc | 7 +- src/timing/cl_t_current2.cc | 6 +- src/timing/cl_t_d.cc | 6 +- src/timing/cl_t_dec.cc | 6 +- src/timing/cl_t_inc.cc | 6 +- src/timing/cl_t_minus.cc | 6 +- src/timing/cl_t_report.cc | 12 +- src/timing/cl_t_td_minus.cc | 6 +- src/timing/cl_t_td_plus.cc | 6 +- src/vector/cl_GV_I.cc | 11 +- src/vector/cl_GV_I_copy.cc | 6 +- src/vector/cl_GV_I_debug.cc | 10 +- src/vector/cl_GV_io.h | 8 +- src/vector/cl_GV_number.cc | 9 +- src/vector/cl_GV_number_copy.cc | 6 +- src/vector/cl_GV_number_debug.cc | 16 +- src/vector/cl_SV_copy.cc | 10 +- src/vector/cl_SV_io.h | 8 +- src/vector/cl_SV_number.cc | 11 +- src/vector/cl_SV_number_debug.cc | 16 +- src/vector/cl_SV_ringelt.cc | 11 +- src/vector/cl_SV_ringelt_debug.cc | 10 +- src/vector/output/cl_GV_number_aprint.cc | 14 +- src/vector/output/cl_SV_aprint.cc | 10 +- src/vector/output/cl_SV_number_aprint.cc | 14 +- tests/Makefile.in | 1 + tests/exam.cc | 11 +- tests/exam.h | 36 +- tests/exam_DF_div.cc | 4 +- tests/exam_DF_floor.cc | 8 +- tests/exam_DF_minus.cc | 4 +- tests/exam_DF_mul.cc | 4 +- tests/exam_DF_plus.cc | 4 +- tests/exam_FF_div.cc | 4 +- tests/exam_FF_floor.cc | 8 +- tests/exam_FF_minus.cc | 4 +- tests/exam_FF_mul.cc | 4 +- tests/exam_FF_plus.cc | 4 +- tests/exam_I_div.cc | 8 +- tests/exam_I_floor.cc | 4 +- tests/exam_I_gcd.cc | 36 +- tests/exam_I_minus.cc | 4 +- tests/exam_I_mul.cc | 4 +- tests/exam_I_plus.cc | 4 +- tests/exam_LF_div.cc | 4 +- tests/exam_LF_floor.cc | 8 +- tests/exam_LF_minus.cc | 4 +- tests/exam_LF_mul.cc | 4 +- tests/exam_LF_plus.cc | 4 +- tests/exam_RA_div.cc | 4 +- tests/exam_RA_floor.cc | 8 +- tests/exam_RA_minus.cc | 4 +- tests/exam_RA_mul.cc | 4 +- tests/exam_RA_plus.cc | 4 +- tests/exam_SF_div.cc | 4 +- tests/exam_SF_floor.cc | 8 +- tests/exam_SF_minus.cc | 4 +- tests/exam_SF_mul.cc | 4 +- tests/exam_SF_plus.cc | 4 +- tests/main.cc | 60 +- tests/test.h | 69 +- tests/test_I.cc | 5 +- tests/test_I.h | 4 +- tests/test_I_GV.cc | 6 +- tests/test_I_compare.cc | 4 +- tests/test_I_ilength.cc | 8 - tests/test_MI.cc | 4 +- tests/test_MI.h | 6 +- tests/test_MI_canonhom.cc | 2 +- tests/test_MI_div.cc | 2 +- tests/test_MI_expt.cc | 10 +- tests/test_MI_minus.cc | 6 +- tests/test_MI_mul.cc | 10 +- tests/test_MI_plus.cc | 6 +- tests/test_MI_recip.cc | 2 +- tests/test_nt.cc | 4 +- tests/test_nt.h | 6 +- tests/tests.cc | 9 +- tests/timeLFRAmul.cc | 16 +- tests/timeLFatan-compare.cc | 14 +- tests/timeLFatan.cc | 16 +- tests/timeLFatanh-compare.cc | 16 +- tests/timeLFatanh.cc | 18 +- tests/timeLFcos-compare.cc | 14 +- tests/timeLFcos.cc | 16 +- tests/timeLFcosh.cc | 16 +- tests/timeLFexp-compare.cc | 14 +- tests/timeLFexp.cc | 16 +- tests/timeLFln-compare.cc | 14 +- tests/timeLFln.cc | 16 +- tests/timeLFsin-compare.cc | 14 +- tests/timeLFsin.cc | 16 +- tests/timeLFsinh.cc | 16 +- tests/timeLFsqrt.cc | 16 +- tests/timeMImisc5.cc | 24 +- tests/timeMIpow2div.cc | 12 +- tests/timeMIpow2recip.cc | 12 +- tests/timeRALFdiv.cc | 16 +- tests/timeRAtoLF.cc | 18 +- tests/timeUPMImul.cc | 20 +- tests/timecatalan.cc | 12 +- tests/timediv.cc | 10 +- tests/timediv2adic-compare.cc | 16 +- tests/timediv2adic.cc | 16 +- tests/timeeuler.cc | 12 +- tests/timeexp1.cc | 12 +- tests/timefact.cc | 10 +- tests/timegcd.cc | 10 +- tests/timemul-compare.cc | 10 +- tests/timemul.cc | 10 +- tests/timepi.cc | 25 +- tests/timeprint-compare.cc | 22 +- tests/timeprint.cc | 20 +- tests/timerecip2adic-compare.cc | 14 +- tests/timerecip2adic.cc | 12 +- tests/timesqrt.cc | 10 +- tests/timesqrtmodp.cc | 16 +- tests/timesquare.cc | 14 +- tests/timezeta3.cc | 16 +- 1148 files changed, 12230 insertions(+), 8315 deletions(-) create mode 100644 cln-config.in delete mode 100644 include/cl_config.h.in delete mode 100644 include/cl_floatformat.h delete mode 100644 include/cln.h rename include/{cl_GV.h => cln/GV.h} (98%) rename include/{cl_GV_complex.h => cln/GV_complex.h} (88%) rename include/{cl_GV_integer.h => cln/GV_integer.h} (91%) rename include/{cl_GV_modinteger.h => cln/GV_modinteger.h} (93%) rename include/{cl_GV_number.h => cln/GV_number.h} (94%) rename include/{cl_GV_rational.h => cln/GV_rational.h} (88%) rename include/{cl_GV_real.h => cln/GV_real.h} (87%) rename include/{cl_SV.h => cln/SV.h} (98%) rename include/{cl_SV_complex.h => cln/SV_complex.h} (87%) rename include/{cl_SV_integer.h => cln/SV_integer.h} (86%) rename include/{cl_SV_number.h => cln/SV_number.h} (95%) rename include/{cl_SV_rational.h => cln/SV_rational.h} (87%) rename include/{cl_SV_real.h => cln/SV_real.h} (87%) rename include/{cl_SV_ringelt.h => cln/SV_ringelt.h} (95%) rename include/{cl_V.h => cln/V.h} (86%) rename include/{cl_abort.h => cln/abort.h} (84%) create mode 100644 include/cln/cln.h rename include/{cl_complex.h => cln/complex.h} (91%) rename include/{cl_complex_class.h => cln/complex_class.h} (91%) rename include/{cl_complex_io.h => cln/complex_io.h} (85%) rename include/{cl_complex_ring.h => cln/complex_ring.h} (76%) rename include/{cl_condition.h => cln/condition.h} (61%) rename include/{cl_dfloat.h => cln/dfloat.h} (91%) rename include/{cl_dfloat_class.h => cln/dfloat_class.h} (90%) rename include/{cl_dfloat_io.h => cln/dfloat_io.h} (70%) rename include/{cl_ffloat.h => cln/ffloat.h} (91%) rename include/{cl_ffloat_class.h => cln/ffloat_class.h} (90%) rename include/{cl_ffloat_io.h => cln/ffloat_io.h} (70%) rename include/{cl_float.h => cln/float.h} (81%) rename include/{cl_float_class.h => cln/float_class.h} (85%) rename include/{cl_float_io.h => cln/float_io.h} (91%) create mode 100644 include/cln/floatformat.h rename include/{cl_input.h => cln/input.h} (90%) rename include/{cl_integer.h => cln/integer.h} (95%) rename include/{cl_integer_class.h => cln/integer_class.h} (88%) rename include/{cl_integer_io.h => cln/integer_io.h} (90%) rename include/{cl_integer_ring.h => cln/integer_ring.h} (76%) rename include/{cl_io.h => cln/io.h} (58%) rename include/{cl_lfloat.h => cln/lfloat.h} (93%) rename include/{cl_lfloat_class.h => cln/lfloat_class.h} (90%) rename include/{cl_lfloat_io.h => cln/lfloat_io.h} (70%) rename include/{cl_malloc.h => cln/malloc.h} (69%) rename include/{cl_modinteger.h => cln/modinteger.h} (93%) rename include/{cl_modules.h => cln/modules.h} (100%) rename include/{cl_null_ring.h => cln/null_ring.h} (80%) rename include/{cl_number.h => cln/number.h} (99%) rename include/{cl_number_io.h => cln/number_io.h} (91%) rename include/{cl_numtheory.h => cln/numtheory.h} (95%) rename include/{cl_object.h => cln/object.h} (97%) rename include/{cl_output.h => cln/output.h} (86%) rename include/{cl_proplist.h => cln/proplist.h} (79%) rename include/{cl_random.h => cln/random.h} (69%) rename include/{cl_rational.h => cln/rational.h} (93%) rename include/{cl_rational_class.h => cln/rational_class.h} (88%) rename include/{cl_rational_io.h => cln/rational_io.h} (93%) rename include/{cl_rational_ring.h => cln/rational_ring.h} (76%) rename include/{cl_real.h => cln/real.h} (93%) rename include/{cl_real_class.h => cln/real_class.h} (89%) rename include/{cl_real_io.h => cln/real_io.h} (89%) rename include/{cl_real_ring.h => cln/real_ring.h} (75%) rename include/{cl_ring.h => cln/ring.h} (94%) rename include/{cl_sfloat.h => cln/sfloat.h} (91%) rename include/{cl_sfloat_class.h => cln/sfloat_class.h} (83%) rename include/{cl_sfloat_io.h => cln/sfloat_io.h} (70%) rename include/{cl_string.h => cln/string.h} (98%) rename include/{cl_symbol.h => cln/symbol.h} (95%) rename include/{cl_timing.h => cln/timing.h} (88%) rename include/{cl_types.h => cln/types.h} (98%) rename include/{cl_univpoly.h => cln/univpoly.h} (93%) rename include/{cl_univpoly_complex.h => cln/univpoly_complex.h} (90%) rename include/{cl_univpoly_integer.h => cln/univpoly_integer.h} (88%) rename include/{cl_univpoly_modint.h => cln/univpoly_modint.h} (90%) rename include/{cl_univpoly_rational.h => cln/univpoly_rational.h} (89%) rename include/{cl_univpoly_real.h => cln/univpoly_real.h} (90%) create mode 100644 src/base/input/cl_read_globals.cc diff --git a/FILES b/FILES index b48166c..ce6ff5e 100644 --- a/FILES +++ b/FILES @@ -35,7 +35,7 @@ Files in this package: (standalone) Include files - include/ + include/cln/ Sample programs examples/ diff --git a/INSTALL b/INSTALL index f0ccf99..abd272c 100644 --- a/INSTALL +++ b/INSTALL @@ -11,18 +11,12 @@ $ make install You need GNU make. On HP-UX, you also need GNU sed. Known to work with: - - Linux/x86, gcc-2.7.0, gcc-2.7.2, gcc-2.8.0, egcs-1.1, gcc-2.95 - - Solaris 2.4 (sparc), gcc-2.7.0, gcc-2.7.2, egcs-1.1, gcc-2.95 + - Linux/x86, gcc-2.8.0, egcs-1.1, gcc-2.95.x + - Solaris 2.4 (sparc), egcs-1.1, gcc-2.95 - OSF/1 V4.0 (alpha), egcs-1.1, gcc-2.95 - Irix 5.3, CC 4 -The "make" step takes about 4 hours, on a 486 DX / 33 MHz / 8 MB. - -On Linux, g++ needs 15 MB to compile the tests. So better have -17 MB swap space and 1 MB room in $TMPDIR. - -If you use gcc and g++ version 2.7.x, don't add -O2 to the CXXFLAGS, because -"g++ -O" generates better code for libcln.a than "g++ -O2". +The "make" step takes about 1 hour, on a P-II / 400 MHz / 64 MB. If you use g++ version 2.8.x or egcs-2.91.x (a.k.a. egcs-1.1) or gcc-2.95.x, I recommend adding "-fno-exceptions" to the CXXFLAGS. This will likely diff --git a/Makefile.devel b/Makefile.devel index 5eda254..bbc1484 100644 --- a/Makefile.devel +++ b/Makefile.devel @@ -24,7 +24,7 @@ AUTOCONF_FILES = autoconf/aclocal.m4 autoconf/acgeneral.m4 autoconf/acspecific.m configures : $(CONFIGURES) configure : configure.in $(AUTOCONF_FILES) - autoconf/autoconf -m autoconf + ./autoconf/autoconf -m autoconf # # ACLOCAL = /home/bruno/clisp/src/autoconf/aclocal.m4 # # ACSELECT = /home/bruno/clisp/src/autoconf/acselect diff --git a/Makefile.in b/Makefile.in index 0e36aa6..4123d57 100644 --- a/Makefile.in +++ b/Makefile.in @@ -6,6 +6,7 @@ prefix = @prefix@ local_prefix = /usr/local exec_prefix = @exec_prefix@ +bindir = @bindir@ datadir = @datadir@ libdir = @libdir@ includedir = @includedir@ @@ -16,6 +17,9 @@ CC = @CC@ CFLAGS = @CFLAGS@ RM = rm -f @SET_MAKE@ +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +UNINSTALL_PROGRAM = @UNINSTALL_PROGRAM@ #### End of system configuration section. #### @@ -26,12 +30,16 @@ all : force install : force cd @subdir@; $(MAKE) install + if [ ! -d $(bindir) ] ; then mkdir $(bindir) ; fi + $(INSTALL_PROGRAM) cln-config $(bindir)/cln-config installdirs : force cd @subdir@; $(MAKE) installdirs + if [ ! -d $(bindir) ] ; then mkdir $(bindir) ; fi uninstall : force cd @subdir@; $(MAKE) uninstall + $(RM) $(bindir)/cln-config check : force cd @subdir@; $(MAKE) check @@ -45,14 +53,15 @@ clean : force distclean : force cd @subdir@; if test -f Makefile; then $(MAKE) distclean; fi $(RM) config.status config.log config.cache Makefile + $(RM) cln-config $(RM) libtool - $(RM) include/cl_config.h include/cl_intparam.h include/cl_floatparam.h src/base/cl_base_config.h src/base/cl_gmpconfig.h src/float/cl_float_config.h src/timing/cl_t_config.h + $(RM) include/cln/config.h include/cln/intparam.h include/cln/floatparam.h src/base/cl_base_config.h src/base/cl_gmpconfig.h src/float/cl_float_config.h src/timing/cl_t_config.h maintainer-clean : force cd @subdir@; if test -f Makefile; then $(MAKE) maintainer-clean; fi $(RM) config.status config.log config.cache Makefile + $(RM) cln-config $(RM) libtool - $(RM) include/cl_config.h include/cl_intparam.h include/cl_floatparam.h src/base/cl_base_config.h src/base/cl_gmpconfig.h src/float/cl_float_config.h src/timing/cl_t_config.h + $(RM) include/cln/config.h include/cln/intparam.h include/cln/floatparam.h src/base/cl_base_config.h src/base/cl_gmpconfig.h src/float/cl_float_config.h src/timing/cl_t_config.h force : - diff --git a/NEWS b/NEWS index f20ef4b..5ecb74c 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,18 @@ 2000-06-xx, version 1.1.0 ========================= +Functional changes +------------------ + +* ISO/IEC 14882 fashion adjustments: + Put everything into namespace cln. All funcamental data types still + carry their old names. Other non-macro identifiers are now written as + cln::foo instead of cl_foo, except where the cl_ comes from a data type + (as in cl_I_to_int()). Headers are installed into a separate + directory, #include instead of . Applications + must be manually ported to the new style. We apologizes for the + inconvenience. + Implementation changes ---------------------- @@ -10,6 +22,8 @@ Implementation changes * Adjusted several break-even points to make better use of a faster libgmp and better match present-day CPUs. +* Fix compilation errors with gcc-2.96. + 2000-01-13, version 1.0.3 ========================= diff --git a/README b/README index bc5fe58..9e9793a 100644 --- a/README +++ b/README @@ -6,10 +6,9 @@ GPL Features: - Rich set of number classes: - Integer (unlimited precision), rational, - short float, single float, double float, - long float (unlimited precision), complex, - modular integer, univariate polynomial. + Integer (unlimited precision), rational, short float, + single float, double float, long float (unlimited + precision), complex, modular integer, univariate polynomial. - Elementary, logical, transcendental functions. - C++ as implementation language brings - efficiency, @@ -29,13 +28,10 @@ Features: Requires: C++ compiler g++. The following C++ features are used: -classes, member functions, -overloading of functions and operators, -constructors and destructors, inline, const, -multiple inheritance, templates. +classes, member functions, overloading of functions and operators, +constructors and destructors, inline, const, multiple inheritance, +templates and namespaces. The following C++ features are not used: -new, delete, virtual inheritance, -exceptions. +new, delete, virtual inheritance, exceptions. Homepage: http://clisp.cons.org/~haible/packages-cln.html - diff --git a/autoconf/aclocal.m4 b/autoconf/aclocal.m4 index 29c3e99..dcd1d84 100644 --- a/autoconf/aclocal.m4 +++ b/autoconf/aclocal.m4 @@ -948,7 +948,7 @@ AC_DEFUN(CL_GMP_H_VERSION, cl_cv_new_gmp_h="yes", cl_cv_new_gmp_h="no") ])])dnl -# Does libgmp feature 3.0 functionality? +# Does libgmp provide some functionality introduced in version 3.0? AC_DEFUN(CL_GMP_CHECK, [AC_CACHE_CHECK([for working libgmp], cl_cv_new_libgmp, [ SAVELIBS=$LIBS diff --git a/autoconf/config.guess b/autoconf/config.guess index b4faaed..81688c4 100755 --- a/autoconf/config.guess +++ b/autoconf/config.guess @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 # Free Software Foundation, Inc. -version='2000-05-30' +version='2000-07-27' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -119,7 +119,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # object file format. # Determine the machine/vendor (is the vendor relevant). case "${UNAME_MACHINE}" in - amiga) machine=m68k-cbm ;; + amiga) machine=m68k-unknown ;; arm32) machine=arm-unknown ;; atari*) machine=m68k-atari ;; sun3*) machine=m68k-sun ;; @@ -215,7 +215,7 @@ EOF echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-cbm-sysv4 + echo m68k-unknown-sysv4 exit 0;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} @@ -687,6 +687,9 @@ EOF *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; *:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -709,8 +712,7 @@ EOF exit 0 ;; elf_i?86) - echo "${UNAME_MACHINE}-pc-linux" - exit 0 + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" @@ -897,6 +899,7 @@ EOF EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 fi ;; # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions # are messed up and put the nodename in both sysname and nodename. @@ -1085,6 +1088,17 @@ EOF DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 diff --git a/autoconf/config.sub b/autoconf/config.sub index f414a43..945a7f4 100755 --- a/autoconf/config.sub +++ b/autoconf/config.sub @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 # Free Software Foundation, Inc. -version='2000-05-30' +version='2000-08-07' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -29,7 +29,6 @@ version='2000-05-30' # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# Written by Per Bothner . # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. @@ -132,7 +131,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple) + -apple | -axis) os= basic_machine=$1 ;; @@ -205,29 +204,35 @@ case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ + | arme[lb] | armv* | pyramid | mn10200 | mn10300 | tron | a29k \ | 580 | i960 | h8300 \ | x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \ | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ | hppa64 \ | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ | alphaev6[78] \ - | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ + | we32k | ns16k | clipper | i370 | sh | sh[34] \ + | powerpc | powerpcle \ | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ | mips64orion | mips64orionel | mipstx39 | mipstx39el \ | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ | mips64vr5000 | miprs64vr5000el | mcore \ | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ - | thumb | d10v | fr30 | avr) + | thumb | d10v | d30v | fr30 | avr) basic_machine=$basic_machine-unknown ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. - i[34567]86) + i[234567]86) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. @@ -237,7 +242,7 @@ case $basic_machine in ;; # Recognize the basic CPU types with company name. # FIXME: clean up the formatting here. - vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ + vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ @@ -257,7 +262,7 @@ case $basic_machine in | f301-* | armv*-* | s390-* | sv1-* | t3e-* \ | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \ - | bs2000-*) + | bs2000-* | tic54x-* | c54x-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. @@ -294,14 +299,14 @@ case $basic_machine in os=-sysv ;; amiga | amiga-*) - basic_machine=m68k-cbm + basic_machine=m68k-unknown ;; amigaos | amigados) - basic_machine=m68k-cbm + basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) - basic_machine=m68k-cbm + basic_machine=m68k-unknown os=-sysv4 ;; apollo68) @@ -355,6 +360,9 @@ case $basic_machine in crds | unos) basic_machine=m68k-crds ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -666,7 +674,7 @@ case $basic_machine in pentium | p5 | k5 | k6 | nexen) basic_machine=i586-pc ;; - pentiumpro | p6 | 6x86) + pentiumpro | p6 | 6x86 | athlon) basic_machine=i686-pc ;; pentiumii | pentium2) @@ -675,7 +683,7 @@ case $basic_machine in pentium-* | p5-* | k5-* | k6-* | nexen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumpro-* | p6-* | 6x86-*) + pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) @@ -790,6 +798,10 @@ case $basic_machine in basic_machine=t3e-cray os=-unicos ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; tx39) basic_machine=mipstx39-unknown ;; @@ -891,6 +903,9 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; + sh3 | sh4) + base_machine=sh-unknown + ;; sparc | sparcv9) basic_machine=sparc-sun ;; @@ -972,7 +987,7 @@ case $os in | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit*) + | -openstep* | -oskit* | -conix*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) diff --git a/benchmarks/timebench1.cc b/benchmarks/timebench1.cc index e2bad84..201dd00 100644 --- a/benchmarks/timebench1.cc +++ b/benchmarks/timebench1.cc @@ -1,17 +1,17 @@ // Benchmarks from the LiDIA home page -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include +#include // Timings on Linux i486 33 MHz, 1000 decimal places = 104 32-bit words. // Function LiDIA Pari CLISP CLN @@ -61,42 +61,42 @@ int main (int argc, char * argv[]) if (argc < 1) exit(1); - fprint(cl_stderr, "Number of repetitions: "); - fprintdecimal(cl_stderr, repetitions); - fprint(cl_stderr, "\n"); + fprint(stderr, "Number of repetitions: "); + fprintdecimal(stderr, repetitions); + fprint(stderr, "\n"); - cl_float_format_t prec = cl_float_format(1000); + float_format_t prec = float_format(1000); - fprint(cl_stderr, "pi\n"); + fprint(stderr, "pi\n"); { cl_F p; - { CL_TIMING; p = cl_pi(prec); } + { CL_TIMING; p = pi(prec); } { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { cl_F p = cl_pi(prec); } + { cl_F p = pi(prec); } } cout << p << endl << endl; } - fprint(cl_stderr, "gamma\n"); + fprint(stderr, "gamma\n"); { cl_F p; - { CL_TIMING; p = cl_eulerconst(prec); } + { CL_TIMING; p = eulerconst(prec); } { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { cl_F p = cl_eulerconst(prec); } + { cl_F p = eulerconst(prec); } } cout << p << endl << endl; } - fprint(cl_stderr, "e\n"); - { cl_F p = cl_exp1(prec); + fprint(stderr, "e\n"); + { cl_F p = exp1(prec); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { cl_F p = cl_exp1(prec); } + { cl_F p = exp1(prec); } } cout << p << endl << endl; } - fprint(cl_stderr, "sqrt(3)\n"); + fprint(stderr, "sqrt(3)\n"); { cl_R p = sqrt(cl_float(3,prec)); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -105,7 +105,7 @@ int main (int argc, char * argv[]) cout << p << endl << endl; } - fprint(cl_stderr, "exp(log(2))\n"); + fprint(stderr, "exp(log(2))\n"); { cl_N p = exp(log(cl_float(2,prec))); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -114,7 +114,7 @@ int main (int argc, char * argv[]) cout << p << endl << endl; } - fprint(cl_stderr, "log(exp(2))\n"); + fprint(stderr, "log(exp(2))\n"); { cl_N p = log(exp(cl_float(2,prec))); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -123,25 +123,25 @@ int main (int argc, char * argv[]) cout << p << endl << endl; } - fprint(cl_stderr, "sin(pi/3)\n"); - { cl_R p = sin(cl_pi(prec)/3); + fprint(stderr, "sin(pi/3)\n"); + { cl_R p = sin(pi(prec)/3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { cl_R p = sin(cl_pi(prec)/3); } + { cl_R p = sin(pi(prec)/3); } } cout << p << endl << endl; } - fprint(cl_stderr, "cos(pi/3)\n"); - { cl_R p = cos(cl_pi(prec)/3); + fprint(stderr, "cos(pi/3)\n"); + { cl_R p = cos(pi(prec)/3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { cl_R p = cos(cl_pi(prec)/3); } + { cl_R p = cos(pi(prec)/3); } } cout << p << endl << endl; } - fprint(cl_stderr, "arcsin(sqrt(3)/2)\n"); + fprint(stderr, "arcsin(sqrt(3)/2)\n"); { cl_N p = asin(sqrt(cl_float(3,prec))/2); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -150,7 +150,7 @@ int main (int argc, char * argv[]) cout << p << endl << endl; } - fprint(cl_stderr, "arccos(sqrt(3)/2)\n"); + fprint(stderr, "arccos(sqrt(3)/2)\n"); { cl_N p = acos(sqrt(cl_float(3,prec))/2); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -159,7 +159,7 @@ int main (int argc, char * argv[]) cout << p << endl << endl; } - fprint(cl_stderr, "sinh(log(2))\n"); + fprint(stderr, "sinh(log(2))\n"); { cl_N p = sinh(log(cl_float(2,prec))); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -168,7 +168,7 @@ int main (int argc, char * argv[]) cout << p << endl << endl; } - fprint(cl_stderr, "cosh(log(2))\n"); + fprint(stderr, "cosh(log(2))\n"); { cl_N p = cosh(log(cl_float(2,prec))); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -177,20 +177,20 @@ int main (int argc, char * argv[]) cout << p << endl << endl; } - fprint(cl_stderr, "arsinh(pi)\n"); - { cl_N p = asinh(cl_pi(prec)); + fprint(stderr, "arsinh(pi)\n"); + { cl_N p = asinh(pi(prec)); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { cl_N p = asinh(cl_pi(prec)); } + { cl_N p = asinh(pi(prec)); } } cout << p << endl << endl; } - fprint(cl_stderr, "arcosh(pi)\n"); - { cl_N p = acosh(cl_pi(prec)); + fprint(stderr, "arcosh(pi)\n"); + { cl_N p = acosh(pi(prec)); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { cl_N p = acosh(cl_pi(prec)); } + { cl_N p = acosh(pi(prec)); } } cout << p << endl << endl; } diff --git a/benchmarks/timebench2a.cc b/benchmarks/timebench2a.cc index fc27c1c..84a5dfb 100644 --- a/benchmarks/timebench2a.cc +++ b/benchmarks/timebench2a.cc @@ -1,12 +1,15 @@ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include -#include +#include + +using namespace std; +using namespace cln; int main (int argc, char * argv[]) { @@ -27,22 +30,18 @@ int main (int argc, char * argv[]) } if (argc < 1) exit(1); + + stderr << "Number of digits: " << digits << endl; + stderr << "Number of repetitions: " << repetitions << endl; - fprint(cl_stderr, "Number of digits: "); - fprintdecimal(cl_stderr, digits); - fprint(cl_stderr, "\n"); - fprint(cl_stderr, "Number of repetitions: "); - fprintdecimal(cl_stderr, repetitions); - fprint(cl_stderr, "\n"); - - cl_float_format_t prec = cl_float_format(digits); - cl_float_format_t prec2 = cl_float_format(digits*2); + float_format_t prec = float_format(digits); + float_format_t prec2 = float_format(digits*2); cl_I pow = expt_pos(10,digits); cl_I x1 = floor1((sqrt(cl_float(5,prec2))+1)/2 * expt_pos(pow,2)); cl_I x2 = floor1(sqrt(cl_float(3,prec)) * pow); cl_I x3 = pow+1; - fprint(cl_stderr, "multiplication\n"); + stderr << "multiplication" << endl; { cl_I r = x1*x2; { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -51,7 +50,7 @@ int main (int argc, char * argv[]) cout << r << endl << endl; } - fprint(cl_stderr, "division\n"); + stderr << "division" << endl; { cl_I_div_t qr = floor2(x1,x2); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -60,7 +59,7 @@ int main (int argc, char * argv[]) cout << qr.quotient << endl << qr.remainder << endl << endl; } - fprint(cl_stderr, "isqrt\n"); + stderr << "isqrt" << endl; { cl_I r = isqrt(x3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -69,7 +68,7 @@ int main (int argc, char * argv[]) cout << r << endl << endl; } - fprint(cl_stderr, "gcd\n"); + stderr << "gcd" << endl; { cl_I r = gcd(x1,x2); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) diff --git a/benchmarks/timebench2ap.cc b/benchmarks/timebench2ap.cc index 561ef71..401e929 100644 --- a/benchmarks/timebench2ap.cc +++ b/benchmarks/timebench2ap.cc @@ -1,9 +1,12 @@ -#include -#include -#include +#include +#include +#include #include #include -#include +#include + +using namespace std; +using namespace cln; int main (int argc, char * argv[]) { @@ -25,12 +28,8 @@ int main (int argc, char * argv[]) if (argc < 1) exit(1); - fprint(cl_stderr, "Limit: "); - fprintdecimal(cl_stderr, limit); - fprint(cl_stderr, "\n"); - fprint(cl_stderr, "Number of repetitions: "); - fprintdecimal(cl_stderr, repetitions); - fprint(cl_stderr, "\n"); + stderr << "Limit: " << limit << endl; + stderr << "Number of repetitions: " << repetitions << endl; { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) diff --git a/benchmarks/timebench2b.cc b/benchmarks/timebench2b.cc index f683045..94c48ee 100644 --- a/benchmarks/timebench2b.cc +++ b/benchmarks/timebench2b.cc @@ -1,15 +1,18 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include +#include + +using namespace std; +using namespace cln; int main (int argc, char * argv[]) { @@ -31,19 +34,15 @@ int main (int argc, char * argv[]) if (argc < 1) exit(1); - fprint(cl_stderr, "Number of digits: "); - fprintdecimal(cl_stderr, digits); - fprint(cl_stderr, "\n"); - fprint(cl_stderr, "Number of repetitions (except for pi,euler,e): "); - fprintdecimal(cl_stderr, repetitions); - fprint(cl_stderr, "\n"); + stderr << "Number of digits: " << digits << endl; + stderr << "Number of repetitions (except for pi,euler,e): " << repetitions << endl; - cl_float_format_t prec = cl_float_format(digits); + float_format_t prec = float_format(digits); cl_F x1 = sqrt(cl_float(2,prec)); cl_F x2 = sqrt(cl_float(3,prec)); cl_F x3 = The(cl_F)(log(cl_float(2,prec))); - fprint(cl_stderr, "multiplication\n"); + stderr << "multiplication" << endl; { cl_F r = x1*x2; { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -52,7 +51,7 @@ int main (int argc, char * argv[]) cout << r << endl << endl; } - fprint(cl_stderr, "sqrt\n"); + stderr << "sqrt" << endl; { cl_F r = sqrt(x3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -61,25 +60,25 @@ int main (int argc, char * argv[]) cout << r << endl << endl; } - fprint(cl_stderr, "pi\n"); + stderr << "pi" << endl; { cl_F r; - { CL_TIMING; r = cl_pi(prec); } + { CL_TIMING; r = pi(prec); } cout << r << endl << endl; } - fprint(cl_stderr, "eulerconst\n"); + stderr << "eulerconst" << endl; { cl_F r; - { CL_TIMING; r = cl_eulerconst(prec); } + { CL_TIMING; r = eulerconst(prec); } cout << r << endl << endl; } - fprint(cl_stderr, "e\n"); + stderr << "e" << endl; { cl_F r; - { CL_TIMING; r = cl_exp1(prec); } + { CL_TIMING; r = exp1(prec); } cout << r << endl << endl; } - fprint(cl_stderr, "exp\n"); + stderr << "exp" << endl; { cl_F r = exp(-x1); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -88,7 +87,7 @@ int main (int argc, char * argv[]) cout << r << endl << endl; } - fprint(cl_stderr, "log\n"); + stderr << "log" << endl; { cl_N r = log(x2); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -97,7 +96,7 @@ int main (int argc, char * argv[]) cout << r << endl << endl; } - fprint(cl_stderr, "sin\n"); + stderr << "sin" << endl; { cl_R r = sin(5*x1); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -106,7 +105,7 @@ int main (int argc, char * argv[]) cout << r << endl << endl; } - fprint(cl_stderr, "cos\n"); + stderr << "cos" << endl; { cl_R r = cos(5*x1); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -115,7 +114,7 @@ int main (int argc, char * argv[]) cout << r << endl << endl; } - fprint(cl_stderr, "asin\n"); + stderr << "asin" << endl; { cl_N r = asin(x3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -124,7 +123,7 @@ int main (int argc, char * argv[]) cout << r << endl << endl; } - fprint(cl_stderr, "acos\n"); + stderr << "acos" << endl; { cl_N r = acos(x3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -133,7 +132,7 @@ int main (int argc, char * argv[]) cout << r << endl << endl; } - fprint(cl_stderr, "atan\n"); + stderr << "atan" << endl; { cl_F r = atan(x3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -142,7 +141,7 @@ int main (int argc, char * argv[]) cout << r << endl << endl; } - fprint(cl_stderr, "sinh\n"); + stderr << "sinh" << endl; { cl_F r = sinh(x2); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -151,7 +150,7 @@ int main (int argc, char * argv[]) cout << r << endl << endl; } - fprint(cl_stderr, "cosh\n"); + stderr << "cosh" << endl; { cl_F r = cosh(x2); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -160,7 +159,7 @@ int main (int argc, char * argv[]) cout << r << endl << endl; } - fprint(cl_stderr, "asinh\n"); + stderr << "asinh" << endl; { cl_N r = asinh(x3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -169,7 +168,7 @@ int main (int argc, char * argv[]) cout << r << endl << endl; } - fprint(cl_stderr, "acosh\n"); + stderr << "acosh" << endl; { cl_N r = acosh(1+x3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) @@ -178,7 +177,7 @@ int main (int argc, char * argv[]) cout << r << endl << endl; } - fprint(cl_stderr, "atanh\n"); + stderr << "atanh" << endl; { cl_N r = atanh(x3); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) diff --git a/cln-config.in b/cln-config.in new file mode 100644 index 0000000..1b9edde --- /dev/null +++ b/cln-config.in @@ -0,0 +1,57 @@ +#!/bin/sh + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +exec_prefix_set=no + +usage="\ +Usage: cln-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cppflags]" + +if test $# -eq 0; then + echo "${usage}" 1>&2 + exit 1 +fi + +while test $# -gt 0; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --prefix=*) + prefix=$optarg + if test $exec_prefix_set = no ; then + exec_prefix=$optarg + fi + ;; + --prefix) + echo $prefix + ;; + --exec-prefix=*) + exec_prefix=$optarg + exec_prefix_set=yes + ;; + --exec-prefix) + echo $exec_prefix + ;; + --version) + echo @CL_VERSION@ + ;; + --cppflags) + if test @includedir@ != /usr/include ; then + includes=-I@includedir@ + fi + echo $includes @CPPFLAGS@ + ;; + --libs) + libdirs=-L@libdir@ + echo $libdirs -lcln @LIBS@ + ;; + *) + echo "${usage}" 1>&2 + exit 1 + ;; + esac + shift +done diff --git a/configure b/configure index 577b6b2..443e0e9 100755 --- a/configure +++ b/configure @@ -22,7 +22,7 @@ ac_help="$ac_help ac_help="$ac_help --with-gnu-ld assume the C compiler uses GNU ld [default=no]" ac_help="$ac_help - --with-gmp use external fast low-level functions from GNU gmp3. + --with-gmp use external fast low-level functions from GNU MP 3. [default=yes]" # Initialize some variables set by options. @@ -1310,8 +1310,9 @@ cat >> confdefs.h <&6 -echo "configure:1374: checking for ld used by GCC" >&5 +echo "configure:1375: checking for ld used by GCC" >&5 ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. @@ -1388,10 +1389,10 @@ echo "configure:1374: checking for ld used by GCC" >&5 esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1392: checking for GNU ld" >&5 +echo "configure:1393: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1395: checking for non-GNU ld" >&5 +echo "configure:1396: checking for non-GNU ld" >&5 fi if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1427,7 +1428,7 @@ fi test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1431: checking if the linker ($LD) is GNU ld" >&5 +echo "configure:1432: checking if the linker ($LD) is GNU ld" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1442,7 +1443,7 @@ echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1446: checking for BSD-compatible nm" >&5 +echo "configure:1447: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1479,7 +1480,7 @@ echo "$ac_t""$NM" 1>&6 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1483: checking whether ln -s works" >&5 +echo "configure:1484: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1515,8 +1516,8 @@ test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" case "$host" in *-*-irix6*) # Find out which ABI we are using. - echo '#line 1519 "configure"' > conftest.$ac_ext - if { (eval echo configure:1520: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 1520 "configure"' > conftest.$ac_ext + if { (eval echo configure:1521: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *32-bit*) LD="${LD-ld} -32" @@ -1545,17 +1546,18 @@ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \ $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ || { echo "configure: error: libtool configure failed" 1>&2; exit 1; } + CL_CURRENT=1 CL_REVISION=0 CL_AGE=0 -CL_VERSION=1 +CL_VERSION_MAJOR=1 CL_VERSION_MINOR=1 CL_VERSION_PATCHLEVEL=0 cat >> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1608: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cl_cv_cplusplus_bool=yes else @@ -1630,7 +1638,7 @@ cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking for long long type""... $ac_c" 1>&6 -echo "configure:1634: checking for long long type" >&5 +echo "configure:1642: checking for long long type" >&5 if eval "test \"`echo '$''{'cl_cv_c_longlong'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1639,7 +1647,7 @@ if test "$cross_compiling" = yes; then cl_cv_c_longlong="guessing no" else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cl_cv_c_longlong=yes else @@ -1696,7 +1704,7 @@ EOF esac echo $ac_n "checking for long double type""... $ac_c" 1>&6 -echo "configure:1700: checking for long double type" >&5 +echo "configure:1708: checking for long double type" >&5 if eval "test \"`echo '$''{'cl_cv_c_longdouble'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1705,7 +1713,7 @@ if test "$cross_compiling" = yes; then cl_cv_c_longdouble="guessing no" else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1725: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cl_cv_c_longdouble=yes else @@ -1746,20 +1754,20 @@ EOF esac echo $ac_n "checking for working template<>""... $ac_c" 1>&6 -echo "configure:1750: checking for working template<>" >&5 +echo "configure:1758: checking for working template<>" >&5 if eval "test \"`echo '$''{'cl_cv_c_templatenull'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < class c {}; template <> class c { int x; }; int main() { ; return 0; } EOF -if { (eval echo configure:1763: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1771: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cl_cv_c_templatenull=yes else @@ -1783,7 +1791,7 @@ fi if test -n "$GCC"; then echo $ac_n "checking for the global constructors function prefix""... $ac_c" 1>&6 -echo "configure:1787: checking for the global constructors function prefix" >&5 +echo "configure:1795: checking for the global constructors function prefix" >&5 if eval "test \"`echo '$''{'cl_cv_cplusplus_ctorprefix'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1793,7 +1801,7 @@ struct foo { foo (); }; foo foobar; EOF # look for the assembly language name in the .s file -{ ac_try='${CXX-g++} $CXXFLAGS -S conftest.cc'; { (eval echo configure:1797: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } >/dev/null 2>&1 +{ ac_try='${CXX-g++} $CXXFLAGS -S conftest.cc'; { (eval echo configure:1805: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } >/dev/null 2>&1 if grep '_GLOBAL_\$I\$foobar' conftest.s >/dev/null ; then cl_cv_cplusplus_ctorprefix='_GLOBAL_$I$' else @@ -1823,7 +1831,7 @@ EOF EOF echo $ac_n "checking whether the global constructors function need to be exported""... $ac_c" 1>&6 -echo "configure:1827: checking whether the global constructors function need to be exported" >&5 +echo "configure:1835: checking whether the global constructors function need to be exported" >&5 if eval "test \"`echo '$''{'cl_cv_cplusplus_ctorexport'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1844,7 +1852,7 @@ foo::foo () {} extern "C" void ctor (void) __asm__ (ASM_UNDERSCORE_PREFIX CL_GLOBAL_CONSTRUCTOR_PREFIX "foobar"); int main() { ctor(); return 0; } EOF -if { ac_try='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest1.cc conftest2.cc $LIBS 1>&5'; { (eval echo configure:1848: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } >/dev/null 2>&1 && test -s conftest${ac_exeext}; then +if { ac_try='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest1.cc conftest2.cc $LIBS 1>&5'; { (eval echo configure:1856: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } >/dev/null 2>&1 && test -s conftest${ac_exeext}; then cl_cv_cplusplus_ctorexport=no else cl_cv_cplusplus_ctorexport=yes @@ -1866,17 +1874,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1870: checking for $ac_hdr" >&5 +echo "configure:1878: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1880: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1888: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1906,20 +1914,20 @@ done # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1910: checking for working alloca.h" >&5 +echo "configure:1918: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'cl_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = (char *) alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cl_cv_header_alloca_h=yes else @@ -1961,20 +1969,20 @@ char *alloca (); #endif " echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1965: checking for alloca" >&5 +echo "configure:1973: checking for alloca" >&5 if eval "test \"`echo '$''{'cl_cv_func_alloca'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cl_cv_func_alloca=yes else @@ -2006,20 +2014,20 @@ EOF fi echo $ac_n "checking for fpu_control_t""... $ac_c" 1>&6 -echo "configure:2010: checking for fpu_control_t" >&5 +echo "configure:2018: checking for fpu_control_t" >&5 if eval "test \"`echo '$''{'cl_cv_type_fpu_control_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { fpu_control_t x; ; return 0; } EOF -if { (eval echo configure:2023: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2031: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cl_cv_type_fpu_control_t=yes else @@ -2041,20 +2049,20 @@ EOF fi echo $ac_n "checking for __setfpucw""... $ac_c" 1>&6 -echo "configure:2045: checking for __setfpucw" >&5 +echo "configure:2053: checking for __setfpucw" >&5 if eval "test \"`echo '$''{'cl_cv_func_setfpucw'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { __setfpucw(_FPU_IEEE); ; return 0; } EOF -if { (eval echo configure:2058: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2066: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cl_cv_func_setfpucw=yes else @@ -2080,12 +2088,12 @@ fi for ac_func in gettimeofday do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2084: checking for $ac_func" >&5 +echo "configure:2092: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2136,13 +2144,13 @@ fi done if test $ac_cv_func_gettimeofday = yes; then echo $ac_n "checking for gettimeofday declaration""... $ac_c" 1>&6 -echo "configure:2140: checking for gettimeofday declaration" >&5 +echo "configure:2148: checking for gettimeofday declaration" >&5 if eval "test \"`echo '$''{'cl_cv_proto_gettimeofday'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2163,7 +2171,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2167: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2175: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cl_cv_proto_gettimeofday_dots=no cl_cv_proto_gettimeofday_arg2="struct timezone *" @@ -2172,7 +2180,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < @@ -2193,7 +2201,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2197: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2205: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cl_cv_proto_gettimeofday_dots=no cl_cv_proto_gettimeofday_arg2="void *" @@ -2234,12 +2242,12 @@ fi for ac_func in ftime do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2238: checking for $ac_func" >&5 +echo "configure:2246: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2277: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2291,12 +2299,12 @@ done if test $ac_cv_func_gettimeofday = no -a $ac_cv_func_ftime = no; then echo $ac_n "checking for times""... $ac_c" 1>&6 -echo "configure:2295: checking for times" >&5 +echo "configure:2303: checking for times" >&5 if eval "test \"`echo '$''{'ac_cv_func_times'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_times=yes" else @@ -2343,7 +2351,7 @@ no_times=1 fi if test -z "$no_times"; then echo $ac_n "checking for times return value""... $ac_c" 1>&6 -echo "configure:2347: checking for times return value" >&5 +echo "configure:2355: checking for times return value" >&5 if eval "test \"`echo '$''{'cl_cv_func_times_return'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2352,7 +2360,7 @@ if test "$cross_compiling" = yes; then cl_cv_func_times_return="guessing no" else cat > conftest.$ac_ext <= CLK_TCK/2) && (ticks <= 3*CLK_TCK/2))); } EOF -if { (eval echo configure:2382: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2390: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cl_cv_func_times_return=yes else @@ -2416,17 +2424,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2420: checking for $ac_hdr" >&5 +echo "configure:2428: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2430: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2438: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2453,13 +2461,13 @@ fi done if test $ac_cv_header_sys_resource_h = yes; then echo $ac_n "checking for getrusage""... $ac_c" 1>&6 -echo "configure:2457: checking for getrusage" >&5 +echo "configure:2465: checking for getrusage" >&5 if eval "test \"`echo '$''{'cl_cv_func_getrusage'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* NetBSD 1.0 needs this */ #include @@ -2468,7 +2476,7 @@ int main() { struct rusage x; int y = RUSAGE_SELF; getrusage(y,&x); x.ru_utime.tv_sec; ; return 0; } EOF -if { (eval echo configure:2472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2480: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cl_cv_func_getrusage=yes else @@ -2490,13 +2498,13 @@ EOF fi if test $cl_cv_func_getrusage = yes; then echo $ac_n "checking for getrusage declaration""... $ac_c" 1>&6 -echo "configure:2494: checking for getrusage declaration" >&5 +echo "configure:2502: checking for getrusage declaration" >&5 if eval "test \"`echo '$''{'cl_cv_proto_getrusage'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2522,7 +2530,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2526: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2534: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cl_cv_proto_getrusage_arg1="int" else @@ -2549,13 +2557,13 @@ EOF fi echo $ac_n "checking for perror declaration""... $ac_c" 1>&6 -echo "configure:2553: checking for perror declaration" >&5 +echo "configure:2561: checking for perror declaration" >&5 if eval "test \"`echo '$''{'cl_cv_proto_perror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <, some in , some don't @@ -2571,7 +2579,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2575: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2583: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cl_cv_proto_perror=no else @@ -2593,7 +2601,7 @@ EOF fi echo $ac_n "checking whether characters are unsigned""... $ac_c" 1>&6 -echo "configure:2597: checking whether characters are unsigned" >&5 +echo "configure:2605: checking whether characters are unsigned" >&5 if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2601,7 +2609,7 @@ else if test $ac_cv_prog_gcc = yes; then # GCC predefines this symbol on systems where it applies. cat > conftest.$ac_ext < conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_char_unsigned=yes else @@ -2673,11 +2681,11 @@ fi test -d 'include' || mkdir 'include' cl_machine_file_c=${srcdir}/autoconf/intparam.c -cl_machine_file_h=include/cl_intparam.h +cl_machine_file_h=include/cln/intparam.h if test $cross_compiling = no; then if test -z "$cl_cv_file_intparam_h"; then echo "checking for integer types and behaviour" 1>&6 -echo "configure:2681: checking for integer types and behaviour" >&5 +echo "configure:2689: checking for integer types and behaviour" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:2700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } CC="$ORIGCC" if test -s conftest; then echo "creating $cl_machine_file_h" @@ -2711,11 +2719,11 @@ echo "cross-compiling - cannot create $cl_machine_file_h" fi cl_machine_file_c=${srcdir}/autoconf/floatparam.c -cl_machine_file_h=include/cl_floatparam.h +cl_machine_file_h=include/cln/floatparam.h if test $cross_compiling = no; then if test -z "$cl_cv_file_floatparam_h"; then echo "checking for floating-point types and behaviour" 1>&6 -echo "configure:2719: checking for floating-point types and behaviour" >&5 +echo "configure:2727: checking for floating-point types and behaviour" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:2738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } CC="$ORIGCC" if test -s conftest; then echo "creating $cl_machine_file_h" @@ -2757,14 +2765,14 @@ else fi if test "$with_gmp" = yes; then -echo $ac_n "checking for recent enough gmp.h""... $ac_c" 1>&6 -echo "configure:2762: checking for recent enough gmp.h" >&5 + echo $ac_n "checking for recent enough gmp.h""... $ac_c" 1>&6 +echo "configure:2770: checking for recent enough gmp.h" >&5 if eval "test \"`echo '$''{'cl_cv_new_gmp_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if !defined(__GNU_MP_VERSION) || (__GNU_MP_VERSION < 3) @@ -2772,7 +2780,7 @@ else #endif EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2776: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2784: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2788,10 +2796,10 @@ rm -f conftest* fi echo "$ac_t""$cl_cv_new_gmp_h" 1>&6 -if test "$cl_cv_new_gmp_h" = no; then with_gmp="no"; fi -if test "$with_gmp" = yes; then -echo $ac_n "checking for working libgmp""... $ac_c" 1>&6 -echo "configure:2795: checking for working libgmp" >&5 + if test "$cl_cv_new_gmp_h" = no; then with_gmp="no"; fi + if test "$with_gmp" = yes; then + echo $ac_n "checking for working libgmp""... $ac_c" 1>&6 +echo "configure:2803: checking for working libgmp" >&5 if eval "test \"`echo '$''{'cl_cv_new_libgmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2799,14 +2807,14 @@ else SAVELIBS=$LIBS LIBS="$LIBS -lgmp" cat > conftest.$ac_ext < int main() { mpn_divexact_by3(0,0,0) ; return 0; } EOF -if { (eval echo configure:2810: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2818: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cl_cv_new_libgmp="yes" else @@ -2819,8 +2827,8 @@ rm -f conftest* fi echo "$ac_t""$cl_cv_new_libgmp" 1>&6 -if test "$cl_cv_new_libgmp" = no; then with_gmp="no"; fi -fi + if test "$cl_cv_new_libgmp" = no; then with_gmp="no"; fi + fi fi if test "$with_gmp" = yes; then cat >> confdefs.h <<\EOF @@ -2890,7 +2898,7 @@ trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15 test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='$(prefix)' +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Any assignment to VPATH causes Sun make to only execute # the first set of double-colon rules, so remove it if not needed. @@ -2938,7 +2946,7 @@ done ac_given_srcdir=$srcdir -trap 'rm -fr `echo "Makefile src/Makefile tests/Makefile benchmarks/Makefile examples/Makefile doc/Makefile include/cl_config.h src/base/cl_base_config.h src/base/cl_gmpconfig.h src/float/cl_float_config.h src/timing/cl_t_config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "Makefile src/Makefile tests/Makefile benchmarks/Makefile examples/Makefile doc/Makefile cln-config include/cln/config.h src/base/cl_base_config.h src/base/cl_gmpconfig.h src/float/cl_float_config.h src/timing/cl_t_config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then @@ -3114,7 +3123,7 @@ ac_fD='%g' if test "${CONFIG_HEADERS+set}" != set; then EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF fi @@ -3199,7 +3208,7 @@ cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF - +chmod +x cln-config exit 0 EOF chmod +x $CONFIG_STATUS diff --git a/configure.in b/configure.in index 5f15a4d..03cd01d 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,8 @@ dnl dnl configure.in ------>> configure dnl dnl configure ------>> config.status -dnl --->> include/cl_config.h +dnl --->> include/cln/config.h +dnl cln-config.in --->> cln-config dnl Makefile.in --->> Makefile dnl src/Makefile.in --->> src/Makefile dnl @@ -12,7 +13,7 @@ dnl Makefile ------>> libcln.a dnl dnl AC_INIT(src/integer/gcd/cl_I_gcd.cc) -AC_CONFIG_HEADER(include/cl_config.h src/base/cl_base_config.h src/base/cl_gmpconfig.h src/float/cl_float_config.h src/timing/cl_t_config.h) +AC_CONFIG_HEADER(include/cln/config.h src/base/cl_base_config.h src/base/cl_gmpconfig.h src/float/cl_float_config.h src/timing/cl_t_config.h) AC_PROG_MAKE_SET dnl This piece of sed script replaces every line containing '@subdir@' dnl by several consecutive lines, each referencing one subdir. @@ -64,8 +65,13 @@ CL_CANONICAL_HOST_CPU dnl dnl check for build configuration dnl +LIBS=-lm + dnl libcln depends on libm PACKAGE=cln + dnl libtool wants PACKAGE AM_PROG_LIBTOOL + dnl sets variable LIBTOOL + dnl Libtool's library version information for CLN. dnl (Not to be confused with CLN's release version.) dnl Making new releases: @@ -82,15 +88,18 @@ AC_SUBST(CL_CURRENT) AC_SUBST(CL_REVISION) AC_SUBST(CL_AGE) dnl release version -CL_VERSION=1 +CL_VERSION_MAJOR=1 CL_VERSION_MINOR=1 CL_VERSION_PATCHLEVEL=0 -dnl release version for cl_config.h, so it can be tested by the preprocessor -AC_DEFINE_UNQUOTED(CL_VERSION, $CL_VERSION) +dnl release version for cln/config.h, so it can be tested by the preprocessor +AC_DEFINE_UNQUOTED(CL_VERSION_MAJOR, $CL_VERSION_MAJOR) AC_DEFINE_UNQUOTED(CL_VERSION_MINOR, $CL_VERSION_MINOR) AC_DEFINE_UNQUOTED(CL_VERSION_PATCHLEVEL, $CL_VERSION_PATCHLEVEL) +dnl concateneted release version +CL_VERSION=$CL_VERSION_MAJOR.$CL_VERSION_MINOR.$CL_VERSION_PATCHLEVEL +AC_DEFINE_UNQUOTED(CL_VERSION, $CL_VERSION) +AC_SUBST(CL_VERSION) - dnl sets variable LIBTOOL dnl dnl checks for compiler characteristics dnl @@ -137,10 +146,10 @@ dnl CL_CHAR_UNSIGNED dnl DEFS __CHAR_UNSIGNED__ if char is unsigned test -d 'include' || mkdir 'include' -CL_MACHINE([integer types and behaviour],${srcdir}/autoconf/intparam.c,include/cl_intparam.h,cl_cv_file_intparam_h) - dnl builds include/cl_intparam.h -CL_MACHINE([floating-point types and behaviour],${srcdir}/autoconf/floatparam.c,include/cl_floatparam.h,cl_cv_file_floatparam_h) - dnl builds include/cl_floatparam.h +CL_MACHINE([integer types and behaviour],${srcdir}/autoconf/intparam.c,include/cln/intparam.h,cl_cv_file_intparam_h) + dnl builds include/cln/intparam.h +CL_MACHINE([floating-point types and behaviour],${srcdir}/autoconf/floatparam.c,include/cln/floatparam.h,cl_cv_file_floatparam_h) + dnl builds include/cln/floatparam.h dnl dnl interfacing to GNU gmp (must be at least version 3) dnl @@ -172,4 +181,4 @@ changequote([,])dnl cp "$srcdir/$f" "$f" fi done -AC_OUTPUT(Makefile src/Makefile tests/Makefile benchmarks/Makefile examples/Makefile doc/Makefile) +AC_OUTPUT([Makefile src/Makefile tests/Makefile benchmarks/Makefile examples/Makefile doc/Makefile cln-config], [chmod +x cln-config]) diff --git a/doc/cln.dvi b/doc/cln.dvi index af738475f66a415f6e9f73017bcc0b08cd80804f..78de3c11aceeb9eb2feb3b2976193ad4d5e7b3cc 100644 GIT binary patch delta 10943 zcmb6h-I7_fhl5 zuVPj`9lJ53%h24yp~DM{ic6je3JL-m7vFbp#oVs2gYM}%uVLGU4W8in&aYzJp005d z{iSBJS9rC?Dp_+ZdV^h}CZlL=d?UkYiW2P(s<(@@&Sbvpf_XAtmz?O$`x_yr*72ERmCBxE&&xSuRF zI9+n{>t#;5L4<4~FcUV64OLkmb;uGx(xU){A z<0p=-aPNpND%#+=ReixAS!^aV9-ULQ#AG&8qm=8>`TdirUBpF;XjL#%j+Wk+7%gmk zBZEGe_)QGe<4QY)4(jM&b~X>Dz8OTP*YV_kN;Xx)q=FxS5zBwiRhrOYEF9$bQ~UgYpeR%F!@le5l; zwEH-VaE;UA^9M-J_6UVXkQf!#Wc5ilr^#YkX0q1$EYilQZAK9}^7`Hi$yZM$m(Nir zxy(klN{XYwh7h8`R8#NO#ai`FY8LelCvD4_rpTLfeC(V#6Q-1+q$XBmqY9v}io;pPzElj2*g}GsYY5GXv z*sx8yfeH-WSJ>3enrGKLO_Eh_&aE4@Dd<_bQC+JmO4B|3^VUK1SYa=EwlIcOQ3$4Q z6-ADC;O&=Jc*~bhSwZnX&aeE*=kO4dJ;PS)sHl_d&YTHmN$>O~-Pu`zQZ|d~*b_JE z4*jL5X9IFX*}`OXinXF0xApX1c?&UAOzu-ZMJHh@^{JvzQyw3$CYm!H5@g5 z!a1tU)C6XzGBn;jGzW(6U9q-1ig`3|E|x;zg?3&xr;PZ%E4bUooVU$0%FafE@9sI* zyc$B=77T0dQS}!cdHC(X>a8vVR*9<3p|X!TPk%O!CHNRE_8`{0=DA{II4leR=QZ!N z&I>1&Z#yO?E%k;m{fm%HV_zB6oUwX4G#`FEgEU`$vN0449dLhJZ;S+;GHxE@lcNZG ztz&V-E4QLyNym6u^U*Lm^_{soajC6S-ow7MdZY zr6)4zi)Yek`I&)q<(UfgbeGP2LZEN^rp-6o?u#V;OC1wSzugr@zNzh)F#Z%D4HfNU z`7IrUgOJqaS^2|Y*e=9$TQO46tjapkD?A>}mV`r@Xhi>R6pdAi0#bh_dM0#r>YV0e zRAu&Ob7r@%sru~C?toTRy7P>x)i}dSBOoE28pS9phNx;^y}POF!w;)Y$KkZQ3{Gw* zY~_(2`wqb|{kS%myz1{6W8 zx>XhWX{YGn-21XOdV*DbU?e-#2VQ4VU-*|?)emBUzxHL`{%{DAJE&v>;Jt9te>|Vb zm7gwv^eB@5fHGpI?t|i#q?I;BUHp?3deKFCg_uPuoh)+{3?w;QSmh`f{$NuekEn53 z4ctjPl;i=^ohlQGSJYcL0e*~PJP~Z{#^Htn3XnGRSA6(wMm}9 zAdt!G-W7NFb=f@{u7VIUz9-eM?k0p>IZWfE`%^qPp>aAJMWb;|JLZ*#U=ZtbKU_i& z$8eC$V&_4kJajCq3x#bg??JHOW9x&^oxS$}N0X}X`fg;_mc>N)kKNb4mMCDXi+DFwa%>Uf4DmvC?cGO#)`lVbY`PZAkd|^j@Z82_q18Ok zusgDUjh_eWZS3MS$YOUEKtIGWpbCcSkoQIw5f7;>Z8{{duM;7PjgE&f_GUShv8Z@R z;S0SH{14?YEyU~}kn4Vxt*%1Y*QP@@8xs$qtZh0}BSh&8Sc#8AGoV;VbIxZsWs0T2d9jpX~{r=;i8CRIZ6gaye}-#e?6gHriL1JpGo=Xse3O#G(XH zXL2J^Q4phh7Z)08N^f?c5=MpLtZ26*P0G~VUm%_xsf0*&cr+xkmYL8sR86+iFyZef zz~p~%`R6giOyt1k*$~67&xBeb{;OKHaW+o9`vf|g4YS}=5}z<8NFjZ^-hjz)o%g@d zOBq#h3MTa9US@lrgv9Pfu}1GQJF9GV3<>Cp^|cN^W`cj($jlGJGo5v}8!0N1v*tl8 z5n{ipkw-3oQb0At^P$jgvL7CYICf(p#G|01^{`r_E?uRr;yIPN6ARH0lH#E&cbti; zcE7KO?TDzTNRht0yc(W{WFgO3YnH0@X1e%=UyS4Qc9Xu^jEN>oGs57W!o&hhJJFvb z{q>4z2LwskVj~P8RipWS-Pm7^u&zCulV^+2CyZ1xz8247S3`gKO$%Hn?GWq_Hkc8% z>cecsrLwR`;T6t;J&%Gz?rVn>At|_9BhTA;o#jNkz%1X3Q*4$C@>0SJmQ^nCNz`bH z6tN`mIjI4S1Jy{PZSoEmL=&<|?6milCEx z@t8`|!A-D`laxl`Y*<>v7wYU=4AS`QDF)-&BhSIOuz~9at4p(dFp1rM4yJTKmv4rr zI!0}qVGI9ug%^gA_0QaOnu{G^owit<()Y-E1-r{?T5OZd^;PICcy{ecIXHto;)6#z zzQfHXvfj_bz>cYk=iw<@`@J zJGuqNsh=0W1Uc&4>X%@;`Zlo%V%c+B(c+StP@|P?aBeo+)`SS~Pc}>63KP_Y6I-DR z2kz58Ok`z^Xyi>Vp@Kzkg9w3q{}{iUPV)5lbD~u!OGGyWJaFsM547NY8O>nugpdh!<6W0Ct zvE2HcrfQSf!*4cK+tJNo7seB6dlu{PdS3&!R_b`82D27y-5`m2o6T%8DCH>D<9|9` z??Vu!ZKA1dW>8wcMaq2Ju|sfZgW*5k9lLQp;Koq zGhl*B%SmZI1!9gPDi&0CFy)O+KztkXNUk5c)VFuSZ1k{e} zL{X^*u3+~HYbPMx)&`%;;#2dkb`Rh{|FFI}(_r4<3EG+WbWqUJ<{)9xP4^4JwE<<> zs9wLC_f7t-$*GgGH+XdU19QFP_nusu>-NN7Pt3wPYke~pFqVdnddud9H!`ZxyGY0m z4<5-$>uo;K!C&v)-;4WW!i66z2fXJT93jfT+9#Q_G^#N#_3A_ucVHL;tdhl~$7tCJ zb%RD5$33(BSA@~?P9FX7M4q56q5dp1n;u_gR@R|!M5LI#Rr^GPo_D8Ifv9p@g5U7= znbOrl2x_s47Rie87Oj%2woW^mgyoJ`Xn3^-zwKx;2HL0&YO-hsB^nju8Lzk$rRl2g z1dr~6)+n7;RUyi-AZ|jeQgjHv zU!q5}s46zQWYgDjZ^Z)*p2XhS52HO>1Kn7I-pY}xYNzl@>#Xzh+r?aW)7=rRh`~`v zQX*iFqcAZFOE;uID`KRh*it$4Ppl0OAH6Gzrm{YtLUL@Ng^78S(hOiHkHV0cUGc4d z?~J9#F<2CWElfa~Ajs&x4TL~xv?ZJ73CAA@{0;v@{>GkZT(^UX1zVWB(dGl&Ye z=J5m?YfBdQ8T4S~Cop@OcMP(El|!=F&!DF|88~Rc3Amq?AIF*iPs@~1`$3ga%n3~U zaIgFmm_*>|RG9XI;f`7Zw-a(aUk1DHG&1+I`M+ZBw$qTDV9nE-uT>_gox!6{KnZ*8 zBqZF!KM!4 z&T`vw3i@)Q-a7>){CQIw_c{&f-8(~a?KETCLfM5KISpxdtIi+p;zo${PF-eGhM$A1e8V zSNt%YKS#B}EaWw!VBfW2dLMfpHD=X$EU$3!+cp(wnU+RPd+!JWS)yw(~HWKU2Q|1Ak(D zlE9|4VPoT^FJK0rx%LIr@aLQhVCK&cFJJ~e<`SOge8>F+!)!Q}?YIO9397mCD<5lZ zJ3H>X2q`H|3B#Z0q!Z|&Ix&0EMab;3X%a?|Kz>}zwq1loGW-elr;A|f{uD+`ez(#` zOO1G|POa&NeF=RAs6IhMh;XV)M3}o>qHO#UUIE>XI7AzL35wEGFI$P7TwT_64K??% zRC8NLFTwOI-2*4MS8TuLL-*$u_W$EIz$bqV^BXkRtss5;C-sgJ-8z1SA)&qH>A<@| z%oWg^^D8Nf-s!}<5l^VYGdXat$>-5WFR`1@S)(y30ekrH^EHxB@&v~m_Ve(MIXGt1 z4tZ;#xs%0K=H)kJ8DnaNsiLeG9pQLC^egrD3aYc(a~Qht?1 z{s$h%?u_R@(2vYK&i3Adt@6yDVJ^`|U$Pl@P)l#*-%U$WNrBt#-b$V*8n|KW?X9ia z;n<6}Aw{gI$jCpL7}|&4*V~mDZKeQ*(tC&I#MkN z5A9(GbR-2|8ri5|lFEM8k*Jc+4iaPW2M)?KPsnSnYy~2nPur8FZ0$32mzWAH#_Znc6{b&8^CYU~Bue>#e!04gH*RQ~dK&6S zRmM^sPoci@qRHS}MA@xi(x;zC_m{_%YK>Q7K0Rhq+D=Z%D?Is@x*sbIA$`a*E>;sl z`VZ?wWhdlH7|_1;*JE=Da~ghWko^J%3bSbu6@BcZ5Rx{mb6ny4SIoR!Rk^H<*lo&NooTYV@}lO!D6KWHHDej3oC1>QLw?VgdP` z38WIjOY$`^c|$o_2|Dfp<(L^{6h!ma7BrLz9%!-3(_bL-fJMw9QK4?s-M_XTm%Gg& zlhK_;rWMNihsaSP_gFw?fc)%2QbOcnk(|@XJ4cWtke8duCq%Z`NQzGW-bH5WWY==i zO61jrWGpay14&e0Nzo8_=o92o2y4+ggYvYixCbdHlD9ocrUTw_ZwmV1Z%dU`t#h#v z8M1N7Oc_bfhAyF3Ufx|?f;1^`^31iQ08l3C=-H>pEC^QLzxf>*6nIZwM@j?l^PeG8 z1Mhp*69+^q@OU8Qwo*M%e8JGb7J-E-xuKAZhnTxp>h^aLsv)6ZSZ8qco>Gq8Ly92& zw^mj!AwwXh(+c`5r=0F36%fwlrBZNXBbfv}3NaD(4pFBrSB`Txb@`%I1DLf5H_*u4 zKvCKeinP_QzkLqb6|d43xGGfgQ`s|~^n&EV;=o2Nfo0{kP+d;>tz~{&?g=_|PCj2s zQXnO4TF&m@08=vF|9=xDiB^{*JAKXGol26((TBN)p9%GZkKehwu!P;ZM)FCQ<%)5Q z|DN>h_8UET58Upj*u_9kxZS?Hq|m)1GGVL|>X9^cGHrE@yPj)(4TXo!Am~9S^l|97!E1itc!*qFFRJM>hLE* z{Bl-4wu(e3+WqIPWE_OM@Yg%ay|X;>ZPZTrhi&9$h|UA+?kHqOdcuPq++9$B2#e%v zyU*~Ar?iWovp?$xvWNc+X3_^ zVceQIZaLz8G~Y;d8@z9}8sxNfWH972cwCU`6?lQ&CD0inmk^W8f)L6&8YRWuskNl~9i1+=?8mTi>UWX(l>IcRqwhUUad?kMFQQNjd> zYX5Q?rbIWQ1qrktc(q7YQ4=SmF5xKpK)5H2exL@dcVdNuN$gOj&{K8~5DGYjy~Z(p zp%5>h$`l3xGZhF4a?gRn*AcyX{jxjYr^=DywnOTu#fJ7Es^rP_gM}9XO!DO~(Diod zaDg_n%c1yEesvZ(RG1Scq&?Fp*NhSL!6EAX`TmvY(d7N(h4*@dW0s}-{BEcke}9hS zE+S=cNAh)Nd*3%UY}k6|_RhWv%XZ5R3x#rsYf6oIOXFb$p7G*Yd3d!j6i9lW>@)}; zMhI|m6E~R4Xp9e?4H#pYBy0~B(q8zz{DV`Nr;A2?R4^+V#b(tDw~;Skl;n=*p`_EY$pthssvPAxD5g#?YHqY{$jb=QO~5T+wL$yxmOf91Mc-2eap delta 9222 zcmcgSd0bP+)||P4unV#Y%BHBGfCO+~QQT3m;MQ7WNNylCB$x!1))uvP*F55_40S`Q zrP|UyHGOZo__TJ{YWKRexYU+fwTrKjnUKWLPmj`_~JG4=;7gwlhh5GQR*nyYDwYN?QZPpXbu+P*rUeog>^$ z-G0uKss|=XTaw56bGCA&3(4tfuUE>@Zo{&5y`>40iV7x|j_#dRESXXUMk=s*^KL`8 zr6frsQ(~nrlY2BVW{md;wO3ts$!M>twpc~URf+#ar^|^V`!KT9 zF4Z=ojGdMC8mmbvub**Rbh$)_RB32j+9*o8p(+LEvPMI-D$} zWX_8iIcLPx6%Er~dwPY0|G1oTrk+JIQ$2;hUn{M&J6u_ltagK|A#%*kQj4v^Dk@`7 zNL`t@@jl7znt<=;h<qPIAIaR6LV1()f)IpUq}aKbkXoOvb; zzT!jgt-IC}0m(|9g~NI4J-qOs1{O$r{G+99#y`S0&kz-tMf=-&hxD9j0>S1-Qv&F{ zA!0}n>_#%QoYB)pKVuI7F%7p?GO#bE35F z5v}*+nz>ro>(#Ao34!_Ys)WWzLrJ5b+;89UM;IKDyM4VM1!|E+ae1{)TJ?UW^!mOy zY1FB@rM|gAM-up)3^yFwAl16Zu>}C z8B5#VP4&jVzA2dO@5UEN*A71-)2e%af!u!a{vC3gbtIp+Uc-?D!inDdL3W}{q>@vu z>`YdHNX_r2c+Y&WBmjPvW_^B9CNlC^joj`&wm6UHEtA`}Q>7|S5AT#O z-Y2jf`55n=b9z(=IsLfYKla_uP;xO??!R%hdl+2hT^6T-KoFvDJ;HkX!*-!Z%s0Db zYeQpe(C!T9inWR^QKIK^p%=X#2pM&F8k1D7;?C{m?0RR1tGRa3k?YcBcEeSLct;s z&2(8fNf9tv@gl>KXja=DRue&3`#8NB4e_eHqv^mHNK5wo6AzD5rD6Gs;&6JDLJ{5R1Djd+ITwyF`yF%ZT34$R$8` z_J&b%$I}Pm>5bm-WXI_Hj!qhVIt?!09_{T52jHA6iI@7p!64Egqk)*qEp zH$`b@qH}4EwoCfj@iChasMSxChax(;$+Xr^4dYU2>*~Hf*!Icy5UoxqZXl)Mb)rLe{!}c#F=P22-G!?wAIt z&_WMQ0~a=9ro%#PwoFH}X{Mh|hdwyEHXWAt!Ndot;r*cc#%Zgw*5)!S=O$${85|~e z3zdpsR)XR>zG;KCLM(R}EJmEaSp>6t{%IbAQsz*21H&VOF90?_e)m{w60V3u{?%R{S5g*}Y zh(EFf#^Gp12~=Y9O$pqOjd2#_3rUOf=*C&lF9DwVFT?dq^BHc2Af%eOx#ri|Yh2Ye zE;T#+|2Nrb7);Tv{=#JKifgHy{guh87>dclQ`}^;!xd}AQ@NYCt)RK~rr+EFV}g_k z(cz#T^ma1sEpB)dsIC-rnx;tWII155iF9Qtbk{V+1inLe&xU9kRR$G8v~{d9`e+sO zVlR}zXCw+SWC2e!7}1?88~)D@!O$T_fTZS>s0^n-5Qbo}!;* zX__Kl31gG*ga{%am+a03Pym`H&QsIfaE*@EqZiHADqgfn4?SpM2}FirR5BULt+jIO zru!DcD$TB_ygY7dL+RIg*a9u=p+(sA^q)4Z!fG!!Sf!<#ZkY-V4hycs$dB@(Bg$b& zs=s$UMkxLo*_&D`2d54*QNsy+q8x^jMfY(Y;^-IU@OVdl%&LsgCy3oIeF^CwSW(2av+^XyP-s8)#QeS zM7w=LI>)Am>tPX|Ces6Fv}uRe%CMswAQ@plY=DWhc0Cko@hu=vyuBWt^kEq!c*HmO zNkWC`>EE7&;lzEv%sOtJL4!BIYd)mgbeDD}IfcH|07HCONOv+FPGNu#g2ba~9mOPt zbDXjnl4wLD^zAYVVDlRxo{)yeJ2p?J-i`2rjI?Nza(23V6I6FBo7U0EpeMINU;6T9 zNa+A2(J5P?8=bltb)2vTBD%om$RnhgNMG9mdACO)TVb{`+6pr}Is@t4Es!3@GapQ0 zoR~s1uc9GM&{K~_>*{#UDo<6bY};mw&7`lfS(aAYt+je?i2M?NdId&w#mF6^tHxnd z?+h2W{c8RMmQyOHRAtBahO@ent!_fI;B2seZi4`SvU#viH0;JR@O`k%B6_xLQrYC$ z7T-Lz?NQU1fW43(Rc1tMt`y6qTBB4cF6A3hyBAVurWZna_^K2gRTdW=>xKSw+g=#V zVOD$y+Dvqe7tKK9#T$TgGR%wj1Mwy(4q5XC+WT`a!QL?P&t)=*A?RU$^448cCy;!q zdk+Q+3BP>LEbl=h2uTG&RC5^m39&yvL9-5HX4(xq(qSkhena5$~=ybcA`1*f*29u+Ab@!f^vE>WMUVabe&vey!h^1+t!_Ziz zG9k|?k8n&d@#6ay=R!Ko(X3;z*k6y4%}Nc&VI*C53i_ctz;T#I^iJN6qnnRIGSQp) zpn%@O0V1TF00Yrm6@<4=pqbzGIR?!`zbVJx|2f1*c7DVwG4sj^m>ae$>c~+a=k!WD zL{aN;$e~Bukjir>A()n&!o23glMspG}n1vcZpgz@x0r=SP+Bfo%h&Xx?j zc^p!R-lPl?zl0P-82cp{v?>#H<|#Z$`biiN*zwfo+l;=wD=zq{4U-^@(5GSAIDHjQ zl8mz0-G3Hu6`yEi zP|!JuL)Lqr!`o3$#d9zsNIwVn_k?`9owlBnNxyRr(&)yoAvjn+d5&7|;bu6RUiw;I zee^3R3*d7Ok=C6@9c=kV*6Y&qFh@YRVgPH;LoS`t4q;l3T4guUkI$p`m3|GqaqDGY zLsqc9)JNaY4yp8`uOT;t1C*@Y)!HiA63t+|O$qP_k*vb7|mMRRAo$R4Z25{3d8;lmK#bpuEEN-u`aq&k= zGw7?|L3((>Pn`lr9{uS%h#?7!sP-aQdQ@a759U7V)002*Ywkm3a@J6QZ z-Aku@4|m6T{B_w#PtA4g4wLARL-R+UL39rjFLGk(6W=OQm4TOPQArW6E@ZQQfHo~= z<;_>&QOwx0{sU*FnL`3t>@~~;x~0sz)JYoo^r7n*wQyC-bqFD8Z*ExU$-ch%bb5uU zJcE}H%25J~d122`jx|EuVCj48lix9-(Cn)i$i5xVk3P60$L)4+BM;^cShwxQwj;+B zB7ICEUUl-zc|wuCaN_vclifQ)S7O~9xA?QbG38cu%uAMeAXW;W^;oFVFX8~qm{69e$Ig9Pb)0_lb4-6W6^c>0q9G0{MQ^e5NmE0@vz8qx!F z(nrQv)~X@j0KNvL0J5`F;#Cq%W(b4lv!^gu8fFzinuE!(55kD0_jE?`JQ zo;%cIZqQ_GbyZsMh8FRTu9f)eB#MQo@a|m$peLYW4V@oCl7^{kJF;45<|g5KB*rj| zc1tZ-XKD~GJc^Zcv=_;0!55*UmhYR{NdJzjL*+}`C@tn#^s^Asr?*Ovm)bYZRlk~G zz24R+Cn89=k@gBDeaPn5X+bFIH@551)YWZhqTJ59gl(x!A?M)5olN9rF@6-F+d>Jy z<_?CEsPLtBi)jG2ne+ijmR<`b10%2&#lg3sIbozf(}$51fPBS!ZkEw8zmYh|Wv_>m zC7Buz^bTVMn@9`@^v+f`Y!n#@Z2K6}Ks1Mp7AO0-2e}96D-%cd6iujqt$yUxH8i>kKPj-mUDivE+wV4cnXkA{HDY<&uG1Z|RWtB2zHq}R&)Imgm6p!}34_kBp5>qZd z{%?E9^-TpKtP2GR3x=q}sW)iBSLCgXzys4-a|d_j)@-P;y6~pPZwXjOHB>k~u=HJu zJiQ;~3A`NLI#|~kpJK(W6UA_u;*bsu_VHwLKTy4y1VJIQn8|pEGudnK8L2l^qrETp z2r*^p86Lj_6Zj54XLthh>s!0X7fXKz%y13PN?zJk@arA-arEm+MIsbm!LPo1Nr=LpGMWlq>*xeL4xnkQG`)rUIRBBq7W=gSY@g#6yiS$gx(OFpWFFdO17`g@g>{m zlTS#noc+mp9lLRy1OpkYW0ea?hK5vISaV-8ALxhC#GgI7h%D4ZbSbF%tt?`Awh##L zXn%dGHJ6<y2uO&hv$3Sr~!#i*qqjeUUJt#+I1 zFm$Eq+)c?jcgtH`Dl2sF3V-c_JUC<$%WEnWM?sbJfxwP9#zw9tWe_CC33=nE9weE- z#=FV$0W7hBJVfG~lB+vNPE<3aL$akSS|NEuS;{6-2<+)CM0H9PyDP!0*Xxp*C@JRGvyL{(M< zZn2LSlTi>Hw5+H#Z!pR#hptK#qFJv5VMi<-)L)2Vr*hCM=<7K`PnMP|3;@lJ5Y|rj zjKHb#JmErcWa=I1ic&6>m0$+fX9c@!jDUr7YmHN`Bn7VU5kP2_-;4o7rskYGHwfr*G&mbpOM`4J{fKr^pUGB2455 znbX4j9}|k8Z<*7$VgK;kB?=y9x6Xg^#l#Q*or}5SIWDC zJI*~D|2kuCfih}kf2k)$gtIN{SOVA_s4m z%tqA>{Gd~g diff --git a/doc/cln.html b/doc/cln.html index 70f6635..1c6aef9 100644 --- a/doc/cln.html +++ b/doc/cln.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers @@ -105,18 +105,19 @@
  • 11. Using the library -
  • 12. Customizing +
  • 12. Customizing -
  • Index +
  • Index


    @@ -274,6 +275,11 @@ The garbage collection imposes no burden on the main application.

  • The library provides hooks for memory allocation and exceptions. +
  • + + +All non-macro identifiers are hidden in namespace cln in +order to avoid name clashes. @@ -294,23 +300,21 @@ This section describes how to install the CLN package on your system.

    To build CLN, you need a C++ compiler. -Actually, you need GNU g++ 2.7.0 or newer. -On HPPA, you need GNU g++ 2.8.0 or newer. +Actually, you need GNU g++ 2.90 or newer, the EGCS compilers will +do. I recommend GNU g++ 2.95 or newer.

    The following C++ features are used: -classes, member functions, -overloading of functions and operators, -constructors and destructors, inline, const, -multiple inheritance, templates. +classes, member functions, overloading of functions and operators, +constructors and destructors, inline, const, multiple inheritance, +templates and namespaces.

    The following C++ features are not used: -new, delete, virtual inheritance, -exceptions. +new, delete, virtual inheritance, exceptions.

    @@ -323,7 +327,7 @@ implement for GNU g++ only.

    2.1.2 Make utility

    - +

    @@ -334,7 +338,7 @@ To build CLN, you also need to have GNU make installed.

    2.1.3 Sed utility

    - +

    @@ -416,12 +420,10 @@ Examples:

     $ CC="gcc" CFLAGS="-O" CXX="g++" CXXFLAGS="-O" ./configure
    -$ CC="gcc -V 2.7.2" CFLAGS="-O -g" \
    -  CXX="g++ -V 2.7.2" CXXFLAGS="-O -g" ./configure
    -$ CC="gcc -V 2.8.1" CFLAGS="-O -fno-exceptions" \
    -  CXX="g++ -V 2.8.1" CXXFLAGS="-O -fno-exceptions" ./configure
    -$ CC="gcc -V egcs-2.91.60" CFLAGS="-O2 -fno-exceptions" \
    -  CXX="g++ -V egcs-2.91.60" CFLAGS="-O2 -fno-exceptions" ./configure
    +$ CC="gcc -V egcs-2.91.60" CFLAGS="-O -g" \
    +  CXX="g++ -V egcs-2.91.60" CXXFLAGS="-O -g" ./configure
    +$ CC="gcc -V 2.95.2" CFLAGS="-O2 -fno-exceptions" \
    +  CXX="g++ -V 2.95.2" CFLAGS="-O2 -fno-exceptions" ./configure
     

    @@ -434,13 +436,9 @@ calling configure. In a csh shell, you have to use the

    -On Linux, g++ needs 15 MB to compile the tests. So you should better -have 17 MB swap space and 1 MB room in $TMPDIR. - - -

    -If you use g++ version 2.7.x, don't add `-O2' to the CXXFLAGS, -because `g++ -O' generates better code for CLN than `g++ -O2'. +Currently CLN works only with the GNU g++ compiler, and only in +optimizing mode. So you should specify at least -O in the CXXFLAGS, +or no CXXFLAGS at all. (If CXXFLAGS is not set, CLN will use -O.)

    @@ -472,7 +470,7 @@ libraries so runtime-critical applications should be linked statically.

    2.2.1 Using the GNU MP Library

    - +

    @@ -501,7 +499,7 @@ $ CC="gcc" CFLAGS="-O2" CXX="g++" CXXFLAGS="-O2 -fno-exceptions" \

    2.3 Installing the library

    - +

    @@ -561,35 +559,35 @@ CLN implements the following class hierarchy:

                             Number
    -                       cl_number
    -                     <cl_number.h>
    +                      cl_number
    +                    <cln/number.h>
                               |
                               |
                      Real or complex number
                             cl_N
    -                     <cl_complex.h>
    +                    <cln/complex.h>
                               |
                               |
                          Real number
                             cl_R
    -                      <cl_real.h>
    +                     <cln/real.h>
                               |
           +-------------------+-------------------+
           |                                       |
     Rational number                     Floating-point number
         cl_RA                                   cl_F
    -<cl_rational.h>                          <cl_float.h>
    +<cln/rational.h>                         <cln/float.h>
           |                                       |
    -      |                  +-------------+-------------+-------------+
    -   Integer               |             |             |             |
    -    cl_I            Short-Float   Single-Float  Double-Float   Long-Float
    - <cl_integer.h>        cl_SF         cl_FF         cl_DF         cl_LF
    -                   <cl_sfloat.h> <cl_ffloat.h> <cl_dfloat.h> <cl_lfloat.h>
    +      |                +--------------+--------------+--------------+
    +   Integer             |              |              |              |
    +    cl_I          Short-Float    Single-Float   Double-Float    Long-Float
    +<cln/integer.h>      cl_SF          cl_FF          cl_DF          cl_LF
    +                 <cln/sfloat.h> <cln/ffloat.h> <cln/dfloat.h> <cln/lfloat.h>
     

    - + The base class cl_number is an abstract base class. It is not useful to declare a variable of this type except if you want to completely disable compile-time type checking and use run-time type @@ -597,24 +595,24 @@ checking instead.

    - + The class cl_N comprises real and complex numbers. There is no special class for complex numbers since complex numbers with imaginary part 0 are automatically converted to real numbers.

    - + The class cl_R comprises real numbers of different kinds. It is an abstract class.

    - + The class cl_RA comprises exact real numbers: rational numbers, including integers. There is no special class for non-integral rational numbers since rational numbers with denominator 1 are automatically converted @@ -622,7 +620,7 @@ to integers.

    - + The class cl_F implements floating-point approximations to real numbers. It is an abstract class. @@ -631,7 +629,7 @@ It is an abstract class.

    3.1 Exact numbers

    - +

    @@ -675,7 +673,7 @@ is completely transparent.

    3.2 Floating-point numbers

    - +

    @@ -687,7 +685,7 @@ CLN implements ordinary floating-point numbers, with mantissa and exponent.

    - + The elementary operations (+, -, *, /, ...) only return approximate results. For example, the value of the expression (cl_F) 0.3 + (cl_F) 0.4 prints as `0.70000005', not as @@ -718,7 +716,7 @@ Floating point numbers come in four flavors:

    • - + Short floats, type cl_SF. They have 1 sign bit, 8 exponent bits (including the exponent's sign), and 17 mantissa bits (including the "hidden" bit). @@ -726,7 +724,7 @@ They don't consume heap allocation.
    • - + Single floats, type cl_FF. They have 1 sign bit, 8 exponent bits (including the exponent's sign), and 24 mantissa bits (including the "hidden" bit). @@ -735,7 +733,7 @@ This corresponds closely to the C/C++ type `float'.
    • - + Double floats, type cl_DF. They have 1 sign bit, 11 exponent bits (including the exponent's sign), and 53 mantissa bits (including the "hidden" bit). @@ -744,7 +742,7 @@ This corresponds closely to the C/C++ type `double'.
    • - + Long floats, type cl_LF. They have 1 sign bit, 32 exponent bits (including the exponent's sign), and n mantissa bits (including the "hidden" bit), where n >= 64. @@ -765,7 +763,7 @@ with larger exponent range.

      - + As a user of CLN, you can forget about the differences between the four floating-point types and just declare all your floating-point variables as being of type cl_F. This has the advantage that @@ -782,7 +780,7 @@ the floating point contagion rule happened to change in the future.)

      3.3 Complex numbers

      - +

      @@ -801,7 +799,7 @@ through application of sqrt or transcendental functions.

      3.4 Conversions

      - +

      @@ -860,7 +858,7 @@ Conversions from `const char *' are provided for the classes cl_R, cl_N. The easiest way to specify a value which is outside of the range of the C++ built-in types is therefore to specify it as a string, like this: - +

          cl_I order_of_rubiks_cube_group = "43252003274489856000";
      @@ -880,16 +878,16 @@ the functions
       
       
      int cl_I_to_int (const cl_I& x)
      - +
      unsigned int cl_I_to_uint (const cl_I& x)
      - +
      long cl_I_to_long (const cl_I& x)
      - +
      unsigned long cl_I_to_ulong (const cl_I& x)
      - + Returns x as element of the C type ctype. If x is not representable in the range of ctype, a runtime error occurs. @@ -904,12 +902,12 @@ the functions
      -
      float cl_float_approx (const type& x) -
      - -
      double cl_double_approx (const type& x) +
      float float_approx (const type& x)
      +
      double double_approx (const type& x) +
      + Returns an approximation of x of C type ctype. If abs(x) is too close to 0 (underflow), 0 is returned. If abs(x) is too large (overflow), an IEEE infinity is returned. @@ -920,10 +918,10 @@ Conversions from any class to any of its subclasses ("derived classes" in C++ terminology) are not provided. Instead, you can assert and check that a value belongs to a certain subclass, and return it as element of that class, using the `As' and `The' macros. - + As(type)(value) checks that value belongs to type and returns it as such. - + The(type)(value) assumes that value belongs to type and returns it as such. It is your responsibility to ensure that this assumption is valid. @@ -945,7 +943,7 @@ Example:

      Each of the number classes declares its mathematical operations in the corresponding include file. For example, if your code operates with -objects of type cl_I, it should #include <cl_integer.h>. +objects of type cl_I, it should #include <cln/integer.h>. @@ -1040,12 +1038,12 @@ defines the following operations:

      type operator + (const type&, const type&)
      - + Addition.
      type operator - (const type&, const type&)
      - + Subtraction.
      type operator - (const type&) @@ -1054,22 +1052,22 @@ Returns the negative of the argument.
      type plus1 (const type& x)
      - + Returns x + 1.
      type minus1 (const type& x)
      - + Returns x - 1.
      type operator * (const type&, const type&)
      - + Multiplication.
      type square (const type& x)
      - + Returns x * x.
      @@ -1083,12 +1081,12 @@ defines the following operations:
      type operator / (const type&, const type&)
      - + Division.
      type recip (const type&)
      - + Returns the reciprocal of the argument. @@ -1104,7 +1102,7 @@ Instead, cl_I defines an "exact quotient" function:
      cl_I exquo (const cl_I& x, const cl_I& y)
      - + Checks that y divides x, and returns the quotient x/y. @@ -1116,14 +1114,14 @@ The following exponentiation functions are defined:
      cl_I expt_pos (const cl_I& x, const cl_I& y)
      - +
      cl_RA expt_pos (const cl_RA& x, const cl_I& y)
      y must be > 0. Returns x^y.
      cl_RA expt (const cl_RA& x, const cl_I& y)
      - +
      cl_R expt (const cl_R& x, const cl_I& y)
      cl_N expt (const cl_N& x, const cl_I& y) @@ -1141,7 +1139,7 @@ defines the following operation:
      type abs (const type& x)
      - + Returns the absolute value of x. This is x if x >= 0, and -x if x <= 0. @@ -1167,7 +1165,7 @@ defines the following operation:
      type signum (const type& x)
      - + Returns the sign of x, in the same number format as x. This is defined as x / abs(x) if x is non-zero, and x if x is zero. If x is real, the value is either @@ -1186,12 +1184,12 @@ Each of the classes cl_RA, cl_I defines the following
      cl_I numerator (const type& x)
      - + Returns the numerator of x.
      cl_I denominator (const type& x)
      - + Returns the denominator of x. @@ -1212,7 +1210,7 @@ The class cl_N defines the following operation:
      cl_N complex (const cl_R& a, const cl_R& b)
      - + Returns the complex number a+bi, that is, the complex number with real part a and imaginary part b. @@ -1225,17 +1223,17 @@ Each of the classes cl_N, cl_R defines the following o
      cl_R realpart (const type& x)
      - + Returns the real part of x.
      cl_R imagpart (const type& x)
      - + Returns the imaginary part of x.
      type conjugate (const type& x)
      - + Returns the complex conjugate of x. @@ -1257,7 +1255,7 @@ We have the relations

      4.5 Comparisons

      - +

      @@ -1270,22 +1268,22 @@ defines the following operations:

      bool operator == (const type&, const type&)
      - +
      bool operator != (const type&, const type&)
      - + Comparison, as in C and C++. -
      uint32 cl_equal_hashcode (const type&) +
      uint32 equal_hashcode (const type&)
      - + Returns a 32-bit hash code that is the same for any two numbers which are the same according to ==. This hash code depends on the number's value, not its type or precision.
      cl_boolean zerop (const type& x)
      - + Compare against zero: x == 0 @@ -1297,44 +1295,44 @@ defines the following operations:
      -
      cl_signean cl_compare (const type& x, const type& y) +
      cl_signean compare (const type& x, const type& y)
      - + Compares x and y. Returns +1 if x>y, -1 if x<y, 0 if x=y.
      bool operator <= (const type&, const type&)
      - +
      bool operator < (const type&, const type&)
      - +
      bool operator >= (const type&, const type&)
      - +
      bool operator > (const type&, const type&)
      - + Comparison, as in C and C++.
      cl_boolean minusp (const type& x)
      - + Compare against zero: x < 0
      cl_boolean plusp (const type& x)
      - + Compare against zero: x > 0
      type max (const type& x, const type& y)
      - + Return the maximum of x and y.
      type min (const type& x, const type& y)
      - + Return the minimum of x and y.
      @@ -1351,7 +1349,7 @@ there is no floating point number whose value is exactly 1/3.

      4.6 Rounding functions

      - +

      @@ -1422,19 +1420,19 @@ defines the following operations:

      cl_I floor1 (const type& x)
      - + Returns floor(x).
      cl_I ceiling1 (const type& x)
      - + Returns ceiling(x).
      cl_I truncate1 (const type& x)
      - + Returns truncate(x).
      cl_I round1 (const type& x)
      - + Returns round(x). @@ -1523,16 +1521,16 @@ defines the following operations:
      type_div_t floor2 (const type& x, const type& y)
      - +
      type_div_t ceiling2 (const type& x, const type& y)
      - +
      type_div_t truncate2 (const type& x, const type& y)
      - +
      type_div_t round2 (const type& x, const type& y)
      - +

      @@ -1551,16 +1549,16 @@ defines the following operations:

      type ffloor (const type& x)
      - +
      type fceiling (const type& x)
      - +
      type ftruncate (const type& x)
      - +
      type fround (const type& x)
      - +

      @@ -1592,11 +1590,11 @@ and the remainder. The suffix `2' indicates this. Each of the classes cl_F, cl_SF, cl_FF, cl_DF, cl_LF defines the following operations: - +

      @@ -1605,20 +1603,20 @@ defines the following operations:
      type_fdiv_t ffloor2 (const type& x)
      - +
      type_fdiv_t fceiling2 (const type& x)
      - +
      type_fdiv_t ftruncate2 (const type& x)
      - +
      type_fdiv_t fround2 (const type& x)
      - +

      and similarly for class cl_R, but with quotient type cl_F. - +

      @@ -1670,10 +1668,10 @@ The classes cl_R, cl_I define the following operations

      type mod (const type& x, const type& y)
      - +
      type rem (const type& x, const type& y)
      - + @@ -1690,7 +1688,7 @@ defines the following operation:
      type sqrt (const type& x)
      - + x must be >= 0. This function returns the square root of x, normalized to be >= 0. If x is the square of a rational number, sqrt(x) will be a rational number, else it will return a @@ -1705,7 +1703,7 @@ The classes cl_RA, cl_I define the following operation
      cl_boolean sqrtp (const type& x, type* root)
      - + This tests whether x is a perfect square. If so, it returns true and the exact square root in *root, else it returns false. @@ -1718,7 +1716,7 @@ Furthermore, for integers, similarly:
      cl_boolean isqrt (const type& x, type* root)
      - + x should be >= 0. This function sets *root to floor(sqrt(x)) and returns the same value as sqrtp: the boolean value (expt(*root,2) == x). @@ -1733,7 +1731,7 @@ define the following operation:
      cl_boolean rootp (const type& x, const cl_I& n, type* root)
      - + x must be >= 0. n must be > 0. This tests whether x is an nth power of a rational number. If so, it returns true and the exact root in *root, else it returns @@ -1749,7 +1747,7 @@ for class cl_N:
      cl_N sqrt (const cl_N& z)
      - + Returns the square root of z, as defined by the formula sqrt(z) = exp(log(z)/2). Conversion to a floating-point type or to a complex number are done if necessary. The range of the result is the @@ -1763,7 +1761,7 @@ The result is an exact number only if z is an exact number.

      4.8 Transcendental functions

      - +

      @@ -1781,7 +1779,7 @@ For example, cos(0) = 1 returns the rational number 1.

      cl_R exp (const cl_R& x)
      - +
      cl_N exp (const cl_N& x)
      Returns the exponential function of x. This is e^x where @@ -1790,12 +1788,12 @@ is the entire complex plane excluding 0.
      cl_R ln (const cl_R& x)
      - + x must be > 0. Returns the (natural) logarithm of x.
      cl_N log (const cl_N& x)
      - + Returns the (natural) logarithm of x. If x is real and positive, this is ln(x). In general, log(x) = log(abs(x)) + i*phase(x). The range of the result is the strip in the complex plane @@ -1803,7 +1801,7 @@ The range of the result is the strip in the complex plane
      cl_R phase (const cl_N& x)
      - + Returns the angle part of x in its polar representation as a complex number. That is, phase(x) = atan(realpart(x),imagpart(x)). This is also the imaginary part of log(x). @@ -1825,7 +1823,7 @@ Returns the logarithm of a with respect to base b.
      cl_N expt (const cl_N& x, const cl_N& y)
      - + Exponentiation: Returns x^y = exp(y*log(x)). @@ -1835,18 +1833,18 @@ The constant e = exp(1) = 2.71828... is returned by the following functions:
      -
      cl_F cl_exp1 (cl_float_format_t f) +
      cl_F exp1 (cl_float_format_t f)
      - + Returns e as a float of format f. -
      cl_F cl_exp1 (const cl_F& y) +
      cl_F exp1 (const cl_F& y)
      Returns e in the float format of y. -
      cl_F cl_exp1 (void) +
      cl_F exp1 (void)
      -Returns e as a float of format cl_default_float_format. +Returns e as a float of format default_float_format.
      @@ -1857,7 +1855,7 @@ Returns e as a float of format cl_default_float_format.
      cl_R sin (const cl_R& x)
      - + Returns sin(x). The range of the result is the interval -1 <= sin(x) <= 1. @@ -1867,7 +1865,7 @@ Returns sin(z). The range of the result is the entire complex plane
      cl_R cos (const cl_R& x)
      - + Returns cos(x). The range of the result is the interval -1 <= cos(x) <= 1. @@ -1875,33 +1873,33 @@ Returns cos(x). The range of the result is the interval
      Returns cos(z). The range of the result is the entire complex plane. -
      struct cl_cos_sin_t { cl_R cos; cl_R sin; }; +
      struct cos_sin_t { cl_R cos; cl_R sin; };
      - -
      cl_cos_sin_t cl_cos_sin (const cl_R& x) + +
      cos_sin_t cos_sin (const cl_R& x)
      Returns both sin(x) and cos(x). This is more efficient than - + computing them separately. The relation cos^2 + sin^2 = 1 will hold only approximately.
      cl_R tan (const cl_R& x)
      - +
      cl_N tan (const cl_N& x)
      Returns tan(x) = sin(x)/cos(x).
      cl_N cis (const cl_R& x)
      - +
      cl_N cis (const cl_N& x)
      Returns exp(i*x). The name `cis' means "cos + i sin", because e^(i*x) = cos(x) + i*sin(x). - +
      cl_N asin (const cl_N& z)
      Returns arcsin(z). This is defined as @@ -1914,7 +1912,7 @@ with realpart = pi/2 and imagpart > 0.
      cl_N acos (const cl_N& z)
      - + Returns arccos(z). This is defined as arccos(z) = pi/2 - arcsin(z) = log(z+i*sqrt(1-z^2))/i and satisfies arccos(-z) = pi - arccos(z). @@ -1923,8 +1921,8 @@ The range of the result is the strip in the complex domain with realpart = 0 and imagpart < 0 and the numbers with realpart = pi and imagpart > 0. - +
      cl_R atan (const cl_R& x, const cl_R& y)
      Returns the angle of the polar representation of the complex number @@ -1953,25 +1951,25 @@ with realpart = pi/2 and imagpart <= 0.

      - + Archimedes' constant pi = 3.14... is returned by the following functions:

      -
      cl_F cl_pi (cl_float_format_t f) +
      cl_F pi (cl_float_format_t f)
      - + Returns pi as a float of format f. -
      cl_F cl_pi (const cl_F& y) +
      cl_F pi (const cl_F& y)
      Returns pi in the float format of y. -
      cl_F cl_pi (void) +
      cl_F pi (void)
      -Returns pi as a float of format cl_default_float_format. +Returns pi as a float of format default_float_format.
      @@ -1982,7 +1980,7 @@ Returns pi as a float of format cl_default_float_format.
      cl_R sinh (const cl_R& x)
      - + Returns sinh(x).
      cl_N sinh (const cl_N& z) @@ -1991,7 +1989,7 @@ Returns sinh(z). The range of the result is the entire complex plan
      cl_R cosh (const cl_R& x)
      - + Returns cosh(x). The range of the result is the interval cosh(x) >= 1. @@ -1999,26 +1997,26 @@ Returns cosh(x). The range of the result is the interval
      Returns cosh(z). The range of the result is the entire complex plane. -
      struct cl_cosh_sinh_t { cl_R cosh; cl_R sinh; }; -
      - -
      cl_cosh_sinh_t cl_cosh_sinh (const cl_R& x) +
      struct cosh_sinh_t { cl_R cosh; cl_R sinh; };
      +
      cosh_sinh_t cosh_sinh (const cl_R& x) +
      + Returns both sinh(x) and cosh(x). This is more efficient than computing them separately. The relation cosh^2 - sinh^2 = 1 will hold only approximately.
      cl_R tanh (const cl_R& x)
      - +
      cl_N tanh (const cl_N& x)
      Returns tanh(x) = sinh(x)/cosh(x).
      cl_N asinh (const cl_N& z)
      - + Returns arsinh(z). This is defined as arsinh(z) = log(z+sqrt(1+z^2)) and satisfies arsinh(-z) = -arsinh(z). @@ -2029,7 +2027,7 @@ with imagpart = pi/2 and realpart < 0.
      cl_N acosh (const cl_N& z)
      - + Returns arcosh(z). This is defined as arcosh(z) = 2*log(sqrt((z+1)/2)+sqrt((z-1)/2)). The range of the result is the half-strip in the complex domain @@ -2038,7 +2036,7 @@ excluding the numbers with realpart = 0 and -pi < imagpar
      cl_N atanh (const cl_N& z)
      - + Returns artanh(z). This is defined as artanh(z) = (log(1+z)-log(1-z)) / 2 and satisfies artanh(-z) = -artanh(z). The range of the result is @@ -2052,7 +2050,7 @@ with imagpart = pi/2 and realpart >= 0.

      4.8.4 Euler gamma

      - +

      @@ -2061,46 +2059,46 @@ Euler's constant C = 0.577... is returned by the following functions:

      -
      cl_F cl_eulerconst (cl_float_format_t f) +
      cl_F eulerconst (cl_float_format_t f)
      - + Returns Euler's constant as a float of format f. -
      cl_F cl_eulerconst (const cl_F& y) +
      cl_F eulerconst (const cl_F& y)
      Returns Euler's constant in the float format of y. -
      cl_F cl_eulerconst (void) +
      cl_F eulerconst (void)
      -Returns Euler's constant as a float of format cl_default_float_format. +Returns Euler's constant as a float of format default_float_format.

      Catalan's constant G = 0.915... is returned by the following functions: - +

      -
      cl_F cl_catalanconst (cl_float_format_t f) +
      cl_F catalanconst (cl_float_format_t f)
      - + Returns Catalan's constant as a float of format f. -
      cl_F cl_catalanconst (const cl_F& y) +
      cl_F catalanconst (const cl_F& y)
      Returns Catalan's constant in the float format of y. -
      cl_F cl_catalanconst (void) +
      cl_F catalanconst (void)
      -Returns Catalan's constant as a float of format cl_default_float_format. +Returns Catalan's constant as a float of format default_float_format.

      4.8.5 Riemann zeta

      - +

      @@ -2110,19 +2108,19 @@ following functions:

      -
      cl_F cl_zeta (int s, cl_float_format_t f) +
      cl_F zeta (int s, cl_float_format_t f)
      - + Returns Riemann's zeta function at s as a float of format f. -
      cl_F cl_zeta (int s, const cl_F& y) +
      cl_F zeta (int s, const cl_F& y)
      Returns Riemann's zeta function at s in the float format of y. -
      cl_F cl_zeta (int s) +
      cl_F zeta (int s)
      Returns Riemann's zeta function at s as a float of format -cl_default_float_format. +default_float_format.
      @@ -2152,69 +2150,69 @@ on each of the bit positions in parallel.
      cl_I lognot (const cl_I& x)
      - +
      cl_I operator ~ (const cl_I& x)
      - + Logical not, like ~x in C. This is the same as -1-x.
      cl_I logand (const cl_I& x, const cl_I& y)
      - +
      cl_I operator & (const cl_I& x, const cl_I& y)
      - + Logical and, like x & y in C.
      cl_I logior (const cl_I& x, const cl_I& y)
      - +
      cl_I operator | (const cl_I& x, const cl_I& y)
      - + Logical (inclusive) or, like x | y in C.
      cl_I logxor (const cl_I& x, const cl_I& y)
      - +
      cl_I operator ^ (const cl_I& x, const cl_I& y)
      - + Exclusive or, like x ^ y in C.
      cl_I logeqv (const cl_I& x, const cl_I& y)
      - + Bitwise equivalence, like ~(x ^ y) in C.
      cl_I lognand (const cl_I& x, const cl_I& y)
      - + Bitwise not and, like ~(x & y) in C.
      cl_I lognor (const cl_I& x, const cl_I& y)
      - + Bitwise not or, like ~(x | y) in C.
      cl_I logandc1 (const cl_I& x, const cl_I& y)
      - + Logical and, complementing the first argument, like ~x & y in C.
      cl_I logandc2 (const cl_I& x, const cl_I& y)
      - + Logical and, complementing the second argument, like x & ~y in C.
      cl_I logorc1 (const cl_I& x, const cl_I& y)
      - + Logical or, complementing the first argument, like ~x | y in C.
      cl_I logorc2 (const cl_I& x, const cl_I& y)
      - + Logical or, complementing the second argument, like x | ~y in C. @@ -2224,7 +2222,7 @@ These operations are all available though the function
      cl_I boole (cl_boole op, const cl_I& x, const cl_I& y)
      - +

      where op must have one of the 16 values (each one stands for a function @@ -2233,7 +2231,6 @@ which combines two bits into one bit): boole_clr, boole_setboole_and, boole_ior, boole_xor, boole_eqv, boole_nand, boole_nor, boole_andc1, boole_andc2, boole_orc1, boole_orc2. - @@ -2248,6 +2245,7 @@ which combines two bits into one bit): boole_clr, boole_set +

      @@ -2258,19 +2256,19 @@ Other functions that view integers as bit strings:

      cl_boolean logtest (const cl_I& x, const cl_I& y)
      - + Returns true if some bit is set in both x and y, i.e. if logand(x,y) != 0.
      cl_boolean logbitp (const cl_I& n, const cl_I& x)
      - + Returns true if the nth bit (from the right) of x is set. Bit 0 is the least significant bit.
      uintL logcount (const cl_I& x)
      - + Returns the number of one bits in x, if x >= 0, or the number of zero bits in x, if x < 0. @@ -2284,7 +2282,7 @@ struct cl_byte { uintL size; uintL position; };

      - + represents the bit interval containing the bits position...position+size-1 of an integer. The constructor cl_byte(size,position) constructs a cl_byte. @@ -2294,19 +2292,19 @@ The constructor cl_byte(size,position) constructs a cl_bytecl_I ldb (const cl_I& n, const cl_byte& b)

      - + extracts the bits of n described by the bit interval b and returns them as a nonnegative integer with b.size bits.
      cl_boolean ldb_test (const cl_I& n, const cl_byte& b)
      - + Returns true if some bit described by the bit interval b is set in n.
      cl_I dpb (const cl_I& newbyte, const cl_I& n, const cl_byte& b)
      - + Returns n, with the bits described by the bit interval b replaced by newbyte. Only the lowest b.size bits of newbyte are relevant. @@ -2321,13 +2319,13 @@ functions are their counterparts without shifting:
      cl_I mask_field (const cl_I& n, const cl_byte& b)
      - + returns an integer with the bits described by the bit interval b copied from the corresponding bits in n, the other bits zero.
      cl_I deposit_field (const cl_I& newbyte, const cl_I& n, const cl_byte& b)
      - + returns an integer where the bits described by the bit interval b come from newbyte and the other bits come from n. @@ -2358,39 +2356,39 @@ for common arithmetic operations:
      cl_boolean oddp (const cl_I& x)
      - + Returns true if the least significant bit of x is 1. Equivalent to mod(x,2) != 0.
      cl_boolean evenp (const cl_I& x)
      - + Returns true if the least significant bit of x is 0. Equivalent to mod(x,2) == 0.
      cl_I operator << (const cl_I& x, const cl_I& n)
      - + Shifts x by n bits to the left. n should be >=0. Equivalent to x * expt(2,n).
      cl_I operator >> (const cl_I& x, const cl_I& n)
      - + Shifts x by n bits to the right. n should be >=0. Bits shifted out to the right are thrown away. Equivalent to floor(x / expt(2,n)).
      cl_I ash (const cl_I& x, const cl_I& y)
      - + Shifts x by y bits to the left (if y>=0) or by -y bits to the right (if y<=0). In other words, this returns floor(x * expt(2,y)).
      uintL integer_length (const cl_I& x)
      - + Returns the number of bits (excluding the sign bit) needed to represent x in two's complement notation. This is the smallest n >= 0 such that -2^n <= x < 2^n. If x > 0, this is the unique n > 0 such that @@ -2398,14 +2396,14 @@ in two's complement notation. This is the smallest n >= 0 such that
      uintL ord2 (const cl_I& x)
      - + x must be non-zero. This function returns the number of 0 bits at the right of x in two's complement notation. This is the largest n >= 0 such that 2^n divides x.
      uintL power2p (const cl_I& x)
      - + x must be > 0. This function checks whether x is a power of 2. If x = 2^(n-1), it returns n. Else it returns 0. (See also the function logp.) @@ -2419,7 +2417,7 @@ If x = 2^(n-1), it returns n. Else it returns 0.
      uint32 gcd (uint32 a, uint32 b)
      - +
      cl_I gcd (const cl_I& a, const cl_I& b)
      This function returns the greatest common divisor of a and b, @@ -2427,7 +2425,7 @@ normalized to be >= 0.
      cl_I xgcd (const cl_I& a, const cl_I& b, cl_I* u, cl_I* v)
      - + This function ("extended gcd") returns the greatest common divisor g of a and b and at the same time the representation of g as an integral linear combination of a and b: @@ -2439,13 +2437,13 @@ value, in the following sense: If a and b are non-zero
      cl_I lcm (const cl_I& a, const cl_I& b)
      - + This function returns the least common multiple of a and b, normalized to be >= 0.
      cl_boolean logp (const cl_I& a, const cl_I& b, cl_RA* l)
      - +
      cl_boolean logp (const cl_RA& a, const cl_RA& b, cl_RA* l)
      a must be > 0. b must be >0 and != 1. If log(a,b) is @@ -2461,20 +2459,20 @@ it returns false.
      cl_I factorial (uintL n)
      - + n must be a small integer >= 0. This function returns the factorial n! = 1*2*...*n.
      cl_I doublefactorial (uintL n)
      - + n must be a small integer >= 0. This function returns the doublefactorial n!! = 1*3*...*n or n!! = 2*4*...*n, respectively.
      cl_I binomial (uintL n, uintL k)
      - + n and k must be small integers >= 0. This function returns the binomial coefficient (n choose k) = n! / k! (n-k)! @@ -2501,7 +2499,7 @@ defines the following operations.
      type scale_float (const type& x, sintL delta)
      - +
      type scale_float (const type& x, const cl_I& delta)
      Returns x*2^delta. This is more efficient than an explicit multiplication @@ -2517,32 +2515,32 @@ representation of floating-point numbers.
      sintL float_exponent (const type& x)
      - + Returns the exponent e of x. For x = 0.0, this is 0. For x non-zero, this is the unique integer with 2^(e-1) <= abs(x) < 2^e.
      sintL float_radix (const type& x)
      - + Returns the base of the floating-point representation. This is always 2.
      type float_sign (const type& x)
      - + Returns the sign s of x as a float. The value is 1 for x >= 0, -1 for x < 0.
      uintL float_digits (const type& x)
      - + Returns the number of mantissa bits in the floating-point representation of x, including the hidden bit. The value only depends on the type of x, not on its value.
      uintL float_precision (const type& x)
      - + Returns the number of significant mantissa bits in the floating-point representation of x. Since denormalized numbers are not supported, this is the same as float_digits(x) if x is non-zero, and @@ -2551,16 +2549,16 @@ this is the same as float_digits(x) if x is non-zero,

      The complete internal representation of a float is encoded in the type - -cl_decoded_float (or cl_decoded_sfloat, cl_decoded_ffloat, -cl_decoded_dfloat, cl_decoded_lfloat, respectively), defined by + +decoded_float (or decoded_sfloat, decoded_ffloat, +decoded_dfloat, decoded_lfloat, respectively), defined by

      -struct cl_decoded_typefloat {
      +struct decoded_typefloat {
               type mantissa; cl_I exponent; type sign;
       };
       
      @@ -2571,9 +2569,9 @@ and returned by the function
      -
      cl_decoded_typefloat decode_float (const type& x) +
      decoded_typefloat decode_float (const type& x)
      - + For x non-zero, this returns (-1)^s, e, m with x = (-1)^s * 2^e * m and 0.5 <= m < 1.0. For x = 0, it returns (-1)^s=1, e=0, m=0. @@ -2582,9 +2580,10 @@ it returns (-1)^s=1, e=0, m=0.

      A complete decoding in terms of integers is provided as type +

      -struct cl_idecoded_float {
      +struct cl_idecoded_float {
               cl_I mantissa; cl_I exponent; cl_I sign;
       };
       
      @@ -2597,7 +2596,7 @@ by the following function:
      cl_idecoded_float integer_decode_float (const type& x)
      - + For x non-zero, this returns (-1)^s, e, m with x = (-1)^s * 2^e * m and m an integer with float_digits(x) bits. For x = 0, it returns (-1)^s=1, e=0, m=0. @@ -2613,7 +2612,7 @@ Some other function, implemented only for class cl_F:
      cl_F float_sign (const cl_F& x, const cl_F& y)
      - + This returns a floating point number whose precision and absolute value is that of y and whose sign is that of x. If x is zero, it is treated as positive. Same for y. @@ -2623,7 +2622,7 @@ zero, it is treated as positive. Same for y.

      4.11 Conversion functions

      - + @@ -2632,14 +2631,14 @@ zero, it is treated as positive. Same for y.

      The type cl_float_format_t describes a floating-point format. - +

      cl_float_format_t cl_float_format (uintL n)
      - + Returns the smallest float format which guarantees at least n decimal digits in the mantissa (after the decimal point). @@ -2647,9 +2646,9 @@ decimal digits in the mantissa (after the decimal point).
      Returns the floating point format of x. -
      cl_float_format_t cl_default_float_format +
      cl_float_format_t default_float_format
      - + Global variable: the default float format used when converting rational numbers to floats.
      @@ -2665,14 +2664,14 @@ defines the following operations:
      cl_F cl_float (const type&x, cl_float_format_t f)
      - + Returns x as a float of format f.
      cl_F cl_float (const type&x, const cl_F& y)
      Returns x in the float format of y.
      cl_F cl_float (const type&x)
      -Returns x as a float of format cl_default_float_format if +Returns x as a float of format default_float_format if it is an exact number, or x itself if it is already a float.
      @@ -2688,34 +2687,34 @@ Every floating-point format has some characteristic numbers:
      cl_F most_positive_float (cl_float_format_t f)
      - + Returns the largest (most positive) floating point number in float format f.
      cl_F most_negative_float (cl_float_format_t f)
      - + Returns the smallest (most negative) floating point number in float format f.
      cl_F least_positive_float (cl_float_format_t f)
      - + Returns the least positive floating point number (i.e. > 0 but closest to 0) in float format f.
      cl_F least_negative_float (cl_float_format_t f)
      - + Returns the least negative floating point number (i.e. < 0 but closest to 0) in float format f.
      cl_F float_epsilon (cl_float_format_t f)
      - + Returns the smallest floating point number e > 0 such that 1+e != 1.
      cl_F float_negative_epsilon (cl_float_format_t f)
      - + Returns the smallest floating point number e > 0 such that 1-e != 1. @@ -2732,7 +2731,7 @@ defines the following operation:
      cl_RA rational (const type& x)
      - + Returns the value of x as an exact number. If x is already an exact number, this is x. If x is a floating-point number, the value is a rational number whose denominator is a power of 2. @@ -2747,7 +2746,7 @@ the function
      cl_RA rationalize (const cl_R& x)
      - + If x is a floating-point number, it actually represents an interval of real numbers, and this function returns the rational number with smallest denominator (and smallest numerator, in magnitude) @@ -2775,7 +2774,7 @@ If x is any float, one has

      A random generator is a machine which produces (pseudo-)random numbers. -The include file <cl_random.h> defines a class cl_random_state +The include file <cln/random.h> defines a class random_state which contains the state of a random generator. If you make a copy of the random number generator, the original one and the copy will produce the same sequence of random numbers. @@ -2789,48 +2788,48 @@ a complicated but deterministic way.

      The global variable - +

      -cl_random_state cl_default_random_state
      +random_state default_random_state
       

      contains a default random number generator. It is used when the functions -below are called without cl_random_state argument. +below are called without random_state argument.

      -
      uint32 random32 (cl_random_state& randomstate) +
      uint32 random32 (random_state& randomstate)
      uint32 random32 ()
      - + Returns a random unsigned 32-bit number. All bits are equally random. -
      cl_I random_I (cl_random_state& randomstate, const cl_I& n) +
      cl_I random_I (random_state& randomstate, const cl_I& n)
      cl_I random_I (const cl_I& n)
      - + n must be an integer > 0. This function returns a random integer x in the range 0 <= x < n. -
      cl_F random_F (cl_random_state& randomstate, const cl_F& n) +
      cl_F random_F (random_state& randomstate, const cl_F& n)
      cl_F random_F (const cl_F& n)
      - + n must be a float > 0. This function returns a random floating-point number of the same format as n in the range 0 <= x < n. -
      cl_R random_R (cl_random_state& randomstate, const cl_R& n) +
      cl_R random_R (random_state& randomstate, const cl_R& n)
      cl_R random_R (const cl_R& n)
      - + Behaves like random_I if n is an integer and like random_F if n is a float.
      @@ -2839,7 +2838,7 @@ if n is a float.

      4.13 Obfuscating operators

      - +

      @@ -2855,7 +2854,7 @@ to get happy, then add

      - + to the beginning of your source files, before the inclusion of any CLN include files. This flag will enable the following operators: @@ -2869,16 +2868,16 @@ For the classes cl_N, cl_R, cl_RA,

      type& operator += (type&, const type&)
      - +
      type& operator -= (type&, const type&)
      - +
      type& operator *= (type&, const type&)
      - +
      type& operator /= (type&, const type&)
      - +

      @@ -2895,19 +2894,19 @@ For the class cl_I:

      type& operator &= (type&, const type&)
      - +
      type& operator |= (type&, const type&)
      - +
      type& operator ^= (type&, const type&)
      - +
      type& operator <<= (type&, const type&)
      - +
      type& operator >>= (type&, const type&)
      - +

      @@ -2919,7 +2918,7 @@ For the classes cl_N, cl_R, cl_RA,

      type& operator ++ (type& x)
      - + The prefix operator ++x.
      void operator ++ (type& x, int) @@ -2928,7 +2927,7 @@ The postfix operator x++.
      type& operator -- (type& x)
      - + The prefix operator --x.
      void operator -- (type& x, int) @@ -2946,14 +2945,14 @@ efficient.

      5. Input/Output

      - +

      5.1 Internal and printed representation

      - +

      @@ -2968,9 +2967,9 @@ Several external representations may denote the same number, for example,

      Converting an internal to an external representation is called "printing", - -converting an external to an internal representation is called "reading". +converting an external to an internal representation is called "reading". + In CLN, it is always true that conversion of an internal to an external representation and then back to an internal representation will yield the same internal representation. Symbolically: read(print(x)) == x. @@ -3053,10 +3052,9 @@ In Common Lisp notation: #C(realpart imagpart)5.2 Input functions

      -Including <cl_io.h> defines a type cl_istream, which is -the type of the first argument to all input functions. Unless you build -and use CLN with the macro CL_IO_STDIO being defined, cl_istream -is the same as istream&. +Including <cln/io.h> defines a type cl_istream, which is +the type of the first argument to all input functions. cl_istream +is the same as std::istream&.

      @@ -3065,7 +3063,7 @@ The variable

      • -cl_istream cl_stdin +cl_istream stdin

      @@ -3092,7 +3090,7 @@ last freadchar operation on stream.

      Each of the classes cl_N, cl_R, cl_RA, cl_I, cl_F, cl_SF, cl_FF, cl_DF, cl_LF -defines, in <cl_type_io.h>, the following input function: +defines, in <cln/type_io.h>, the following input function:

      @@ -3103,7 +3101,7 @@ Reads a number from stream and stores it in the result

      -The most flexible input functions, defined in <cl_type_io.h>, +The most flexible input functions, defined in <cln/type_io.h>, are the following: @@ -3205,10 +3203,9 @@ precision corresponding to their number of significant digits.

      5.3 Output functions

      -Including <cl_io.h> defines a type cl_ostream, which is -the type of the first argument to all output functions. Unless you build -and use CLN with the macro CL_IO_STDIO being defined, cl_ostream -is the same as ostream&. +Including <cln/io.h> defines a type cl_ostream, which is +the type of the first argument to all output functions. cl_ostream +is the same as std::ostream&.

      @@ -3217,7 +3214,7 @@ The variable

      • -cl_ostream cl_stdout +cl_ostream stdout

      @@ -3230,7 +3227,7 @@ The variable

      • -cl_ostream cl_stderr +cl_ostream stderr

      @@ -3276,7 +3273,7 @@ on the stream.

      Each of the classes cl_N, cl_R, cl_RA, cl_I, cl_F, cl_SF, cl_FF, cl_DF, cl_LF -defines, in <cl_type_io.h>, the following output functions: +defines, in <cln/type_io.h>, the following output functions:

      @@ -3286,13 +3283,13 @@ defines, in <cl_type_io.h>, the following output
      cl_ostream operator<< (cl_ostream stream, const type& x)
      Prints the number x on the stream. The output may depend -on the global printer settings in the variable cl_default_print_flags. +on the global printer settings in the variable default_print_flags. The ostream flags and settings (flags, width and locale) are ignored.

      -The most flexible output function, defined in <cl_type_io.h>, +The most flexible output function, defined in <cln/type_io.h>, are the following:

      @@ -3351,7 +3348,7 @@ using this variable name. Default is "x".
       
       
       

      -The global variable cl_default_print_flags contains the default values, +The global variable default_print_flags contains the default values, used by the function fprint. @@ -3367,7 +3364,7 @@ CLN has a class of abstract rings.

                                Ring
                              cl_ring
      -                      <cl_ring.h>
      +                     <cln/ring.h>
       

      @@ -3391,28 +3388,40 @@ Given a ring R, the following members can be used.

      void R->fprint (cl_ostream stream, const cl_ring_element& x)
      +
      cl_boolean R->equal (const cl_ring_element& x, const cl_ring_element& y)
      +
      cl_ring_element R->zero ()
      +
      cl_boolean R->zerop (const cl_ring_element& x)
      +
      cl_ring_element R->plus (const cl_ring_element& x, const cl_ring_element& y)
      +
      cl_ring_element R->minus (const cl_ring_element& x, const cl_ring_element& y)
      +
      cl_ring_element R->uminus (const cl_ring_element& x)
      +
      cl_ring_element R->one ()
      +
      cl_ring_element R->canonhom (const cl_I& x)
      +
      cl_ring_element R->mul (const cl_ring_element& x, const cl_ring_element& y)
      +
      cl_ring_element R->square (const cl_ring_element& x)
      +
      cl_ring_element R->expt_pos (const cl_ring_element& x, const cl_I& y)
      +

      @@ -3451,7 +3460,7 @@ Type tests can be performed for any of cl_C_ring, cl_R_ringcl_boolean instanceof (const cl_number& x, const cl_number_ring& R)

      - + Tests whether the given number is an element of the number ring R. @@ -3459,14 +3468,14 @@ Tests whether the given number is an element of the number ring R.

      7. Modular integers

      - +

      7.1 Modular integer rings

      - +

      @@ -3486,16 +3495,16 @@ The class of modular integer rings is

                                Ring
                              cl_ring
      -                      <cl_ring.h>
      +                     <cln/ring.h>
                                 |
                                 |
                        Modular integer ring
                           cl_modint_ring
      -                   <cl_modinteger.h>
      +                  <cln/modinteger.h>
       

      - +

      @@ -3506,7 +3515,7 @@ and the class of all modular integers (elements of modular integer rings) is

                           Modular integer
                                cl_MI
      -                   <cl_modinteger.h>
      +                   <cln/modinteger.h>
       

      @@ -3515,13 +3524,13 @@ Modular integer rings are constructed using the function

      -
      cl_modint_ring cl_find_modint_ring (const cl_I& N) +
      cl_modint_ring find_modint_ring (const cl_I& N)
      - + This function returns the modular ring `Z/NZ'. It takes care of finding out about special cases of N, like powers of two and odd numbers for which Montgomery multiplication will be a win, - + and precomputes any necessary auxiliary data for computing modulo N. There is a cache table of rings, indexed by N (or, more precisely, by abs(N)). This ensures that the precomputation costs are reduced @@ -3536,12 +3545,12 @@ Modular integer rings can be compared for equality:
      bool operator== (const cl_modint_ring&, const cl_modint_ring&)
      - +
      bool operator!= (const cl_modint_ring&, const cl_modint_ring&)
      - + These compare two modular integer rings for equality. Two different calls -to cl_find_modint_ring with the same argument necessarily return the +to find_modint_ring with the same argument necessarily return the same ring because it is memoized in the cache table.
      @@ -3557,35 +3566,35 @@ Given a modular integer ring R, the following members can be used.
      cl_I R->modulus
      - + This is the ring's modulus, normalized to be nonnegative: abs(N).
      cl_MI R->zero()
      - + This returns 0 mod N.
      cl_MI R->one()
      - + This returns 1 mod N.
      cl_MI R->canonhom (const cl_I& x)
      - + This returns x mod N.
      cl_I R->retract (const cl_MI& x)
      - + This is a partial inverse function to R->canonhom. It returns the standard representative (>=0, <N) of x. -
      cl_MI R->random(cl_random_state& randomstate) +
      cl_MI R->random(random_state& randomstate)
      cl_MI R->random()
      - + This returns a random integer modulo N. @@ -3597,18 +3606,18 @@ The following operations are defined on modular integers.
      cl_modint_ring x.ring ()
      - + Returns the ring to which the modular integer x belongs.
      cl_MI operator+ (const cl_MI&, const cl_MI&)
      - + Returns the sum of two modular integers. One of the arguments may also be a plain integer.
      cl_MI operator- (const cl_MI&, const cl_MI&)
      - + Returns the difference of two modular integers. One of the arguments may also be a plain integer. @@ -3618,61 +3627,61 @@ Returns the negative of a modular integer.
      cl_MI operator* (const cl_MI&, const cl_MI&)
      - + Returns the product of two modular integers. One of the arguments may also be a plain integer.
      cl_MI square (const cl_MI&)
      - + Returns the square of a modular integer.
      cl_MI recip (const cl_MI& x)
      - + Returns the reciprocal x^-1 of a modular integer x. x must be coprime to the modulus, otherwise an error message is issued.
      cl_MI div (const cl_MI& x, const cl_MI& y)
      - + Returns the quotient x*y^-1 of two modular integers x, y. y must be coprime to the modulus, otherwise an error message is issued.
      cl_MI expt_pos (const cl_MI& x, const cl_I& y)
      - + y must be > 0. Returns x^y.
      cl_MI expt (const cl_MI& x, const cl_I& y)
      - + Returns x^y. If y is negative, x must be coprime to the modulus, else an error message is issued.
      cl_MI operator<< (const cl_MI& x, const cl_I& y)
      - + Returns x*2^y.
      cl_MI operator>> (const cl_MI& x, const cl_I& y)
      - + Returns x*2^-y. When y is positive, the modulus must be odd, or an error message is issued.
      bool operator== (const cl_MI&, const cl_MI&)
      - +
      bool operator!= (const cl_MI&, const cl_MI&)
      - + Compares two modular integers, belonging to the same modular integer ring, for equality.
      cl_boolean zerop (const cl_MI& x)
      - + Returns true if x is 0 mod N. @@ -3685,19 +3694,19 @@ input/output).
      void fprint (cl_ostream stream, const cl_MI& x)
      - +
      cl_ostream operator<< (cl_ostream stream, const cl_MI& x)
      - + Prints the modular integer x on the stream. The output may depend -on the global printer settings in the variable cl_default_print_flags. +on the global printer settings in the variable default_print_flags.

      8. Symbolic data types

      - +

      @@ -3708,7 +3717,8 @@ CLN implements two symbolic (non-numeric) data types: strings and symbols.

      8.1 Strings

      - + +

      @@ -3719,7 +3729,7 @@ The class

                             String
                            cl_string
      -                    <cl_string.h>
      +                   <cln/string.h>
       

      @@ -3734,7 +3744,6 @@ Strings are constructed through the following constructors:

      cl_string (const char * s)
      - Returns an immutable copy of the (zero-terminated) C string s.
      cl_string (const char * ptr, unsigned long len) @@ -3755,21 +3764,21 @@ Assignment from cl_string and const char *.
      s.length()
      - +
      strlen(s)
      - + Returns the length of the string s.
      s[i]
      - + Returns the ith character of the string s. i must be in the range 0 <= i < s.length().
      bool equal (const cl_string& s1, const cl_string& s2)
      - + Compares two strings for equality. One of the arguments may also be a plain const char *. @@ -3778,7 +3787,8 @@ plain const char *.

      8.2 Symbols

      - + +

      @@ -3798,7 +3808,6 @@ Symbols are constructed through the following constructor:

      cl_symbol (const cl_string& s)
      - Looks up or creates a new symbol with a given name. @@ -3815,7 +3824,7 @@ Conversion to cl_string: Returns the string which names the symbol
      bool equal (const cl_symbol& sym1, const cl_symbol& sym2)
      - + Compares two symbols for equality. This is very fast. @@ -3823,8 +3832,8 @@ Compares two symbols for equality. This is very fast.

      9. Univariate polynomials

      - - + + @@ -3834,7 +3843,7 @@ Compares two symbols for equality. This is very fast.

      CLN implements univariate polynomials (polynomials in one variable) over an arbitrary ring. The indeterminate variable may be either unnamed (and will be -printed according to cl_default_print_flags.univpoly_varname, which +printed according to default_print_flags.univpoly_varname, which defaults to `x') or carry a given name. The base ring and the indeterminate are explicitly part of every polynomial. CLN doesn't allow you to (accidentally) mix elements of different polynomial rings, e.g. @@ -3850,36 +3859,36 @@ The classes of univariate polynomial rings are

                                  Ring
                                cl_ring
      -                        <cl_ring.h>
      +                       <cln/ring.h>
                                   |
                                   |
                        Univariate polynomial ring
                             cl_univpoly_ring
      -                      <cl_univpoly.h>
      +                      <cln/univpoly.h>
                                   |
                  +----------------+-------------------+
                  |                |                   |
        Complex polynomial ring    |    Modular integer polynomial ring
        cl_univpoly_complex_ring   |        cl_univpoly_modint_ring
      -  <cl_univpoly_complex.h>   |        <cl_univpoly_modint.h>
      + <cln/univpoly_complex.h>   |        <cln/univpoly_modint.h>
                                   |
                  +----------------+
                  |                |
          Real polynomial ring     |
          cl_univpoly_real_ring    |
      -    <cl_univpoly_real.h>    |
      +   <cln/univpoly_real.h>    |
                                   |
                  +----------------+
                  |                |
        Rational polynomial ring   |
        cl_univpoly_rational_ring  |
      -  <cl_univpoly_rational.h>  |
      + <cln/univpoly_rational.h>  |
                                   |
                  +----------------+
                  |
        Integer polynomial ring
        cl_univpoly_integer_ring
      -  <cl_univpoly_integer.h>
      + <cln/univpoly_integer.h>
       

      @@ -3890,31 +3899,31 @@ and the corresponding classes of univariate polynomials are

                          Univariate polynomial
                                 cl_UP
      -                      <cl_univpoly.h>
      +                      <cln/univpoly.h>
                                   |
                  +----------------+-------------------+
                  |                |                   |
          Complex polynomial       |      Modular integer polynomial
               cl_UP_N             |                cl_UP_MI
      -  <cl_univpoly_complex.h>   |        <cl_univpoly_modint.h>
      + <cln/univpoly_complex.h>   |        <cln/univpoly_modint.h>
                                   |
                  +----------------+
                  |                |
            Real polynomial        |
               cl_UP_R             |
      -    <cl_univpoly_real.h>    |
      +  <cln/univpoly_real.h>     |
                                   |
                  +----------------+
                  |                |
          Rational polynomial      |
               cl_UP_RA            |
      -  <cl_univpoly_rational.h>  |
      + <cln/univpoly_rational.h>  |
                                   |
                  +----------------+
                  |
          Integer polynomial
               cl_UP_I
      -  <cl_univpoly_integer.h>
      + <cln/univpoly_integer.h>
       

      @@ -3923,9 +3932,9 @@ Univariate polynomial rings are constructed using the functions

      -
      cl_univpoly_ring cl_find_univpoly_ring (const cl_ring& R) +
      cl_univpoly_ring find_univpoly_ring (const cl_ring& R)
      -
      cl_univpoly_ring cl_find_univpoly_ring (const cl_ring& R, const cl_symbol& varname) +
      cl_univpoly_ring find_univpoly_ring (const cl_ring& R, const cl_symbol& varname)
      This function returns the polynomial ring `R[X]', unnamed or named. R may be an arbitrary ring. This function takes care of finding out @@ -3935,28 +3944,28 @@ There is a cache table of rings, indexed by R and varnamecl_univpoly_complex_ring cl_find_univpoly_ring (const cl_complex_ring& R) +
      cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R)
      - -
      cl_univpoly_complex_ring cl_find_univpoly_ring (const cl_complex_ring& R, const cl_symbol& varname) + +
      cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R, const cl_symbol& varname)
      -
      cl_univpoly_real_ring cl_find_univpoly_ring (const cl_real_ring& R) +
      cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R)
      -
      cl_univpoly_real_ring cl_find_univpoly_ring (const cl_real_ring& R, const cl_symbol& varname) +
      cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R, const cl_symbol& varname)
      -
      cl_univpoly_rational_ring cl_find_univpoly_ring (const cl_rational_ring& R) +
      cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R)
      -
      cl_univpoly_rational_ring cl_find_univpoly_ring (const cl_rational_ring& R, const cl_symbol& varname) +
      cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R, const cl_symbol& varname)
      -
      cl_univpoly_integer_ring cl_find_univpoly_ring (const cl_integer_ring& R) +
      cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R)
      -
      cl_univpoly_integer_ring cl_find_univpoly_ring (const cl_integer_ring& R, const cl_symbol& varname) +
      cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R, const cl_symbol& varname)
      -
      cl_univpoly_modint_ring cl_find_univpoly_ring (const cl_modint_ring& R) +
      cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R)
      -
      cl_univpoly_modint_ring cl_find_univpoly_ring (const cl_modint_ring& R, const cl_symbol& varname) +
      cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R, const cl_symbol& varname)
      -These functions are equivalent to the general cl_find_univpoly_ring, +These functions are equivalent to the general find_univpoly_ring, only the return type is more specific, according to the base ring's type.
      @@ -3972,33 +3981,33 @@ Given a univariate polynomial ring R, the following members can be
      cl_ring R->basering()
      - -This returns the base ring, as passed to `cl_find_univpoly_ring'. + +This returns the base ring, as passed to `find_univpoly_ring'.
      cl_UP R->zero()
      - + This returns 0 in R, a polynomial of degree -1.
      cl_UP R->one()
      - + This returns 1 in R, a polynomial of degree <= 0.
      cl_UP R->canonhom (const cl_I& x)
      - + This returns x in R, a polynomial of degree <= 0.
      cl_UP R->monomial (const cl_ring_element& x, uintL e)
      - + This returns a sparse polynomial: x * X^e, where X is the indeterminate.
      cl_UP R->create (sintL degree)
      - + Creates a new polynomial with a given degree. The zero polynomial has degree -1. After creating the polynomial, you should put in the coefficients, using the set_coeff member function, and then call the finalize @@ -4013,14 +4022,14 @@ The following are the only destructive operations on univariate polynomials.
      void set_coeff (cl_UP& x, uintL index, const cl_ring_element& y)
      - + This changes the coefficient of X^index in x to be y. After changing a polynomial and before applying any "normal" operation on it, you should call its finalize member function.
      void finalize (cl_UP& x)
      - + This function marks the endpoint of destructive modifications of a polynomial. It normalizes the internal representation so that subsequent computations have less overhead. Doing normal computations on unnormalized polynomials may @@ -4035,17 +4044,17 @@ The following operations are defined on univariate polynomials.
      cl_univpoly_ring x.ring ()
      - + Returns the ring to which the univariate polynomial x belongs.
      cl_UP operator+ (const cl_UP&, const cl_UP&)
      - + Returns the sum of two univariate polynomials.
      cl_UP operator- (const cl_UP&, const cl_UP&)
      - + Returns the difference of two univariate polynomials.
      cl_UP operator- (const cl_UP&) @@ -4054,54 +4063,54 @@ Returns the negative of a univariate polynomial.
      cl_UP operator* (const cl_UP&, const cl_UP&)
      - + Returns the product of two univariate polynomials. One of the arguments may also be a plain integer or an element of the base ring.
      cl_UP square (const cl_UP&)
      - + Returns the square of a univariate polynomial.
      cl_UP expt_pos (const cl_UP& x, const cl_I& y)
      - + y must be > 0. Returns x^y.
      bool operator== (const cl_UP&, const cl_UP&)
      - +
      bool operator!= (const cl_UP&, const cl_UP&)
      - + Compares two univariate polynomials, belonging to the same univariate polynomial ring, for equality.
      cl_boolean zerop (const cl_UP& x)
      - + Returns true if x is 0 in R.
      sintL degree (const cl_UP& x)
      - + Returns the degree of the polynomial. The zero polynomial has degree -1.
      cl_ring_element coeff (const cl_UP& x, uintL index)
      - + Returns the coefficient of X^index in the polynomial x.
      cl_ring_element x (const cl_ring_element& y)
      - + Evaluation: If x is a polynomial and y belongs to the base ring, then `x(y)' returns the value of the substitution of y into x.
      cl_UP deriv (const cl_UP& x)
      - + Returns the derivative of the polynomial x with respect to the indeterminate X. @@ -4115,13 +4124,13 @@ input/output).
      void fprint (cl_ostream stream, const cl_UP& x)
      - +
      cl_ostream operator<< (cl_ostream stream, const cl_UP& x)
      - + Prints the univariate polynomial x on the stream. The output may depend on the global printer settings in the variable -cl_default_print_flags. +default_print_flags. @@ -4134,28 +4143,28 @@ The following functions return special polynomials.
      -
      cl_UP_I cl_tschebychev (sintL n) +
      cl_UP_I tschebychev (sintL n)
      - - -Returns the n-th Tchebychev polynomial (n >= 0). + + +Returns the n-th Chebyshev polynomial (n >= 0). -
      cl_UP_I cl_hermite (sintL n) +
      cl_UP_I hermite (sintL n)
      - - + + Returns the n-th Hermite polynomial (n >= 0). -
      cl_UP_RA cl_legendre (sintL n) +
      cl_UP_RA legendre (sintL n)
      - - + + Returns the n-th Legendre polynomial (n >= 0). -
      cl_UP_I cl_laguerre (sintL n) +
      cl_UP_I laguerre (sintL n)
      - - + + Returns the n-th Laguerre polynomial (n >= 0).
      @@ -4173,7 +4182,7 @@ of these polynomials from their definition can be found in the

      10.1 Why C++ ?

      - +

      @@ -4188,7 +4197,7 @@ Efficiency: It compiles to machine code.

    • - + Portability: It runs on all platforms supporting a C++ compiler. Because of the availability of GNU C++, this includes all currently used 32-bit and 64-bit platforms, independently of the quality of the vendor's C++ compiler. @@ -4234,8 +4243,8 @@ Object sharing: An operation like x+0 returns x withou it.
    • - - + + Garbage collection: A reference counting mechanism makes sure that any number object's storage is freed immediately when the last reference to the object is gone. @@ -4280,7 +4289,7 @@ algorithm. For very large numbers (more than 12000 decimal digits), CLN uses Schönhage-Strassen - + multiplication, which is an asymptotically optimal multiplication algorithm.
    • @@ -4293,7 +4302,7 @@ of division and radix conversion.

      10.4 Garbage collection

      - +

      @@ -4331,7 +4340,7 @@ environment variables, or directly substitute the appropriate values.

      11.1 Compiler options

      - +

      @@ -4368,10 +4377,53 @@ linking a CLN application it is sufficient to give the flag -lcln. -

      11.2 Include files

      +

      11.2 Compatibility to old CLN versions

      - - + + + + +

      +As of CLN version 1.1 all non-macro identifiers were hidden in namespace +cln in order to avoid potential name clashes with other C++ +libraries. If you have an old application, you will have to manually +port it to the new scheme. The following principles will help during +the transition: + +

        +
      • + +All headers are now in a separate subdirectory. Instead of including +cl_something.h, include +cln/something.h now. +
      • + +All public identifiers (typenames and functions) have lost their +cl_ prefix. Exceptions are all the typenames of number types, +(cl_N, cl_I, cl_MI, ...), rings, symbolic types (cl_string, +cl_symbol) and polynomials (cl_UP_type). (This is because their +names would not be mnemonic enough once the namespace cln is +imported. Even in a namespace we favor cl_N over N.) +
      • + +All public functions that had by a cl_ in their name still +carry that cl_ if it is intrinsic part of a typename (as in +cl_I_to_int ()). +
      + +

      +When developing other libraries, please keep in mind not to import the +namespace cln in one of your public header files by saying +using namespace cln;. This would propagate to other applications +and can cause name clashes there. + + + + +

      11.3 Include files

      +

      + +

      @@ -4380,201 +4432,202 @@ Here is a summary of the include files and their contents.

      -
      <cl_object.h> +
      <cln/object.h>
      General definitions, reference counting, garbage collection. -
      <cl_number.h> +
      <cln/number.h>
      The class cl_number. -
      <cl_complex.h> +
      <cln/complex.h>
      Functions for class cl_N, the complex numbers. -
      <cl_real.h> +
      <cln/real.h>
      Functions for class cl_R, the real numbers. -
      <cl_float.h> +
      <cln/float.h>
      Functions for class cl_F, the floats. -
      <cl_sfloat.h> +
      <cln/sfloat.h>
      Functions for class cl_SF, the short-floats. -
      <cl_ffloat.h> +
      <cln/ffloat.h>
      Functions for class cl_FF, the single-floats. -
      <cl_dfloat.h> +
      <cln/dfloat.h>
      Functions for class cl_DF, the double-floats. -
      <cl_lfloat.h> +
      <cln/lfloat.h>
      Functions for class cl_LF, the long-floats. -
      <cl_rational.h> +
      <cln/rational.h>
      Functions for class cl_RA, the rational numbers. -
      <cl_integer.h> +
      <cln/integer.h>
      Functions for class cl_I, the integers. -
      <cl_io.h> +
      <cln/io.h>
      Input/Output. -
      <cl_complex_io.h> +
      <cln/complex_io.h>
      Input/Output for class cl_N, the complex numbers. -
      <cl_real_io.h> +
      <cln/real_io.h>
      Input/Output for class cl_R, the real numbers. -
      <cl_float_io.h> +
      <cln/float_io.h>
      Input/Output for class cl_F, the floats. -
      <cl_sfloat_io.h> +
      <cln/sfloat_io.h>
      Input/Output for class cl_SF, the short-floats. -
      <cl_ffloat_io.h> +
      <cln/ffloat_io.h>
      Input/Output for class cl_FF, the single-floats. -
      <cl_dfloat_io.h> +
      <cln/dfloat_io.h>
      Input/Output for class cl_DF, the double-floats. -
      <cl_lfloat_io.h> +
      <cln/lfloat_io.h>
      Input/Output for class cl_LF, the long-floats. -
      <cl_rational_io.h> +
      <cln/rational_io.h>
      Input/Output for class cl_RA, the rational numbers. -
      <cl_integer_io.h> +
      <cln/integer_io.h>
      Input/Output for class cl_I, the integers. -
      <cl_input.h> +
      <cln/input.h>
      Flags for customizing input operations. -
      <cl_output.h> +
      <cln/output.h>
      Flags for customizing output operations. -
      <cl_malloc.h> +
      <cln/malloc.h>
      -cl_malloc_hook, cl_free_hook. -
      <cl_abort.h> +malloc_hook, free_hook. +
      <cln/abort.h>
      cl_abort. -
      <cl_condition.h> +
      <cln/condition.h>
      Conditions/exceptions. -
      <cl_string.h> +
      <cln/string.h>
      Strings. -
      <cl_symbol.h> +
      <cln/symbol.h>
      Symbols. -
      <cl_proplist.h> +
      <cln/proplist.h>
      Property lists. -
      <cl_ring.h> +
      <cln/ring.h>
      General rings. -
      <cl_null_ring.h> +
      <cln/null_ring.h>
      The null ring. -
      <cl_complex_ring.h> +
      <cln/complex_ring.h>
      The ring of complex numbers. -
      <cl_real_ring.h> +
      <cln/real_ring.h>
      The ring of real numbers. -
      <cl_rational_ring.h> +
      <cln/rational_ring.h>
      The ring of rational numbers. -
      <cl_integer_ring.h> +
      <cln/integer_ring.h>
      The ring of integers. -
      <cl_numtheory.h> +
      <cln/numtheory.h>
      Number threory functions. -
      <cl_modinteger.h> +
      <cln/modinteger.h>
      Modular integers. -
      <cl_V.h> +
      <cln/V.h>
      Vectors. -
      <cl_GV.h> +
      <cln/GV.h>
      General vectors. -
      <cl_GV_number.h> +
      <cln/GV_number.h>
      General vectors over cl_number. -
      <cl_GV_complex.h> +
      <cln/GV_complex.h>
      General vectors over cl_N. -
      <cl_GV_real.h> +
      <cln/GV_real.h>
      General vectors over cl_R. -
      <cl_GV_rational.h> +
      <cln/GV_rational.h>
      General vectors over cl_RA. -
      <cl_GV_integer.h> +
      <cln/GV_integer.h>
      General vectors over cl_I. -
      <cl_GV_modinteger.h> +
      <cln/GV_modinteger.h>
      General vectors of modular integers. -
      <cl_SV.h> +
      <cln/SV.h>
      Simple vectors. -
      <cl_SV_number.h> +
      <cln/SV_number.h>
      Simple vectors over cl_number. -
      <cl_SV_complex.h> +
      <cln/SV_complex.h>
      Simple vectors over cl_N. -
      <cl_SV_real.h> +
      <cln/SV_real.h>
      Simple vectors over cl_R. -
      <cl_SV_rational.h> +
      <cln/SV_rational.h>
      Simple vectors over cl_RA. -
      <cl_SV_integer.h> +
      <cln/SV_integer.h>
      Simple vectors over cl_I. -
      <cl_SV_ringelt.h> +
      <cln/SV_ringelt.h>
      Simple vectors of general ring elements. -
      <cl_univpoly.h> +
      <cln/univpoly.h>
      Univariate polynomials. -
      <cl_univpoly_integer.h> +
      <cln/univpoly_integer.h>
      Univariate polynomials over the integers. -
      <cl_univpoly_rational.h> +
      <cln/univpoly_rational.h>
      Univariate polynomials over the rational numbers. -
      <cl_univpoly_real.h> +
      <cln/univpoly_real.h>
      Univariate polynomials over the real numbers. -
      <cl_univpoly_complex.h> +
      <cln/univpoly_complex.h>
      Univariate polynomials over the complex numbers. -
      <cl_univpoly_modint.h> +
      <cln/univpoly_modint.h>
      Univariate polynomials over modular integer rings. -
      <cl_timing.h> +
      <cln/timing.h>
      Timing facilities. -
      <cln.h> +
      <cln/cln.h>
      Includes all of the above.
      -

      11.3 An Example

      +

      11.4 An Example

      A function which computes the nth Fibonacci number can be written as follows. - +

      -#include <cl_integer.h>
      -#include <cl_real.h>
      +#include <cln/integer.h>
      +#include <cln/real.h>
      +using namespace cln;
       
       // Returns F_n, computed as the nearest integer to
       // ((1+sqrt(5))/2)^n/sqrt(5). Assume n>=0.
      @@ -4593,10 +4646,11 @@ Let's explain what is going on in detail.
       
       
       

      -The include file <cl_integer.h> is necessary because the type -cl_I is used in the function, and the include file <cl_real.h> +The include file <cln/integer.h> is necessary because the type +cl_I is used in the function, and the include file <cln/real.h> is needed for the type cl_R and the floating point number functions. -The order of the include files does not matter. +The order of the include files does not matter. In order not to write out +cln::foo we can safely import the whole namespace cln.

      @@ -4652,9 +4706,9 @@ contains this implementation together with an even faster algorithm. -

      11.4 Debugging support

      +

      11.5 Debugging support

      - +

      @@ -4688,11 +4742,11 @@ CLN offers a function cl_print, callable from the debugger, for printing number objects. In order to get this function, you have to define the macro `CL_DEBUG' and then include all the header files for which you want cl_print debugging support. For example: - +

       #define CL_DEBUG
      -#include <cl_string.h>
      +#include <cln/string.h>
       
      Now, if you have in your program a variable cl_string s, and @@ -4715,7 +4769,7 @@ only with number objects and similar. Therefore CLN offers a member function debug_print() on all CLN types. The same macro `CL_DEBUG' is needed for this member function to be implemented. Under gdb, you call it like this: - +
       (gdb) print s
      @@ -4735,14 +4789,14 @@ Unfortunately, this feature does not seem to work under all circumstances.
       
       
       
      -

      12. Customizing

      +

      12. Customizing

      - + -

      12.1 Error handling

      +

      12.1 Error handling

      When a fatal error occurs, an error message is output to the standard error @@ -4752,20 +4806,20 @@ To catch such a fatal error, you need to define the function cl_abort -#include <cl_abort.h> +#include <cln/abort.h> void cl_abort (void);

      - + This function must not return control to its caller. -

      12.2 Floating-point underflow

      +

      12.2 Floating-point underflow

      - +

      @@ -4786,37 +4840,39 @@ will be generated instead. The default value of -

      12.3 Customizing I/O

      +

      12.3 Customizing I/O

      The output of the function fprint may be customized by changing the -value of the global variable cl_default_print_flags. - +value of the global variable default_print_flags. + -

      12.4 Customizing the memory allocator

      +

      12.4 Customizing the memory allocator

      Every memory allocation of CLN is done through the function pointer -cl_malloc_hook. Freeing of this memory is done through the function -pointer cl_free_hook. The default versions of these functions, +malloc_hook. Freeing of this memory is done through the function +pointer free_hook. The default versions of these functions, provided in the library, call malloc and free and check the malloc result against NULL. If you want to provide another memory allocator, you need to define -the variables cl_malloc_hook and cl_free_hook yourself, +the variables malloc_hook and free_hook yourself, like this:

      -#include <cl_malloc.h>
      -void* (*cl_malloc_hook) (size_t size) = ...;
      -void (*cl_free_hook) (void* ptr)      = ...;
      +#include <cln/malloc.h>
      +namespace cln {
      +        void* (*malloc_hook) (size_t size) = ...;
      +        void (*free_hook) (void* ptr)      = ...;
      +}
       

      - - + + The cl_malloc_hook function must not return a NULL pointer. @@ -4828,7 +4884,7 @@ global variables. -

      Index

      +

      Index

      Jump to: @@ -4836,7 +4892,7 @@ Jump to:


      -This document was generated on 2 June 2000 using +This document was generated on 28 August 2000 using texi2html 1.56k. diff --git a/doc/cln.info b/doc/cln.info index 4770106..f9fa2ba 100644 --- a/doc/cln.info +++ b/doc/cln.info @@ -141,6 +141,7 @@ Internals Using the library * Compiler options:: +* Compatibility to old CLN versions:: * Include files:: * An Example:: * Debugging support:: @@ -236,6 +237,9 @@ CLN aims at being easily integrated into larger software packages: * The library provides hooks for memory allocation and exceptions. + * All non-macro identifiers are hidden in namespace `cln' in order + to avoid name clashes. +  File: cln.info, Node: Installation, Next: Ordinary number types, Prev: Introduction, Up: Top @@ -270,12 +274,12 @@ C++ compiler ------------ To build CLN, you need a C++ compiler. Actually, you need GNU `g++ -2.7.0' or newer. On HPPA, you need GNU `g++ 2.8.0' or newer. I -recommend GNU `g++ 2.95' or newer. +2.90' or newer, the EGCS compilers will do. I recommend GNU `g++ 2.95' +or newer. The following C++ features are used: classes, member functions, overloading of functions and operators, constructors and destructors, -inline, const, multiple inheritance, templates. +inline, const, multiple inheritance, templates and namespaces. The following C++ features are not used: `new', `delete', virtual inheritance, exceptions. @@ -350,12 +354,10 @@ through the following environment variables when running `configure': Examples: $ CC="gcc" CFLAGS="-O" CXX="g++" CXXFLAGS="-O" ./configure - $ CC="gcc -V 2.7.2" CFLAGS="-O -g" \ - CXX="g++ -V 2.7.2" CXXFLAGS="-O -g" ./configure - $ CC="gcc -V 2.8.1" CFLAGS="-O -fno-exceptions" \ - CXX="g++ -V 2.8.1" CXXFLAGS="-O -fno-exceptions" ./configure - $ CC="gcc -V egcs-2.91.60" CFLAGS="-O2 -fno-exceptions" \ - CXX="g++ -V egcs-2.91.60" CFLAGS="-O2 -fno-exceptions" ./configure + $ CC="gcc -V egcs-2.91.60" CFLAGS="-O -g" \ + CXX="g++ -V egcs-2.91.60" CXXFLAGS="-O -g" ./configure + $ CC="gcc -V 2.95.2" CFLAGS="-O2 -fno-exceptions" \ + CXX="g++ -V 2.95.2" CFLAGS="-O2 -fno-exceptions" ./configure Note that for these environment variables to take effect, you have to set them (assuming a Bourne-compatible shell) on the same line as the @@ -364,11 +366,9 @@ commands, you have to `export' the environment variables before calling `configure'. In a `csh' shell, you have to use the `setenv' command for setting each of the environment variables. -On Linux, `g++' needs 15 MB to compile the tests. So you should better -have 17 MB swap space and 1 MB room in $TMPDIR. - -If you use `g++' version 2.7.x, don't add `-O2' to the CXXFLAGS, -because `g++ -O' generates better code for CLN than `g++ -O2'. +Currently CLN works only with the GNU `g++' compiler, and only in +optimizing mode. So you should specify at least `-O' in the CXXFLAGS, +or no CXXFLAGS at all. (If CXXFLAGS is not set, CLN will use `-O'.) If you use `g++' version 2.8.x or egcs-2.91.x (a.k.a. egcs-1.1) or gcc-2.95.x, I recommend adding `-fno-exceptions' to the CXXFLAGS. This @@ -457,30 +457,30 @@ Ordinary number types CLN implements the following class hierarchy: Number - cl_number - + cl_number + | | Real or complex number cl_N - + | | Real number cl_R - + | +-------------------+-------------------+ | | Rational number Floating-point number cl_RA cl_F - + | | - | +-------------+-------------+-------------+ - Integer | | | | - cl_I Short-Float Single-Float Double-Float Long-Float - cl_SF cl_FF cl_DF cl_LF - + | +--------------+--------------+--------------+ + Integer | | | | + cl_I Short-Float Single-Float Double-Float Long-Float + cl_SF cl_FF cl_DF cl_LF + The base class `cl_number' is an abstract base class. It is not useful to declare a variable of this type except if you want to completely @@ -684,8 +684,8 @@ Conversions from the classes `cl_I', `cl_RA', `cl_SF', `cl_FF', `cl_DF', `cl_LF', `cl_F' and `cl_R' to the C built-in types `float' and `double' are provided through the functions -`float cl_float_approx (const TYPE& x)' -`double cl_double_approx (const TYPE& x)' +`float float_approx (const TYPE& x)' +`double double_approx (const TYPE& x)' Returns an approximation of `x' of C type CTYPE. If `abs(x)' is too close to 0 (underflow), 0 is returned. If `abs(x)' is too large (overflow), an IEEE infinity is returned. @@ -711,7 +711,7 @@ Functions on numbers Each of the number classes declares its mathematical operations in the corresponding include file. For example, if your code operates with -objects of type `cl_I', it should `#include '. +objects of type `cl_I', it should `#include '. * Menu: @@ -937,7 +937,7 @@ Each of the classes `cl_N', `cl_R', `cl_RA', `cl_I', `cl_F', `cl_SF', `bool operator != (const TYPE&, const TYPE&)' Comparison, as in C and C++. -`uint32 cl_equal_hashcode (const TYPE&)' +`uint32 equal_hashcode (const TYPE&)' Returns a 32-bit hash code that is the same for any two numbers which are the same according to `=='. This hash code depends on the number's value, not its type or precision. @@ -948,7 +948,7 @@ Each of the classes `cl_N', `cl_R', `cl_RA', `cl_I', `cl_F', `cl_SF', Each of the classes `cl_R', `cl_RA', `cl_I', `cl_F', `cl_SF', `cl_FF', `cl_DF', `cl_LF' defines the following operations: -`cl_signean cl_compare (const TYPE& x, const TYPE& y)' +`cl_signean compare (const TYPE& x, const TYPE& y)' Compares `x' and `y'. Returns +1 if `x'>`y', -1 if `x'<`y', 0 if `x'=`y'. @@ -1252,14 +1252,14 @@ Exponential and logarithmic functions The constant e = exp(1) = 2.71828... is returned by the following functions: -`cl_F cl_exp1 (cl_float_format_t f)' +`cl_F exp1 (cl_float_format_t f)' Returns e as a float of format `f'. -`cl_F cl_exp1 (const cl_F& y)' +`cl_F exp1 (const cl_F& y)' Returns e in the float format of `y'. -`cl_F cl_exp1 (void)' - Returns e as a float of format `cl_default_float_format'. +`cl_F exp1 (void)' + Returns e as a float of format `default_float_format'.  File: cln.info, Node: Trigonometric functions, Next: Hyperbolic functions, Prev: Exponential and logarithmic functions, Up: Transcendental functions @@ -1283,8 +1283,8 @@ Trigonometric functions Returns `cos(z)'. The range of the result is the entire complex plane. -`struct cl_cos_sin_t { cl_R cos; cl_R sin; };' -`cl_cos_sin_t cl_cos_sin (const cl_R& x)' +`struct cos_sin_t { cl_R cos; cl_R sin; };' +`cos_sin_t cos_sin (const cl_R& x)' Returns both `sin(x)' and `cos(x)'. This is more efficient than computing them separately. The relation `cos^2 + sin^2 = 1' will hold only approximately. @@ -1338,14 +1338,14 @@ Trigonometric functions Archimedes' constant pi = 3.14... is returned by the following functions: -`cl_F cl_pi (cl_float_format_t f)' +`cl_F pi (cl_float_format_t f)' Returns pi as a float of format `f'. -`cl_F cl_pi (const cl_F& y)' +`cl_F pi (const cl_F& y)' Returns pi in the float format of `y'. -`cl_F cl_pi (void)' - Returns pi as a float of format `cl_default_float_format'. +`cl_F pi (void)' + Returns pi as a float of format `default_float_format'.  File: cln.info, Node: Hyperbolic functions, Next: Euler gamma, Prev: Trigonometric functions, Up: Transcendental functions @@ -1368,8 +1368,8 @@ Hyperbolic functions Returns `cosh(z)'. The range of the result is the entire complex plane. -`struct cl_cosh_sinh_t { cl_R cosh; cl_R sinh; };' -`cl_cosh_sinh_t cl_cosh_sinh (const cl_R& x)' +`struct cosh_sinh_t { cl_R cosh; cl_R sinh; };' +`cosh_sinh_t cosh_sinh (const cl_R& x)' Returns both `sinh(x)' and `cosh(x)'. This is more efficient than computing them separately. The relation `cosh^2 - sinh^2 = 1' will hold only approximately. @@ -1409,27 +1409,27 @@ Euler gamma Euler's constant C = 0.577... is returned by the following functions: -`cl_F cl_eulerconst (cl_float_format_t f)' +`cl_F eulerconst (cl_float_format_t f)' Returns Euler's constant as a float of format `f'. -`cl_F cl_eulerconst (const cl_F& y)' +`cl_F eulerconst (const cl_F& y)' Returns Euler's constant in the float format of `y'. -`cl_F cl_eulerconst (void)' +`cl_F eulerconst (void)' Returns Euler's constant as a float of format - `cl_default_float_format'. + `default_float_format'. Catalan's constant G = 0.915... is returned by the following functions: -`cl_F cl_catalanconst (cl_float_format_t f)' +`cl_F catalanconst (cl_float_format_t f)' Returns Catalan's constant as a float of format `f'. -`cl_F cl_catalanconst (const cl_F& y)' +`cl_F catalanconst (const cl_F& y)' Returns Catalan's constant in the float format of `y'. -`cl_F cl_catalanconst (void)' +`cl_F catalanconst (void)' Returns Catalan's constant as a float of format - `cl_default_float_format'. + `default_float_format'.  File: cln.info, Node: Riemann zeta, Prev: Euler gamma, Up: Transcendental functions @@ -1440,15 +1440,15 @@ Riemann zeta Riemann's zeta function at an integral point `s>1' is returned by the following functions: -`cl_F cl_zeta (int s, cl_float_format_t f)' +`cl_F zeta (int s, cl_float_format_t f)' Returns Riemann's zeta function at `s' as a float of format `f'. -`cl_F cl_zeta (int s, const cl_F& y)' +`cl_F zeta (int s, const cl_F& y)' Returns Riemann's zeta function at `s' in the float format of `y'. -`cl_F cl_zeta (int s)' +`cl_F zeta (int s)' Returns Riemann's zeta function at `s' as a float of format - `cl_default_float_format'. + `default_float_format'.  File: cln.info, Node: Functions on integers, Next: Functions on floating-point numbers, Prev: Transcendental functions, Up: Functions on numbers @@ -1714,15 +1714,15 @@ representation of floating-point numbers. non-zero, and 0 if `x' = 0. The complete internal representation of a float is encoded in the type -`cl_decoded_float' (or `cl_decoded_sfloat', `cl_decoded_ffloat', -`cl_decoded_dfloat', `cl_decoded_lfloat', respectively), defined by - struct cl_decoded_TYPEfloat { +`decoded_float' (or `decoded_sfloat', `decoded_ffloat', +`decoded_dfloat', `decoded_lfloat', respectively), defined by + struct decoded_TYPEfloat { TYPE mantissa; cl_I exponent; TYPE sign; }; and returned by the function -`cl_decoded_TYPEfloat decode_float (const TYPE& x)' +`decoded_TYPEfloat decode_float (const TYPE& x)' For `x' non-zero, this returns `(-1)^s', `e', `m' with `x = (-1)^s * 2^e * m' and `0.5 <= m < 1.0'. For `x' = 0, it returns `(-1)^s'=1, `e'=0, `m'=0. `e' is the same as returned by the @@ -1774,7 +1774,7 @@ The type `cl_float_format_t' describes a floating-point format. `cl_float_format_t cl_float_format (const cl_F& x)' Returns the floating point format of `x'. -`cl_float_format_t cl_default_float_format' +`cl_float_format_t default_float_format' Global variable: the default float format used when converting rational numbers to floats. @@ -1789,8 +1789,8 @@ following operations: Returns `x' in the float format of `y'. `cl_F cl_float (const TYPE&x)' - Returns `x' as a float of format `cl_default_float_format' if it - is an exact number, or `x' itself if it is already a float. + Returns `x' as a float of format `default_float_format' if it is + an exact number, or `x' itself if it is already a float. Of course, converting a number to a float can lose precision. @@ -1857,37 +1857,37 @@ Random number generators ======================== A random generator is a machine which produces (pseudo-)random numbers. -The include file `' defines a class `cl_random_state' -which contains the state of a random generator. If you make a copy of -the random number generator, the original one and the copy will produce -the same sequence of random numbers. +The include file `' defines a class `random_state' which +contains the state of a random generator. If you make a copy of the +random number generator, the original one and the copy will produce the +same sequence of random numbers. The following functions return (pseudo-)random numbers in different formats. Calling one of these modifies the state of the random number generator in a complicated but deterministic way. The global variable - cl_random_state cl_default_random_state + random_state default_random_state contains a default random number generator. It is used when the -functions below are called without `cl_random_state' argument. +functions below are called without `random_state' argument. -`uint32 random32 (cl_random_state& randomstate)' +`uint32 random32 (random_state& randomstate)' `uint32 random32 ()' Returns a random unsigned 32-bit number. All bits are equally random. -`cl_I random_I (cl_random_state& randomstate, const cl_I& n)' +`cl_I random_I (random_state& randomstate, const cl_I& n)' `cl_I random_I (const cl_I& n)' `n' must be an integer > 0. This function returns a random integer `x' in the range `0 <= x < n'. -`cl_F random_F (cl_random_state& randomstate, const cl_F& n)' +`cl_F random_F (random_state& randomstate, const cl_F& n)' `cl_F random_F (const cl_F& n)' `n' must be a float > 0. This function returns a random floating-point number of the same format as `n' in the range `0 <= x < n'. -`cl_R random_R (cl_random_state& randomstate, const cl_R& n)' +`cl_R random_R (random_state& randomstate, const cl_R& n)' `cl_R random_R (const cl_R& n)' Behaves like `random_I' if `n' is an integer and like `random_F' if `n' is a float. @@ -2024,13 +2024,12 @@ File: cln.info, Node: Input functions, Next: Output functions, Prev: Internal Input functions =============== -Including `' defines a type `cl_istream', which is the type of -the first argument to all input functions. Unless you build and use CLN -with the macro CL_IO_STDIO being defined, `cl_istream' is the same as -`istream&'. +Including `' defines a type `cl_istream', which is the type +of the first argument to all input functions. `cl_istream' is the same +as `std::istream&'. The variable - `cl_istream cl_stdin' + `cl_istream stdin' contains the standard input stream. These are the simple input functions: @@ -2044,14 +2043,14 @@ These are the simple input functions: `freadchar' operation on `stream'. Each of the classes `cl_N', `cl_R', `cl_RA', `cl_I', `cl_F', `cl_SF', -`cl_FF', `cl_DF', `cl_LF' defines, in `', the following +`cl_FF', `cl_DF', `cl_LF' defines, in `', the following input function: `cl_istream operator>> (cl_istream stream, TYPE& result)' Reads a number from `stream' and stores it in the `result'. -The most flexible input functions, defined in `', are the -following: +The most flexible input functions, defined in `', are +the following: `cl_N read_complex (cl_istream stream, const cl_read_flags& flags)' `cl_R read_real (cl_istream stream, const cl_read_flags& flags)' @@ -2125,17 +2124,16 @@ File: cln.info, Node: Output functions, Prev: Input functions, Up: Input/Outp Output functions ================ -Including `' defines a type `cl_ostream', which is the type of -the first argument to all output functions. Unless you build and use -CLN with the macro CL_IO_STDIO being defined, `cl_ostream' is the same -as `ostream&'. +Including `' defines a type `cl_ostream', which is the type +of the first argument to all output functions. `cl_ostream' is the same +as `std::ostream&'. The variable - `cl_ostream cl_stdout' + `cl_ostream stdout' contains the standard output stream. The variable - `cl_ostream cl_stderr' + `cl_ostream stderr' contains the standard error output stream. These are the simple output functions: @@ -2163,18 +2161,18 @@ These are the simple output functions: the `stream'. Each of the classes `cl_N', `cl_R', `cl_RA', `cl_I', `cl_F', `cl_SF', -`cl_FF', `cl_DF', `cl_LF' defines, in `', the following +`cl_FF', `cl_DF', `cl_LF' defines, in `', the following output functions: `void fprint (cl_ostream stream, const TYPE& x)' `cl_ostream operator<< (cl_ostream stream, const TYPE& x)' Prints the number `x' on the `stream'. The output may depend on - the global printer settings in the variable - `cl_default_print_flags'. The `ostream' flags and settings - (flags, width and locale) are ignored. + the global printer settings in the variable `default_print_flags'. + The `ostream' flags and settings (flags, width and locale) are + ignored. -The most flexible output function, defined in `', are the -following: +The most flexible output function, defined in `', are +the following: void print_complex (cl_ostream stream, const cl_print_flags& flags, const cl_N& z); void print_real (cl_ostream stream, const cl_print_flags& flags, @@ -2214,8 +2212,8 @@ The structure type `cl_print_flags' contains the following fields: Univariate polynomials with no explicit indeterminate name will be printed using this variable name. Default is `"x"'. -The global variable `cl_default_print_flags' contains the default -values, used by the function `fprint'. +The global variable `default_print_flags' contains the default values, +used by the function `fprint'.  File: cln.info, Node: Rings, Next: Modular integers, Prev: Input/Output, Up: Top @@ -2227,7 +2225,7 @@ CLN has a class of abstract rings. Ring cl_ring - + Rings can be compared for equality: @@ -2300,23 +2298,23 @@ The class of modular integer rings is Ring cl_ring - + | | Modular integer ring cl_modint_ring - + and the class of all modular integers (elements of modular integer rings) is Modular integer cl_MI - + Modular integer rings are constructed using the function -`cl_modint_ring cl_find_modint_ring (const cl_I& N)' +`cl_modint_ring find_modint_ring (const cl_I& N)' This function returns the modular ring `Z/NZ'. It takes care of finding out about special cases of `N', like powers of two and odd numbers for which Montgomery multiplication will be a win, and @@ -2330,7 +2328,7 @@ Modular integer rings can be compared for equality: `bool operator== (const cl_modint_ring&, const cl_modint_ring&)' `bool operator!= (const cl_modint_ring&, const cl_modint_ring&)' These compare two modular integer rings for equality. Two - different calls to `cl_find_modint_ring' with the same argument + different calls to `find_modint_ring' with the same argument necessarily return the same ring because it is memoized in the cache table. @@ -2358,7 +2356,7 @@ Given a modular integer ring `R', the following members can be used. This is a partial inverse function to `R->canonhom'. It returns the standard representative (`>=0', `random(cl_random_state& randomstate)' +`cl_MI R->random(random_state& randomstate)' `cl_MI R->random()' This returns a random integer modulo `N'. @@ -2423,7 +2421,7 @@ input/output). `cl_ostream operator<< (cl_ostream stream, const cl_MI& x)' Prints the modular integer `x' on the `stream'. The output may depend on the global printer settings in the variable - `cl_default_print_flags'. + `default_print_flags'.  File: cln.info, Node: Symbolic data types, Next: Univariate polynomials, Prev: Modular integers, Up: Top @@ -2449,7 +2447,7 @@ The class String cl_string - + implements immutable strings. @@ -2527,9 +2525,9 @@ Univariate polynomial rings CLN implements univariate polynomials (polynomials in one variable) over an arbitrary ring. The indeterminate variable may be either unnamed (and will be printed according to -`cl_default_print_flags.univpoly_varname', which defaults to `x') or -carry a given name. The base ring and the indeterminate are explicitly -part of every polynomial. CLN doesn't allow you to (accidentally) mix +`default_print_flags.univpoly_varname', which defaults to `x') or carry +a given name. The base ring and the indeterminate are explicitly part +of every polynomial. CLN doesn't allow you to (accidentally) mix elements of different polynomial rings, e.g. `(a^2+1) * (b^3-1)' will result in a runtime error. (Ideally this should return a multivariate polynomial, but they are not yet implemented in CLN.) @@ -2538,71 +2536,71 @@ The classes of univariate polynomial rings are Ring cl_ring - + | | Univariate polynomial ring cl_univpoly_ring - + | +----------------+-------------------+ | | | Complex polynomial ring | Modular integer polynomial ring cl_univpoly_complex_ring | cl_univpoly_modint_ring - | + | | +----------------+ | | Real polynomial ring | cl_univpoly_real_ring | - | + | | +----------------+ | | Rational polynomial ring | cl_univpoly_rational_ring | - | + | | +----------------+ | Integer polynomial ring cl_univpoly_integer_ring - + and the corresponding classes of univariate polynomials are Univariate polynomial cl_UP - + | +----------------+-------------------+ | | | Complex polynomial | Modular integer polynomial cl_UP_N | cl_UP_MI - | + | | +----------------+ | | Real polynomial | cl_UP_R | - | + | | +----------------+ | | Rational polynomial | cl_UP_RA | - | + | | +----------------+ | Integer polynomial cl_UP_I - + Univariate polynomial rings are constructed using the functions -`cl_univpoly_ring cl_find_univpoly_ring (const cl_ring& R)' -`cl_univpoly_ring cl_find_univpoly_ring (const cl_ring& R, const cl_symbol& varname)' +`cl_univpoly_ring find_univpoly_ring (const cl_ring& R)' +`cl_univpoly_ring find_univpoly_ring (const cl_ring& R, const cl_symbol& varname)' This function returns the polynomial ring `R[X]', unnamed or named. `R' may be an arbitrary ring. This function takes care of finding out about special cases of `R', such as the rings of complex @@ -2611,19 +2609,19 @@ Univariate polynomial rings are constructed using the functions and `varname'. This ensures that two calls of this function with the same arguments will return the same polynomial ring. -`cl_univpoly_complex_ring cl_find_univpoly_ring (const cl_complex_ring& R)' -`cl_univpoly_complex_ring cl_find_univpoly_ring (const cl_complex_ring& R, const cl_symbol& varname)' -`cl_univpoly_real_ring cl_find_univpoly_ring (const cl_real_ring& R)' -`cl_univpoly_real_ring cl_find_univpoly_ring (const cl_real_ring& R, const cl_symbol& varname)' -`cl_univpoly_rational_ring cl_find_univpoly_ring (const cl_rational_ring& R)' -`cl_univpoly_rational_ring cl_find_univpoly_ring (const cl_rational_ring& R, const cl_symbol& varname)' -`cl_univpoly_integer_ring cl_find_univpoly_ring (const cl_integer_ring& R)' -`cl_univpoly_integer_ring cl_find_univpoly_ring (const cl_integer_ring& R, const cl_symbol& varname)' -`cl_univpoly_modint_ring cl_find_univpoly_ring (const cl_modint_ring& R)' -`cl_univpoly_modint_ring cl_find_univpoly_ring (const cl_modint_ring& R, const cl_symbol& varname)' - These functions are equivalent to the general - `cl_find_univpoly_ring', only the return type is more specific, - according to the base ring's type. +`cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R)' +`cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R, const cl_symbol& varname)' +`cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R)' +`cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R, const cl_symbol& varname)' +`cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R)' +`cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R, const cl_symbol& varname)' +`cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R)' +`cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R, const cl_symbol& varname)' +`cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R)' +`cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R, const cl_symbol& varname)' + These functions are equivalent to the general `find_univpoly_ring', + only the return type is more specific, according to the base + ring's type.  File: cln.info, Node: Functions on univariate polynomials, Next: Special polynomials, Prev: Univariate polynomial rings, Up: Univariate polynomials @@ -2635,7 +2633,7 @@ Given a univariate polynomial ring `R', the following members can be used. `cl_ring R->basering()' - This returns the base ring, as passed to `cl_find_univpoly_ring'. + This returns the base ring, as passed to `find_univpoly_ring'. `cl_UP R->zero()' This returns `0 in R', a polynomial of degree -1. @@ -2727,7 +2725,7 @@ input/output). `cl_ostream operator<< (cl_ostream stream, const cl_UP& x)' Prints the univariate polynomial `x' on the `stream'. The output may depend on the global printer settings in the variable - `cl_default_print_flags'. + `default_print_flags'.  File: cln.info, Node: Special polynomials, Prev: Functions on univariate polynomials, Up: Univariate polynomials @@ -2737,16 +2735,16 @@ Special polynomials The following functions return special polynomials. -`cl_UP_I cl_tschebychev (sintL n)' - Returns the n-th Tchebychev polynomial (n >= 0). +`cl_UP_I tschebychev (sintL n)' + Returns the n-th Chebyshev polynomial (n >= 0). -`cl_UP_I cl_hermite (sintL n)' +`cl_UP_I hermite (sintL n)' Returns the n-th Hermite polynomial (n >= 0). -`cl_UP_RA cl_legendre (sintL n)' +`cl_UP_RA legendre (sintL n)' Returns the n-th Legendre polynomial (n >= 0). -`cl_UP_I cl_laguerre (sintL n)' +`cl_UP_I laguerre (sintL n)' Returns the n-th Laguerre polynomial (n >= 0). Information how to derive the differential equation satisfied by each @@ -2887,12 +2885,13 @@ environment variables, or directly substitute the appropriate values. * Menu: * Compiler options:: +* Compatibility to old CLN versions:: * Include files:: * An Example:: * Debugging support::  -File: cln.info, Node: Compiler options, Next: Include files, Prev: Using the library, Up: Using the library +File: cln.info, Node: Compiler options, Next: Compatibility to old CLN versions, Prev: Using the library, Up: Using the library Compiler options ================ @@ -2914,191 +2913,220 @@ directory as well (normally `/usr/local/lib'), hence when linking a CLN application it is sufficient to give the flag `-lcln'.  -File: cln.info, Node: Include files, Next: An Example, Prev: Compiler options, Up: Using the library +File: cln.info, Node: Compatibility to old CLN versions, Next: Include files, Prev: Compiler options, Up: Using the library + +Compatibility to old CLN versions +================================= + +As of CLN version 1.1 all non-macro identifiers were hidden in namespace +`cln' in order to avoid potential name clashes with other C++ +libraries. If you have an old application, you will have to manually +port it to the new scheme. The following principles will help during +the transition: + * All headers are now in a separate subdirectory. Instead of + including `cl_'SOMETHING`.h', include `cln/'SOMETHING`.h' now. + + * All public identifiers (typenames and functions) have lost their + `cl_' prefix. Exceptions are all the typenames of number types, + (cl_N, cl_I, cl_MI, ...), rings, symbolic types (cl_string, + cl_symbol) and polynomials (cl_UP_TYPE). (This is because their + names would not be mnemonic enough once the namespace `cln' is + imported. Even in a namespace we favor `cl_N' over `N'.) + + * All public _functions_ that had by a `cl_' in their name still + carry that `cl_' if it is intrinsic part of a typename (as in + `cl_I_to_int ()'). +When developing other libraries, please keep in mind not to import the +namespace `cln' in one of your public header files by saying `using +namespace cln;'. This would propagate to other applications and can +cause name clashes there. + + +File: cln.info, Node: Include files, Next: An Example, Prev: Compatibility to old CLN versions, Up: Using the library Include files ============= Here is a summary of the include files and their contents. -`' +`' General definitions, reference counting, garbage collection. -`' +`' The class cl_number. -`' +`' Functions for class cl_N, the complex numbers. -`' +`' Functions for class cl_R, the real numbers. -`' +`' Functions for class cl_F, the floats. -`' +`' Functions for class cl_SF, the short-floats. -`' +`' Functions for class cl_FF, the single-floats. -`' +`' Functions for class cl_DF, the double-floats. -`' +`' Functions for class cl_LF, the long-floats. -`' +`' Functions for class cl_RA, the rational numbers. -`' +`' Functions for class cl_I, the integers. -`' +`' Input/Output. -`' +`' Input/Output for class cl_N, the complex numbers. -`' +`' Input/Output for class cl_R, the real numbers. -`' +`' Input/Output for class cl_F, the floats. -`' +`' Input/Output for class cl_SF, the short-floats. -`' +`' Input/Output for class cl_FF, the single-floats. -`' +`' Input/Output for class cl_DF, the double-floats. -`' +`' Input/Output for class cl_LF, the long-floats. -`' +`' Input/Output for class cl_RA, the rational numbers. -`' +`' Input/Output for class cl_I, the integers. -`' +`' Flags for customizing input operations. -`' +`' Flags for customizing output operations. -`' - `cl_malloc_hook', `cl_free_hook'. +`' + `malloc_hook', `free_hook'. -`' +`' `cl_abort'. -`' +`' Conditions/exceptions. -`' +`' Strings. -`' +`' Symbols. -`' +`' Property lists. -`' +`' General rings. -`' +`' The null ring. -`' +`' The ring of complex numbers. -`' +`' The ring of real numbers. -`' +`' The ring of rational numbers. -`' +`' The ring of integers. -`' +`' Number threory functions. -`' +`' Modular integers. -`' +`' Vectors. -`' +`' General vectors. -`' +`' General vectors over cl_number. -`' +`' General vectors over cl_N. -`' +`' General vectors over cl_R. -`' +`' General vectors over cl_RA. -`' +`' General vectors over cl_I. -`' +`' General vectors of modular integers. -`' +`' Simple vectors. -`' +`' Simple vectors over cl_number. -`' +`' Simple vectors over cl_N. -`' +`' Simple vectors over cl_R. -`' +`' Simple vectors over cl_RA. -`' +`' Simple vectors over cl_I. -`' +`' Simple vectors of general ring elements. -`' +`' Univariate polynomials. -`' +`' Univariate polynomials over the integers. -`' +`' Univariate polynomials over the rational numbers. -`' +`' Univariate polynomials over the real numbers. -`' +`' Univariate polynomials over the complex numbers. -`' +`' Univariate polynomials over modular integer rings. -`' +`' Timing facilities. -`' +`' Includes all of the above.  @@ -3110,8 +3138,9 @@ An Example A function which computes the nth Fibonacci number can be written as follows. - #include - #include + #include + #include + using namespace cln; // Returns F_n, computed as the nearest integer to // ((1+sqrt(5))/2)^n/sqrt(5). Assume n>=0. @@ -3126,10 +3155,11 @@ follows. Let's explain what is going on in detail. -The include file `' is necessary because the type `cl_I' -is used in the function, and the include file `' is needed +The include file `' is necessary because the type `cl_I' +is used in the function, and the include file `' is needed for the type `cl_R' and the floating point number functions. The order -of the include files does not matter. +of the include files does not matter. In order not to write out +`cln::'FOO we can safely import the whole namespace `cln'. Then comes the function declaration. The argument is an `int', the result an integer. The return type is defined as `const cl_I', not @@ -3195,7 +3225,7 @@ available from the library: to define the macro `CL_DEBUG' and then include all the header files for which you want `cl_print' debugging support. For example: #define CL_DEBUG - #include + #include Now, if you have in your program a variable `cl_string s', and inspect it under `gdb', the output may look like this: (gdb) print s @@ -3249,7 +3279,7 @@ error output stream, and the function `cl_abort' is called. The default version of this function (provided in the library) terminates the application. To catch such a fatal error, you need to define the function `cl_abort' yourself, with the prototype - #include + #include void cl_abort (void); This function must not return control to its caller. @@ -3275,7 +3305,7 @@ Customizing I/O =============== The output of the function `fprint' may be customized by changing the -value of the global variable `cl_default_print_flags'. +value of the global variable `default_print_flags'.  File: cln.info, Node: Customizing the memory allocator, Prev: Customizing I/O, Up: Customizing @@ -3284,15 +3314,17 @@ Customizing the memory allocator ================================ Every memory allocation of CLN is done through the function pointer -`cl_malloc_hook'. Freeing of this memory is done through the function -pointer `cl_free_hook'. The default versions of these functions, -provided in the library, call `malloc' and `free' and check the -`malloc' result against `NULL'. If you want to provide another memory -allocator, you need to define the variables `cl_malloc_hook' and -`cl_free_hook' yourself, like this: - #include - void* (*cl_malloc_hook) (size_t size) = ...; - void (*cl_free_hook) (void* ptr) = ...; +`malloc_hook'. Freeing of this memory is done through the function +pointer `free_hook'. The default versions of these functions, provided +in the library, call `malloc' and `free' and check the `malloc' result +against `NULL'. If you want to provide another memory allocator, you +need to define the variables `malloc_hook' and `free_hook' yourself, +like this: + #include + namespace cln { + void* (*malloc_hook) (size_t size) = ...; + void (*free_hook) (void* ptr) = ...; + } The `cl_malloc_hook' function must not return a `NULL' pointer. It is not possible to change the memory allocator at runtime, because @@ -3340,72 +3372,48 @@ Index * boole_set: Logical functions. * boole_xor: Logical functions. * canonhom () <1>: Functions on univariate polynomials. -* canonhom (): Functions on modular integers. +* canonhom () <2>: Functions on modular integers. +* canonhom (): Rings. * Catalan's constant: Euler gamma. +* catalanconst (): Euler gamma. * ceiling1 (): Rounding functions. * ceiling2 (): Rounding functions. +* Chebyshev polynomial: Special polynomials. * cis (): Trigonometric functions. * cl_abort (): Error handling. * cl_byte: Logical functions. -* cl_catalanconst (): Euler gamma. -* cl_compare (): Comparisons. -* cl_cos_sin (): Trigonometric functions. -* cl_cos_sin_t: Trigonometric functions. -* cl_cosh_sinh (): Hyperbolic functions. -* cl_cosh_sinh_t: Hyperbolic functions. * CL_DEBUG: Debugging support. -* cl_decoded_dfloat: Functions on floating-point numbers. -* cl_decoded_ffloat: Functions on floating-point numbers. -* cl_decoded_float: Functions on floating-point numbers. -* cl_decoded_lfloat: Functions on floating-point numbers. -* cl_decoded_sfloat: Functions on floating-point numbers. -* cl_default_float_format: Conversion to floating-point numbers. -* cl_default_print_flags: Customizing I/O. -* cl_default_random_state: Random number generators. * cl_DF: Floating-point numbers. * cl_DF_fdiv_t: Rounding functions. -* cl_double_approx (): Conversions. -* cl_equal_hashcode (): Comparisons. -* cl_eulerconst (): Euler gamma. * cl_F <1>: Floating-point numbers. * cl_F: Ordinary number types. * cl_F_fdiv_t: Rounding functions. * cl_FF: Floating-point numbers. * cl_FF_fdiv_t: Rounding functions. -* cl_find_modint_ring (): Modular integer rings. -* cl_find_univpoly_ring (): Univariate polynomial rings. * cl_float (): Conversion to floating-point numbers. -* cl_float_approx (): Conversions. * cl_float_format (): Conversion to floating-point numbers. * cl_float_format_t: Conversion to floating-point numbers. -* cl_free_hook (): Customizing the memory allocator. -* cl_hermite (): Special polynomials. * cl_I_to_int (): Conversions. * cl_I_to_long (): Conversions. * cl_I_to_uint (): Conversions. * cl_I_to_ulong (): Conversions. * cl_idecoded_float: Functions on floating-point numbers. -* cl_laguerre (): Special polynomials. -* cl_legendre (): Special polynomials. * cl_LF: Floating-point numbers. * cl_LF_fdiv_t: Rounding functions. -* cl_malloc_hook (): Customizing the memory allocator. * cl_modint_ring: Modular integer rings. * cl_N: Ordinary number types. * cl_number: Ordinary number types. -* cl_pi (): Trigonometric functions. * cl_R: Ordinary number types. * cl_R_fdiv_t: Rounding functions. * cl_RA: Ordinary number types. -* cl_random_state: Random number generators. * cl_SF: Floating-point numbers. * cl_SF_fdiv_t: Rounding functions. -* cl_string (): Strings. -* cl_symbol (): Symbols. -* cl_tschebychev (): Special polynomials. -* cl_zeta (): Riemann zeta. +* cl_string: Strings. +* cl_symbol: Symbols. * coeff (): Functions on univariate polynomials. +* compare (): Comparisons. * comparison: Comparisons. +* compatibility: Compatibility to old CLN versions. * compiler options: Compiler options. * complex (): Elementary complex functions. * complex number <1>: Complex numbers. @@ -3414,22 +3422,38 @@ Index * conversion <1>: Conversion functions. * conversion: Conversions. * cos (): Trigonometric functions. +* cos_sin (): Trigonometric functions. +* cos_sin_t: Trigonometric functions. * cosh (): Hyperbolic functions. +* cosh_sinh (): Hyperbolic functions. +* cosh_sinh_t: Hyperbolic functions. * create (): Functions on univariate polynomials. * customizing: Customizing. * debug_print (): Debugging support. * debugging: Debugging support. * decode_float (): Functions on floating-point numbers. +* decoded_dfloat: Functions on floating-point numbers. +* decoded_ffloat: Functions on floating-point numbers. +* decoded_float: Functions on floating-point numbers. +* decoded_lfloat: Functions on floating-point numbers. +* decoded_sfloat: Functions on floating-point numbers. +* default_float_format: Conversion to floating-point numbers. +* default_print_flags: Customizing I/O. +* default_random_state: Random number generators. * degree (): Functions on univariate polynomials. * denominator (): Elementary rational functions. * deposit_field (): Logical functions. * deriv (): Functions on univariate polynomials. * div (): Functions on modular integers. +* double_approx (): Conversions. * doublefactorial (): Combinatorial functions. * dpb (): Logical functions. * equal () <1>: Symbols. -* equal (): Strings. +* equal () <2>: Strings. +* equal (): Rings. +* equal_hashcode (): Comparisons. * Euler's constant: Euler gamma. +* eulerconst (): Euler gamma. * evenp (): Logical functions. * exact number: Exact numbers. * exp (): Exponential and logarithmic functions. @@ -3439,6 +3463,7 @@ Index * expt (): Elementary functions. * expt_pos () <1>: Functions on univariate polynomials. * expt_pos () <2>: Functions on modular integers. +* expt_pos () <3>: Rings. * expt_pos (): Elementary functions. * exquo (): Elementary functions. * factorial (): Combinatorial functions. @@ -3448,6 +3473,9 @@ Index * ffloor2 (): Rounding functions. * Fibonacci number: An Example. * finalize (): Functions on univariate polynomials. +* find_modint_ring (): Modular integer rings. +* find_univpoly_ring (): Univariate polynomial rings. +* float_approx (): Conversions. * float_digits (): Functions on floating-point numbers. * float_epsilon (): Conversion to floating-point numbers. * float_exponent (): Functions on floating-point numbers. @@ -3459,7 +3487,9 @@ Index * floor1 (): Rounding functions. * floor2 (): Rounding functions. * fprint () <1>: Functions on univariate polynomials. -* fprint (): Functions on modular integers. +* fprint () <2>: Functions on modular integers. +* fprint (): Rings. +* free_hook (): Customizing the memory allocator. * fround (): Rounding functions. * fround2 (): Rounding functions. * ftruncate (): Rounding functions. @@ -3470,6 +3500,7 @@ Index * GMP <1>: Using the GNU MP Library. * GMP: Introduction. * header files: Include files. +* hermite (): Special polynomials. * Hermite polynomial: Special polynomials. * imagpart (): Elementary complex functions. * include files: Include files. @@ -3480,6 +3511,7 @@ Index * integer_decode_float (): Functions on floating-point numbers. * integer_length (): Logical functions. * isqrt (): Roots. +* laguerre (): Special polynomials. * Laguerre polynomial: Special polynomials. * lcm (): Number theoretic functions. * ldb (): Logical functions. @@ -3487,6 +3519,7 @@ Index * least_negative_float (): Conversion to floating-point numbers. * least_positive_float (): Conversion to floating-point numbers. * Legende polynomial: Special polynomials. +* legendre (): Special polynomials. * length (): Strings. * ln (): Exponential and logarithmic functions. * log (): Exponential and logarithmic functions. @@ -3506,9 +3539,11 @@ Index * logtest (): Logical functions. * logxor (): Logical functions. * make: Make utility. +* malloc_hook (): Customizing the memory allocator. * mask_field (): Logical functions. * max (): Comparisons. * min (): Comparisons. +* minus (): Rings. * minus1 (): Elementary functions. * minusp (): Comparisons. * mod (): Rounding functions. @@ -3519,10 +3554,14 @@ Index * Montgomery multiplication: Modular integer rings. * most_negative_float (): Conversion to floating-point numbers. * most_positive_float (): Conversion to floating-point numbers. +* mul (): Rings. +* namespace <1>: Compatibility to old CLN versions. +* namespace: Introduction. * numerator (): Elementary rational functions. * oddp (): Logical functions. * one () <1>: Functions on univariate polynomials. -* one (): Functions on modular integers. +* one () <2>: Functions on modular integers. +* one (): Rings. * operator != () <1>: Functions on univariate polynomials. * operator != () <2>: Functions on modular integers. * operator != () <3>: Modular integer rings. @@ -3570,6 +3609,8 @@ Index * ord2 (): Logical functions. * phase (): Exponential and logarithmic functions. * pi: Trigonometric functions. +* pi (): Trigonometric functions. +* plus (): Rings. * plus1 (): Elementary functions. * plusp (): Comparisons. * polynomial: Univariate polynomials. @@ -3581,6 +3622,7 @@ Index * random_F (): Random number generators. * random_I (): Random number generators. * random_R (): Random number generators. +* random_state: Random number generators. * rational (): Conversion to rational numbers. * rational number: Ordinary number types. * rationalize (): Conversion to rational numbers. @@ -3615,6 +3657,7 @@ Index * sqrtp (): Roots. * square () <1>: Functions on univariate polynomials. * square () <2>: Functions on modular integers. +* square () <3>: Rings. * square (): Elementary functions. * string: Strings. * strlen (): Strings. @@ -3626,94 +3669,99 @@ Index * transcendental functions: Transcendental functions. * truncate1 (): Rounding functions. * truncate2 (): Rounding functions. -* Tschebychev polynomial: Special polynomials. +* tschebychev (): Special polynomials. +* uminus (): Rings. * underflow: Floating-point underflow. * univariate polynomial: Univariate polynomials. * WANT_OBFUSCATING_OPERATORS: Obfuscating operators. * xgcd (): Number theoretic functions. * zero () <1>: Functions on univariate polynomials. -* zero (): Functions on modular integers. +* zero () <2>: Functions on modular integers. +* zero (): Rings. * zerop () <1>: Functions on univariate polynomials. * zerop () <2>: Functions on modular integers. +* zerop () <3>: Rings. * zerop (): Comparisons. +* zeta (): Riemann zeta.  Tag Table: Node: Top931 -Node: Introduction3153 -Node: Installation5675 -Node: Prerequisites5969 -Node: C++ compiler6167 -Node: Make utility6882 -Node: Sed utility7068 -Node: Building the library7388 -Node: Using the GNU MP Library10776 -Node: Installing the library11652 -Node: Cleaning up12375 -Node: Ordinary number types12700 -Node: Exact numbers15047 -Node: Floating-point numbers16212 -Node: Complex numbers19791 -Node: Conversions20288 -Node: Functions on numbers23754 -Node: Constructing numbers24457 -Node: Constructing integers24829 -Node: Constructing rational numbers25119 -Node: Constructing floating-point numbers25594 -Node: Constructing complex numbers26714 -Node: Elementary functions27078 -Node: Elementary rational functions29547 -Node: Elementary complex functions30119 -Node: Comparisons30947 -Node: Rounding functions32846 -Node: Roots38623 -Node: Transcendental functions40504 -Node: Exponential and logarithmic functions41060 -Node: Trigonometric functions43077 -Node: Hyperbolic functions46428 -Node: Euler gamma48501 -Node: Riemann zeta49417 -Node: Functions on integers49973 -Node: Logical functions50261 -Node: Number theoretic functions56214 -Node: Combinatorial functions57581 -Node: Functions on floating-point numbers58259 -Node: Conversion functions61490 -Node: Conversion to floating-point numbers61770 -Node: Conversion to rational numbers63993 -Node: Random number generators65047 -Node: Obfuscating operators66721 -Node: Input/Output68451 -Node: Internal and printed representation68661 -Node: Input functions71203 -Node: Output functions75754 -Node: Rings79490 -Node: Modular integers81414 -Node: Modular integer rings81614 -Node: Functions on modular integers83704 -Node: Symbolic data types86714 -Node: Strings86977 -Node: Symbols88042 -Node: Univariate polynomials88944 -Node: Univariate polynomial rings89202 -Node: Functions on univariate polynomials94156 -Node: Special polynomials97937 -Node: Internals98657 -Node: Why C++ ?98871 -Node: Memory efficiency100371 -Node: Speed efficiency101069 -Node: Garbage collection102153 -Node: Using the library102980 -Node: Compiler options103514 -Node: Include files104432 -Node: An Example108073 -Node: Debugging support111223 -Node: Customizing113573 -Node: Error handling113801 -Node: Floating-point underflow114375 -Node: Customizing I/O115014 -Node: Customizing the memory allocator115307 -Node: Index116264 +Node: Introduction3191 +Node: Installation5812 +Node: Prerequisites6106 +Node: C++ compiler6304 +Node: Make utility7016 +Node: Sed utility7202 +Node: Building the library7522 +Node: Using the GNU MP Library10745 +Node: Installing the library11621 +Node: Cleaning up12344 +Node: Ordinary number types12669 +Node: Exact numbers15022 +Node: Floating-point numbers16187 +Node: Complex numbers19766 +Node: Conversions20263 +Node: Functions on numbers23723 +Node: Constructing numbers24427 +Node: Constructing integers24799 +Node: Constructing rational numbers25089 +Node: Constructing floating-point numbers25564 +Node: Constructing complex numbers26684 +Node: Elementary functions27048 +Node: Elementary rational functions29517 +Node: Elementary complex functions30089 +Node: Comparisons30917 +Node: Rounding functions32810 +Node: Roots38587 +Node: Transcendental functions40468 +Node: Exponential and logarithmic functions41024 +Node: Trigonometric functions43029 +Node: Hyperbolic functions46359 +Node: Euler gamma48423 +Node: Riemann zeta49315 +Node: Functions on integers49859 +Node: Logical functions50147 +Node: Number theoretic functions56100 +Node: Combinatorial functions57467 +Node: Functions on floating-point numbers58145 +Node: Conversion functions61355 +Node: Conversion to floating-point numbers61635 +Node: Conversion to rational numbers63852 +Node: Random number generators64906 +Node: Obfuscating operators66557 +Node: Input/Output68287 +Node: Internal and printed representation68497 +Node: Input functions71039 +Node: Output functions75524 +Node: Rings79184 +Node: Modular integers81108 +Node: Modular integer rings81308 +Node: Functions on modular integers83393 +Node: Symbolic data types86397 +Node: Strings86660 +Node: Symbols87725 +Node: Univariate polynomials88627 +Node: Univariate polynomial rings88885 +Node: Functions on univariate polynomials93801 +Node: Special polynomials97576 +Node: Internals98283 +Node: Why C++ ?98497 +Node: Memory efficiency99997 +Node: Speed efficiency100695 +Node: Garbage collection101779 +Node: Using the library102606 +Node: Compiler options103178 +Node: Compatibility to old CLN versions104116 +Node: Include files105537 +Node: An Example109252 +Node: Debugging support112518 +Node: Customizing114869 +Node: Error handling115097 +Node: Floating-point underflow115672 +Node: Customizing I/O116311 +Node: Customizing the memory allocator116601 +Node: Index117585  End Tag Table diff --git a/doc/cln.ps b/doc/cln.ps index 7a38f9b..47e22a0 100644 --- a/doc/cln.ps +++ b/doc/cln.ps @@ -1,7 +1,7 @@ %!PS-Adobe-2.0 %%Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %%Title: cln.dvi -%%Pages: 59 +%%Pages: 60 %%PageOrder: Ascend %%BoundingBox: 0 0 596 842 %%EndComments @@ -9,7 +9,7 @@ %DVIPSCommandLine: /usr/local/teTeX/bin/ix86-linux-libc6/dvips -D600 -o %+ cln.ps cln.dvi %DVIPSParameters: dpi=600, compressed -%DVIPSSource: TeX output 2000.06.02:1711 +%DVIPSSource: TeX output 2000.08.28:2345 %%BeginProcSet: texc.pro %! /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S @@ -70,16 +70,12 @@ rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end %%EndProcSet TeXDict begin 39158280 55380996 1000 600 600 (cln.dvi) @start -%DVIPSBitmapFont: Fa cmti10 10.95 1 -/Fa 1 47 df<120FEA1F80EA3FC0127F12FFA3EA7F801300123C0A0A77891C>46 -D E -%EndDVIPSBitmapFont -%DVIPSBitmapFont: Fb cmbxti10 14.4 1 -/Fb 1 47 df<13FCEA03FF481380121F4813C0A25AA2B5FCA31480A26C13005B6C5AEA1F +%DVIPSBitmapFont: Fa cmbxti10 14.4 1 +/Fa 1 47 df<13FCEA03FF481380121F4813C0A25AA2B5FCA31480A26C13005B6C5AEA1F F0EA07C0121271912B>46 D E %EndDVIPSBitmapFont -%DVIPSBitmapFont: Fc cmr9 9 55 -/Fc 55 128 df12 DI<007FB712FEA29039800F -F8013B7C0007F0003E0078161E0070160EA200601606A200E01607A2481603A6C71500B3 -ADEC1FFC011FB512FCA230337DB237>I97 DII<153FEC0FFFA2EC007F81AFEB07F0EB3FFCEB -FC0F3901E003BF4848C6B4FC48487F48C7FC4880123EA2127E127CA212FCA8127CA2127E -123EA27E6C5C6C6C5B3903C001BF3A01E0033F802600F81E13FCEB3FFCD90FE013002635 -7DB32B>III<151F90391FC07F8090397FF1 -E3C09038F07B833903C01E039039800E01800007010FC7FC000F80EB00074880A66C5CEB -800F000791C7FC0003130E6D5AEBF07838067FF0380E1FC090C9FCA5EA0F80EBFFFE6CEB -FFC06C14F06C80000780390F0001FE001EEB007F48141F007C158048140FA5007CEC1F00 -A26C143E6C5C390FC001F83903F007E0C6B51280D91FFCC7FC22337EA126>III107 DI<2703 -F01FE013FF00FF90267FF80313C0913AE07C0703E03C07F3803E1C01F02803F7003F387F -01F690381F300001FC02E07F495CA3495CB3A2486C496C487EB53BC7FFFE3FFFF0A23C21 -7EA041>I<3903F01FC000FFEB7FF09038F1E0F83907F3807C3903F6007E01FC133E153F -5BA35BB3A2486CEB7F80B538C7FFFCA226217EA02B>II<3903F03F8000FFEBFFE09038F3C0F83907F7003CD803FC7F497F -168049EB07C016E0150316F0A2150116F8A816F01503A216E0150716C06DEB0F80ED1F00 -6D131E01F6137C9038F381F89038F1FFE0D9F07FC7FC91C8FCAB487EB512C0A225307EA0 -2B>I<3803E07C00FF13FF9038E18F803907E31FC0EA03E613ECEC0F809038F8070091C7 -FCA35BB3487EB512E0A21A217FA01E>114 DI<1330A51370A313F0A2120112031207121FB512FEA23803F000B01403 -A81201EBF8061200140CEB7E1CEB1FF8EB07E0182F7FAD1E>IIIII<3A7FFF807FF8A23A07F8001FE00003EC0F80ED07 -0000011406A26C6C5BA26D131C017E1318A26D5BA2EC8070011F1360ECC0E0010F5BA290 -3807E180A214F3010390C7FC14FBEB01FEA26D5AA31478A21430A25CA214E05CA2495A12 -78D8FC03C8FCA21306130EEA701CEA7838EA1FF0EA0FC025307F9F29>I<003FB512F0A2 -90380007E0003CEB0FC00038131F0030EB3F8000701400147E006013FE5C495A1303C648 -5A5C495A131F495A91C7FC017E133013FE485A5B485A000714705B48481360001F14E048 -5AEB0003007E130FB6FCA21C207E9F22>I<001C1370003E13F8387F01FC00FF13FEA200 -7F13FC383E00F8001C1370170879B226>127 D E +F1E013F039E0FC03E039C01FFF80D903FEC7FC22377CB42B>I97 DII<153FEC0FFFA2EC007F +81AFEB07F0EB3FFCEBFC0F3901E003BF4848C6B4FC48487F48C7FC4880123EA2127E127C +A212FCA8127CA2127E123EA27E6C5C6C6C5B3903C001BF3A01E0033F802600F81E13FCEB +3FFCD90FE0130026357DB32B>III<151F90 +391FC07F8090397FF1E3C09038F07B833903C01E039039800E01800007010FC7FC000F80 +EB00074880A66C5CEB800F000791C7FC0003130E6D5AEBF07838067FF0380E1FC090C9FC +A5EA0F80EBFFFE6CEBFFC06C14F06C80000780390F0001FE001EEB007F48141F007C1580 +48140FA5007CEC1F00A26C143E6C5C390FC001F83903F007E0C6B51280D91FFCC7FC2233 +7EA126>III107 DI<2703F01FE013FF00FF90267FF80313C0913AE07C0703E03C07F3803E +1C01F02803F7003F387F01F690381F300001FC02E07F495CA3495CB3A2486C496C487EB5 +3BC7FFFE3FFFF0A23C217EA041>I<3903F01FC000FFEB7FF09038F1E0F83907F3807C39 +03F6007E01FC133E153F5BA35BB3A2486CEB7F80B538C7FFFCA226217EA02B>II<3903F03F8000FFEBFFE09038F3C0F839 +07F7003CD803FC7F497F168049EB07C016E0150316F0A2150116F8A816F01503A216E015 +0716C06DEB0F80ED1F006D131E01F6137C9038F381F89038F1FFE0D9F07FC7FC91C8FCAB +487EB512C0A225307EA02B>I<3803E07C00FF13FF9038E18F803907E31FC0EA03E613EC +EC0F809038F8070091C7FCA35BB3487EB512E0A21A217FA01E>114 +DI<1330A51370A313F0A212 +0112031207121FB512FEA23803F000B01403A81201EBF8061200140CEB7E1CEB1FF8EB07 +E0182F7FAD1E>IIIII<3A7F +FF807FF8A23A07F8001FE00003EC0F80ED070000011406A26C6C5BA26D131C017E1318A2 +6D5BA2EC8070011F1360ECC0E0010F5BA2903807E180A214F3010390C7FC14FBEB01FEA2 +6D5AA31478A21430A25CA214E05CA2495A1278D8FC03C8FCA21306130EEA701CEA7838EA +1FF0EA0FC025307F9F29>I<003FB512F0A290380007E0003CEB0FC00038131F0030EB3F +8000701400147E006013FE5C495A1303C6485A5C495A131F495A91C7FC017E133013FE48 +5A5B485A000714705B48481360001F14E0485AEB0003007E130FB6FCA21C207E9F22>I< +001C1370003E13F8387F01FC00FF13FEA2007F13FC383E00F8001C1370170879B226> +127 D E %EndDVIPSBitmapFont -%DVIPSBitmapFont: Fd cmti9 9 1 -/Fd 1 47 df<121C123E127F12FFA212FE127C12380808778718>46 +%DVIPSBitmapFont: Fc cmti9 9 1 +/Fc 1 47 df<121C123E127F12FFA212FE127C12380808778718>46 D E %EndDVIPSBitmapFont -%DVIPSBitmapFont: Fe cmtt9 9 63 -/Fe 63 127 df<123C127E12FFAF127EAE123C1200A7123C127E12FFA4127E123C082F71 +%DVIPSBitmapFont: Fd cmtt9 9 63 +/Fd 63 127 df<123C127E12FFAF127EAE123C1200A7123C127E12FFA4127E123C082F71 AE27>33 D<131FEB7FC0497E5A80EA03F1EBE1F8EA07E013C0A513C15C9039C3F1FF80D9 E3E113C03803E7E3EBEFC1D9FF811380EDF800EC01F0EA01FEEBFC0301F85B00031307D8 07FC5B120F381FFE0FD83FBE5BEB3F1FD87E1F90C7FC149F38FC0FBF14FE1307ECFC0201 @@ -365,6 +360,36 @@ FE4814FFA490380001FEEC03FCEC07F8EC0FF0001EEB1FE0C7EA3FC0EC7F80ECFF00495A C0000F130F381FFE1F393FFF7F80397FBFFF0038FE1FFE486C5A00F813F0387003C01A0A 7AAD27>126 D E %EndDVIPSBitmapFont +%DVIPSBitmapFont: Fe cmti10 10.95 9 +/Fe 9 118 df<120FEA1F80EA3FC0127F12FFA3EA7F801300123C0A0A77891C>46 +D99 D<167C4BB4FC923803C38092380781C0ED0F03ED1F0FA2ED3E1FA292387E0F +80EE070093C7FC5DA54A5AA54A5AA30103B512F0825E90260007E0C7FCA44A5AA54A5AA5 +4AC8FCA5147EA55CA5495AA5495AA45C1307A25CA2130F001C5B127E91C9FCEAFE1F131E +12FC485AEA70386C5AEA1FE0EA0F802A5383BF1C>102 D<14E0EB01F0EB03F8A214F014 +E0EB01C090C7FCAE13F8EA03FCEA070EEA0E0F001C138012181238EA301F1270A2126038 +E03F00A2137E12C012005BA3485AA3485AA2485AA21430380FC070A3381F80E0A214C013 +01A2EB03801400EA0F06130EEA07F8EA01F0153E78BC1C>105 D +110 DI115 +DI<13F8D803FC1438D8070E14 +7CD80E0F14FC001C7F121800384A5AEA301F1270A200604A5A38E03F00A2137E00C04A5A +12005BA24B5A485AA34848495AA4484890383F01801603A392387E0700A315FE0003150E +EC01BE00019038033E1C9038F0061E2600F81C5B90393FF80FF090390FE003E0292978A7 +31>I E +%EndDVIPSBitmapFont %DVIPSBitmapFont: Ff cmmi10 10.95 2 /Ff 2 80 df<49B592B512F082A290C76D913807FE00DA01BFED01F0705D039F6F5AA291 26031FF04A5A150F82150702066D4AC7FC1503A26F7E020C16068281834A017F5CA2707E @@ -415,8 +440,8 @@ A3123F7EA46C7EA36C7EA212037F1201A26C7EA21378A27F131C131E130E7FEB0380A2EB 1307A514C0A3130F1480A4EB1F00A3133EA2133C137C1378A25BA2485AA2485A5B120790 C7FC120E5AA25A5A5A124014627C8226>I E %EndDVIPSBitmapFont -%DVIPSBitmapFont: Fl cmsl10 10.95 20 -/Fl 20 122 dfII<177C913907F803FE91393FFE0F8F9139FC0F9C1F -903901F007F0903A03E003E01ED907C0EBF00C90260F80011300011F80133F14004980A3 -01FE495AA3017E5C15075E013E5C013F495A6D49C7FCEC803E903837C0FC903861FFF090 -38607F8001E0C9FC5B1201A47F7F6CB512F8EDFF806D14E06D8090B67E3A03E0000FFCD8 -0F80EB00FE48C8127E003E81123C007C815AA4163EA25E00785D007C4A5A6C4A5A6CEC0F -C0D807C0013FC7FC3903F801FC39007FFFF0010F90C8FC303D7FA82D>103 -D<147814FCEB01FE130314FFEB07FE130314FCEB01F8EB00F01400ACEB07F03801FFE0A3 -EA001F130FA214C0A6EB1F80A6EB3F00A6137EA65BA5EA03FE387FFFE0A2B5FC183E7DBD -19>105 D<147EEB3FFEA3130113005CA6495AA6495AA6494890B5FC17FE5D9238007FE0 +C0D93FFFC7FCEB07F8242A7BA828>II<177C +913907F803FE91393FFE0F8F9139FC0F9C1F903901F007F0903A03E003E01ED907C0EBF0 +0C90260F80011300011F80133F14004980A301FE495AA3017E5C15075E013E5C013F495A +6D49C7FCEC803E903837C0FC903861FFF09038607F8001E0C9FC5B1201A47F7F6CB512F8 +EDFF806D14E06D8090B67E3A03E0000FFCD80F80EB00FE48C8127E003E81123C007C815A +A4163EA25E00785D007C4A5A6C4A5A6CEC0FC0D807C0013FC7FC3903F801FC39007FFFF0 +010F90C8FC303D7FA82D>I<147EEB3FFEA3130113005CA6495AA6495AA5ED0FF0903907 +E07FFCEDF03E9138E1801F9139E7000F8014EE02F814C0EB0FD814F05CA25CA2011FEC1F +805CA549C7EA3F00A6017E147EA6495CA400011401486C497EB500F0B512F0A32C3F7CBE +33>I<147814FCEB01FE130314FFEB07FE130314FCEB01F8EB00F01400ACEB07F03801FF +E0A3EA001F130FA214C0A6EB1F80A6EB3F00A6137EA65BA5EA03FE387FFFE0A2B5FC183E +7DBD19>I<147EEB3FFEA3130113005CA6495AA6495AA6494890B5FC17FE5D9238007FE0 EE3F00163C49485B16E04B5A4BC7FC1506151C90381F80305DEC81C0EC83E0EC87F0149F 90383F31F81461ECC0FCEC807C90383E007E153E49133F8182150F826F7E5B6F7EA26F7E 00014A7E486C497EB539E01FFFF017E05D303F7EBE30>107 D<147EEB1FFE133FA21301 @@ -861,8 +891,8 @@ FC604B5C001F4A91C7FC495B5F4B5B4B5B5DC85C4B5B92B55A5C5F4A91C8FC5C4A5B5E4A 484A141F5A92C8123F4849157F484915FF485E4A14074849021F13C0484BB5FCBAFCA47E 3C407CBF48>I E %EndDVIPSBitmapFont -%DVIPSBitmapFont: Fp cmtt10 10.95 85 -/Fp 85 127 df<121C127FA2EAFF80B2EA7F00B1123EC7FCA9121C127FA2EAFF80A3EA7F +%DVIPSBitmapFont: Fp cmtt10 10.95 86 +/Fp 86 127 df<121C127FA2EAFF80B2EA7F00B1123EC7FCA9121C127FA2EAFF80A3EA7F 00A2121C09396DB830>33 D<003C131E00FEEB3F80A26C137FA248133FB3007E1400007C 7F003C131E191B75B830>I<903903800380496C487E496C487EA8011F131F02C05BA400 3FB612FE4881B81280A36C16006C5D3A003F803F80017F137F020090C7FCA9495B495B00 @@ -935,177 +965,178 @@ F0010190C7FC273A7CB830>II59 D<16E0ED01F0ED07F8150F153FEDFFF04A13E0020713 -C04A1300EC3FFEEC7FF8903801FFE0495B010F90C7FC495AEB7FF8495A000313C0485BD8 -1FFEC8FC485AEA7FF0485A138013E06C7EEA3FFC6C7E3807FF806C7FC613F06D7EEB1FFE -6D7E010313C06D7F9038007FF8EC3FFEEC0FFF6E13C0020113E06E13F0ED3FF8150F1507 -ED01F0ED00E0252F7BB230>I<003FB612FE4881B81280A36C16006C5DCBFCA7003FB612 -FE4881B81280A36C16006C5D29157DA530>I<1238127CB4FC7F13E0EA7FF86C7E6CB4FC -00077F6C13E0C67FEB3FFC6D7E903807FF806D7F010013F06E7EEC1FFE6E7E020313C06E -13E09138007FF0ED3FF8150F153FED7FF0913801FFE04A13C0020F13004A5AEC7FF84A5A -010313C0495BD91FFEC7FC495AEBFFF000035B481380001F90C8FCEA3FFC485AEAFFE013 -8090C9FC127C1238252F7BB230>I64 DI<007FB512F0B612FE6F7E82826C813A03F0001FF815076F7E150115008216 -7EA516FE5E15015E15074B5AED7FE090B65A5E4BC7FC6F7E16E0829039F0000FF8ED03FC -ED00FE167E167F82A2EE1F80A6163F17005EA2ED01FE1503ED0FFC007FB65AB7FC16E05E -93C7FC6C14FC29387EB730>I<91383F801C903901FFF03E0107EBFC7E011F13FE4913FF -4914FE9038FFC07F48EB001F4848130F49130748481303484813015B48481300A2485A16 -7E90C8FC5A127E163C160012FEA25AAA7EA2127EA2163C007F157E7E7FA26C7E16FE6C6C -14FC6D13016C6C14F86C6C13036DEB07F06C6C130F6C9038C03FE06DB512C06D14806D14 -00010713FC010113F09038003F80273A7CB830>I<007FB512E015FCB67E6F7E6C81823A -03F0007FF0ED1FF815076F7E6F7E1500167FA2EE3F80A2161F17C0A2160FA317E01607AB -160F17C0A3161F1780163FA2EE7F00A216FE15014B5A1507ED1FF8ED7FF0007FB65A5EB7 -5A93C7FC6C14FC15E02B387FB730>I<007FB612FEB8FCA47ED803F0C7123FA8161E93C7 -FCA4157815FCA490B5FCA6EBF000A4157892C8FCA5EE0780EE0FC0A9007FB7FCB8FCA46C -16802A387DB730>I<007FB7128017C0B8FCA27EA2D801F8C7120FA8EE078093C7FCA515 -1E153FA490B6FCA69038F8003FA4151E92C8FCAE387FFFF080B5FCA27E5C2A387EB730> -I<027F1370903903FFC0F8010F13F1013F13FD4913FF90B6FC4813C0EC003FD803FC131F -4848130F5B484813075B001F14035B123F90C71201A25A127E6F5A93C7FC12FE5AA992B5 -FC17805C7E007E7F1700ED01F8127F6C1403A27F121F6D1307120F7F6C6C130F6D131F6C -6C133F6CB4137FEC80FF6C90B5FC6D13FD6D13F9010F13F10103EBC0F0D9007EC8FC293A -7DB830>I<3B7FFF803FFFC0B56C4813E0A46C496C13C03B03F00001F800B290B6FCA690 -38F00001B3A23B7FFF803FFFC0B56C4813E0A46C496C13C02B387EB730>I<007FB512FE -B7FCA46C14FE390007E000B3B3A8007FB512FEB7FCA46C14FE203878B730>I<387FFFF8 -B5FC80A25C7ED801F8C9FCB3B0160FEE1F80A9007FB7FCB8FCA46C160029387DB730>76 -DII<90383FFFE048B512FC00 -0714FF4815804815C04815E09038F0007F01C0131F4848EB0FF090C71207A2007E1403A3 -00FE15F8481401B3A96C1403A2007E15F0A3007F1407A26D130F6C6CEB1FE001F813FF90 -B6FC6C15C06C15806C1500000114FCD8003F13E0253A7BB830>I<007FB512E0B612FC15 -FF16C016E06C15F03903F0003FED0FF8ED03FC1501ED00FEA2167E167F163FA6167F167E -16FEA2ED01FC1503ED0FF8ED3FF090B6FC16E016C0160015FC15E001F0C8FCB0387FFF80 -B57EA46C5B28387DB730>I<007FB5FCB612E015F815FE816C812603F0017F6E6C7E151F -6F7E15071503821501A515035E1507150F4B5A157F4A485A90B65A93C7FC5D5D8181D9F0 -017FEC007FED1FC0150F821507A917F0EEE1F8A316F13A7FFF8003F3B500C0EBFFF0A26F -13E0816C49EB7FC0C9EA1F002D397EB730>82 D<90390FF801C090397FFF03E048B512C3 -4814F74814FF5A381FF007383FE001903880007F48C7123F007E141F12FE48140FA21507 -A46CEC03C0007E91C7FC127F6C7E13E0EA1FF86CB47E6C13F86CEBFF806C14F0D8003F13 -FC01077F9038007FFF020713809138007FC0153FED0FE0ED07F01503A216F80078140112 -FCA56C140316F06C14077F6DEB0FE001F0EB3FC001FE13FF90B61280160000FD5CD8F87F -13F8011F13E0D870011380253A7BB830>I<007FB712C0B812E0A53AFC001F8007A80078 -ED03C0C791C7FCB3B1010FB5FC4980A46D91C7FC2B387EB730>I<3B7FFF800FFFF0B56C -4813F8A46C496C13F0D803F0C7EA7E00B3B16D14FE00015DA26D1301A26C6C495AA2017F -495A90393FC01FE0ECF07F6DB55A6D5C6D91C7FC6D5B010013F8EC1FC02D397FB730>I< -D87FFE90380FFFC0B54913E0A46C486D13C0D807E0903800FC00A26D130100035DA36D13 -0300015DA36D130700005DA36D130F017E5CA3017F131F6D5CA3EC803F011F91C7FCA490 -380FC07EA46D6C5AA4903803F1F8A401015B14FBA301005B14FFA36E5AA36E5A2B397EB7 -30>II<3A3FFF807FFE92B5FC487FA26C5B6F5A3A00FC001FC0 -6D5C017E133F017F91C7FC6D5BEC807E011F13FE6E5AEB0FE15DEB07F35DEB03FF5D7F6D -5BA26E5AA26EC8FCA24A7EA24A7EA2497FA2903803FBF014F3903807F1F814E190380FE0 -FC14C0011F137EEC807F013F7F02007F49131F017E8001FE130F49800001140749801503 -D87FFF90381FFFC05DB5008014E0A26C010014C0812B387EB730>I<003FB612FC4815FE -A416FC007EC71201ED03F8ED07F0A2ED0FE0ED1FC0A2ED3F80003CEC7F00C8FC15FE4A5A -5D14034A5A4A5AA24A5A4A5AA24AC7FC14FEA2495A495AA2495A495AA2495A495A91C8FC -5B13FE4848143C167E485A485AA2485A485AA2485A48C8FC90B612FEB7FCA46C15FC2738 -7CB730>90 D<007FB5FCB61280A4150000FCC8FCB3B3B3A5B6FC1580A46C140019476DBE -30>I<1238127C12FEA27E7E7F123F7F121F7F120FA27F12077F12037F12017F12007F7F -80133F80131FA280130F801307801303801301801300808081143F81141FA281140F8114 -0781140381140181140081811680153FA216C0151F16E0150F16F0150716F81503A2ED01 -F0ED00E025477BBE30>I<007FB5FCB61280A47EC7121FB3B3B3A5007FB5FCB6FCA46C14 -0019477DBE30>I<1307EB1FC0497EEBFFF8000313FE000FEBFF80D81FFD13C0D87FF813 -F039FFE03FF8EB800FEB0007007CEB01F00070EB00701D0D77B730>I<003FB612E04815 -F0B712F8A36C15F06C15E025077B7D30>I97 -DI<49B47E010F13F0013F13FC497F48B6FC -4815803907FE007F13F8485A485A49EB3F004848130C90C9FC5A127EA212FE5AA87E127E -A2127FED07806C6CEB0FC07F6C6C131F6C6C148001FC133F6CB4EBFF006C90B5FC6C5C6C -5C013F13F0010F13C0D901FEC7FC222A79A830>I<913803FFC0825CA280A2EC0007AAEB -01FC90380FFF87013F13E790B512F74814FF5A3807FE03380FF80049137F4848133F4848 -131F49130F48C7FC1507127E12FEA25AA77E150F127EA2007F141F7E6D133F6C6C137F6D -13FF380FF8012607FE07EBFFC06CB7FC6C02F713E06C14E76D01C713C0011F1303D903F8 -C8FC2B397DB730>II<15 -7F913803FFE0020F13F0143F4A13F8A2ECFF07EB01FE9138FC03F0903903F800C04A1300 -A8007FB612C0B712E0A46C15C0260003F0C7FCB3A9003FB6FCA2481580A26C1500A22539 -7DB830>IIIIII<387FFFF0B57EA47EEA0001B3 -B3A8007FB612E0B712F0A46C15E024387AB730>I<903901F001F03A7F8FFC0FFC3AFFDF -FE1FFE90B5487E92B51280A23A7FFE1FFE1F3B07FC0FFC0FC001F813F89039F007F00701 -E013E0A401C013C0B3A23B7FFC1FFC1FFC3BFFFE3FFE3FFEA43B7FFC1FFC1FFC2F2880A7 -30>IIII<903901FC01E090390FFF83F0013F13E390B512F3 -4814FB4814FF481301380FF80049133F4848131F4848130F5B48C71207A2127E150312FE -5AA77E1507127E127F150F6C7E151F6C6C133F6D137FD80FF813FF3807FE036CB6FC6C14 -FB6C14F36D13C3011F1303EB03F890C7FCAD4AB512E04A14F0A46E14E02C3C7CA730>I< -ED0FF0D87FFFEB7FFEB50081B5FC1487028F1480149F6C9038BFF07F39001FFFC0923800 -3F004A130C4A90C7FC5C5C5CA25CA45CAF007FB512FCB6FC81A25D7E29287DA730>I<90 -381FFC0E90B5129F000714FF5A5A5A387FE007EB800100FEC77E5A81A37E007F141E01C0 -90C7FCEA3FF8381FFFE06C13FF000314C0C614F0010F13FC9038007FFEEC03FFEC007F00 -78EC3F8000FC141FED0FC0A27EA27E151F01C0EB3F806D137F9039F803FF0090B6FC5D5D -00F814F0013F13C0267007FEC7FC222A79A830>III<3B7FFF803FFFC0B56C4813E0A46C496C13C03B01F00001 -F000A26D130300005DA2017C495AA36D495AA36D49C7FCA390380F803EA36D6C5AA2ECE0 -FC01035BA214F101015BA214FB01005BA214FF6E5AA3021FC8FC2B277EA630>I<3B7FFF -800FFFF06E5AB515F8A26C16F04A7ED807C0C7EA1F00A26D5C0003153EA56D147E000115 -7CEC0FC0EC1FE0EC3FF0A32600F87F5BEC7DF8147CA214FC01786D5AA290387CF87C137D -157D14F0013DEB3DE0013F133FA2ECE01FA2011F5C6D486C5A2D277FA630>I<263FFFC0 -B5FC48168014E1A214C06C16003A007E001F806D49C7FCEB1F80157E6D6C5A6D6C5AEB03 -F1903801F3F0ECFFE06D5B147F6E5A92C8FCA2814A7E4A7EEB01F3ECF1F0903803E0F849 -487E010F137C49487EEC003F496D7E017E6D7E4913073B7FFF803FFF806E4813C0B5FCA2 -7E4A6C13802A277EA630>I<3B7FFF803FFFC06E4813E0B5FCA27E4A6C13C03B01F80001 -F000120015036D5C137C4B5A7FA2013F495A7FA26E48C7FC130F14C00107133EA214E001 -035BA2EB01F05DA2EB00F85D1479147D5D143FA26E5AA36E5AA2141F92C8FCA25C143EA2 -147E147C120F486C5AEA3FC113C3EB07F0495A13FF6C5B5C6C90C9FCEA07FCEA01F02B3C -7EA630>I<003FB612FC4815FEA416FC007EC7EA07F8ED0FF0ED1FE0ED3FC0ED7F80003C -ECFF00C7485AEC07FC4A5A4A5A4A5A4A5A4A5A4990C7FC495A495A495A495A495A495A49 -C7121E4848143F485A485A485A485A485A48B7FCB8FCA46C15FE28277DA630>II<1238127C12FEB3B3B3AD127C123807476CBE30>II<01781338D803FE137C3907FF80FE001F13C1 -48EBE7FC4813FF01CF13F8D8FF0713F0486C13C0D87C0013800038EB3C001F0B78B730> -I E +253A7BB830>I<120EEA3F80EA7FC0EAFFE0A5EA7FC0EA3F80EA0E00C7FCB1120EEA3F80 +EA7FC0EAFFE0A5EA7FC0EA3F80EA0E000B276EA630>II<16E0ED01F0ED +07F8150F153FEDFFF04A13E0020713C04A1300EC3FFEEC7FF8903801FFE0495B010F90C7 +FC495AEB7FF8495A000313C0485BD81FFEC8FC485AEA7FF0485A138013E06C7EEA3FFC6C +7E3807FF806C7FC613F06D7EEB1FFE6D7E010313C06D7F9038007FF8EC3FFEEC0FFF6E13 +C0020113E06E13F0ED3FF8150F1507ED01F0ED00E0252F7BB230>I<003FB612FE4881B8 +1280A36C16006C5DCBFCA7003FB612FE4881B81280A36C16006C5D29157DA530>I<1238 +127CB4FC7F13E0EA7FF86C7E6CB4FC00077F6C13E0C67FEB3FFC6D7E903807FF806D7F01 +0013F06E7EEC1FFE6E7E020313C06E13E09138007FF0ED3FF8150F153FED7FF0913801FF +E04A13C0020F13004A5AEC7FF84A5A010313C0495BD91FFEC7FC495AEBFFF000035B4813 +80001F90C8FCEA3FFC485AEAFFE0138090C9FC127C1238252F7BB230>I64 DI<007FB512F0B612FE6F7E82826C813A +03F0001FF815076F7E1501150082167EA516FE5E15015E15074B5AED7FE090B65A5E4BC7 +FC6F7E16E0829039F0000FF8ED03FCED00FE167E167F82A2EE1F80A6163F17005EA2ED01 +FE1503ED0FFC007FB65AB7FC16E05E93C7FC6C14FC29387EB730>I<91383F801C903901 +FFF03E0107EBFC7E011F13FE4913FF4914FE9038FFC07F48EB001F4848130F4913074848 +1303484813015B48481300A2485A167E90C8FC5A127E163C160012FEA25AAA7EA2127EA2 +163C007F157E7E7FA26C7E16FE6C6C14FC6D13016C6C14F86C6C13036DEB07F06C6C130F +6C9038C03FE06DB512C06D14806D1400010713FC010113F09038003F80273A7CB830>I< +007FB512E015FCB67E6F7E6C81823A03F0007FF0ED1FF815076F7E6F7E1500167FA2EE3F +80A2161F17C0A2160FA317E01607AB160F17C0A3161F1780163FA2EE7F00A216FE15014B +5A1507ED1FF8ED7FF0007FB65A5EB75A93C7FC6C14FC15E02B387FB730>I<007FB612FE +B8FCA47ED803F0C7123FA8161E93C7FCA4157815FCA490B5FCA6EBF000A4157892C8FCA5 +EE0780EE0FC0A9007FB7FCB8FCA46C16802A387DB730>I<007FB7128017C0B8FCA27EA2 +D801F8C7120FA8EE078093C7FCA5151E153FA490B6FCA69038F8003FA4151E92C8FCAE38 +7FFFF080B5FCA27E5C2A387EB730>I<027F1370903903FFC0F8010F13F1013F13FD4913 +FF90B6FC4813C0EC003FD803FC131F4848130F5B484813075B001F14035B123F90C71201 +A25A127E6F5A93C7FC12FE5AA992B5FC17805C7E007E7F1700ED01F8127F6C1403A27F12 +1F6D1307120F7F6C6C130F6D131F6C6C133F6CB4137FEC80FF6C90B5FC6D13FD6D13F901 +0F13F10103EBC0F0D9007EC8FC293A7DB830>I<3B7FFF803FFFC0B56C4813E0A46C496C +13C03B03F00001F800B290B6FCA69038F00001B3A23B7FFF803FFFC0B56C4813E0A46C49 +6C13C02B387EB730>I<007FB512FEB7FCA46C14FE390007E000B3B3A8007FB512FEB7FC +A46C14FE203878B730>I<387FFFF8B5FC80A25C7ED801F8C9FCB3B0160FEE1F80A9007F +B7FCB8FCA46C160029387DB730>76 DII<90383FFFE048B512FC000714FF4815804815C04815E09038F0007F01C0131F +4848EB0FF090C71207A2007E1403A300FE15F8481401B3A96C1403A2007E15F0A3007F14 +07A26D130F6C6CEB1FE001F813FF90B6FC6C15C06C15806C1500000114FCD8003F13E025 +3A7BB830>I<007FB512E0B612FC15FF16C016E06C15F03903F0003FED0FF8ED03FC1501 +ED00FEA2167E167F163FA6167F167E16FEA2ED01FC1503ED0FF8ED3FF090B6FC16E016C0 +160015FC15E001F0C8FCB0387FFF80B57EA46C5B28387DB730>I<007FB5FCB612E015F8 +15FE816C812603F0017F6E6C7E151F6F7E15071503821501A515035E1507150F4B5A157F +4A485A90B65A93C7FC5D5D8181D9F0017FEC007FED1FC0150F821507A917F0EEE1F8A316 +F13A7FFF8003F3B500C0EBFFF0A26F13E0816C49EB7FC0C9EA1F002D397EB730>82 +D<90390FF801C090397FFF03E048B512C34814F74814FF5A381FF007383FE00190388000 +7F48C7123F007E141F12FE48140FA21507A46CEC03C0007E91C7FC127F6C7E13E0EA1FF8 +6CB47E6C13F86CEBFF806C14F0D8003F13FC01077F9038007FFF020713809138007FC015 +3FED0FE0ED07F01503A216F80078140112FCA56C140316F06C14077F6DEB0FE001F0EB3F +C001FE13FF90B61280160000FD5CD8F87F13F8011F13E0D870011380253A7BB830>I<00 +7FB712C0B812E0A53AFC001F8007A80078ED03C0C791C7FCB3B1010FB5FC4980A46D91C7 +FC2B387EB730>I<3B7FFF800FFFF0B56C4813F8A46C496C13F0D803F0C7EA7E00B3B16D +14FE00015DA26D1301A26C6C495AA2017F495A90393FC01FE0ECF07F6DB55A6D5C6D91C7 +FC6D5B010013F8EC1FC02D397FB730>III<3A3FFF807F +FE92B5FC487FA26C5B6F5A3A00FC001FC06D5C017E133F017F91C7FC6D5BEC807E011F13 +FE6E5AEB0FE15DEB07F35DEB03FF5D7F6D5BA26E5AA26EC8FCA24A7EA24A7EA2497FA290 +3803FBF014F3903807F1F814E190380FE0FC14C0011F137EEC807F013F7F02007F49131F +017E8001FE130F49800001140749801503D87FFF90381FFFC05DB5008014E0A26C010014 +C0812B387EB730>I<003FB612FC4815FEA416FC007EC71201ED03F8ED07F0A2ED0FE0ED +1FC0A2ED3F80003CEC7F00C8FC15FE4A5A5D14034A5A4A5AA24A5A4A5AA24AC7FC14FEA2 +495A495AA2495A495AA2495A495A91C8FC5B13FE4848143C167E485A485AA2485A485AA2 +485A48C8FC90B612FEB7FCA46C15FC27387CB730>90 D<007FB5FCB61280A4150000FCC8 +FCB3B3B3A5B6FC1580A46C140019476DBE30>I<1238127C12FEA27E7E7F123F7F121F7F +120FA27F12077F12037F12017F12007F7F80133F80131FA280130F801307801303801301 +801300808081143F81141FA281140F81140781140381140181140081811680153FA216C0 +151F16E0150F16F0150716F81503A2ED01F0ED00E025477BBE30>I<007FB5FCB61280A4 +7EC7121FB3B3B3A5007FB5FCB6FCA46C140019477DBE30>I<1307EB1FC0497EEBFFF800 +0313FE000FEBFF80D81FFD13C0D87FF813F039FFE03FF8EB800FEB0007007CEB01F00070 +EB00701D0D77B730>I<003FB612E04815F0B712F8A36C15F06C15E025077B7D30>I97 DI<49B4 +7E010F13F0013F13FC497F48B6FC4815803907FE007F13F8485A485A49EB3F004848130C +90C9FC5A127EA212FE5AA87E127EA2127FED07806C6CEB0FC07F6C6C131F6C6C148001FC +133F6CB4EBFF006C90B5FC6C5C6C5C013F13F0010F13C0D901FEC7FC222A79A830>I<91 +3803FFC0825CA280A2EC0007AAEB01FC90380FFF87013F13E790B512F74814FF5A3807FE +03380FF80049137F4848133F4848131F49130F48C7FC1507127E12FEA25AA77E150F127E +A2007F141F7E6D133F6C6C137F6D13FF380FF8012607FE07EBFFC06CB7FC6C02F713E06C +14E76D01C713C0011F1303D903F8C8FC2B397DB730>II<157F913803FFE0020F13F0143F4A13F8A2ECFF07EB01FE +9138FC03F0903903F800C04A1300A8007FB612C0B712E0A46C15C0260003F0C7FCB3A900 +3FB6FCA2481580A26C1500A225397DB830>IIIIII<387FFFF0B57EA47EEA0001B3B3A8007FB612E0B712F0A46C15E024387AB730>I<9039 +01F001F03A7F8FFC0FFC3AFFDFFE1FFE90B5487E92B51280A23A7FFE1FFE1F3B07FC0FFC +0FC001F813F89039F007F00701E013E0A401C013C0B3A23B7FFC1FFC1FFC3BFFFE3FFE3F +FEA43B7FFC1FFC1FFC2F2880A730>IIII<903901FC01E090 +390FFF83F0013F13E390B512F34814FB4814FF481301380FF80049133F4848131F484813 +0F5B48C71207A2127E150312FE5AA77E1507127E127F150F6C7E151F6C6C133F6D137FD8 +0FF813FF3807FE036CB6FC6C14FB6C14F36D13C3011F1303EB03F890C7FCAD4AB512E04A +14F0A46E14E02C3C7CA730>II<90381FFC0E90B5129F000714FF5A5A5A387FE007EB800100 +FEC77E5A81A37E007F141E01C090C7FCEA3FF8381FFFE06C13FF000314C0C614F0010F13 +FC9038007FFEEC03FFEC007F0078EC3F8000FC141FED0FC0A27EA27E151F01C0EB3F806D +137F9039F803FF0090B6FC5D5D00F814F0013F13C0267007FEC7FC222A79A830>III<3B7FFF803FFFC0B56C48 +13E0A46C496C13C03B01F00001F000A26D130300005DA2017C495AA36D495AA36D49C7FC +A390380F803EA36D6C5AA2ECE0FC01035BA214F101015BA214FB01005BA214FF6E5AA302 +1FC8FC2B277EA630>I<3B7FFF800FFFF06E5AB515F8A26C16F04A7ED807C0C7EA1F00A2 +6D5C0003153EA56D147E0001157CEC0FC0EC1FE0EC3FF0A32600F87F5BEC7DF8147CA214 +FC01786D5AA290387CF87C137D157D14F0013DEB3DE0013F133FA2ECE01FA2011F5C6D48 +6C5A2D277FA630>I<263FFFC0B5FC48168014E1A214C06C16003A007E001F806D49C7FC +EB1F80157E6D6C5A6D6C5AEB03F1903801F3F0ECFFE06D5B147F6E5A92C8FCA2814A7E4A +7EEB01F3ECF1F0903803E0F849487E010F137C49487EEC003F496D7E017E6D7E4913073B +7FFF803FFF806E4813C0B5FCA27E4A6C13802A277EA630>I<3B7FFF803FFFC06E4813E0 +B5FCA27E4A6C13C03B01F80001F000120015036D5C137C4B5A7FA2013F495A7FA26E48C7 +FC130F14C00107133EA214E001035BA2EB01F05DA2EB00F85D1479147D5D143FA26E5AA3 +6E5AA2141F92C8FCA25C143EA2147E147C120F486C5AEA3FC113C3EB07F0495A13FF6C5B +5C6C90C9FCEA07FCEA01F02B3C7EA630>I<003FB612FC4815FEA416FC007EC7EA07F8ED +0FF0ED1FE0ED3FC0ED7F80003CECFF00C7485AEC07FC4A5A4A5A4A5A4A5A4A5A4990C7FC +495A495A495A495A495A495A49C7121E4848143F485A485A485A485A485A48B7FCB8FCA4 +6C15FE28277DA630>II<1238127C12FEB3B3B3AD +127C123807476CBE30>II<01781338 +D803FE137C3907FF80FE001F13C148EBE7FC4813FF01CF13F8D8FF0713F0486C13C0D87C +0013800038EB3C001F0B78B730>I E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fq cmsy10 10.95 3 /Fq 3 16 df<007FB812F8B912FCA26C17F83604789847>0 D15 D E %EndDVIPSBitmapFont -%DVIPSBitmapFont: Fr cmr10 10.95 82 -/Fr 82 128 df11 DI33 D<001E130F003FEB1F80397F803FC039FFC07FE0A201E013F0A2007F133F 393F601FB0001EEB0F3000001300A5491360A3484813C0A23903000180A20006EB0300A2 -481306485B485B002013101C1C7DBE2D>I<14E0A4EB07FC90383FFF804913E03901F8E3 -F03903E0E078D80780131CD80F007F001E8081481580007C14011278ED06C000F8140F15 -1F153FA36CEC1F80ED0F0092C7FC127E127FA2EA3FC013E0EA1FFE13FF6C13FC6C13FF6C -14C06C806C6C7F011F7F01037F01007F14E7ECE1FFECE07FED3F80151FA2ED0FC0121812 -3C007E1407B4FCA35A5A00C015801260150F16006C5C151E6C5C121C6C14F8390780E1F0 -3903F0EFE0C6B51280D93FFEC7FCEB0FF8EB00E0A422497BC32D>36 -D<121E123FEA7F80EAFFC0A213E0A2127FEA3F60121E1200A513C0A3EA0180A2EA0300A2 -1206A25A5A5A12200B1C79BE19>39 D<1430147014E0EB01C0EB0380EB0700130EA25B5B -1378137013F05B1201485AA2485AA348C7FCA35A121EA2123EA2123CA2127CA5127812F8 -B21278127CA5123CA2123EA2121EA2121F7EA36C7EA36C7EA26C7E12007F137013781338 -7F7FA27FEB0380EB01C0EB00E014701430145A77C323>I<7E7E7E12707E7E7EA27E6C7E -7F12017F12007F1378A27FA37FA3131F7FA21480A21307A214C0A5130314E0B214C01307 -A51480A2130FA21400A25B131EA35BA35BA25B5B12015B12035B48C7FC120EA25A5A5A5A -5A5A135A7AC323>II<121E123FEA7F80EAFFC0A213E0A2127FEA3F60121E1200A513C0A3 -EA0180A2EA0300A21206A25A5A5A12200B1C798919>44 DI<12 -1E123FEA7F80EAFFC0A4EA7F80EA3F00121E0A0A798919>III<14C013031307131F137FEA07FFB5FC139FEAF81F1200B3B3ACEB7F -F0B612F8A31D3D78BC2D>III<150EA2151E153EA2157E15FEA214011403157E1406140E140C1418143814 -30146014E014C0EB0180130314001306130E130C5B133813305B13E05B485A120390C7FC -1206120E120C5A123812305A12E0B8FCA3C8EAFE00AC4A7E49B6FCA3283E7EBD2D>I<00 -021403D807C0130F01F813FE90B55A5D5D5D158092C7FC38063FF890C9FCADEB01FE9038 -0FFF8090383E03E090387001F09038C00078D80780137C90C77E153F0002EC1F80C8FC16 -C0A2ED0FE0A316F0A4123E127F5A7FA290C713E0A248141F006015C0A200701580003014 -3F003815000018147E000E5C6C495A3903C003F03901F00FE06CB55A013F90C7FCEB07F8 -243F7CBC2D>II<123012 -38123E003FB612FCA316F84815F0A216E00070C812C00060EC0180A2ED030015065A5D5D -A2C85A5D15E05D4A5A140392C7FC1406A2140E5CA2143C14381478A214F85CA21301A213 -03A3495AA4130FA6131FA96D5A6D5A26407BBD2D>III<121E123FEA7F80EAFFC0A4EA7F80EA3F -00121EC7FCB3121E123FEA7F80EAFFC0A4EA7F80EA3F00121E0A2779A619>I<007FB912 -E0BA12F0A26C18E0CDFCAE007FB912E0BA12F0A26C18E03C167BA147>61 -D63 D<1507A34B7EA34B7EA24B7EA34B7E156FA2EDEFF815C7A291380187FC1583 -A291380303FE1501A291380600FFA34A6D7EA34A6D7EA34A6D7EA20270800260130FA202 -E0804A1307A201018191B6FCA2498191C71201A201068182A2496F7EA3496F7EA3496F7E -A21370717E13F0486C82D80FFEED3FFCB500E0010FB512F8A33D417DC044>65 -DIIIIIIII75 DIIIII82 -DI<003FB91280A3903AE0007FE00090C76C48131F007EEF0F -C0007C17070078170300701701A300601700A5481860A5C81600B3B14B7E4B7E0107B612 -FEA33B3D7DBC42>IIII<007FB5D8C003B512E0A3C66C48C7387FFC00D93FF8EC1FE0 -6D48EC0F806D6C92C7FC170E6D6C140C6D6C5C17386D6C14306D6D5B17E06E6C5B023F49 -5AEDE003DA1FF090C8FC020F1306EDF80E6E6C5A1618913803FE386E6C5A16606E13E06F -5AA26F7E6F7EA26F7E4B7EA2ED33FEED71FF156103C07F0201137F03807F4A486C7E5C02 -066D7E4A6D7E141C02186D7E4A6D7E147002606D7E4A6D7F13014A6E7E49C86C7E5B0106 -6F7E010E6F7E133F496C812607FFC0EC3FFFB500F80103B512FEA33F3E7EBD44>II91 D<6D1340000114C039030001800006EB0300481306A2485BA248 -5BA2485BA3485BA500CFEB678039DF806FC039FFC07FE001E013F0A2007F133FA2393FC0 -1FE0391F800FC0390F0007801C1C73BE2D>II<13801201EA030012065AA25AA25AA25AA35AA512CFEADF80EAFFC013E0A2 -127FA2EA3FC0EA1F80EA0F000B1C7ABE19>96 DII<49B4FC010F13E090383F00F8017C131C49130648 -48131F48485B0007EC7F80485A121F5B003FEC3F00151E007F91C7FC90C9FCA35AA97EA2 -7F123F16C0121F6DEB0180120F6C6CEB0300A26C6C13066C6C5BD8007C133890383F01F0 -90380FFFC0D901FEC7FC222A7DA828>IIII<167C903903F801FF90391F -FF0787903A7E0FCE0F809038F803F83901F001F03B03E000F8070000076EC7FCA2484813 -7EA2001F147FA6000F147EA26C6C5BA200035C6C6C485A6D485A39037E0FC0D91FFFC8FC -380703F80006CAFCA2120EA2120F7E7F7F6CB512F015FE6C6E7E6C15E00003813A07C000 -1FF848C7EA03FC001E140048157E007C153E0078153F00F881A50078151E007C153E6C5D -001E15786C5DD807C0EB03E0D803F0EB0FC0D800FE017FC7FC90383FFFFC010313C0293D -7EA82D>II< -EA01E0487E487E487EA46C5A6C5A6C5AC8FCACEA01F8127FA3120712031201B3AC487EB5 -12E0A3133E7DBD19>I<14F0EB01F8EB03FCEB07FEA4EB03FCEB01F8EB00F01400AC14FE -137FA313011300147EB3B3A6123C007E137CB413FC14F8A2EB01F0007E13E0383803C038 -1E0780380FFF00EA01FC175184BD1C>III<2703F003FCEB01FE00FF903B0FFF8007FFC0913B3C0FC01E07E0 -913B7003E03801F00007903BC001F06000F82603F1806D487F2601F300EBF98001F6D900 -FBC7127C04FF147E01FC5CA3495CB3A6486C496C14FFB528F07FFFF83F13FCA346287CA7 -4D>I<3903F003F800FFEB1FFF91383C0F8091386007C00007496C7E2603F1807F3801F3 -0001F613018213FCA35BB3A6486C497EB500F0B512F0A32C287CA733>I<14FF010713E0 -90381F81F890387E007E01F8131F4848EB0F804848EB07C04848EB03E0000F15F04848EB -01F8A2003F15FCA248C812FEA44815FFA96C15FEA36C6CEB01FCA3001F15F86C6CEB03F0 -A26C6CEB07E06C6CEB0FC06C6CEB1F80D8007EEB7E0090383F81FC90380FFFF0010090C7 -FC282A7EA82D>I<3901F807F800FFEB3FFF9138781FC09138C007E03A07F98001F02603 -FB007FD801FE6D7E49147E49147FEE3F80A2EE1FC0A217E0A2160F17F0A917E0161FA217 -C0A2EE3F80A26DEC7F00167E6D5C4B5A01FB495A9039F9C007E09039F8F01F80DA3FFEC7 -FCEC0FF091C9FCAD487EB512F0A32C3A7DA733>I<02FF13180107EBC03890381F80E090 -397E0030784913184848130C4848EB06F8485A000F1403485AA248481301A2127FA290C7 -FC5AA97E7FA2123FA26C7E15036C7E000714076C7E6C6C130D00001419017E137190383F -81E190380FFF81903801FE0190C7FCAD4B7E92B512F0A32C3A7DA730>I<3903F007E000 -FFEB1FF0EC7878ECE0FC3907F181FE12033801F3019038F600FCA2153001FC1300A35BB3 -A5487EB512FCA31F287EA724>I<90387FC0603901FFF8E03807C03D380E000748130348 -1301481300A212F01560A27EA27E007F140013C0EA3FFE381FFFE06C13FC6C7F6C7FC614 -80010F13C09038007FE0EC0FF00040130300C0EB01F814007E1578A37E15707E15E07E6C -EB01C000F3EB038039E1E01F0038C0FFFCEB1FE01D2A7DA824>I<1318A61338A41378A2 -13F8A2120112031207001FB512C0B6FCA2D801F8C7FCB3A21560A9000014C07F137CEC01 -80133E90381F8700EB07FEEB01F81B397EB723>IIII<3B7FFFC00FFFE0A3000390390007FE -00C648EB03F0017E6D5A6DEB03801480011F49C7FC90380FC00E903807E00C6E5A903803 -F83801015B6D6C5AEC7EC0EC7F80143F141F6E7E81141FEC3BF0EC71F8ECE1FC14C09038 -01807E01037FD907007F01066D7E49130F496D7E01386D7E017880EA01F8D80FFCEB07FE -B590381FFFF8A32D277FA630>II<001FB61280A29039E0003F0090C7127E001E14FE -001C495A5D0018495A003813075D0030495A141F4A5A92C7FC147EC712FE495A5C495A13 -075C495A011FEB0180EB3F801400137E13FE485A491303485A000715005B48485B001F5C -485A90C7123F007E49B4FCB7FCA221277EA628>I<001C130E007EEB1F80007F133F39FF -807FC0A3397F003F80007E131F001CEB0E001A0977BD2D>127 D -E +481306485B485B002013101C1C7DBE2D>I<121E123FEA7F80EAFFC0A213E0A2127FEA3F +60121E1200A513C0A3EA0180A2EA0300A21206A25A5A5A12200B1C79BE19>39 +D<1430147014E0EB01C0EB0380EB0700130EA25B5B1378137013F05B1201485AA2485AA3 +48C7FCA35A121EA2123EA2123CA2127CA5127812F8B21278127CA5123CA2123EA2121EA2 +121F7EA36C7EA36C7EA26C7E12007F1370137813387F7FA27FEB0380EB01C0EB00E01470 +1430145A77C323>I<7E7E7E12707E7E7EA27E6C7E7F12017F12007F1378A27FA37FA313 +1F7FA21480A21307A214C0A5130314E0B214C01307A51480A2130FA21400A25B131EA35B +A35BA25B5B12015B12035B48C7FC120EA25A5A5A5A5A5A135A7AC323>II<121E123FEA7F +80EAFFC0A213E0A2127FEA3F60121E1200A513C0A3EA0180A2EA0300A21206A25A5A5A12 +200B1C798919>44 DI<121E123FEA7F80EAFFC0A4EA7F80EA3F +00121E0A0A798919>III<14C013031307 +131F137FEA07FFB5FC139FEAF81F1200B3B3ACEB7FF0B612F8A31D3D78BC2D>II< +EB07FC90383FFF809038F80FE03901C003F848C66C7E00066D7E48147F481580EA1F8048 +6C14C06D133FA46C5A6C48137F6CC71380C8FCA216005D5D5D4A5A5D4A5AEC0FC0023FC7 +FCEB1FFCECFF809038000FE0EC03F0EC01FC6E7E157F1680153F16C0A2ED1FE0A216F0A2 +120C123F487E487EA316E05B153F6CC713C012606CEC7F80003815006C14FE6C495A3907 +C003F83903F80FF0C6B55A013F1380D907FCC7FC243F7CBC2D>I<150EA2151E153EA215 +7E15FEA214011403157E1406140E140C141814381430146014E014C0EB01801303140013 +06130E130C5B133813305B13E05B485A120390C7FC1206120E120C5A123812305A12E0B8 +FCA3C8EAFE00AC4A7E49B6FCA3283E7EBD2D>I<00021403D807C0130F01F813FE90B55A +5D5D5D158092C7FC38063FF890C9FCADEB01FE90380FFF8090383E03E090387001F09038 +C00078D80780137C90C77E153F0002EC1F80C8FC16C0A2ED0FE0A316F0A4123E127F5A7F +A290C713E0A248141F006015C0A2007015800030143F003815000018147E000E5C6C495A +3903C003F03901F00FE06CB55A013F90C7FCEB07F8243F7CBC2D>II<12301238123E003FB612FCA316F84815F0A2 +16E00070C812C00060EC0180A2ED030015065A5D5DA2C85A5D15E05D4A5A140392C7FC14 +06A2140E5CA2143C14381478A214F85CA21301A21303A3495AA4130FA6131FA96D5A6D5A +26407BBD2D>III<121E123FEA7F80EAFFC0A4EA7F80EA3F00121EC7FCB3121E123FEA7F80EAFF +C0A4EA7F80EA3F00121E0A2779A619>I<007FB912E0BA12F0A26C18E0CDFCAE007FB912 +E0BA12F0A26C18E03C167BA147>61 D63 D<1507A34B7EA34B7EA24B7EA34B7E15 +6FA2EDEFF815C7A291380187FC1583A291380303FE1501A291380600FFA34A6D7EA34A6D +7EA34A6D7EA20270800260130FA202E0804A1307A201018191B6FCA2498191C71201A201 +068182A2496F7EA3496F7EA3496F7EA21370717E13F0486C82D80FFEED3FFCB500E0010F +B512F8A33D417DC044>65 DIIIIIIII75 DIIIII82 DI<003FB91280A3903AE0007FE000 +90C76C48131F007EEF0FC0007C17070078170300701701A300601700A5481860A5C81600 +B3B14B7E4B7E0107B612FEA33B3D7DBC42>IIII<007FB5D8C003B512E0A3C66C48C7 +387FFC00D93FF8EC1FE06D48EC0F806D6C92C7FC170E6D6C140C6D6C5C17386D6C14306D +6D5B17E06E6C5B023F495AEDE003DA1FF090C8FC020F1306EDF80E6E6C5A1618913803FE +386E6C5A16606E13E06F5AA26F7E6F7EA26F7E4B7EA2ED33FEED71FF156103C07F020113 +7F03807F4A486C7E5C02066D7E4A6D7E141C02186D7E4A6D7E147002606D7E4A6D7F1301 +4A6E7E49C86C7E5B01066F7E010E6F7E133F496C812607FFC0EC3FFFB500F80103B512FE +A33F3E7EBD44>II91 D<6D1340000114C039030001800006EB +0300481306A2485BA2485BA2485BA3485BA500CFEB678039DF806FC039FFC07FE001E013 +F0A2007F133FA2393FC01FE0391F800FC0390F0007801C1C73BE2D>II<13801201EA030012065AA25AA25AA25AA35AA512 +CFEADF80EAFFC013E0A2127FA2EA3FC0EA1F80EA0F000B1C7ABE19>96 +DII<49B4FC +010F13E090383F00F8017C131C4913064848131F48485B0007EC7F80485A121F5B003FEC +3F00151E007F91C7FC90C9FCA35AA97EA27F123F16C0121F6DEB0180120F6C6CEB0300A2 +6C6C13066C6C5BD8007C133890383F01F090380FFFC0D901FEC7FC222A7DA828>IIII<167C903903F801FF90391FFF0787903A7E0FCE0F809038F803F83901F001 +F03B03E000F8070000076EC7FCA24848137EA2001F147FA6000F147EA26C6C5BA200035C +6C6C485A6D485A39037E0FC0D91FFFC8FC380703F80006CAFCA2120EA2120F7E7F7F6CB5 +12F015FE6C6E7E6C15E00003813A07C0001FF848C7EA03FC001E140048157E007C153E00 +78153F00F881A50078151E007C153E6C5D001E15786C5DD807C0EB03E0D803F0EB0FC0D8 +00FE017FC7FC90383FFFFC010313C0293D7EA82D>III<14F0EB01F8EB03FCEB +07FEA4EB03FCEB01F8EB00F01400AC14FE137FA313011300147EB3B3A6123C007E137CB4 +13FC14F8A2EB01F0007E13E0383803C0381E0780380FFF00EA01FC175184BD1C>III<2703F003FCEB01FE00 +FF903B0FFF8007FFC0913B3C0FC01E07E0913B7003E03801F00007903BC001F06000F826 +03F1806D487F2601F300EBF98001F6D900FBC7127C04FF147E01FC5CA3495CB3A6486C49 +6C14FFB528F07FFFF83F13FCA346287CA74D>I<3903F003F800FFEB1FFF91383C0F8091 +386007C00007496C7E2603F1807F3801F30001F613018213FCA35BB3A6486C497EB500F0 +B512F0A32C287CA733>I<14FF010713E090381F81F890387E007E01F8131F4848EB0F80 +4848EB07C04848EB03E0000F15F04848EB01F8A2003F15FCA248C812FEA44815FFA96C15 +FEA36C6CEB01FCA3001F15F86C6CEB03F0A26C6CEB07E06C6CEB0FC06C6CEB1F80D8007E +EB7E0090383F81FC90380FFFF0010090C7FC282A7EA82D>I<3901F807F800FFEB3FFF91 +38781FC09138C007E03A07F98001F02603FB007FD801FE6D7E49147E49147FEE3F80A2EE +1FC0A217E0A2160F17F0A917E0161FA217C0A2EE3F80A26DEC7F00167E6D5C4B5A01FB49 +5A9039F9C007E09039F8F01F80DA3FFEC7FCEC0FF091C9FCAD487EB512F0A32C3A7DA733 +>I<02FF13180107EBC03890381F80E090397E0030784913184848130C4848EB06F8485A +000F1403485AA248481301A2127FA290C7FC5AA97E7FA2123FA26C7E15036C7E00071407 +6C7E6C6C130D00001419017E137190383F81E190380FFF81903801FE0190C7FCAD4B7E92 +B512F0A32C3A7DA730>I<3903F007E000FFEB1FF0EC7878ECE0FC3907F181FE12033801 +F3019038F600FCA2153001FC1300A35BB3A5487EB512FCA31F287EA724>I<90387FC060 +3901FFF8E03807C03D380E0007481303481301481300A212F01560A27EA27E007F140013 +C0EA3FFE381FFFE06C13FC6C7F6C7FC61480010F13C09038007FE0EC0FF00040130300C0 +EB01F814007E1578A37E15707E15E07E6CEB01C000F3EB038039E1E01F0038C0FFFCEB1F +E01D2A7DA824>I<1318A61338A41378A213F8A2120112031207001FB512C0B6FCA2D801 +F8C7FCB3A21560A9000014C07F137CEC0180133E90381F8700EB07FEEB01F81B397EB723 +>I +III<3B7FFFC00FFFE0A3000390390007FE00C648EB03F0017E6D5A6DEB03801480011F49 +C7FC90380FC00E903807E00C6E5A903803F83801015B6D6C5AEC7EC0EC7F80143F141F6E +7E81141FEC3BF0EC71F8ECE1FC14C0903801807E01037FD907007F01066D7E49130F496D +7E01386D7E017880EA01F8D80FFCEB07FEB590381FFFF8A32D277FA630>II<001FB6 +1280A29039E0003F0090C7127E001E14FE001C495A5D0018495A003813075D0030495A14 +1F4A5A92C7FC147EC712FE495A5C495A13075C495A011FEB0180EB3F801400137E13FE48 +5A491303485A000715005B48485B001F5C485A90C7123F007E49B4FCB7FCA221277EA628 +>I<001C130E007EEB1F80007F133F39FF807FC0A3397F003F80007E131F001CEB0E001A +0977BD2D>127 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fs cmbx12 14.4 62 /Fs 62 123 df)1451 981 y(|)1451 1085 y(|)1021 1189 -y(Real)47 b(or)g(complex)f(number)1355 1292 y(cl_N)1212 -1396 y()1451 1500 y(|)1451 1604 y(|)1212 -1707 y(Real)h(number)1355 1811 y(cl_R)1260 1915 y()1451 +m(y:)1355 670 y Fp(Number)1260 773 y(cl_number)1165 877 +y()1451 981 y(|)1451 1085 y(|)1021 1189 +y(Real)47 b(or)g(complex)f(number)1355 1292 y(cl_N)1165 +1396 y()1451 1500 y(|)1451 1604 y(|)1212 +1707 y(Real)h(number)1355 1811 y(cl_R)1212 1915 y()1451 2019 y(|)496 2123 y(+-------------------+-----)o(---)o(----)o(----)o (---)o(+)496 2226 y(|)1861 b(|)210 2330 y(Rational)46 b(number)1000 b(Floating-point)44 b(number)401 2434 y(cl_RA)1669 -b(cl_F)210 2538 y()1237 b()496 -2641 y(|)1861 b(|)496 2745 y(|)859 b(+-------------+----------)o(---+)o -(---)o(----)o(----)o(--+)353 2849 y(Integer)714 b(|)620 -b(|)h(|)f(|)401 2953 y(cl_I)572 b(Short-Float)140 b(Single-Float)92 -b(Double-Float)140 b(Long-Float)258 3057 y()378 -b(cl_SF)428 b(cl_FF)g(cl_DF)g(cl_LF)1117 3160 y()44 -b()g()g()-30 3297 -y Fr(The)28 b(base)h(class)h Fp(cl_number)c Fr(is)j(an)g(abstract)g -(base)g(class.)41 b(It)29 b(is)g(not)g(useful)f(to)i(declare)f(a)h(v)-5 +b(cl_F)210 2538 y()1189 b()496 +2641 y(|)1861 b(|)496 2745 y(|)764 b(+--------------+-------)o(----)o +(---+)o(---)o(----)o(----)o(---)o(+)353 2849 y(Integer)619 +b(|)668 b(|)g(|)f(|)401 2953 y(cl_I)476 b(Short-Float)188 +b(Single-Float)140 b(Double-Float)188 b(Long-Float)210 +3057 y()282 b(cl_SF)476 b(cl_FF)g(cl_DF)g(cl_LF)1021 +3160 y()44 b()g()g +()-30 3297 y Fr(The)28 b(base)h(class)h +Fp(cl_number)c Fr(is)j(an)g(abstract)g(base)g(class.)41 +b(It)29 b(is)g(not)g(useful)f(to)i(declare)f(a)h(v)-5 b(ariable)29 b(of)g(this)g(t)m(yp)s(e)-30 3406 y(except)g(if)f(y)m(ou)g (w)m(an)m(t)h(to)g(completely)f(disable)g(compile-time)g(t)m(yp)s(e)h (c)m(hec)m(king)g(and)f(use)f(run-time)g(t)m(yp)s(e)h(c)m(hec)m(king) @@ -2241,9 +2266,9 @@ Fp(cl_FF)p Fr(,)h Fp(cl_DF)p Fr(,)g Fp(cl_LF)p Fr(,)f Fp(cl_F)f Fr(and)h Fp(cl_R)e Fr(to)j(the)f(C)-30 1116 y(built-in)30 b(t)m(yp)s(es)h(`)p Fp(float)p Fr(')e(and)h(`)p Fp(double)p Fr(')f(are)i(pro)m(vided)f(through)f(the)i(functions)-30 -1275 y Fp(float)e(cl_float_approx)d(\(const)j Fl(t)m(yp)s(e)5 -b Fp(&)30 b(x\))-30 1385 y(double)f(cl_double_approx)d(\(const)i -Fl(t)m(yp)s(e)5 b Fp(&)31 b(x\))450 1494 y Fr(Returns)e(an)h(appro)m +1275 y Fp(float)e(float_approx)e(\(const)i Fl(t)m(yp)s(e)5 +b Fp(&)30 b(x\))-30 1385 y(double)f(double_approx)d(\(const)j +Fl(t)m(yp)s(e)5 b Fp(&)30 b(x\))450 1494 y Fr(Returns)f(an)h(appro)m (ximation)f(of)h Fp(x)g Fr(of)g(C)f(t)m(yp)s(e)h Fl(ct)m(yp)s(e)p Fr(.)41 b(If)29 b Fp(abs\(x\))f Fr(is)i(to)s(o)h(close)g(to)f(0)g (\(under\015o)m(w\),)450 1604 y(0)h(is)f(returned.)40 @@ -2276,10 +2301,10 @@ b(on)f(n)m(um)m(b)s(ers)2523 b(10)-30 299 y Fo(4)80 b(F)-13 b(unctions)53 b(on)g(n)l(um)l(b)t(ers)-30 600 y Fr(Eac)m(h)36 b(of)g(the)g(n)m(um)m(b)s(er)d(classes)k(declares)f(its)g(mathematical) g(op)s(erations)g(in)f(the)h(corresp)s(onding)e(include)i(\014le.)-30 -709 y(F)-8 b(or)31 b(example,)f(if)g(y)m(our)g(co)s(de)g(op)s(erates)h -(with)e(ob)5 b(jects)31 b(of)f(t)m(yp)s(e)h Fp(cl_I)p -Fr(,)e(it)h(should)f Fp(#include)g()p Fr(.)-30 -1022 y Fs(4.1)68 b(Constructing)45 b(n)l(um)l(b)t(ers)-30 +709 y(F)-8 b(or)27 b(example,)g(if)f(y)m(our)g(co)s(de)h(op)s(erates)g +(with)f(ob)5 b(jects)27 b(of)f(t)m(yp)s(e)g Fp(cl_I)p +Fr(,)h(it)f(should)g Fp(#include)i()p +Fr(.)-30 1022 y Fs(4.1)68 b(Constructing)45 b(n)l(um)l(b)t(ers)-30 1237 y Fr(Here)31 b(is)f(ho)m(w)h(to)g(create)h(n)m(um)m(b)s(er)c(ob)5 b(jects)31 b(\\from)e(nothing".)-30 1505 y Fn(4.1.1)63 b(Constructing)41 b(in)m(tegers)-30 1720 y Fp(cl_I)28 @@ -2451,7 +2476,7 @@ Fl(t)m(yp)s(e)5 b Fp(&,)30 b(const)f Fl(t)m(yp)s(e)5 b Fp(&\))-30 862 y(bool)29 b(operator)f(!=)i(\(const)f Fl(t)m(yp)s(e)5 b Fp(&,)30 b(const)f Fl(t)m(yp)s(e)5 b Fp(&\))450 971 y Fr(Comparison,)29 b(as)i(in)f(C)g(and)f(C)p -Fp(++)p Fr(.)-30 1125 y Fp(uint32)g(cl_equal_hashcode)c(\(const)k +Fp(++)p Fr(.)-30 1125 y Fp(uint32)g(equal_hashcode)d(\(const)j Fl(t)m(yp)s(e)5 b Fp(&\))450 1235 y Fr(Returns)35 b(a)h(32-bit)h(hash)e (co)s(de)h(that)g(is)g(the)g(same)f(for)h(an)m(y)g(t)m(w)m(o)h(n)m(um)m (b)s(ers)c(whic)m(h)i(are)i(the)f(same)450 1345 y(according)24 @@ -2464,7 +2489,7 @@ b(of)g(the)f(classes)i Fp(cl_R)p Fr(,)h Fp(cl_RA)p Fr(,)f Fp(cl_I)p Fr(,)h Fp(cl_F)p Fr(,)f Fp(cl_SF)p Fr(,)g Fp(cl_FF)p Fr(,)h Fp(cl_DF)p Fr(,)f Fp(cl_LF)d Fr(de\014nes)h(the)g(follo)m(wing) -30 1872 y(op)s(erations:)-30 2026 y Fp(cl_signean)28 -b(cl_compare)f(\(const)i Fl(t)m(yp)s(e)5 b Fp(&)30 b(x,)g(const)f +b(compare)g(\(const)h Fl(t)m(yp)s(e)5 b Fp(&)30 b(x,)g(const)f Fl(t)m(yp)s(e)5 b Fp(&)30 b(y\))450 2135 y Fr(Compares)f Fp(x)h Fr(and)g Fp(y)p Fr(.)40 b(Returns)30 b Fp(+)p Fr(1)g(if)g Fp(x>y)p Fr(,)g(-1)h(if)g Fp(x=)i(0)50 b Fr(and)g(the)h(n)m(um)m(b)s b(on)f(n)m(um)m(b)s(ers)2523 b(19)-30 299 y(Arc)m(himedes')30 b(constan)m(t)i(pi)e(=)g(3.14)6 b(.)23 b(.)f(.)42 b(is)30 b(returned)g(b)m(y)g(the)g(follo)m(wing)i(functions:)-30 -469 y Fp(cl_F)d(cl_pi)g(\(cl_float_format_t)d(f\))450 -578 y Fr(Returns)j(pi)i(as)f(a)h(\015oat)g(of)f(format)g -Fp(f)p Fr(.)-30 745 y Fp(cl_F)f(cl_pi)g(\(const)g(cl_F&)g(y\))450 +469 y Fp(cl_F)d(pi)h(\(cl_float_format_t)25 b(f\))450 +578 y Fr(Returns)k(pi)i(as)f(a)h(\015oat)g(of)f(format)g +Fp(f)p Fr(.)-30 745 y Fp(cl_F)f(pi)h(\(const)f(cl_F&)g(y\))450 855 y Fr(Returns)g(pi)i(in)f(the)g(\015oat)h(format)f(of)g -Fp(y)p Fr(.)-30 1021 y Fp(cl_F)f(cl_pi)g(\(void\))450 -1131 y Fr(Returns)g(pi)i(as)f(a)h(\015oat)g(of)f(format)g -Fp(cl_default_float_format)p Fr(.)-30 1369 y Fn(4.8.3)63 +Fp(y)p Fr(.)-30 1021 y Fp(cl_F)f(pi)h(\(void\))450 1131 +y Fr(Returns)f(pi)i(as)f(a)h(\015oat)g(of)f(format)g +Fp(default_float_format)p Fr(.)-30 1369 y Fn(4.8.3)63 b(Hyp)s(erb)s(olic)42 b(functions)-30 1597 y Fp(cl_R)29 b(sinh)g(\(const)g(cl_R&)g(x\))450 1707 y Fr(Returns)g Fp(sinh\(x\))p Fr(.)-30 1873 y Fp(cl_N)g(sinh)g(\(const)g(cl_N&)g(z\)) @@ -2912,9 +2937,9 @@ h(result)f(is)h(the)f(in)m(terv)-5 b(al)32 b Fp(cosh\(x\))c(>=)i(1)p Fr(.)-30 2425 y Fp(cl_N)f(cosh)g(\(const)g(cl_N&)g(z\))450 2535 y Fr(Returns)g Fp(cosh\(z\))p Fr(.)39 b(The)30 b(range)h(of)f(the) h(result)f(is)h(the)f(en)m(tire)h(complex)g(plane.)-30 -2701 y Fp(struct)e(cl_cosh_sinh_t)d({)k(cl_R)f(cosh;)g(cl_R)h(sinh;)e -(};)-30 2811 y(cl_cosh_sinh_t)e(cl_cosh_sinh)h(\(const)i(cl_R&)g(x\)) -450 2921 y Fr(Returns)i(b)s(oth)g Fp(sinh\(x\))f Fr(and)h +2701 y Fp(struct)e(cosh_sinh_t)e({)j(cl_R)f(cosh;)g(cl_R)g(sinh;)g(};) +-30 2811 y(cosh_sinh_t)e(cosh_sinh)h(\(const)h(cl_R&)g(x\))450 +2921 y Fr(Returns)i(b)s(oth)g Fp(sinh\(x\))f Fr(and)h Fp(cosh\(x\))p Fr(.)43 b(This)31 b(is)h(more)f(e\016cien)m(t)i(than)f (computing)f(them)f(sepa-)450 3030 y(rately)-8 b(.)42 b(The)30 b(relation)i Fp(cosh^2)c(-)i(sinh^2)f(=)h(1)g @@ -2958,50 +2983,49 @@ Fr(.)p eop b(on)f(n)m(um)m(b)s(ers)2523 b(20)-30 299 y Fn(4.8.4)63 b(Euler)40 b(gamma)-30 498 y Fr(Euler's)30 b(constan)m(t)i(C)e(=)g (0.577)6 b(.)24 b(.)e(.)41 b(is)31 b(returned)e(b)m(y)h(the)h(follo)m -(wing)h(functions:)-30 666 y Fp(cl_F)d(cl_eulerconst)e -(\(cl_float_format_t)e(f\))450 776 y Fr(Returns)k(Euler's)i(constan)m +(wing)h(functions:)-30 666 y Fp(cl_F)d(eulerconst)f +(\(cl_float_format_t)d(f\))450 776 y Fr(Returns)k(Euler's)i(constan)m (t)g(as)g(a)g(\015oat)g(of)f(format)g Fp(f)p Fr(.)-30 -942 y Fp(cl_F)f(cl_eulerconst)e(\(const)i(cl_F&)g(y\))450 +942 y Fp(cl_F)f(eulerconst)f(\(const)g(cl_F&)h(y\))450 1051 y Fr(Returns)g(Euler's)i(constan)m(t)g(in)f(the)h(\015oat)g -(format)f(of)g Fp(y)p Fr(.)-30 1217 y Fp(cl_F)f(cl_eulerconst)e -(\(void\))450 1326 y Fr(Returns)i(Euler's)i(constan)m(t)g(as)g(a)g -(\015oat)g(of)f(format)g Fp(cl_default_float_format)p -Fr(.)-30 1495 y(Catalan's)i(constan)m(t)f(G)g(=)f(0.915)6 -b(.)24 b(.)e(.)42 b(is)30 b(returned)f(b)m(y)h(the)h(follo)m(wing)h -(functions:)-30 1664 y Fp(cl_F)d(cl_catalanconst)d(\(cl_float_format_t) -g(f\))450 1773 y Fr(Returns)j(Catalan's)j(constan)m(t)g(as)e(a)h -(\015oat)g(of)g(format)e Fp(f)p Fr(.)-30 1939 y Fp(cl_F)g -(cl_catalanconst)d(\(const)j(cl_F&)g(y\))450 2048 y Fr(Returns)g -(Catalan's)j(constan)m(t)g(in)e(the)g(\015oat)h(format)f(of)h -Fp(y)p Fr(.)-30 2214 y Fp(cl_F)e(cl_catalanconst)d(\(void\))450 -2324 y Fr(Returns)j(Catalan's)j(constan)m(t)g(as)e(a)h(\015oat)g(of)g -(format)e Fp(cl_default_float_format)p Fr(.)-30 2560 -y Fn(4.8.5)63 b(Riemann)39 b(zeta)-30 2759 y Fr(Riemann's)29 -b(zeta)j(function)e(at)h(an)g(in)m(tegral)h(p)s(oin)m(t)e -Fp(s>1)f Fr(is)i(returned)e(b)m(y)h(the)h(follo)m(wing)h(functions:)-30 -2927 y Fp(cl_F)d(cl_zeta)g(\(int)g(s,)h(cl_float_format_t)25 -b(f\))450 3037 y Fr(Returns)k(Riemann's)h(zeta)i(function)e(at)h -Fp(s)f Fr(as)g(a)h(\015oat)g(of)g(format)e Fp(f)p Fr(.)-30 -3203 y Fp(cl_F)g(cl_zeta)g(\(int)g(s,)h(const)f(cl_F&)f(y\))450 -3312 y Fr(Returns)h(Riemann's)h(zeta)i(function)e(at)h +(format)f(of)g Fp(y)p Fr(.)-30 1217 y Fp(cl_F)f(eulerconst)f(\(void\)) +450 1326 y Fr(Returns)h(Euler's)i(constan)m(t)g(as)g(a)g(\015oat)g(of)f +(format)g Fp(default_float_format)p Fr(.)-30 1495 y(Catalan's)i +(constan)m(t)f(G)g(=)f(0.915)6 b(.)24 b(.)e(.)42 b(is)30 +b(returned)f(b)m(y)h(the)h(follo)m(wing)h(functions:)-30 +1664 y Fp(cl_F)d(catalanconst)e(\(cl_float_format_t)f(f\))450 +1773 y Fr(Returns)j(Catalan's)j(constan)m(t)g(as)e(a)h(\015oat)g(of)g +(format)e Fp(f)p Fr(.)-30 1939 y Fp(cl_F)g(catalanconst)e(\(const)i +(cl_F&)g(y\))450 2048 y Fr(Returns)g(Catalan's)j(constan)m(t)g(in)e +(the)g(\015oat)h(format)f(of)h Fp(y)p Fr(.)-30 2214 y +Fp(cl_F)e(catalanconst)e(\(void\))450 2324 y Fr(Returns)i(Catalan's)j +(constan)m(t)g(as)e(a)h(\015oat)g(of)g(format)e Fp +(default_float_format)p Fr(.)-30 2560 y Fn(4.8.5)63 b(Riemann)39 +b(zeta)-30 2759 y Fr(Riemann's)29 b(zeta)j(function)e(at)h(an)g(in)m +(tegral)h(p)s(oin)m(t)e Fp(s>1)f Fr(is)i(returned)e(b)m(y)h(the)h +(follo)m(wing)h(functions:)-30 2927 y Fp(cl_F)d(zeta)g(\(int)h(s,)f +(cl_float_format_t)d(f\))450 3037 y Fr(Returns)j(Riemann's)h(zeta)i +(function)e(at)h Fp(s)f Fr(as)g(a)h(\015oat)g(of)g(format)e +Fp(f)p Fr(.)-30 3203 y Fp(cl_F)g(zeta)g(\(int)h(s,)f(const)g(cl_F&)g +(y\))450 3312 y Fr(Returns)g(Riemann's)h(zeta)i(function)e(at)h Fp(s)f Fr(in)g(the)g(\015oat)h(format)f(of)h Fp(y)p Fr(.)-30 -3478 y Fp(cl_F)e(cl_zeta)g(\(int)g(s\))450 3587 y Fr(Returns)g -(Riemann's)h(zeta)i(function)e(at)h Fp(s)f Fr(as)g(a)h(\015oat)g(of)g -(format)e Fp(cl_default_float_format)p Fr(.)-30 3860 -y Fs(4.9)68 b(F)-11 b(unctions)44 b(on)h(in)l(tegers)-30 -4155 y Fn(4.9.1)63 b(Logical)40 b(functions)-30 4354 -y Fr(In)m(tegers,)31 b(when)d(view)m(ed)j(as)f(in)f(t)m(w)m(o's)i -(complemen)m(t)e(notation,)i(can)f(b)s(e)f(though)m(t)h(as)g -(in\014nite)f(bit)h(strings)f(where)-30 4463 y(the)i(bits')f(v)-5 -b(alues)31 b(ev)m(en)m(tually)h(are)f(constan)m(t.)42 -b(F)-8 b(or)31 b(example,)401 4598 y Fp(17)47 b(=)h(......00010001)401 -4702 y(-6)f(=)h(......11111010)-30 4843 y Fr(The)33 b(logical)j(op)s -(erations)e(view)g(in)m(tegers)h(as)f(suc)m(h)f(bit)h(strings)f(and)h -(op)s(erate)g(on)f(eac)m(h)i(of)f(the)g(bit)g(p)s(ositions)f(in)-30 -4952 y(parallel.)-30 5121 y Fp(cl_I)c(lognot)g(\(const)g(cl_I&)f(x\)) --30 5230 y(cl_I)h(operator)f(~)i(\(const)f(cl_I&)g(x\))450 -5340 y Fr(Logical)j(not,)f(lik)m(e)h Fp(~x)e Fr(in)g(C.)g(This)g(is)g -(the)h(same)e(as)i Fp(-1-x)p Fr(.)p eop +3478 y Fp(cl_F)e(zeta)g(\(int)h(s\))450 3587 y Fr(Returns)f(Riemann's)h +(zeta)i(function)e(at)h Fp(s)f Fr(as)g(a)h(\015oat)g(of)g(format)e +Fp(default_float_format)p Fr(.)-30 3860 y Fs(4.9)68 b(F)-11 +b(unctions)44 b(on)h(in)l(tegers)-30 4155 y Fn(4.9.1)63 +b(Logical)40 b(functions)-30 4354 y Fr(In)m(tegers,)31 +b(when)d(view)m(ed)j(as)f(in)f(t)m(w)m(o's)i(complemen)m(t)e(notation,) +i(can)f(b)s(e)f(though)m(t)h(as)g(in\014nite)f(bit)h(strings)f(where) +-30 4463 y(the)i(bits')f(v)-5 b(alues)31 b(ev)m(en)m(tually)h(are)f +(constan)m(t.)42 b(F)-8 b(or)31 b(example,)401 4598 y +Fp(17)47 b(=)h(......00010001)401 4702 y(-6)f(=)h(......11111010)-30 +4843 y Fr(The)33 b(logical)j(op)s(erations)e(view)g(in)m(tegers)h(as)f +(suc)m(h)f(bit)h(strings)f(and)h(op)s(erate)g(on)f(eac)m(h)i(of)f(the)g +(bit)g(p)s(ositions)f(in)-30 4952 y(parallel.)-30 5121 +y Fp(cl_I)c(lognot)g(\(const)g(cl_I&)f(x\))-30 5230 y(cl_I)h(operator)f +(~)i(\(const)f(cl_I&)g(x\))450 5340 y Fr(Logical)j(not,)f(lik)m(e)h +Fp(~x)e Fr(in)g(C.)g(This)g(is)g(the)h(same)e(as)i Fp(-1-x)p +Fr(.)p eop %%Page: 21 23 21 22 bop -30 -116 a Fr(Chapter)30 b(4:)41 b(F)-8 b(unctions)31 b(on)f(n)m(um)m(b)s(ers)2523 b(21)-30 299 y Fp(cl_I)29 @@ -3234,62 +3258,62 @@ b(x\))450 408 y Fr(Returns)j(the)g(exp)s(onen)m(t)h Fp(e)f Fr(of)h Fp(x)p Fr(.)50 b(F)-8 b(or)34 b Fp(x)c(=)g(0.0)p Fr(,)k(this)f(is)h(0.)50 b(F)-8 b(or)35 b Fp(x)e Fr(non-zero,)i(this)f (is)f(the)h(unique)450 518 y(in)m(teger)e(with)e Fp(2^\(e-1\))e(<=)i -(abs\(x\))f(<)h(2^e)p Fr(.)-30 692 y Fp(sintL)f(float_radix)e(\(const)i -Fl(t)m(yp)s(e)5 b Fp(&)30 b(x\))450 802 y Fr(Returns)f(the)i(base)g(of) +(abs\(x\))f(<)h(2^e)p Fr(.)-30 701 y Fp(sintL)f(float_radix)e(\(const)i +Fl(t)m(yp)s(e)5 b Fp(&)30 b(x\))450 811 y Fr(Returns)f(the)i(base)g(of) f(the)h(\015oating-p)s(oin)m(t)g(represen)m(tation.)42 -b(This)30 b(is)g(alw)m(a)m(ys)i Fp(2)p Fr(.)-30 976 y +b(This)30 b(is)g(alw)m(a)m(ys)i Fp(2)p Fr(.)-30 994 y Fl(t)m(yp)s(e)k Fp(float_sign)27 b(\(const)i Fl(t)m(yp)s(e)5 -b Fp(&)30 b(x\))450 1086 y Fr(Returns)f(the)i(sign)f +b Fp(&)30 b(x\))450 1103 y Fr(Returns)f(the)i(sign)f Fp(s)g Fr(of)h Fp(x)f Fr(as)h(a)f(\015oat.)42 b(The)30 b(v)-5 b(alue)31 b(is)f(1)h(for)f Fp(x)g(>)p Fr(=)g(0,)h(-1)g(for)f -Fp(x)g(<)g Fr(0.)-30 1260 y Fp(uintL)f(float_digits)e(\(const)i -Fl(t)m(yp)s(e)5 b Fp(&)30 b(x\))450 1370 y Fr(Returns)f(the)h(n)m(um)m +Fp(x)g(<)g Fr(0.)-30 1287 y Fp(uintL)f(float_digits)e(\(const)i +Fl(t)m(yp)s(e)5 b Fp(&)30 b(x\))450 1396 y Fr(Returns)f(the)h(n)m(um)m (b)s(er)e(of)i(man)m(tissa)g(bits)g(in)g(the)g(\015oating-p)s(oin)m(t)h (represen)m(tation)g(of)f Fp(x)p Fr(,)g(including)450 -1479 y(the)h(hidden)e(bit.)40 b(The)30 b(v)-5 b(alue)31 +1506 y(the)h(hidden)e(bit.)40 b(The)30 b(v)-5 b(alue)31 b(only)g(dep)s(ends)d(on)i(the)h(t)m(yp)s(e)f(of)h Fp(x)p -Fr(,)f(not)h(on)f(its)h(v)-5 b(alue.)-30 1654 y Fp(uintL)29 +Fr(,)f(not)h(on)f(its)h(v)-5 b(alue.)-30 1689 y Fp(uintL)29 b(float_precision)d(\(const)j Fl(t)m(yp)s(e)5 b Fp(&)30 -b(x\))450 1763 y Fr(Returns)c(the)h(n)m(um)m(b)s(er)d(of)j +b(x\))450 1798 y Fr(Returns)c(the)h(n)m(um)m(b)s(er)d(of)j (signi\014can)m(t)h(man)m(tissa)f(bits)g(in)f(the)h(\015oating-p)s(oin) -m(t)h(represen)m(tation)g(of)f Fp(x)p Fr(.)450 1873 y(Since)j +m(t)h(represen)m(tation)g(of)f Fp(x)p Fr(.)450 1908 y(Since)j (denormalized)e(n)m(um)m(b)s(ers)g(are)h(not)h(supp)s(orted,)e(this)i (is)f(the)h(same)f(as)h Fp(float_digits\(x\))25 b Fr(if)450 -1983 y Fp(x)30 b Fr(is)g(non-zero,)i(and)d(0)i(if)f Fp(x)h -Fr(=)f(0.)-30 2164 y(The)63 b(complete)h(in)m(ternal)h(represen)m -(tation)f(of)g(a)g(\015oat)g(is)g(enco)s(ded)f(in)h(the)g(t)m(yp)s(e)f -Fp(cl_decoded_float)-30 2274 y Fr(\(or)110 b Fp(cl_decoded_sfloat)p -Fr(,)125 b Fp(cl_decoded_ffloat)p Fr(,)g Fp(cl_decoded_dfloat)p -Fr(,)f Fp(cl_decoded_lfloat)p Fr(,)-30 2383 y(resp)s(ectiv)m(ely\),)32 -b(de\014ned)d(b)m(y)210 2527 y Fp(struct)46 b(cl_decoded_)p -Fl(t)m(yp)s(e)5 b Fp(float)44 b({)592 2631 y Fl(t)m(yp)s(e)53 +2018 y Fp(x)30 b Fr(is)g(non-zero,)i(and)d(0)i(if)f Fp(x)h +Fr(=)f(0.)-30 2213 y(The)f(complete)g(in)m(ternal)h(represen)m(tation)h +(of)e(a)g(\015oat)h(is)g(enco)s(ded)e(in)h(the)h(t)m(yp)s(e)f +Fp(decoded_float)d Fr(\(or)j Fp(decoded_)-30 2322 y(sfloat)p +Fr(,)g Fp(decoded_ffloat)p Fr(,)e Fp(decoded_dfloat)p +Fr(,)f Fp(decoded_lfloat)p Fr(,)h(resp)s(ectiv)m(ely\),)32 +b(de\014ned)e(b)m(y)210 2475 y Fp(struct)46 b(decoded_)p +Fl(t)m(yp)s(e)5 b Fp(float)45 b({)592 2578 y Fl(t)m(yp)s(e)53 b Fp(mantissa;)45 b(cl_I)i(exponent;)e Fl(t)m(yp)s(e)53 -b Fp(sign;)210 2735 y(};)-30 2884 y Fr(and)30 b(returned)f(b)m(y)h(the) -h(function)-30 3066 y Fp(cl_decoded_)p Fl(t)m(yp)s(e)5 -b Fp(float)26 b(decode_float)h(\(const)i Fl(t)m(yp)s(e)5 -b Fp(&)30 b(x\))450 3175 y Fr(F)-8 b(or)26 b Fp(x)e Fr(non-zero,)j +b Fp(sign;)210 2682 y(};)-30 2840 y Fr(and)30 b(returned)f(b)m(y)h(the) +h(function)-30 3035 y Fp(decoded_)p Fl(t)m(yp)s(e)5 b +Fp(float)27 b(decode_float)g(\(const)i Fl(t)m(yp)s(e)5 +b Fp(&)30 b(x\))450 3145 y Fr(F)-8 b(or)26 b Fp(x)e Fr(non-zero,)j (this)d(returns)g Fp(\(-1\)^s)p Fr(,)h Fp(e)p Fr(,)g Fp(m)g Fr(with)f Fp(x)30 b(=)g(\(-1\)^s)f(*)h(2^e)g(*)g(m)24 -b Fr(and)g Fp(0.5)30 b(<=)g(m)g(<)g(1.0)p Fr(.)450 3285 +b Fr(and)g Fp(0.5)30 b(<=)g(m)g(<)g(1.0)p Fr(.)450 3255 y(F)-8 b(or)35 b Fp(x)f Fr(=)h(0,)h(it)f(returns)e Fp(\(-1\)^s)p Fr(=1,)h Fp(e)p Fr(=0,)i Fp(m)p Fr(=0.)53 b Fp(e)34 b Fr(is)g(the)h(same)f(as)h(returned)e(b)m(y)i(the)f(function)450 -3395 y Fp(float_exponent)p Fr(.)-30 3576 y(A)c(complete)h(deco)s(ding)g +3364 y Fp(float_exponent)p Fr(.)-30 3559 y(A)c(complete)h(deco)s(ding)g (in)f(terms)f(of)i(in)m(tegers)g(is)g(pro)m(vided)f(as)g(t)m(yp)s(e)210 -3760 y Fp(struct)46 b(cl_idecoded_float)d({)592 3864 +3712 y Fp(struct)46 b(cl_idecoded_float)d({)592 3815 y(cl_I)j(mantissa;)g(cl_I)g(exponent;)g(cl_I)g(sign;)210 -3967 y(};)-30 4117 y Fr(b)m(y)30 b(the)h(follo)m(wing)h(function:)-30 -4299 y Fp(cl_idecoded_float)26 b(integer_decode_float)e(\(const)29 -b Fl(t)m(yp)s(e)5 b Fp(&)31 b(x\))450 4408 y Fr(F)-8 +3919 y(};)-30 4077 y Fr(b)m(y)30 b(the)h(follo)m(wing)h(function:)-30 +4272 y Fp(cl_idecoded_float)26 b(integer_decode_float)e(\(const)29 +b Fl(t)m(yp)s(e)5 b Fp(&)31 b(x\))450 4382 y Fr(F)-8 b(or)38 b Fp(x)e Fr(non-zero,)k(this)d(returns)f Fp(\(-1\)^s)p Fr(,)h Fp(e)p Fr(,)h Fp(m)f Fr(with)g Fp(x)30 b(=)g(\(-1\)^s)e(*)i(2^e) -g(*)g(m)37 b Fr(and)f Fp(m)h Fr(an)g(in)m(teger)450 4518 +g(*)g(m)37 b Fr(and)f Fp(m)h Fr(an)g(in)m(teger)450 4491 y(with)e Fp(float_digits\(x\))30 b Fr(bits.)54 b(F)-8 b(or)36 b Fp(x)e Fr(=)h(0,)h(it)g(returns)d Fp(\(-1\)^s)p Fr(=1,)i Fp(e)p Fr(=0,)h Fp(m)p Fr(=0.)54 b(W)-10 b(ARNING:)450 -4627 y(The)27 b(exp)s(onen)m(t)h Fp(e)f Fr(is)h(not)f(the)h(same)f(as)h +4601 y(The)27 b(exp)s(onen)m(t)h Fp(e)f Fr(is)h(not)f(the)h(same)f(as)h (the)g(one)g(returned)e(b)m(y)h(the)h(functions)f Fp(decode_float)e -Fr(and)450 4737 y Fp(float_exponent)p Fr(.)-30 4919 y(Some)k(other)i +Fr(and)450 4711 y Fp(float_exponent)p Fr(.)-30 4906 y(Some)k(other)i (function,)f(implemen)m(ted)f(only)i(for)f(class)h Fp(cl_F)p Fr(:)-30 5101 y Fp(cl_F)e(float_sign)f(\(const)g(cl_F&)h(x,)h(const)f (cl_F&)g(y\))450 5210 y Fr(This)d(returns)g(a)i(\015oating)g(p)s(oin)m @@ -3311,41 +3335,40 @@ Fr(describ)s(es)k(a)g(\015oating-p)s(oin)m(t)i(format.)-30 1222 y(man)m(tissa)30 b(\(after)i(the)e(decimal)g(p)s(oin)m(t\).)-30 1397 y Fp(cl_float_format_t)c(cl_float_format)g(\(const)j(cl_F&)f(x\)) 450 1507 y Fr(Returns)h(the)i(\015oating)g(p)s(oin)m(t)g(format)e(of)i -Fp(x)p Fr(.)-30 1682 y Fp(cl_float_format_t)26 b -(cl_default_float_format)450 1792 y Fr(Global)d(v)-5 -b(ariable:)37 b(the)23 b(default)f(\015oat)g(format)g(used)f(when)g -(con)m(v)m(erting)j(rational)f(n)m(um)m(b)s(ers)c(to)k(\015oats.)-30 -1974 y(T)-8 b(o)30 b(con)m(v)m(ert)h(a)f(real)g(n)m(um)m(b)s(er)d(to)j -(a)g(\015oat,)g(eac)m(h)h(of)e(the)h(t)m(yp)s(es)f Fp(cl_R)p -Fr(,)g Fp(cl_F)p Fr(,)f Fp(cl_I)p Fr(,)h Fp(cl_RA)p Fr(,)g -Fp(int)p Fr(,)f Fp(unsigned)h(int)p Fr(,)-30 2084 y Fp(float)p -Fr(,)g Fp(double)g Fr(de\014nes)g(the)i(follo)m(wing)h(op)s(erations:) --30 2267 y Fp(cl_F)d(cl_float)f(\(const)h Fl(t)m(yp)s(e)5 -b Fp(&x,)30 b(cl_float_format_t)25 b(f\))450 2376 y Fr(Returns)k -Fp(x)h Fr(as)h(a)g(\015oat)g(of)f(format)g Fp(f)p Fr(.)-30 -2551 y Fp(cl_F)f(cl_float)f(\(const)h Fl(t)m(yp)s(e)5 -b Fp(&x,)30 b(const)f(cl_F&)g(y\))450 2661 y Fr(Returns)g -Fp(x)h Fr(in)h(the)f(\015oat)h(format)f(of)g Fp(y)p Fr(.)-30 -2836 y Fp(cl_F)f(cl_float)f(\(const)h Fl(t)m(yp)s(e)5 -b Fp(&x\))450 2945 y Fr(Returns)29 b Fp(x)g Fr(as)h(a)g(\015oat)g(of)f -(format)g Fp(cl_default_float_format)23 b Fr(if)30 b(it)g(is)g(an)f -(exact)i(n)m(um)m(b)s(er,)d(or)h Fp(x)450 3055 y Fr(itself)i(if)g(it)f -(is)h(already)g(a)g(\015oat.)-30 3238 y(Of)f(course,)h(con)m(v)m -(erting)h(a)f(n)m(um)m(b)s(er)d(to)j(a)f(\015oat)i(can)e(lose)h -(precision.)-30 3388 y(Ev)m(ery)g(\015oating-p)s(oin)m(t)g(format)f -(has)g(some)g(c)m(haracteristic)j(n)m(um)m(b)s(ers:)-30 -3571 y Fp(cl_F)c(most_positive_float)c(\(cl_float_format_t)h(f\))450 -3680 y Fr(Returns)j(the)i(largest)h(\(most)e(p)s(ositiv)m(e\))i -(\015oating)f(p)s(oin)m(t)f(n)m(um)m(b)s(er)e(in)i(\015oat)h(format)f -Fp(f)p Fr(.)-30 3855 y Fp(cl_F)f(most_negative_float)c -(\(cl_float_format_t)h(f\))450 3965 y Fr(Returns)j(the)i(smallest)g -(\(most)f(negativ)m(e\))j(\015oating)e(p)s(oin)m(t)f(n)m(um)m(b)s(er)e -(in)i(\015oat)h(format)f Fp(f)p Fr(.)-30 4140 y Fp(cl_F)f -(least_positive_float)c(\(cl_float_format_t)g(f\))450 -4249 y Fr(Returns)g(the)h(least)h(p)s(ositiv)m(e)g(\015oating)g(p)s -(oin)m(t)e(n)m(um)m(b)s(er)f(\(i.e.)40 b Fp(>)26 b Fr(0)g(but)f -(closest)i(to)g(0\))g(in)e(\015oat)i(format)450 4359 -y Fp(f)p Fr(.)-30 4534 y Fp(cl_F)i(least_negative_float)c +Fp(x)p Fr(.)-30 1682 y Fp(cl_float_format_t)26 b(default_float_format) +450 1792 y Fr(Global)d(v)-5 b(ariable:)37 b(the)23 b(default)f(\015oat) +g(format)g(used)f(when)g(con)m(v)m(erting)j(rational)f(n)m(um)m(b)s +(ers)c(to)k(\015oats.)-30 1974 y(T)-8 b(o)30 b(con)m(v)m(ert)h(a)f +(real)g(n)m(um)m(b)s(er)d(to)j(a)g(\015oat,)g(eac)m(h)h(of)e(the)h(t)m +(yp)s(es)f Fp(cl_R)p Fr(,)g Fp(cl_F)p Fr(,)f Fp(cl_I)p +Fr(,)h Fp(cl_RA)p Fr(,)g Fp(int)p Fr(,)f Fp(unsigned)h(int)p +Fr(,)-30 2084 y Fp(float)p Fr(,)g Fp(double)g Fr(de\014nes)g(the)i +(follo)m(wing)h(op)s(erations:)-30 2267 y Fp(cl_F)d(cl_float)f(\(const) +h Fl(t)m(yp)s(e)5 b Fp(&x,)30 b(cl_float_format_t)25 +b(f\))450 2376 y Fr(Returns)k Fp(x)h Fr(as)h(a)g(\015oat)g(of)f(format) +g Fp(f)p Fr(.)-30 2551 y Fp(cl_F)f(cl_float)f(\(const)h +Fl(t)m(yp)s(e)5 b Fp(&x,)30 b(const)f(cl_F&)g(y\))450 +2661 y Fr(Returns)g Fp(x)h Fr(in)h(the)f(\015oat)h(format)f(of)g +Fp(y)p Fr(.)-30 2836 y Fp(cl_F)f(cl_float)f(\(const)h +Fl(t)m(yp)s(e)5 b Fp(&x\))450 2945 y Fr(Returns)24 b +Fp(x)g Fr(as)h(a)g(\015oat)h(of)f(format)f Fp(default_float_format)19 +b Fr(if)24 b(it)i(is)e(an)h(exact)h(n)m(um)m(b)s(er,)e(or)h +Fp(x)f Fr(itself)450 3055 y(if)30 b(it)h(is)g(already)g(a)f(\015oat.) +-30 3238 y(Of)g(course,)h(con)m(v)m(erting)h(a)f(n)m(um)m(b)s(er)d(to)j +(a)f(\015oat)i(can)e(lose)h(precision.)-30 3388 y(Ev)m(ery)g +(\015oating-p)s(oin)m(t)g(format)f(has)g(some)g(c)m(haracteristic)j(n)m +(um)m(b)s(ers:)-30 3571 y Fp(cl_F)c(most_positive_float)c +(\(cl_float_format_t)h(f\))450 3680 y Fr(Returns)j(the)i(largest)h +(\(most)e(p)s(ositiv)m(e\))i(\015oating)f(p)s(oin)m(t)f(n)m(um)m(b)s +(er)e(in)i(\015oat)h(format)f Fp(f)p Fr(.)-30 3855 y +Fp(cl_F)f(most_negative_float)c(\(cl_float_format_t)h(f\))450 +3965 y Fr(Returns)j(the)i(smallest)g(\(most)f(negativ)m(e\))j +(\015oating)e(p)s(oin)m(t)f(n)m(um)m(b)s(er)e(in)i(\015oat)h(format)f +Fp(f)p Fr(.)-30 4140 y Fp(cl_F)f(least_positive_float)c +(\(cl_float_format_t)g(f\))450 4249 y Fr(Returns)g(the)h(least)h(p)s +(ositiv)m(e)g(\015oating)g(p)s(oin)m(t)e(n)m(um)m(b)s(er)f(\(i.e.)40 +b Fp(>)26 b Fr(0)g(but)f(closest)i(to)g(0\))g(in)e(\015oat)i(format)450 +4359 y Fp(f)p Fr(.)-30 4534 y Fp(cl_F)i(least_negative_float)c (\(cl_float_format_t)g(f\))450 4644 y Fr(Returns)e(the)i(least)h (negativ)m(e)g(\015oating)g(p)s(oin)m(t)e(n)m(um)m(b)s(er)e(\(i.e.)40 b Fp(<)24 b Fr(0)h(but)e(closest)j(to)f(0\))g(in)g(\015oat)g(format)450 @@ -3386,41 +3409,40 @@ Fp(x)p Fr(.)-30 1861 y(If)h Fp(x)g Fr(is)g(an)m(y)h(\015oat,)g(one)g (has)150 1991 y Fp(cl_float\(rational\(x\),x\))24 b(=)30 b(x)150 2122 y(cl_float\(rationalize\(x\),)o(x\))24 b(=)30 b(x)-30 2367 y Fs(4.12)68 b(Random)46 b(n)l(um)l(b)t(er)e(generators) --30 2556 y Fr(A)31 b(random)e(generator)k(is)e(a)g(mac)m(hine)g(whic)m -(h)g(pro)s(duces)f(\(pseudo-\)random)f(n)m(um)m(b)s(ers.)41 -b(The)30 b(include)h(\014le)g Fp()c -Fr(de\014nes)h(a)i(class)g Fp(cl_random_state)25 b Fr(whic)m(h)k(con)m -(tains)h(the)g(state)h(of)e(a)h(random)d(generator.)42 -b(If)29 b(y)m(ou)-30 2775 y(mak)m(e)i(a)g(cop)m(y)h(of)f(the)h(random)d -(n)m(um)m(b)s(er)f(generator,)33 b(the)e(original)h(one)g(and)e(the)h -(cop)m(y)h(will)f(pro)s(duce)f(the)i(same)-30 2885 y(sequence)f(of)f -(random)f(n)m(um)m(b)s(ers.)-30 3015 y(The)j(follo)m(wing)i(functions)d -(return)h(\(pseudo-\)random)e(n)m(um)m(b)s(ers)g(in)i(di\013eren)m(t)h -(formats.)45 b(Calling)33 b(one)g(of)f(these)-30 3125 -y(mo)s(di\014es)d(the)h(state)i(of)e(the)h(random)e(n)m(um)m(b)s(er)f -(generator)j(in)f(a)h(complicated)g(but)f(deterministic)g(w)m(a)m(y)-8 -b(.)-30 3255 y(The)30 b(global)i(v)-5 b(ariable)210 3380 -y Fp(cl_random_state)44 b(cl_default_random_state)-30 -3511 y Fr(con)m(tains)29 b(a)f(default)f(random)f(n)m(um)m(b)s(er)f -(generator.)41 b(It)28 b(is)f(used)g(when)g(the)g(functions)h(b)s(elo)m -(w)f(are)h(called)h(without)-30 3620 y Fp(cl_random_state)d -Fr(argumen)m(t.)-30 3772 y Fp(uint32)j(random32)f(\(cl_random_state&)d -(randomstate\))-30 3881 y(uint32)k(random32)f(\(\))450 -3991 y Fr(Returns)h(a)i(random)e(unsigned)g(32-bit)j(n)m(um)m(b)s(er.) -38 b(All)31 b(bits)f(are)h(equally)g(random.)-30 4143 -y Fp(cl_I)e(random_I)f(\(cl_random_state&)e(randomstate,)h(const)i -(cl_I&)g(n\))-30 4252 y(cl_I)g(random_I)f(\(const)h(cl_I&)g(n\))450 -4362 y(n)i Fr(m)m(ust)e(b)s(e)h(an)h(in)m(teger)h Fp(>)f -Fr(0.)42 b(This)31 b(function)f(returns)g(a)h(random)e(in)m(teger)j -Fp(x)f Fr(in)f(the)h(range)g Fp(0)g(<=)e(x)450 4471 y(<)h(n)p -Fr(.)-30 4623 y Fp(cl_F)f(random_F)f(\(cl_random_state&)e(randomstate,) -h(const)i(cl_F&)g(n\))-30 4732 y(cl_F)g(random_F)f(\(const)h(cl_F&)g -(n\))450 4842 y(n)d Fr(m)m(ust)f(b)s(e)h(a)h(\015oat)g -Fp(>)f Fr(0.)40 b(This)26 b(function)g(returns)f(a)i(random)d +-30 2556 y Fr(A)j(random)e(generator)j(is)f(a)h(mac)m(hine)e(whic)m(h)h +(pro)s(duces)e(\(pseudo-\)random)h(n)m(um)m(b)s(ers.)88 +b(The)46 b(include)h(\014le)-30 2666 y Fp()40 +b Fr(de\014nes)j(a)h(class)h Fp(random_state)c Fr(whic)m(h)i(con)m +(tains)j(the)e(state)h(of)f(a)g(random)f(generator.)-30 +2775 y(If)29 b(y)m(ou)g(mak)m(e)g(a)g(cop)m(y)h(of)f(the)h(random)d(n)m +(um)m(b)s(er)g(generator,)j(the)g(original)g(one)f(and)f(the)i(cop)m(y) +f(will)h(pro)s(duce)e(the)-30 2885 y(same)i(sequence)h(of)f(random)f(n) +m(um)m(b)s(ers.)-30 3015 y(The)j(follo)m(wing)i(functions)d(return)h +(\(pseudo-\)random)e(n)m(um)m(b)s(ers)g(in)i(di\013eren)m(t)h(formats.) +45 b(Calling)33 b(one)g(of)f(these)-30 3125 y(mo)s(di\014es)d(the)h +(state)i(of)e(the)h(random)e(n)m(um)m(b)s(er)f(generator)j(in)f(a)h +(complicated)g(but)f(deterministic)g(w)m(a)m(y)-8 b(.)-30 +3255 y(The)30 b(global)i(v)-5 b(ariable)210 3380 y Fp(random_state)44 +b(default_random_state)-30 3511 y Fr(con)m(tains)29 b(a)f(default)f +(random)f(n)m(um)m(b)s(er)f(generator.)41 b(It)28 b(is)f(used)g(when)g +(the)g(functions)h(b)s(elo)m(w)f(are)h(called)h(without)-30 +3620 y Fp(random_state)e Fr(argumen)m(t.)-30 3772 y Fp(uint32)i +(random32)f(\(random_state&)e(randomstate\))-30 3881 +y(uint32)j(random32)f(\(\))450 3991 y Fr(Returns)h(a)i(random)e +(unsigned)g(32-bit)j(n)m(um)m(b)s(er.)38 b(All)31 b(bits)f(are)h +(equally)g(random.)-30 4143 y Fp(cl_I)e(random_I)f(\(random_state&)f +(randomstate,)g(const)i(cl_I&)g(n\))-30 4252 y(cl_I)g(random_I)f +(\(const)h(cl_I&)g(n\))450 4362 y(n)i Fr(m)m(ust)e(b)s(e)h(an)h(in)m +(teger)h Fp(>)f Fr(0.)42 b(This)31 b(function)f(returns)g(a)h(random)e +(in)m(teger)j Fp(x)f Fr(in)f(the)h(range)g Fp(0)g(<=)e(x)450 +4471 y(<)h(n)p Fr(.)-30 4623 y Fp(cl_F)f(random_F)f(\(random_state&)f +(randomstate,)g(const)i(cl_F&)g(n\))-30 4732 y(cl_F)g(random_F)f +(\(const)h(cl_F&)g(n\))450 4842 y(n)d Fr(m)m(ust)f(b)s(e)h(a)h(\015oat) +g Fp(>)f Fr(0.)40 b(This)26 b(function)g(returns)f(a)i(random)d (\015oating-p)s(oin)m(t)k(n)m(um)m(b)s(er)c(of)j(the)g(same)450 4952 y(format)j(as)g Fp(n)g Fr(in)g(the)h(range)g Fp(0)f(<=)f(x)i(<)f -(n)p Fr(.)-30 5103 y Fp(cl_R)f(random_R)f(\(cl_random_state&)e -(randomstate,)h(const)i(cl_R&)g(n\))-30 5213 y(cl_R)g(random_R)f +(n)p Fr(.)-30 5103 y Fp(cl_R)f(random_R)f(\(random_state&)f +(randomstate,)g(const)i(cl_R&)g(n\))-30 5213 y(cl_R)g(random_R)f (\(const)h(cl_R&)g(n\))450 5322 y Fr(Beha)m(v)m(es)j(lik)m(e)g Fp(random_I)c Fr(if)i Fp(n)g Fr(is)h(an)f(in)m(teger)i(and)e(lik)m(e)h Fp(random_F)d Fr(if)j Fp(n)f Fr(is)g(a)h(\015oat.)p eop @@ -3560,224 +3582,219 @@ Fp(i)p Fr(')g(is)g(then)g(read)f(as)i(a)630 5177 y(digit.)630 Fl(realpart)32 b(imagpart)r Fp(\))p Fr(.)p eop %%Page: 29 31 29 30 bop -30 -116 a Fr(Chapter)30 b(5:)41 b(Input/Output)2844 -b(29)-30 299 y Fs(5.2)68 b(Input)44 b(functions)-30 491 -y Fr(Including)28 b Fp()e Fr(de\014nes)h(a)i(t)m(yp)s(e)g -Fp(cl_istream)p Fr(,)d(whic)m(h)i(is)h(the)g(t)m(yp)s(e)f(of)h(the)g -(\014rst)e(argumen)m(t)h(to)h(all)h(input)-30 601 y(functions.)40 -b(Unless)28 b(y)m(ou)h(build)f(and)g(use)g(CLN)h(with)f(the)h(macro)f -(CL)p 2391 601 28 4 v 32 w(IO)p 2527 601 V 33 w(STDIO)f(b)s(eing)i -(de\014ned,)f Fp(cl_istream)-30 710 y Fr(is)i(the)h(same)f(as)g -Fp(istream&)p Fr(.)-30 844 y(The)g(v)-5 b(ariable)150 -978 y Fp(cl_istream)28 b(cl_stdin)-30 1137 y Fr(con)m(tains)k(the)e -(standard)g(input)f(stream.)-30 1271 y(These)h(are)h(the)f(simple)g -(input)f(functions:)-30 1430 y Fp(int)g(freadchar)f(\(cl_istream)g -(stream\))450 1539 y Fr(Reads)37 b(a)f(c)m(haracter)j(from)c -Fp(stream)p Fr(.)57 b(Returns)35 b Fp(cl_EOF)g Fr(\(not)i(a)g(`)p +b(29)-30 299 y Fs(5.2)68 b(Input)44 b(functions)-30 486 +y Fr(Including)25 b Fp()d Fr(de\014nes)j(a)h(t)m(yp)s(e)f +Fp(cl_istream)p Fr(,)f(whic)m(h)i(is)f(the)h(t)m(yp)s(e)f(of)h(the)g +(\014rst)e(argumen)m(t)h(to)i(all)f(input)-30 595 y(functions.)40 +b Fp(cl_istream)28 b Fr(is)i(the)h(same)f(as)g Fp(std::istream&)p +Fr(.)-30 724 y(The)g(v)-5 b(ariable)150 852 y Fp(cl_istream)28 +b(stdin)-30 1000 y Fr(con)m(tains)k(the)e(standard)g(input)f(stream.) +-30 1129 y(These)h(are)h(the)f(simple)g(input)f(functions:)-30 +1276 y Fp(int)g(freadchar)f(\(cl_istream)g(stream\))450 +1386 y Fr(Reads)37 b(a)f(c)m(haracter)j(from)c Fp(stream)p +Fr(.)57 b(Returns)35 b Fp(cl_EOF)g Fr(\(not)i(a)g(`)p Fp(char)p Fr('!\))59 b(if)36 b(the)h(end)f(of)h(stream)450 -1649 y(w)m(as)31 b(encoun)m(tered)g(or)f(an)g(error)g(o)s(ccurred.)-30 -1807 y Fp(int)f(funreadchar)f(\(cl_istream)f(stream,)h(int)i(c\))450 -1917 y Fr(Puts)41 b(bac)m(k)h Fp(c)f Fr(on)m(to)i Fp(stream)p +1495 y(w)m(as)31 b(encoun)m(tered)g(or)f(an)g(error)g(o)s(ccurred.)-30 +1643 y Fp(int)f(funreadchar)f(\(cl_istream)f(stream,)h(int)i(c\))450 +1753 y Fr(Puts)41 b(bac)m(k)h Fp(c)f Fr(on)m(to)i Fp(stream)p Fr(.)72 b Fp(c)41 b Fr(m)m(ust)f(b)s(e)h(the)h(result)f(of)g(the)h -(last)g Fp(freadchar)d Fr(op)s(eration)j(on)450 2027 -y Fp(stream)p Fr(.)-30 2185 y(Eac)m(h)d(of)f(the)g(classes)h -Fp(cl_N)p Fr(,)g Fp(cl_R)p Fr(,)g Fp(cl_RA)p Fr(,)g Fp(cl_I)p -Fr(,)g Fp(cl_F)p Fr(,)g Fp(cl_SF)p Fr(,)g Fp(cl_FF)p -Fr(,)g Fp(cl_DF)p Fr(,)f Fp(cl_LF)f Fr(de\014nes,)i(in)f -Fp()p Fr(,)29 -b(the)i(follo)m(wing)h(input)d(function:)-30 2453 y Fp(cl_istream)f -(operator>>)f(\(cl_istream)g(stream,)i Fl(t)m(yp)s(e)5 -b Fp(&)30 b(result\))450 2563 y Fr(Reads)g(a)h(n)m(um)m(b)s(er)d(from)h -Fp(stream)g Fr(and)h(stores)g(it)h(in)f(the)h Fp(result)p -Fr(.)-30 2721 y(The)f(most)g(\015exible)g(input)g(functions,)g -(de\014ned)f(in)h Fp()p -Fr(,)28 b(are)j(the)f(follo)m(wing:)-30 2880 y Fp(cl_N)f(read_complex)e -(\(cl_istream)h(stream,)g(const)h(cl_read_flags&)d(flags\))-30 -2990 y(cl_R)j(read_real)f(\(cl_istream)f(stream,)i(const)g -(cl_read_flags&)d(flags\))-30 3099 y(cl_F)j(read_float)f(\(cl_istream)f -(stream,)h(const)h(cl_read_flags&)e(flags\))-30 3209 -y(cl_RA)i(read_rational)e(\(cl_istream)g(stream,)h(const)h -(cl_read_flags&)e(flags\))-30 3318 y(cl_I)i(read_integer)e +(last)g Fp(freadchar)d Fr(op)s(eration)j(on)450 1862 +y Fp(stream)p Fr(.)-30 2010 y(Eac)m(h)53 b(of)f(the)g(classes)i +Fp(cl_N)p Fr(,)i Fp(cl_R)p Fr(,)h Fp(cl_RA)p Fr(,)f Fp(cl_I)p +Fr(,)h Fp(cl_F)p Fr(,)f Fp(cl_SF)p Fr(,)h Fp(cl_FF)p +Fr(,)f Fp(cl_DF)p Fr(,)h Fp(cl_LF)50 b Fr(de\014nes,)57 +b(in)-30 2119 y Fp()p +Fr(,)28 b(the)i(follo)m(wing)i(input)e(function:)-30 +2267 y Fp(cl_istream)e(operator>>)f(\(cl_istream)g(stream,)i +Fl(t)m(yp)s(e)5 b Fp(&)30 b(result\))450 2377 y Fr(Reads)g(a)h(n)m(um)m +(b)s(er)d(from)h Fp(stream)g Fr(and)h(stores)g(it)h(in)f(the)h +Fp(result)p Fr(.)-30 2524 y(The)f(most)g(\015exible)g(input)g +(functions,)g(de\014ned)f(in)h Fp()p Fr(,)28 b(are)j(the)f(follo)m(wing:)-30 +2672 y Fp(cl_N)f(read_complex)e(\(cl_istream)h(stream,)g(const)h +(cl_read_flags&)d(flags\))-30 2781 y(cl_R)j(read_real)f(\(cl_istream)f +(stream,)i(const)g(cl_read_flags&)d(flags\))-30 2891 +y(cl_F)j(read_float)f(\(cl_istream)f(stream,)h(const)h(cl_read_flags&)e +(flags\))-30 3001 y(cl_RA)i(read_rational)e(\(cl_istream)g(stream,)h +(const)h(cl_read_flags&)e(flags\))-30 3110 y(cl_I)i(read_integer)e (\(cl_istream)h(stream,)g(const)h(cl_read_flags&)d(flags\))450 -3428 y Fr(Reads)i(a)g(n)m(um)m(b)s(er)e(from)g Fp(stream)p +3220 y Fr(Reads)i(a)g(n)m(um)m(b)s(er)e(from)g Fp(stream)p Fr(.)38 b(The)27 b Fp(flags)g Fr(are)h(parameters)f(whic)m(h)h -(a\013ect)h(the)f(input)f(syn)m(tax.)450 3538 y(Whitespace)32 +(a\013ect)h(the)f(input)f(syn)m(tax.)450 3329 y(Whitespace)32 b(b)s(efore)e(the)g(n)m(um)m(b)s(er)e(is)j(silen)m(tly)h(skipp)s(ed.) --30 3696 y Fp(cl_N)d(read_complex)e(\(const)i(cl_read_flags&)d(flags,)j -(const)g(char)g(*)h(string,)f(const)g(char)g(*)-30 3806 +-30 3477 y Fp(cl_N)d(read_complex)e(\(const)i(cl_read_flags&)d(flags,)j +(const)g(char)g(*)h(string,)f(const)g(char)g(*)-30 3587 y(string_limit,)e(const)i(char)g(*)h(*)g(end_of_parse\))-30 -3915 y(cl_R)f(read_real)f(\(const)h(cl_read_flags&)d(flags,)j(const)g -(char)g(*)h(string,)e(const)h(char)h(*)-30 4025 y(string_limit,)d -(const)i(char)g(*)h(*)g(end_of_parse\))-30 4134 y(cl_F)f(read_float)f +3696 y(cl_R)f(read_real)f(\(const)h(cl_read_flags&)d(flags,)j(const)g +(char)g(*)h(string,)e(const)h(char)h(*)-30 3806 y(string_limit,)d +(const)i(char)g(*)h(*)g(end_of_parse\))-30 3915 y(cl_F)f(read_float)f (\(const)g(cl_read_flags&)f(flags,)i(const)g(char)g(*)h(string,)e -(const)h(char)g(*)-30 4244 y(string_limit,)e(const)i(char)g(*)h(*)g -(end_of_parse\))-30 4354 y(cl_RA)f(read_rational)e(\(const)h +(const)h(char)g(*)-30 4025 y(string_limit,)e(const)i(char)g(*)h(*)g +(end_of_parse\))-30 4134 y(cl_RA)f(read_rational)e(\(const)h (cl_read_flags&)f(flags,)h(const)h(char)h(*)g(string,)e(const)h(char)g -(*)-30 4463 y(string_limit,)e(const)i(char)g(*)h(*)g(end_of_parse\))-30 -4573 y(cl_I)f(read_integer)e(\(const)i(cl_read_flags&)d(flags,)j(const) -g(char)g(*)h(string,)f(const)g(char)g(*)-30 4682 y(string_limit,)e -(const)i(char)g(*)h(*)g(end_of_parse\))450 4792 y Fr(Reads)k(a)h(n)m +(*)-30 4244 y(string_limit,)e(const)i(char)g(*)h(*)g(end_of_parse\))-30 +4354 y(cl_I)f(read_integer)e(\(const)i(cl_read_flags&)d(flags,)j(const) +g(char)g(*)h(string,)f(const)g(char)g(*)-30 4463 y(string_limit,)e +(const)i(char)g(*)h(*)g(end_of_parse\))450 4573 y Fr(Reads)k(a)h(n)m (um)m(b)s(er)d(from)g(a)j(string)f(in)g(memory)-8 b(.)50 b(The)34 b Fp(flags)e Fr(are)j(parameters)e(whic)m(h)h(a\013ect)i(the) -450 4902 y(input)31 b(syn)m(tax.)46 b(The)31 b(string)h(starts)g(at)h +450 4682 y(input)31 b(syn)m(tax.)46 b(The)31 b(string)h(starts)g(at)h Fp(string)d Fr(and)i(ends)f(at)h Fp(string_limit)d Fr(\(exclusiv)m(e)34 -b(limit\).)450 5011 y Fp(string_limit)29 b Fr(ma)m(y)i(also)i(b)s(e)f +b(limit\).)450 4792 y Fp(string_limit)29 b Fr(ma)m(y)i(also)i(b)s(e)f Fp(NULL)p Fr(,)f(denoting)i(the)f(en)m(tire)h(string,)g(i.e.)47 -b(equiv)-5 b(alen)m(t)33 b(to)g Fp(string_)450 5121 y(limit)c(=)h +b(equiv)-5 b(alen)m(t)33 b(to)g Fp(string_)450 4902 y(limit)c(=)h (string)f(+)h(strlen\(string\))p Fr(.)75 b(If)42 b Fp(end_of_parse)e Fr(is)j Fp(NULL)p Fr(,)j(the)d(string)g(in)g(memory)450 -5230 y(m)m(ust)30 b(con)m(tain)j(exactly)g(one)f(n)m(um)m(b)s(er)d(and) +5011 y(m)m(ust)30 b(con)m(tain)j(exactly)g(one)f(n)m(um)m(b)s(er)d(and) i(nothing)g(more,)g(else)i(a)f(fatal)g(error)f(will)h(b)s(e)f -(signalled.)450 5340 y(If)37 b Fp(end_of_parse)d Fr(is)k(not)g +(signalled.)450 5121 y(If)37 b Fp(end_of_parse)d Fr(is)k(not)g Fp(NULL)p Fr(,)g Fp(*end_of_parse)c Fr(will)k(b)s(e)f(assigned)h(a)g(p) -s(oin)m(ter)g(past)f(the)h(last)p eop +s(oin)m(ter)g(past)f(the)h(last)450 5230 y(parsed)32 +b(c)m(haracter)h(\(i.e.)48 b Fp(string_limit)29 b Fr(if)j(nothing)g +(came)g(after)h(the)g(n)m(um)m(b)s(er\).)44 b(Whitespace)34 +b(is)450 5340 y(not)d(allo)m(w)m(ed.)p eop %%Page: 30 32 30 31 bop -30 -116 a Fr(Chapter)30 b(5:)41 b(Input/Output)2844 -b(30)450 299 y(parsed)32 b(c)m(haracter)h(\(i.e.)48 b -Fp(string_limit)29 b Fr(if)j(nothing)g(came)g(after)h(the)g(n)m(um)m(b) -s(er\).)44 b(Whitespace)34 b(is)450 408 y(not)d(allo)m(w)m(ed.)-30 -565 y(The)f(structure)g Fp(cl_read_flags)d Fr(con)m(tains)k(the)g -(follo)m(wing)g(\014elds:)-30 721 y Fp(cl_read_syntax_t)26 -b(syntax)450 830 y Fr(The)i(p)s(ossible)f(results)h(of)g(the)h(read)f -(op)s(eration.)40 b(P)m(ossible)29 b(v)-5 b(alues)28 -b(are)h Fp(syntax_number)p Fr(,)c Fp(syntax_)450 940 -y(real)p Fr(,)49 b Fp(syntax_rational)p Fr(,)e Fp(syntax_integer)p +b(30)-30 299 y(The)30 b(structure)g Fp(cl_read_flags)d +Fr(con)m(tains)k(the)g(follo)m(wing)g(\014elds:)-30 461 +y Fp(cl_read_syntax_t)26 b(syntax)450 570 y Fr(The)i(p)s(ossible)f +(results)h(of)g(the)h(read)f(op)s(eration.)40 b(P)m(ossible)29 +b(v)-5 b(alues)28 b(are)h Fp(syntax_number)p Fr(,)c Fp(syntax_)450 +680 y(real)p Fr(,)49 b Fp(syntax_rational)p Fr(,)e Fp(syntax_integer)p Fr(,)g Fp(syntax_float)p Fr(,)g Fp(syntax_sfloat)p Fr(,)g -Fp(syntax_)450 1050 y(ffloat)p Fr(,)29 b Fp(syntax_dfloat)p -Fr(,)e Fp(syntax_lfloat)p Fr(.)-30 1206 y Fp(cl_read_lsyntax_t)f -(lsyntax)450 1315 y Fr(Sp)s(eci\014es)31 b(the)g(language-dep)s(enden)m +Fp(syntax_)450 789 y(ffloat)p Fr(,)29 b Fp(syntax_dfloat)p +Fr(,)e Fp(syntax_lfloat)p Fr(.)-30 950 y Fp(cl_read_lsyntax_t)f +(lsyntax)450 1060 y Fr(Sp)s(eci\014es)31 b(the)g(language-dep)s(enden)m (t)h(syn)m(tax)g(v)-5 b(arian)m(t)32 b(for)f(the)h(read)f(op)s -(eration.)43 b(P)m(ossible)33 b(v)-5 b(alues)450 1425 -y(are)450 1581 y Fp(lsyntax_standard)930 1691 y Fr(accept)32 +(eration.)43 b(P)m(ossible)33 b(v)-5 b(alues)450 1169 +y(are)450 1330 y Fp(lsyntax_standard)930 1440 y Fr(accept)32 b(standard)d(algebraic)j(notation)g(only)-8 b(,)31 b(no)g(complex)f(n)m -(um)m(b)s(ers,)450 1847 y Fp(lsyntax_algebraic)930 1957 +(um)m(b)s(ers,)450 1601 y Fp(lsyntax_algebraic)930 1710 y Fr(accept)i(the)e(algebraic)i(notation)g Fl(x)6 b Fp(+)p Fl(y)i Fp(i)30 b Fr(for)g(complex)g(n)m(um)m(b)s(ers,)450 -2113 y Fp(lsyntax_commonlisp)930 2222 y Fr(accept)49 +1871 y Fp(lsyntax_commonlisp)930 1981 y Fr(accept)49 b(the)g Fp(#b)p Fr(,)j Fp(#o)p Fr(,)g Fp(#x)47 b Fr(syn)m(taxes)i(for)f (binary)-8 b(,)52 b(o)s(ctal,)i(hexadecimal)48 b(n)m(um)m(b)s(ers,)930 -2332 y Fp(#)p Fl(base)5 b Fp(R)25 b Fr(for)f(rational)i(n)m(um)m(b)s +2090 y Fp(#)p Fl(base)5 b Fp(R)25 b Fr(for)f(rational)i(n)m(um)m(b)s (ers)d(in)h(a)i(giv)m(en)g(base,)g Fp(#c\()p Fl(realpart)32 -b(imagpart)r Fp(\))24 b Fr(for)h(com-)930 2441 y(plex)30 -b(n)m(um)m(b)s(ers,)450 2598 y Fp(lsyntax_all)930 2707 -y Fr(accept)i(all)f(of)g(these)f(extensions.)-30 2863 -y Fp(unsigned)e(int)i(rational_base)450 2973 y Fr(The)g(base)g(in)g +b(imagpart)r Fp(\))24 b Fr(for)h(com-)930 2200 y(plex)30 +b(n)m(um)m(b)s(ers,)450 2361 y Fp(lsyntax_all)930 2471 +y Fr(accept)i(all)f(of)g(these)f(extensions.)-30 2631 +y Fp(unsigned)e(int)i(rational_base)450 2741 y Fr(The)g(base)g(in)g (whic)m(h)h(rational)g(n)m(um)m(b)s(ers)d(are)j(read.)-30 -3129 y Fp(cl_float_format_t)26 b(float_flags.default_flo)o(at_f)o(orm)o -(at)450 3239 y Fr(The)k(\015oat)h(format)f(used)f(when)h(reading)g +2902 y Fp(cl_float_format_t)26 b(float_flags.default_flo)o(at_f)o(orm)o +(at)450 3012 y Fr(The)k(\015oat)h(format)f(used)f(when)h(reading)g (\015oats)h(with)f(exp)s(onen)m(t)g(mark)m(er)g(`)p Fp(e)p -Fr('.)-30 3395 y Fp(cl_float_format_t)c(float_flags.default_lfl)o(oat_) -o(for)o(mat)450 3505 y Fr(The)k(\015oat)h(format)f(used)f(when)h +Fr('.)-30 3172 y Fp(cl_float_format_t)c(float_flags.default_lfl)o(oat_) +o(for)o(mat)450 3282 y Fr(The)k(\015oat)h(format)f(used)f(when)h (reading)g(\015oats)h(with)f(exp)s(onen)m(t)g(mark)m(er)g(`)p -Fp(l)p Fr('.)-30 3661 y Fp(cl_boolean)e(float_flags.mantissa_de)o(pen)o -(dent)o(_flo)o(at_)o(form)o(at)450 3770 y Fr(When)h(this)g(\015ag)h(is) +Fp(l)p Fr('.)-30 3443 y Fp(cl_boolean)e(float_flags.mantissa_de)o(pen)o +(dent)o(_flo)o(at_)o(form)o(at)450 3553 y Fr(When)h(this)g(\015ag)h(is) f(true,)g(\015oats)h(sp)s(eci\014ed)e(with)h(more)g(digits)g(than)g -(corresp)s(onding)g(to)g(the)h(exp)s(o-)450 3880 y(nen)m(t)g(mark)m(er) -e(they)i(con)m(tain,)h(but)e(without)p 2018 3880 28 4 +(corresp)s(onding)g(to)g(the)h(exp)s(o-)450 3662 y(nen)m(t)g(mark)m(er) +e(they)i(con)m(tain,)h(but)e(without)p 2018 3662 28 4 v 62 w Fl(nnn)e Fr(su\016x,)i(will)h(get)h(a)e(precision)h(corresp)s -(onding)e(to)450 3990 y(their)i(n)m(um)m(b)s(er)e(of)j(signi\014can)m -(t)g(digits.)-30 4242 y Fs(5.3)68 b(Output)45 b(functions)-30 -4433 y Fr(Including)24 b Fp()f Fr(de\014nes)h(a)h(t)m(yp)s(e)g -Fp(cl_ostream)p Fr(,)f(whic)m(h)g(is)h(the)h(t)m(yp)s(e)f(of)g(the)g -(\014rst)f(argumen)m(t)h(to)g(all)h(output)-30 4543 y(functions.)40 -b(Unless)28 b(y)m(ou)h(build)f(and)g(use)g(CLN)h(with)f(the)h(macro)f -(CL)p 2391 4543 V 32 w(IO)p 2527 4543 V 33 w(STDIO)f(b)s(eing)i -(de\014ned,)f Fp(cl_ostream)-30 4652 y Fr(is)i(the)h(same)f(as)g -Fp(ostream&)p Fr(.)-30 4785 y(The)g(v)-5 b(ariable)150 -4918 y Fp(cl_ostream)28 b(cl_stdout)-30 5074 y Fr(con)m(tains)k(the)e -(standard)g(output)g(stream.)-30 5207 y(The)g(v)-5 b(ariable)150 -5340 y Fp(cl_ostream)28 b(cl_stderr)p eop +(onding)e(to)450 3772 y(their)i(n)m(um)m(b)s(er)e(of)j(signi\014can)m +(t)g(digits.)-30 4033 y Fs(5.3)68 b(Output)45 b(functions)-30 +4227 y Fr(Including)40 b Fp()f Fr(de\014nes)h(a)i(t)m(yp)s(e) +f Fp(cl_ostream)p Fr(,)g(whic)m(h)g(is)h(the)f(t)m(yp)s(e)g(of)h(the)f +(\014rst)f(argumen)m(t)h(to)h(all)-30 4337 y(output)30 +b(functions.)40 b Fp(cl_ostream)28 b Fr(is)i(the)h(same)f(as)g +Fp(std::ostream&)p Fr(.)-30 4473 y(The)g(v)-5 b(ariable)150 +4609 y Fp(cl_ostream)28 b(stdout)-30 4770 y Fr(con)m(tains)k(the)e +(standard)g(output)g(stream.)-30 4906 y(The)g(v)-5 b(ariable)150 +5042 y Fp(cl_ostream)28 b(stderr)-30 5204 y Fr(con)m(tains)k(the)e +(standard)g(error)g(output)g(stream.)-30 5340 y(These)g(are)h(the)f +(simple)g(output)g(functions:)p eop %%Page: 31 33 31 32 bop -30 -116 a Fr(Chapter)30 b(5:)41 b(Input/Output)2844 -b(31)-30 299 y(con)m(tains)32 b(the)e(standard)g(error)g(output)g -(stream.)-30 444 y(These)g(are)h(the)f(simple)g(output)g(functions:)-30 -618 y Fp(void)f(fprintchar)f(\(cl_ostream)f(stream,)h(char)i(c\))450 -728 y Fr(Prin)m(ts)g(the)h(c)m(haracter)h Fp(x)e Fr(literally)i(on)e -(the)h Fp(stream)p Fr(.)-30 897 y Fp(void)e(fprint)g(\(cl_ostream)e -(stream,)i(const)f(char)i(*)g(string\))450 1007 y Fr(Prin)m(ts)g(the)h -Fp(string)d Fr(literally)33 b(on)d(the)g Fp(stream)p -Fr(.)-30 1176 y Fp(void)f(fprintdecimal)e(\(cl_ostream)g(stream,)i(int) -g(x\))-30 1286 y(void)g(fprintdecimal)e(\(cl_ostream)g(stream,)i(const) -g(cl_I&)g(x\))450 1396 y Fr(Prin)m(ts)h(the)h(in)m(teger)h -Fp(x)e Fr(in)g(decimal)g(on)g(the)h Fp(stream)p Fr(.)-30 -1565 y Fp(void)e(fprintbinary)e(\(cl_ostream)h(stream,)g(const)h(cl_I&) -g(x\))450 1675 y Fr(Prin)m(ts)h(the)h(in)m(teger)h Fp(x)e +b(31)-30 299 y Fp(void)29 b(fprintchar)f(\(cl_ostream)f(stream,)h(char) +i(c\))450 408 y Fr(Prin)m(ts)g(the)h(c)m(haracter)h Fp(x)e +Fr(literally)i(on)e(the)h Fp(stream)p Fr(.)-30 574 y +Fp(void)e(fprint)g(\(cl_ostream)e(stream,)i(const)f(char)i(*)g +(string\))450 683 y Fr(Prin)m(ts)g(the)h Fp(string)d +Fr(literally)33 b(on)d(the)g Fp(stream)p Fr(.)-30 848 +y Fp(void)f(fprintdecimal)e(\(cl_ostream)g(stream,)i(int)g(x\))-30 +958 y(void)g(fprintdecimal)e(\(cl_ostream)g(stream,)i(const)g(cl_I&)g +(x\))450 1068 y Fr(Prin)m(ts)h(the)h(in)m(teger)h Fp(x)e +Fr(in)g(decimal)g(on)g(the)h Fp(stream)p Fr(.)-30 1233 +y Fp(void)e(fprintbinary)e(\(cl_ostream)h(stream,)g(const)h(cl_I&)g +(x\))450 1342 y Fr(Prin)m(ts)h(the)h(in)m(teger)h Fp(x)e Fr(in)g(binary)f(\(base)i(2,)g(without)g(pre\014x\))e(on)h(the)h -Fp(stream)p Fr(.)-30 1844 y Fp(void)e(fprintoctal)f(\(cl_ostream)f -(stream,)h(const)h(cl_I&)g(x\))450 1954 y Fr(Prin)m(ts)h(the)h(in)m +Fp(stream)p Fr(.)-30 1508 y Fp(void)e(fprintoctal)f(\(cl_ostream)f +(stream,)h(const)h(cl_I&)g(x\))450 1617 y Fr(Prin)m(ts)h(the)h(in)m (teger)h Fp(x)e Fr(in)g(o)s(ctal)h(\(base)g(8,)g(without)g(pre\014x\))e -(on)i(the)f Fp(stream)p Fr(.)-30 2123 y Fp(void)f(fprinthexadecimal)d -(\(cl_ostream)h(stream,)i(const)f(cl_I&)h(x\))450 2233 +(on)i(the)f Fp(stream)p Fr(.)-30 1782 y Fp(void)f(fprinthexadecimal)d +(\(cl_ostream)h(stream,)i(const)f(cl_I&)h(x\))450 1892 y Fr(Prin)m(ts)h(the)h(in)m(teger)h Fp(x)e Fr(in)g(hexadecimal)g (\(base)h(16,)h(without)e(pre\014x\))g(on)g(the)h Fp(stream)p -Fr(.)-30 2408 y(Eac)m(h)39 b(of)f(the)g(classes)h Fp(cl_N)p -Fr(,)g Fp(cl_R)p Fr(,)g Fp(cl_RA)p Fr(,)g Fp(cl_I)p Fr(,)g -Fp(cl_F)p Fr(,)g Fp(cl_SF)p Fr(,)g Fp(cl_FF)p Fr(,)g -Fp(cl_DF)p Fr(,)f Fp(cl_LF)f Fr(de\014nes,)i(in)f Fp()p Fr(,)29 b(the)i(follo)m(wing)h -(output)e(functions:)-30 2692 y Fp(void)f(fprint)g(\(cl_ostream)e -(stream,)i(const)f Fl(t)m(yp)s(e)5 b Fp(&)31 b(x\))-30 -2801 y(cl_ostream)d(operator<<)f(\(cl_ostream)g(stream,)i(const)g -Fl(t)m(yp)s(e)5 b Fp(&)30 b(x\))450 2911 y Fr(Prin)m(ts)42 -b(the)g(n)m(um)m(b)s(er)e Fp(x)i Fr(on)g(the)g Fp(stream)p -Fr(.)75 b(The)41 b(output)h(ma)m(y)g(dep)s(end)e(on)i(the)h(global)g -(prin)m(ter)450 3021 y(settings)23 b(in)e(the)h(v)-5 -b(ariable)22 b Fp(cl_default_print_flags)p Fr(.)32 b(The)21 -b Fp(ostream)f Fr(\015ags)h(and)h(settings)g(\(\015ags,)450 -3130 y(width)30 b(and)f(lo)s(cale\))k(are)e(ignored.)-30 -3305 y(The)f(most)g(\015exible)g(output)g(function,)g(de\014ned)g(in)g -Fp()p Fr(,)28 b(are)j(the)f(follo)m -(wing:)210 3444 y Fp(void)47 b(print_complex)92 b(\(cl_ostream)44 -b(stream,)i(const)g(cl_print_flags&)e(flags,)1212 3548 -y(const)j(cl_N&)f(z\);)210 3651 y(void)h(print_real)236 +Fr(.)-30 2060 y(Eac)m(h)53 b(of)f(the)g(classes)i Fp(cl_N)p +Fr(,)i Fp(cl_R)p Fr(,)h Fp(cl_RA)p Fr(,)f Fp(cl_I)p Fr(,)h +Fp(cl_F)p Fr(,)f Fp(cl_SF)p Fr(,)h Fp(cl_FF)p Fr(,)f +Fp(cl_DF)p Fr(,)h Fp(cl_LF)50 b Fr(de\014nes,)57 b(in)-30 +2170 y Fp()p Fr(,)28 +b(the)i(follo)m(wing)i(output)e(functions:)-30 2338 y +Fp(void)f(fprint)g(\(cl_ostream)e(stream,)i(const)f Fl(t)m(yp)s(e)5 +b Fp(&)31 b(x\))-30 2447 y(cl_ostream)d(operator<<)f(\(cl_ostream)g +(stream,)i(const)g Fl(t)m(yp)s(e)5 b Fp(&)30 b(x\))450 +2557 y Fr(Prin)m(ts)42 b(the)g(n)m(um)m(b)s(er)e Fp(x)i +Fr(on)g(the)g Fp(stream)p Fr(.)75 b(The)41 b(output)h(ma)m(y)g(dep)s +(end)e(on)i(the)h(global)g(prin)m(ter)450 2667 y(settings)36 +b(in)g(the)f(v)-5 b(ariable)37 b Fp(default_print_flags)p +Fr(.)51 b(The)35 b Fp(ostream)e Fr(\015ags)j(and)f(settings)h +(\(\015ags,)450 2776 y(width)30 b(and)f(lo)s(cale\))k(are)e(ignored.) +-30 2944 y(The)f(most)g(\015exible)g(output)g(function,)g(de\014ned)g +(in)g Fp()p Fr(,)28 +b(are)i(the)h(follo)m(wing:)210 3079 y Fp(void)47 b(print_complex)92 b(\(cl_ostream)44 b(stream,)i(const)g(cl_print_flags&)e(flags,)1212 -3755 y(const)j(cl_R&)f(z\);)210 3859 y(void)h(print_float)188 +3183 y(const)j(cl_N&)f(z\);)210 3286 y(void)h(print_real)236 b(\(cl_ostream)44 b(stream,)i(const)g(cl_print_flags&)e(flags,)1212 -3963 y(const)j(cl_F&)f(z\);)210 4066 y(void)h(print_rational)d +3390 y(const)j(cl_R&)f(z\);)210 3494 y(void)h(print_float)188 +b(\(cl_ostream)44 b(stream,)i(const)g(cl_print_flags&)e(flags,)1212 +3598 y(const)j(cl_F&)f(z\);)210 3702 y(void)h(print_rational)d (\(cl_ostream)g(stream,)i(const)g(cl_print_flags&)e(flags,)1212 -4170 y(const)j(cl_RA&)f(z\);)210 4274 y(void)h(print_integer)92 +3805 y(const)j(cl_RA&)f(z\);)210 3909 y(void)h(print_integer)92 b(\(cl_ostream)44 b(stream,)i(const)g(cl_print_flags&)e(flags,)1212 -4378 y(const)j(cl_I&)f(z\);)-30 4522 y Fr(Prin)m(ts)30 +4013 y(const)j(cl_I&)f(z\);)-30 4153 y Fr(Prin)m(ts)30 b(the)h(n)m(um)m(b)s(er)d Fp(x)i Fr(on)g(the)h Fp(stream)p Fr(.)39 b(The)30 b Fp(flags)f Fr(are)h(parameters)g(whic)m(h)g -(a\013ect)i(the)f(output.)-30 4667 y(The)f(structure)g(t)m(yp)s(e)g +(a\013ect)i(the)f(output.)-30 4293 y(The)f(structure)g(t)m(yp)s(e)g Fp(cl_print_flags)d Fr(con)m(tains)k(the)g(follo)m(wing)h(\014elds:)-30 -4842 y Fp(unsigned)c(int)i(rational_base)450 4951 y Fr(The)g(base)g(in) +4462 y Fp(unsigned)c(int)i(rational_base)450 4571 y Fr(The)g(base)g(in) g(whic)m(h)h(rational)g(n)m(um)m(b)s(ers)d(are)j(prin)m(ted.)40 -b(Default)32 b(is)e Fp(10)p Fr(.)-30 5121 y Fp(cl_boolean)e -(rational_readably)450 5230 y Fr(If)34 b(this)h(\015ag)h(is)f(true,)h +b(Default)32 b(is)e Fp(10)p Fr(.)-30 4736 y Fp(cl_boolean)e +(rational_readably)450 4846 y Fr(If)34 b(this)h(\015ag)h(is)f(true,)h (rational)g(n)m(um)m(b)s(ers)c(are)k(prin)m(ted)e(with)h(radix)f(sp)s -(eci\014ers)h(in)f(Common)f(Lisp)450 5340 y(syn)m(tax)e(\()p +(eci\014ers)h(in)f(Common)f(Lisp)450 4956 y(syn)m(tax)e(\()p Fp(#)p Fl(n)p Fp(R)f Fr(or)g Fp(#b)g Fr(or)g Fp(#o)g Fr(or)g Fp(#x)g Fr(pre\014xes,)g(trailing)h(dot\).)41 -b(Default)32 b(is)e(false.)p eop +b(Default)32 b(is)e(false.)-30 5121 y Fp(cl_boolean)e(float_readably) +450 5230 y Fr(If)34 b(this)g(\015ag)h(is)f(true,)i(t)m(yp)s(e)e(sp)s +(eci\014c)g(exp)s(onen)m(t)h(mark)m(ers)e(ha)m(v)m(e)j(precedence)f(o)m +(v)m(er)g('E'.)g(Default)h(is)450 5340 y(false.)p eop %%Page: 32 34 32 33 bop -30 -116 a Fr(Chapter)30 b(5:)41 b(Input/Output)2844 -b(32)-30 299 y Fp(cl_boolean)28 b(float_readably)450 -408 y Fr(If)34 b(this)g(\015ag)h(is)f(true,)i(t)m(yp)s(e)e(sp)s -(eci\014c)g(exp)s(onen)m(t)h(mark)m(ers)e(ha)m(v)m(e)j(precedence)f(o)m -(v)m(er)g('E'.)g(Default)h(is)450 518 y(false.)-30 677 -y Fp(cl_float_format_t)26 b(default_float_format)450 -787 y Fr(Floating)40 b(p)s(oin)m(t)d(n)m(um)m(b)s(ers)e(of)j(this)f +b(32)-30 299 y Fp(cl_float_format_t)26 b(default_float_format)450 +408 y Fr(Floating)40 b(p)s(oin)m(t)d(n)m(um)m(b)s(ers)e(of)j(this)f (format)g(will)h(b)s(e)f(prin)m(ted)g(using)g(the)h('E')g(exp)s(onen)m -(t)f(mark)m(er.)450 897 y(Default)31 b(is)g Fp(cl_float_format_ffloat)p -Fr(.)-30 1056 y Fp(cl_boolean)d(complex_readably)450 -1166 y Fr(If)41 b(this)g(\015ag)g(is)h(true,)i(complex)c(n)m(um)m(b)s -(ers)f(will)j(b)s(e)e(prin)m(ted)h(using)g(the)g(Common)e(Lisp)h(syn)m -(tax)450 1275 y Fp(#C\()p Fl(realpart)32 b(imagpart)r -Fp(\))p Fr(.)40 b(Default)32 b(is)e(false.)-30 1435 y -Fp(cl_string)e(univpoly_varname)450 1544 y Fr(Univ)-5 -b(ariate)37 b(p)s(olynomials)d(with)i(no)f(explicit)i(indeterminate)e -(name)f(will)i(b)s(e)f(prin)m(ted)g(using)g(this)450 -1654 y(v)-5 b(ariable)31 b(name.)40 b(Default)31 b(is)g -Fp("x")p Fr(.)-30 1813 y(The)43 b(global)j(v)-5 b(ariable)45 -b Fp(cl_default_print_flags)37 b Fr(con)m(tains)46 b(the)e(default)g(v) --5 b(alues,)48 b(used)43 b(b)m(y)h(the)g(function)-30 -1923 y Fp(fprint)p Fr(.)p eop +(t)f(mark)m(er.)450 518 y(Default)31 b(is)g Fp(cl_float_format_ffloat)p +Fr(.)-30 677 y Fp(cl_boolean)d(complex_readably)450 787 +y Fr(If)41 b(this)g(\015ag)g(is)h(true,)i(complex)c(n)m(um)m(b)s(ers)f +(will)j(b)s(e)e(prin)m(ted)h(using)g(the)g(Common)e(Lisp)h(syn)m(tax) +450 897 y Fp(#C\()p Fl(realpart)32 b(imagpart)r Fp(\))p +Fr(.)40 b(Default)32 b(is)e(false.)-30 1056 y Fp(cl_string)e +(univpoly_varname)450 1166 y Fr(Univ)-5 b(ariate)37 b(p)s(olynomials)d +(with)i(no)f(explicit)i(indeterminate)e(name)f(will)i(b)s(e)f(prin)m +(ted)g(using)g(this)450 1275 y(v)-5 b(ariable)31 b(name.)40 +b(Default)31 b(is)g Fp("x")p Fr(.)-30 1435 y(The)26 b(global)i(v)-5 +b(ariable)27 b Fp(default_print_flags)21 b Fr(con)m(tains)28 +b(the)f(default)f(v)-5 b(alues,)28 b(used)e(b)m(y)g(the)h(function)f +Fp(fprint)p Fr(.)p eop %%Page: 33 35 33 34 bop -30 -116 a Fr(Chapter)30 b(6:)41 b(Rings)3180 b(33)-30 299 y Fo(6)80 b(Rings)-30 533 y Fr(CLN)30 b(has)g(a)h(class)g -(of)g(abstract)g(rings.)1403 662 y Fp(Ring)1308 765 y(cl_ring)1260 -869 y()-30 1004 y Fr(Rings)f(can)h(b)s(e)f(compared)f(for)h +(of)g(abstract)g(rings.)1403 662 y Fp(Ring)1308 765 y(cl_ring)1212 +869 y()-30 1004 y Fr(Rings)f(can)h(b)s(e)f(compared)f(for)h (equalit)m(y:)-30 1163 y Fp(bool)f(operator==)f(\(const)g(cl_ring&,)g (const)h(cl_ring&\))-30 1273 y(bool)g(operator!=)f(\(const)g(cl_ring&,) g(const)h(cl_ring&\))450 1382 y Fr(These)h(compare)g(t)m(w)m(o)i(rings) @@ -3835,16 +3852,16 @@ b(\(Ideally)28 b(one)g(w)m(ould)f(imagine)-30 1179 y(a)k(generic)h Fp(++)g Fr(do)s(esn't)h(ha)m(v)m(e)h(generic)g(t)m(yp)s(es.)42 b(So)30 b(one)h(has)g(to)h(liv)m(e)g(with)e(run)m(time)-30 1288 y(c)m(hec)m(ks.\))-30 1423 y(The)g(class)h(of)g(mo)s(dular)d(in)m -(teger)k(rings)e(is)1403 1552 y Fp(Ring)1308 1656 y(cl_ring)1260 -1760 y()1451 1863 y(|)1451 1967 y(|)1021 2071 -y(Modular)46 b(integer)g(ring)1165 2175 y(cl_modint_ring)1117 -2279 y()-30 2413 y Fr(and)30 b(the)g(class)h(of)g(all) -g(mo)s(dular)e(in)m(tegers)i(\(elemen)m(ts)g(of)g(mo)s(dular)d(in)m -(teger)k(rings\))e(is)1165 2542 y Fp(Modular)45 b(integer)1403 -2646 y(cl_MI)1117 2750 y()-30 2885 y -Fr(Mo)s(dular)30 b(in)m(teger)i(rings)e(are)g(constructed)h(using)f -(the)h(function)-30 3044 y Fp(cl_modint_ring)26 b(cl_find_modint_ring)g -(\(const)i(cl_I&)h(N\))450 3154 y Fr(This)f(function)g(returns)f(the)h +(teger)k(rings)e(is)1403 1552 y Fp(Ring)1308 1656 y(cl_ring)1212 +1760 y()1451 1863 y(|)1451 1967 y(|)1021 +2071 y(Modular)46 b(integer)g(ring)1165 2175 y(cl_modint_ring)1069 +2279 y()-30 2413 y Fr(and)30 b(the)g(class)h(of)g +(all)g(mo)s(dular)e(in)m(tegers)i(\(elemen)m(ts)g(of)g(mo)s(dular)d(in) +m(teger)k(rings\))e(is)1165 2542 y Fp(Modular)45 b(integer)1403 +2646 y(cl_MI)1117 2750 y()-30 2885 +y Fr(Mo)s(dular)30 b(in)m(teger)i(rings)e(are)g(constructed)h(using)f +(the)h(function)-30 3044 y Fp(cl_modint_ring)26 b(find_modint_ring)g +(\(const)j(cl_I&)g(N\))450 3154 y Fr(This)f(function)g(returns)f(the)h (mo)s(dular)e(ring)j(`)p Fp(Z/NZ)p Fr('.)39 b(It)28 b(tak)m(es)i(care)f (of)g(\014nding)e(out)h(ab)s(out)g(sp)s(ecial)450 3264 y(cases)e(of)e Fp(N)p Fr(,)i(lik)m(e)g(p)s(o)m(w)m(ers)f(of)g(t)m(w)m @@ -3860,11 +3877,11 @@ Fp(abs\(N\))p Fr(\).)38 b(This)26 b(ensures)g(that)450 (compared)f(for)i(equalit)m(y:)-30 3912 y Fp(bool)e(operator==)f (\(const)g(cl_modint_ring&,)e(const)j(cl_modint_ring&\))-30 4022 y(bool)g(operator!=)f(\(const)g(cl_modint_ring&,)e(const)j -(cl_modint_ring&\))450 4131 y Fr(These)j(compare)g(t)m(w)m(o)h(mo)s -(dular)d(in)m(teger)k(rings)d(for)h(equalit)m(y)-8 b(.)48 -b(Tw)m(o)32 b(di\013eren)m(t)h(calls)g(to)g Fp(cl_find_)450 -4241 y(modint_ring)39 b Fr(with)i(the)h(same)f(argumen)m(t)g -(necessarily)h(return)f(the)h(same)f(ring)g(b)s(ecause)h(it)g(is)450 +(cl_modint_ring&\))450 4131 y Fr(These)42 b(compare)g(t)m(w)m(o)i(mo)s +(dular)c(in)m(teger)k(rings)e(for)g(equalit)m(y)-8 b(.)78 +b(Tw)m(o)43 b(di\013eren)m(t)g(calls)g(to)g Fp(find_)450 +4241 y(modint_ring)c Fr(with)i(the)h(same)f(argumen)m(t)g(necessarily)h +(return)f(the)h(same)f(ring)g(b)s(ecause)h(it)g(is)450 4350 y(memoized)29 b(in)h(the)h(cac)m(he)h(table.)-30 4608 y Fs(7.2)68 b(F)-11 b(unctions)44 b(on)h(mo)t(dular)g(in)l(tegers) -30 4801 y Fr(Giv)m(en)31 b(a)g(mo)s(dular)d(in)m(teger)k(ring)e @@ -3884,14 +3901,14 @@ y Fr(This)c(is)h(a)h(partial)f(in)m(v)m(erse)h(function)f(to)h Fp(R->canonhom)p Fr(.)36 b(It)26 b(returns)f(the)h(standard)f(represen) m(tativ)m(e)450 1072 y(\()p Fp(>=0)p Fr(,)30 b Fp(random\(cl_random_stat)o(e&)24 b(randomstate\))-30 -1349 y(cl_MI)29 b(R->random\(\))450 1459 y Fr(This)h(returns)f(a)h -(random)f(in)m(teger)j(mo)s(dulo)d Fp(N)p Fr(.)-30 1630 -y(The)h(follo)m(wing)i(op)s(erations)e(are)h(de\014ned)e(on)i(mo)s -(dular)d(in)m(tegers.)-30 1802 y Fp(cl_modint_ring)e(x.ring)j(\(\))450 -1912 y Fr(Returns)g(the)i(ring)f(to)h(whic)m(h)f(the)h(mo)s(dular)d(in) -m(teger)k Fp(x)e Fr(b)s(elongs.)-30 2079 y Fp(cl_MI)f(operator+)f -(\(const)g(cl_MI&,)h(const)g(cl_MI&\))450 2189 y Fr(Returns)36 +(R->random\(random_state&)24 b(randomstate\))-30 1349 +y(cl_MI)29 b(R->random\(\))450 1459 y Fr(This)h(returns)f(a)h(random)f +(in)m(teger)j(mo)s(dulo)d Fp(N)p Fr(.)-30 1630 y(The)h(follo)m(wing)i +(op)s(erations)e(are)h(de\014ned)e(on)i(mo)s(dular)d(in)m(tegers.)-30 +1802 y Fp(cl_modint_ring)e(x.ring)j(\(\))450 1912 y Fr(Returns)g(the)i +(ring)f(to)h(whic)m(h)f(the)h(mo)s(dular)d(in)m(teger)k +Fp(x)e Fr(b)s(elongs.)-30 2079 y Fp(cl_MI)f(operator+)f(\(const)g +(cl_MI&,)h(const)g(cl_MI&\))450 2189 y Fr(Returns)36 b(the)h(sum)d(of)j(t)m(w)m(o)h(mo)s(dular)d(in)m(tegers.)60 b(One)37 b(of)f(the)h(argumen)m(ts)f(ma)m(y)g(also)i(b)s(e)e(a)h(plain) 450 2298 y(in)m(teger.)-30 2466 y Fp(cl_MI)29 b(operator-)f(\(const)g @@ -3945,7 +3962,7 @@ Fr(.)-30 1325 y(The)g(follo)m(wing)i(output)e(functions)g(are)g (in)m(teger)k Fp(x)d Fr(on)i(the)f Fp(stream)p Fr(.)69 b(The)40 b(output)g(ma)m(y)f(dep)s(end)g(on)h(the)h(global)450 1813 y(prin)m(ter)30 b(settings)h(in)f(the)h(v)-5 b(ariable)31 -b Fp(cl_default_print_flags)p Fr(.)p eop +b Fp(default_print_flags)p Fr(.)p eop %%Page: 37 39 37 38 bop -30 -116 a Fr(Chapter)30 b(8:)41 b(Sym)m(b)s(olic)29 b(data)i(t)m(yp)s(es)2596 b(37)-30 299 y Fo(8)80 b(Sym)l(b)t(olic)54 @@ -3953,11 +3970,11 @@ b(data)g(t)l(yp)t(es)-30 513 y Fr(CLN)30 b(implemen)m(ts)f(t)m(w)m(o)j (sym)m(b)s(olic)d(\(non-n)m(umeric\))h(data)h(t)m(yp)s(es:)41 b(strings)30 b(and)g(sym)m(b)s(ols.)-30 758 y Fs(8.1)68 b(Strings)-30 946 y Fr(The)30 b(class)1260 1071 y Fp(String)1212 -1175 y(cl_string)1165 1278 y()-30 1409 y -Fr(implemen)m(ts)f(imm)m(utable)g(strings.)-30 1539 y(Strings)h(are)h -(constructed)f(through)g(the)h(follo)m(wing)g(constructors:)-30 -1691 y Fp(cl_string)d(\(const)h(char)g(*)h(s\))450 1800 -y Fr(Returns)f(an)i(imm)m(utable)e(cop)m(y)i(of)f(the)h +1175 y(cl_string)1117 1278 y()-30 1409 +y Fr(implemen)m(ts)f(imm)m(utable)g(strings.)-30 1539 +y(Strings)h(are)h(constructed)f(through)g(the)h(follo)m(wing)g +(constructors:)-30 1691 y Fp(cl_string)d(\(const)h(char)g(*)h(s\))450 +1800 y Fr(Returns)f(an)i(imm)m(utable)e(cop)m(y)i(of)f(the)h (\(zero-terminated\))h(C)e(string)g Fp(s)p Fr(.)-30 1951 y Fp(cl_string)e(\(const)h(char)g(*)h(ptr,)f(unsigned)f(long)h(len\)) 450 2061 y Fr(Returns)36 b(an)h(imm)m(utable)f(cop)m(y)i(of)f(the)g @@ -4006,11 +4023,11 @@ b(Univ)-9 b(ariate)56 b(p)t(olynomials)-30 652 y Fs(9.1)68 b(Univ)-7 b(ariate)47 b(p)t(olynomial)f(rings)-30 844 y Fr(CLN)33 b(implemen)m(ts)f(univ)-5 b(ariate)35 b(p)s(olynomials)e (\(p)s(olynomials)g(in)g(one)h(v)-5 b(ariable\))35 b(o)m(v)m(er)g(an)f -(arbitrary)f(ring.)50 b(The)-30 953 y(indeterminate)23 -b(v)-5 b(ariable)23 b(ma)m(y)g(b)s(e)f(either)h(unnamed)e(\(and)h(will) -i(b)s(e)e(prin)m(ted)g(according)i(to)g Fp(cl_default_print_)-30 -1063 y(flags.univpoly_varname)p Fr(,)37 b(whic)m(h)j(defaults)g(to)h(`) -p Fp(x)p Fr('\))g(or)f(carry)h(a)f(giv)m(en)h(name.)70 +(arbitrary)f(ring.)50 b(The)-30 953 y(indeterminate)34 +b(v)-5 b(ariable)36 b(ma)m(y)e(b)s(e)h(either)g(unnamed)d(\(and)j(will) +g(b)s(e)f(prin)m(ted)h(according)g(to)h Fp(default_print_)-30 +1063 y(flags.univpoly_varname)p Fr(,)h(whic)m(h)j(defaults)g(to)h(`)p +Fp(x)p Fr('\))g(or)f(carry)h(a)f(giv)m(en)h(name.)70 b(The)40 b(base)g(ring)g(and)g(the)-30 1172 y(indeterminate)31 b(are)h(explicitly)g(part)f(of)h(ev)m(ery)g(p)s(olynomial.)42 b(CLN)31 b(do)s(esn't)g(allo)m(w)i(y)m(ou)e(to)h(\(acciden)m(tally\))j @@ -4021,49 +4038,49 @@ b(\(Ideally)-30 1391 y(this)30 b(should)g(return)f(a)i(m)m(ultiv)-5 b(ariate)31 b(p)s(olynomial,)f(but)g(they)g(are)h(not)g(y)m(et)g (implemen)m(ted)e(in)h(CLN.\))-30 1525 y(The)g(classes)h(of)g(univ)-5 b(ariate)31 b(p)s(olynomial)f(rings)f(are)1499 1653 y -Fp(Ring)1403 1757 y(cl_ring)1355 1861 y()1546 +Fp(Ring)1403 1757 y(cl_ring)1308 1861 y()1546 1965 y(|)1546 2068 y(|)1021 2172 y(Univariate)45 b(polynomial)g(ring) -1260 2276 y(cl_univpoly_ring)1260 2380 y()1546 +1260 2276 y(cl_univpoly_ring)1260 2380 y()1546 2484 y(|)735 2587 y(+----------------+------)o(----)o(----)o(---)o(--+) 735 2691 y(|)763 b(|)907 b(|)258 2795 y(Complex)46 b(polynomial)f(ring) 189 b(|)i(Modular)46 b(integer)g(polynomial)f(ring)258 2899 y(cl_univpoly_complex_rin)o(g)137 b(|)382 b -(cl_univpoly_modint_ring)305 3002 y()137 -b(|)382 b()1546 3106 y(|)735 3210 +(cl_univpoly_modint_ring)258 3002 y()137 +b(|)382 b()1546 3106 y(|)735 3210 y(+----------------+)735 3314 y(|)763 b(|)353 3418 y(Real)47 b(polynomial)e(ring)237 b(|)353 3521 y(cl_univpoly_real_ring)185 -b(|)401 3625 y()g(|)1546 3729 y(|)735 +b(|)353 3625 y()g(|)1546 3729 y(|)735 3833 y(+----------------+)735 3936 y(|)763 b(|)258 4040 y(Rational)45 b(polynomial)g(ring)142 b(|)258 4144 y -(cl_univpoly_rational_ri)o(ng)89 b(|)305 4248 y -()g(|)1546 4352 y(|)735 4455 +(cl_univpoly_rational_ri)o(ng)89 b(|)258 4248 y +()g(|)1546 4352 y(|)735 4455 y(+----------------+)735 4559 y(|)258 4663 y(Integer)46 -b(polynomial)f(ring)258 4767 y(cl_univpoly_integer_rin)o(g)305 -4870 y()-30 5004 y Fr(and)30 b(the)g(corresp)s -(onding)g(classes)h(of)g(univ)-5 b(ariate)31 b(p)s(olynomials)e(are) -1117 5132 y Fp(Univariate)45 b(polynomial)1451 5236 y(cl_UP)1260 -5340 y()p eop +b(polynomial)f(ring)258 4767 y(cl_univpoly_integer_rin)o(g)258 +4870 y()-30 5004 y Fr(and)30 +b(the)g(corresp)s(onding)g(classes)h(of)g(univ)-5 b(ariate)31 +b(p)s(olynomials)e(are)1117 5132 y Fp(Univariate)45 b(polynomial)1451 +5236 y(cl_UP)1260 5340 y()p eop %%Page: 39 41 39 40 bop -30 -116 a Fr(Chapter)30 b(9:)41 b(Univ)-5 b(ariate)32 b(p)s(olynomials)2483 b(39)1546 299 y Fp(|)735 403 y(+----------------+------)o(----)o(----)o(---)o(--+)735 506 y(|)763 b(|)907 b(|)353 610 y(Complex)46 b(polynomial)331 b(|)286 b(Modular)46 b(integer)g(polynomial)592 714 y(cl_UP_N)618 -b(|)764 b(cl_UP_MI)305 818 y()137 -b(|)382 b()1546 922 y(|)735 1025 +b(|)764 b(cl_UP_MI)258 818 y()137 +b(|)382 b()1546 922 y(|)735 1025 y(+----------------+)735 1129 y(|)763 b(|)449 1233 y(Real)46 -b(polynomial)379 b(|)592 1337 y(cl_UP_R)618 b(|)401 1440 -y()185 b(|)1546 1544 y(|)735 1648 +b(polynomial)379 b(|)592 1337 y(cl_UP_R)618 b(|)305 1440 +y()233 b(|)1546 1544 y(|)735 1648 y(+----------------+)735 1752 y(|)763 b(|)353 1856 y(Rational)46 -b(polynomial)283 b(|)592 1959 y(cl_UP_RA)570 b(|)305 -2063 y()89 b(|)1546 2167 y(|)735 -2271 y(+----------------+)735 2374 y(|)353 2478 y(Integer)46 -b(polynomial)592 2582 y(cl_UP_I)305 2686 y()-30 -3545 y Fr(Univ)-5 b(ariate)32 b(p)s(olynomial)d(rings)h(are)h -(constructed)g(using)f(the)g(functions)-30 4792 y Fp(cl_univpoly_ring)c -(cl_find_univpoly_ring)e(\(const)29 b(cl_ring&)f(R\))-30 -4902 y(cl_univpoly_ring)e(cl_find_univpoly_ring)e(\(const)29 -b(cl_ring&)f(R,)i(const)f(cl_symbol&)f(varname\))450 +b(polynomial)283 b(|)592 1959 y(cl_UP_RA)570 b(|)258 +2063 y()89 b(|)1546 2167 +y(|)735 2271 y(+----------------+)735 2374 y(|)353 2478 +y(Integer)46 b(polynomial)592 2582 y(cl_UP_I)258 2686 +y()-30 3545 y Fr(Univ)-5 b(ariate)32 +b(p)s(olynomial)d(rings)h(are)h(constructed)g(using)f(the)g(functions) +-30 4792 y Fp(cl_univpoly_ring)c(find_univpoly_ring)f(\(const)k +(cl_ring&)f(R\))-30 4902 y(cl_univpoly_ring)e(find_univpoly_ring)f +(\(const)k(cl_ring&)f(R,)i(const)f(cl_symbol&)e(varname\))450 5011 y Fr(This)40 b(function)h(returns)f(the)h(p)s(olynomial)g(ring)g (`)p Fp(R[X])p Fr(',)i(unnamed)c(or)i(named.)71 b Fp(R)41 b Fr(ma)m(y)g(b)s(e)f(an)450 5121 y(arbitrary)f(ring.)68 @@ -4080,34 +4097,34 @@ eop b(ariate)32 b(p)s(olynomials)2483 b(40)450 299 y(that)28 b(t)m(w)m(o)i(calls)f(of)e(this)h(function)g(with)f(the)h(same)f (argumen)m(ts)h(will)g(return)e(the)i(same)g(p)s(olynomial)450 -408 y(ring.)-30 547 y Fp(cl_univpoly_complex_ring)c -(cl_find_univpoly_ring)g(\(const)29 b(cl_complex_ring&)d(R\))-30 -657 y(cl_univpoly_complex_ring)e(cl_find_univpoly_ring)g(\(const)29 -b(cl_complex_ring&)d(R,)k(const)-30 766 y(cl_symbol&)e(varname\))-30 -876 y(cl_univpoly_real_ring)d(cl_find_univpoly_ring)f(\(const)29 -b(cl_real_ring&)e(R\))-30 986 y(cl_univpoly_real_ring)e -(cl_find_univpoly_ring)f(\(const)29 b(cl_real_ring&)e(R,)i(const)g -(cl_symbol&)-30 1095 y(varname\))-30 1205 y(cl_univpoly_rational_rin)o -(g)24 b(cl_find_univpoly_ring)h(\(const)k(cl_rational_ring&)c(R\))-30 -1314 y(cl_univpoly_rational_rin)o(g)f(cl_find_univpoly_ring)h(\(const)k -(cl_rational_ring&)c(R,)30 b(const)-30 1424 y(cl_symbol&)e(varname\)) --30 1533 y(cl_univpoly_integer_ring)c(cl_find_univpoly_ring)g(\(const) -29 b(cl_integer_ring&)d(R\))-30 1643 y(cl_univpoly_integer_ring)e -(cl_find_univpoly_ring)g(\(const)29 b(cl_integer_ring&)d(R,)k(const)-30 -1753 y(cl_symbol&)e(varname\))-30 1862 y(cl_univpoly_modint_ring)c -(cl_find_univpoly_ring)h(\(const)j(cl_modint_ring&)e(R\))-30 -1972 y(cl_univpoly_modint_ring)e(cl_find_univpoly_ring)h(\(const)j -(cl_modint_ring&)e(R,)k(const)-30 2081 y(cl_symbol&)e(varname\))450 -2191 y Fr(These)i(functions)g(are)g(equiv)-5 b(alen)m(t)32 -b(to)f(the)f(general)i Fp(cl_find_univpoly_ring)p Fr(,)24 -b(only)31 b(the)f(return)450 2301 y(t)m(yp)s(e)h(is)f(more)f(sp)s -(eci\014c,)i(according)g(to)g(the)g(base)f(ring's)h(t)m(yp)s(e.)-30 +408 y(ring.)-30 547 y Fp(cl_univpoly_complex_ring)c(find_univpoly_ring) +h(\(const)k(cl_complex_ring&)d(R\))-30 657 y(cl_univpoly_complex_ring)e +(find_univpoly_ring)h(\(const)k(cl_complex_ring&)d(R,)j(const)-30 +766 y(cl_symbol&)f(varname\))-30 876 y(cl_univpoly_real_ring)d +(find_univpoly_ring)g(\(const)k(cl_real_ring&)d(R\))-30 +986 y(cl_univpoly_real_ring)f(find_univpoly_ring)g(\(const)k +(cl_real_ring&)d(R,)k(const)f(cl_symbol&)-30 1095 y(varname\))-30 +1205 y(cl_univpoly_rational_rin)o(g)24 b(find_univpoly_ring)i(\(const)j +(cl_rational_ring&)c(R\))-30 1314 y(cl_univpoly_rational_rin)o(g)f +(find_univpoly_ring)i(\(const)j(cl_rational_ring&)c(R,)30 +b(const)-30 1424 y(cl_symbol&)e(varname\))-30 1533 y +(cl_univpoly_integer_ring)c(find_univpoly_ring)h(\(const)k +(cl_integer_ring&)d(R\))-30 1643 y(cl_univpoly_integer_ring)e +(find_univpoly_ring)h(\(const)k(cl_integer_ring&)d(R,)j(const)-30 +1753 y(cl_symbol&)f(varname\))-30 1862 y(cl_univpoly_modint_ring)c +(find_univpoly_ring)h(\(const)k(cl_modint_ring&)d(R\))-30 +1972 y(cl_univpoly_modint_ring)e(find_univpoly_ring)h(\(const)k +(cl_modint_ring&)d(R,)k(const)f(cl_symbol&)-30 2081 y(varname\))450 +2191 y Fr(These)24 b(functions)g(are)h(equiv)-5 b(alen)m(t)26 +b(to)g(the)e(general)i Fp(find_univpoly_ring)p Fr(,)21 +b(only)k(the)f(return)g(t)m(yp)s(e)450 2301 y(is)30 b(more)g(sp)s +(eci\014c,)g(according)i(to)f(the)f(base)h(ring's)f(t)m(yp)s(e.)-30 2579 y Fs(9.2)68 b(F)-11 b(unctions)44 b(on)h(univ)-7 b(ariate)46 b(p)t(olynomials)-30 2780 y Fr(Giv)m(en)31 b(a)g(univ)-5 b(ariate)31 b(p)s(olynomial)f(ring)g Fp(R)p Fr(,)g(the)h(follo)m(wing)h(mem)m(b)s(ers)27 b(can)k(b)s(e)f(used.)-30 2952 y Fp(cl_ring)e(R->basering\(\))450 3061 y Fr(This)i(returns)f(the) -h(base)h(ring,)f(as)h(passed)f(to)h(`)p Fp(cl_find_univpoly_ring)p +h(base)h(ring,)f(as)h(passed)f(to)h(`)p Fp(find_univpoly_ring)p Fr('.)-30 3229 y Fp(cl_UP)e(R->zero\(\))450 3339 y Fr(This)h(returns)f Fp(0)h(in)g(R)p Fr(,)g(a)h(p)s(olynomial)e(of)i(degree)g(-1.)-30 3506 y Fp(cl_UP)e(R->one\(\))450 3616 y Fr(This)h(returns)f @@ -4196,26 +4213,25 @@ Fp(X)p Fr(.)-30 4842 y(The)g(follo)m(wing)i(output)e(functions)g(are)g b(ariate)26 b(p)s(olynomial)e Fp(x)g Fr(on)h(the)f Fp(stream)p Fr(.)38 b(The)24 b(output)g(ma)m(y)g(dep)s(end)f(on)i(the)g(global)450 5320 y(prin)m(ter)30 b(settings)h(in)f(the)h(v)-5 b(ariable)31 -b Fp(cl_default_print_flags)p Fr(.)p eop +b Fp(default_print_flags)p Fr(.)p eop %%Page: 42 44 42 43 bop -30 -116 a Fr(Chapter)30 b(9:)41 b(Univ)-5 b(ariate)32 b(p)s(olynomials)2483 b(42)-30 299 y Fs(9.3)68 b(Sp)t(ecial)45 b(p)t(olynomials)-30 491 y Fr(The)30 b(follo)m(wing)i(functions)e(return)f(sp)s(ecial)i(p)s(olynomials.)-30 -651 y Fp(cl_UP_I)d(cl_tschebychev)f(\(sintL)i(n\))450 -760 y Fr(Returns)g(the)i(n-th)f(Tc)m(heb)m(yc)m(hev)h(p)s(olynomial)f -(\(n)g Fp(>)p Fr(=)g(0\).)-30 920 y Fp(cl_UP_I)e(cl_hermite)g(\(sintL)h -(n\))450 1029 y Fr(Returns)g(the)i(n-th)f(Hermite)g(p)s(olynomial)g -(\(n)g Fp(>)p Fr(=)g(0\).)-30 1189 y Fp(cl_UP_RA)e(cl_legendre)f -(\(sintL)i(n\))450 1298 y Fr(Returns)g(the)i(n-th)f(Legendre)g(p)s -(olynomial)g(\(n)g Fp(>)p Fr(=)g(0\).)-30 1458 y Fp(cl_UP_I)e -(cl_laguerre)g(\(sintL)g(n\))450 1567 y Fr(Returns)h(the)i(n-th)f -(Laguerre)h(p)s(olynomial)e(\(n)h Fp(>)p Fr(=)g(0\).)-30 -1727 y(Information)e(ho)m(w)h(to)h(deriv)m(e)g(the)g(di\013eren)m(tial) -g(equation)h(satis\014ed)e(b)m(y)g(eac)m(h)h(of)g(these)g(p)s -(olynomials)e(from)g(their)-30 1836 y(de\014nition)i(can)h(b)s(e)e -(found)g(in)i(the)f Fp(doc/polynomial/)c Fr(directory)-8 -b(.)p eop +651 y Fp(cl_UP_I)d(tschebychev)g(\(sintL)g(n\))450 760 +y Fr(Returns)h(the)i(n-th)f(Cheb)m(yshev)g(p)s(olynomial)f(\(n)h +Fp(>)p Fr(=)g(0\).)-30 920 y Fp(cl_UP_I)e(hermite)h(\(sintL)f(n\))450 +1029 y Fr(Returns)h(the)i(n-th)f(Hermite)g(p)s(olynomial)g(\(n)g +Fp(>)p Fr(=)g(0\).)-30 1189 y Fp(cl_UP_RA)e(legendre)g(\(sintL)h(n\)) +450 1298 y Fr(Returns)g(the)i(n-th)f(Legendre)g(p)s(olynomial)g(\(n)g +Fp(>)p Fr(=)g(0\).)-30 1458 y Fp(cl_UP_I)e(laguerre)h(\(sintL)f(n\))450 +1567 y Fr(Returns)h(the)i(n-th)f(Laguerre)h(p)s(olynomial)e(\(n)h +Fp(>)p Fr(=)g(0\).)-30 1727 y(Information)e(ho)m(w)h(to)h(deriv)m(e)g +(the)g(di\013eren)m(tial)g(equation)h(satis\014ed)e(b)m(y)g(eac)m(h)h +(of)g(these)g(p)s(olynomials)e(from)g(their)-30 1836 +y(de\014nition)i(can)h(b)s(e)e(found)g(in)i(the)f Fp(doc/polynomial/)c +Fr(directory)-8 b(.)p eop %%Page: 43 45 43 44 bop -30 -116 a Fr(Chapter)30 b(10:)41 b(In)m(ternals)3010 b(43)-30 299 y Fo(10)80 b(In)l(ternals)-30 651 y Fs(10.1)68 @@ -4325,290 +4341,334 @@ b(rings.)39 b(A)27 b(mo)s(dular)f(in)m(teger)j(ring)e(is)g(destro)m(y)m %%Page: 45 47 45 46 bop -30 -116 a Fr(Chapter)30 b(11:)41 b(Using)31 b(the)f(library)2681 b(45)-30 299 y Fo(11)80 b(Using)54 -b(the)f(library)-30 523 y Fr(F)-8 b(or)47 b(the)g(follo)m(wing)g +b(the)f(library)-30 542 y Fr(F)-8 b(or)47 b(the)g(follo)m(wing)g (discussion,)j(w)m(e)d(will)g(assume)e(that)h(y)m(ou)h(ha)m(v)m(e)h -(installed)f(the)f(CLN)g(source)g(in)g Fp($CLN_)-30 632 +(installed)f(the)f(CLN)g(source)g(in)g Fp($CLN_)-30 652 y(DIR)41 b Fr(and)g(built)h(it)g(in)g Fp($CLN_TARGETDIR)p Fr(.)71 b(F)-8 b(or)43 b(example,)h(for)e(me)f(it's)h -Fp(CLN_DIR="$HOME/cln")37 b Fr(and)k Fp(CLN_)-30 742 +Fp(CLN_DIR="$HOME/cln")37 b Fr(and)k Fp(CLN_)-30 762 y(TARGETDIR="$HOME/cln/lin)o(uxel)o(f")p Fr(.)53 b(Y)-8 b(ou)38 b(migh)m(t)e(de\014ne)g(these)h(as)g(en)m(vironmen)m(t)f(v)-5 -b(ariables,)40 b(or)c(directly)-30 851 y(substitute)30 -b(the)h(appropriate)f(v)-5 b(alues.)-30 1103 y Fs(11.1)68 -b(Compiler)46 b(options)-30 1293 y Fr(Un)m(til)31 b(y)m(ou)g(ha)m(v)m +b(ariables,)40 b(or)c(directly)-30 871 y(substitute)30 +b(the)h(appropriate)f(v)-5 b(alues.)-30 1136 y Fs(11.1)68 +b(Compiler)46 b(options)-30 1332 y Fr(Un)m(til)31 b(y)m(ou)g(ha)m(v)m (e)h(installed)f(CLN)f(in)g(a)h(public)e(place,)j(the)e(follo)m(wing)i -(options)f(are)g(needed:)-30 1426 y(When)f(y)m(ou)h(compile)f(CLN)g -(application)i(co)s(de,)f(add)e(the)i(\015ags)353 1552 +(options)f(are)g(needed:)-30 1470 y(When)f(y)m(ou)h(compile)f(CLN)g +(application)i(co)s(de,)f(add)e(the)i(\015ags)353 1601 y Fp(-I$CLN_DIR/include)43 b(-I$CLN_TARGETDIR/include)-30 -1685 y Fr(to)29 b(the)g(C)p Fp(++)e Fr(compiler's)h(command)f(line)h +1739 y Fr(to)29 b(the)g(C)p Fp(++)e Fr(compiler's)h(command)f(line)h (\()p Fp(make)g Fr(v)-5 b(ariable)29 b(CFLA)m(GS)g(or)f(CXXFLA)m(GS\).) -i(When)e(y)m(ou)h(link)f(CLN)-30 1794 y(application)k(co)s(de)e(to)h -(form)e(an)i(executable,)h(add)e(the)g(\015ags)353 1921 -y Fp($CLN_TARGETDIR/src/libcln)o(.a)-30 2053 y Fr(to)h(the)g(C/C)p +i(When)e(y)m(ou)h(link)f(CLN)-30 1849 y(application)k(co)s(de)e(to)h +(form)e(an)i(executable,)h(add)e(the)g(\015ags)353 1980 +y Fp($CLN_TARGETDIR/src/libcln)o(.a)-30 2118 y Fr(to)h(the)g(C/C)p Fp(++)e Fr(compiler's)h(command)e(line)j(\()p Fp(make)f -Fr(v)-5 b(ariable)31 b(LIBS\).)-30 2186 y(If)62 b(y)m(ou)h(did)f(a)h +Fr(v)-5 b(ariable)31 b(LIBS\).)-30 2256 y(If)62 b(y)m(ou)h(did)f(a)h Fp(make)29 b(install)p Fr(,)69 b(the)62 b(include)h(\014les)f(are)h (installed)g(in)g(a)f(public)g(directory)h(\(normally)-30 -2295 y Fp(/usr/local/include)p Fr(\),)45 b(hence)g(y)m(ou)h(don't)g +2365 y Fp(/usr/local/include)p Fr(\),)45 b(hence)g(y)m(ou)h(don't)g (need)f(sp)s(ecial)h(\015ags)g(for)f(compiling.)85 b(The)45 -b(library)g(has)h(b)s(een)-30 2405 y(installed)i(to)g(a)f(public)f +b(library)g(has)h(b)s(een)-30 2475 y(installed)i(to)g(a)f(public)f (directory)i(as)f(w)m(ell)h(\(normally)f Fp(/usr/local/lib)p -Fr(\),)h(hence)f(when)f(linking)h(a)g(CLN)-30 2514 y(application)32 +Fr(\),)h(hence)f(when)f(linking)h(a)g(CLN)-30 2584 y(application)32 b(it)f(is)f(su\016cien)m(t)h(to)g(giv)m(e)h(the)e(\015ag)h -Fp(-lcln)p Fr(.)-30 2766 y Fs(11.2)68 b(Include)45 b(\014les)-30 -2956 y Fr(Here)31 b(is)f(a)h(summary)c(of)k(the)f(include)h(\014les)f -(and)g(their)g(con)m(ten)m(ts.)-30 3111 y Fp()450 -3221 y Fr(General)h(de\014nitions,)f(reference)h(coun)m(ting,)h -(garbage)f(collection.)-30 3376 y Fp()450 -3486 y Fr(The)f(class)h(cl)p 920 3486 28 4 v 33 w(n)m(um)m(b)s(er.)-30 -3641 y Fp()450 3751 y Fr(F)-8 b(unctions)31 -b(for)f(class)h(cl)p 1288 3751 V 34 w(N,)f(the)h(complex)f(n)m(um)m(b)s -(ers.)-30 3906 y Fp()450 4016 y Fr(F)-8 b(unctions)31 -b(for)f(class)h(cl)p 1288 4016 V 34 w(R,)f(the)h(real)g(n)m(um)m(b)s -(ers.)-30 4171 y Fp()450 4281 y Fr(F)-8 b(unctions)31 -b(for)f(class)h(cl)p 1288 4281 V 34 w(F,)f(the)h(\015oats.)-30 -4436 y Fp()450 4545 y Fr(F)-8 b(unctions)31 -b(for)f(class)h(cl)p 1288 4545 V 34 w(SF,)f(the)h(short-\015oats.)-30 -4701 y Fp()450 4810 y Fr(F)-8 b(unctions)31 -b(for)f(class)h(cl)p 1288 4810 V 34 w(FF,)g(the)f(single-\015oats.)-30 -4966 y Fp()450 5075 y Fr(F)-8 b(unctions)31 -b(for)f(class)h(cl)p 1288 5075 V 34 w(DF,)g(the)f(double-\015oats.)-30 -5230 y Fp()450 5340 y Fr(F)-8 b(unctions)31 -b(for)f(class)h(cl)p 1288 5340 V 34 w(LF,)f(the)h(long-\015oats.)p +Fp(-lcln)p Fr(.)-30 2850 y Fs(11.2)68 b(Compatibilit)l(y)48 +b(to)d(old)g(CLN)g(v)l(ersions)-30 3045 y Fr(As)39 b(of)h(CLN)f(v)m +(ersion)h(1.1)h(all)f(non-macro)f(iden)m(ti\014ers)g(w)m(ere)h(hidden)e +(in)h(namespace)h Fp(cln)e Fr(in)h(order)g(to)h(a)m(v)m(oid)-30 +3155 y(p)s(oten)m(tial)f(name)e(clashes)h(with)f(other)h(C)p +Fp(++)e Fr(libraries.)62 b(If)37 b(y)m(ou)h(ha)m(v)m(e)h(an)e(old)h +(application,)j(y)m(ou)d(will)f(ha)m(v)m(e)i(to)-30 3264 +y(man)m(ually)30 b(p)s(ort)g(it)h(to)g(the)f(new)g(sc)m(heme.)41 +b(The)29 b(follo)m(wing)j(principles)e(will)h(help)f(during)f(the)i +(transition:)45 3402 y Fq(\017)60 b Fr(All)35 b(headers)f(are)h(no)m(w) +f(in)g(a)h(separate)h(sub)s(directory)-8 b(.)52 b(Instead)34 +b(of)h(including)f Fp(cl_)p Fl(something)8 b Fp(.h)p +Fr(,)33 b(include)150 3512 y Fp(cln/)p Fl(something)8 +b Fp(.h)28 b Fr(no)m(w.)45 3648 y Fq(\017)60 b Fr(All)25 +b(public)e(iden)m(ti\014ers)i(\(t)m(yp)s(enames)e(and)h(functions\))g +(ha)m(v)m(e)h(lost)g(their)g Fp(cl_)e Fr(pre\014x.)37 +b(Exceptions)25 b(are)g(all)g(the)150 3757 y(t)m(yp)s(enames)j(of)i(n)m +(um)m(b)s(er)d(t)m(yp)s(es,)j(\(cl)p 1404 3757 28 4 v +34 w(N,)f(cl)p 1625 3757 V 34 w(I,)g(cl)p 1811 3757 V +33 w(MI,)36 b(.)22 b(.)g(.)11 b(\),)30 b(rings,)g(sym)m(b)s(olic)f(t)m +(yp)s(es)g(\(cl)p 3204 3757 V 34 w(string,)g(cl)p 3585 +3757 V 34 w(sym)m(b)s(ol\))150 3867 y(and)36 b(p)s(olynomials)g(\(cl)p +950 3867 V 33 w(UP)p 1113 3867 V 33 w Fl(t)m(yp)s(e)5 +b Fr(\).)60 b(\(This)36 b(is)h(b)s(ecause)f(their)h(names)f(w)m(ould)g +(not)h(b)s(e)f(mnemonic)e(enough)150 3977 y(once)d(the)g(namespace)f +Fp(cln)f Fr(is)i(imp)s(orted.)39 b(Ev)m(en)30 b(in)g(a)h(namespace)f(w) +m(e)h(fa)m(v)m(or)g Fp(cl_N)f Fr(o)m(v)m(er)h Fp(N)p +Fr(.\))45 4113 y Fq(\017)60 b Fr(All)30 b(public)e Fe(functions)37 +b Fr(that)29 b(had)g(b)m(y)g(a)g Fp(cl_)f Fr(in)h(their)g(name)f(still) +i(carry)e(that)i Fp(cl_)e Fr(if)h(it)h(is)f(in)m(trinsic)g(part)g(of) +150 4222 y(a)i(t)m(yp)s(ename)e(\(as)i(in)f Fp(cl_I_to_int)e(\(\))p +Fr(\).)-30 4386 y(When)d(dev)m(eloping)h(other)f(libraries,)h(please)g +(k)m(eep)f(in)g(mind)e(not)i(to)g(imp)s(ort)f(the)h(namespace)f +Fp(cln)g Fr(in)h(one)g(of)g(y)m(our)-30 4496 y(public)e(header)g +(\014les)h(b)m(y)g(sa)m(ying)g Fp(using)29 b(namespace)f(cln;)p +Fr(.)37 b(This)23 b(w)m(ould)h(propagate)g(to)h(other)f(applications)h +(and)-30 4605 y(can)31 b(cause)g(name)e(clashes)i(there.)-30 +4871 y Fs(11.3)68 b(Include)45 b(\014les)-30 5066 y Fr(Here)31 +b(is)f(a)h(summary)c(of)k(the)f(include)h(\014les)f(and)g(their)g(con)m +(ten)m(ts.)-30 5230 y Fp()450 5340 y Fr(General)h +(de\014nitions,)f(reference)h(coun)m(ting,)h(garbage)f(collection.)p eop %%Page: 46 48 46 47 bop -30 -116 a Fr(Chapter)30 b(11:)41 b(Using)31 -b(the)f(library)2681 b(46)-30 299 y Fp()450 -408 y Fr(F)-8 b(unctions)31 b(for)f(class)h(cl)p 1288 -408 28 4 v 34 w(RA,)f(the)h(rational)g(n)m(um)m(b)s(ers.)-30 -573 y Fp()450 682 y Fr(F)-8 b(unctions)31 -b(for)f(class)h(cl)p 1288 682 V 34 w(I,)f(the)h(in)m(tegers.)-30 -847 y Fp()450 956 y Fr(Input/Output.)-30 1121 -y Fp()450 1230 y Fr(Input/Output)d(for)j(class)g(cl)p -1461 1230 V 33 w(N,)g(the)f(complex)g(n)m(um)m(b)s(ers.)-30 -1395 y Fp()450 1504 y Fr(Input/Output)e(for)j(class)g(cl) -p 1461 1504 V 33 w(R,)g(the)f(real)h(n)m(um)m(b)s(ers.)-30 -1669 y Fp()450 1778 y Fr(Input/Output)d(for)j(class)g -(cl)p 1461 1778 V 33 w(F,)g(the)g(\015oats.)-30 1943 -y Fp()450 2052 y Fr(Input/Output)d(for)j(class)g(cl)p -1461 2052 V 33 w(SF,)f(the)h(short-\015oats.)-30 2217 -y Fp()450 2326 y Fr(Input/Output)d(for)j(class)g(cl)p -1461 2326 V 33 w(FF,)g(the)g(single-\015oats.)-30 2491 -y Fp()450 2600 y Fr(Input/Output)d(for)j(class)g(cl)p -1461 2600 V 33 w(DF,)g(the)g(double-\015oats.)-30 2765 -y Fp()450 2874 y Fr(Input/Output)d(for)j(class)g(cl)p -1461 2874 V 33 w(LF,)g(the)f(long-\015oats.)-30 3039 -y Fp()450 3148 y Fr(Input/Output)e(for)j(class)g(cl)p -1461 3148 V 33 w(RA,)g(the)f(rational)i(n)m(um)m(b)s(ers.)-30 -3313 y Fp()450 3422 y Fr(Input/Output)c(for)j(class)g -(cl)p 1461 3422 V 33 w(I,)f(the)h(in)m(tegers.)-30 3587 -y Fp()450 3696 y Fr(Flags)h(for)e(customizing)g(input)g(op) -s(erations.)-30 3861 y Fp()450 3970 y Fr(Flags)i(for)e -(customizing)g(output)g(op)s(erations.)-30 4134 y Fp()450 -4244 y(cl_malloc_hook)p Fr(,)d Fp(cl_free_hook)p Fr(.)-30 -4408 y Fp()450 4518 y(cl_abort)p Fr(.)-30 -4682 y Fp()450 4792 y Fr(Conditions/exceptions.)-30 -4956 y Fp()450 5066 y Fr(Strings.)-30 5230 -y Fp()450 5340 y Fr(Sym)m(b)s(ols.)p eop +b(the)f(library)2681 b(46)-30 299 y Fp()450 +408 y Fr(The)30 b(class)h(cl)p 920 408 28 4 v 33 w(n)m(um)m(b)s(er.)-30 +573 y Fp()450 682 y Fr(F)-8 b(unctions)31 +b(for)f(class)h(cl)p 1288 682 V 34 w(N,)f(the)h(complex)f(n)m(um)m(b)s +(ers.)-30 847 y Fp()450 956 y Fr(F)-8 b(unctions)31 +b(for)f(class)h(cl)p 1288 956 V 34 w(R,)f(the)h(real)g(n)m(um)m(b)s +(ers.)-30 1121 y Fp()450 1230 y Fr(F)-8 +b(unctions)31 b(for)f(class)h(cl)p 1288 1230 V 34 w(F,)f(the)h +(\015oats.)-30 1395 y Fp()450 1504 y Fr(F)-8 +b(unctions)31 b(for)f(class)h(cl)p 1288 1504 V 34 w(SF,)f(the)h +(short-\015oats.)-30 1669 y Fp()450 1778 +y Fr(F)-8 b(unctions)31 b(for)f(class)h(cl)p 1288 1778 +V 34 w(FF,)g(the)f(single-\015oats.)-30 1943 y Fp()450 +2052 y Fr(F)-8 b(unctions)31 b(for)f(class)h(cl)p 1288 +2052 V 34 w(DF,)g(the)f(double-\015oats.)-30 2217 y Fp() +450 2326 y Fr(F)-8 b(unctions)31 b(for)f(class)h(cl)p +1288 2326 V 34 w(LF,)f(the)h(long-\015oats.)-30 2491 +y Fp()450 2600 y Fr(F)-8 b(unctions)31 +b(for)f(class)h(cl)p 1288 2600 V 34 w(RA,)f(the)h(rational)g(n)m(um)m +(b)s(ers.)-30 2765 y Fp()450 2874 y Fr(F)-8 +b(unctions)31 b(for)f(class)h(cl)p 1288 2874 V 34 w(I,)f(the)h(in)m +(tegers.)-30 3039 y Fp()450 3148 y Fr(Input/Output.)-30 +3313 y Fp()450 3422 y Fr(Input/Output)d(for)j(class)g +(cl)p 1461 3422 V 33 w(N,)g(the)f(complex)g(n)m(um)m(b)s(ers.)-30 +3587 y Fp()450 3696 y Fr(Input/Output)e(for)j(class)g +(cl)p 1461 3696 V 33 w(R,)g(the)f(real)h(n)m(um)m(b)s(ers.)-30 +3861 y Fp()450 3970 y Fr(Input/Output)d(for)j(class)g +(cl)p 1461 3970 V 33 w(F,)g(the)g(\015oats.)-30 4134 +y Fp()450 4244 y Fr(Input/Output)d(for)j(class)g(cl)p +1461 4244 V 33 w(SF,)f(the)h(short-\015oats.)-30 4408 +y Fp()450 4518 y Fr(Input/Output)d(for)j(class)g(cl)p +1461 4518 V 33 w(FF,)g(the)g(single-\015oats.)-30 4682 +y Fp()450 4792 y Fr(Input/Output)d(for)j(class)g(cl)p +1461 4792 V 33 w(DF,)g(the)g(double-\015oats.)-30 4956 +y Fp()450 5066 y Fr(Input/Output)d(for)j(class)g(cl)p +1461 5066 V 33 w(LF,)g(the)f(long-\015oats.)-30 5230 +y Fp()450 5340 y Fr(Input/Output)e(for)j(class)g(cl) +p 1461 5340 V 33 w(RA,)g(the)f(rational)i(n)m(um)m(b)s(ers.)p +eop %%Page: 47 49 47 48 bop -30 -116 a Fr(Chapter)30 b(11:)41 b(Using)31 -b(the)f(library)2681 b(47)-30 299 y Fp()450 -408 y Fr(Prop)s(ert)m(y)30 b(lists.)-30 564 y Fp()450 -674 y Fr(General)h(rings.)-30 830 y Fp()450 -939 y Fr(The)f(n)m(ull)g(ring.)-30 1095 y Fp()450 -1204 y Fr(The)g(ring)g(of)h(complex)f(n)m(um)m(b)s(ers.)-30 -1360 y Fp()450 1470 y Fr(The)g(ring)g(of)h(real)g(n)m -(um)m(b)s(ers.)-30 1625 y Fp()450 -1735 y Fr(The)f(ring)g(of)h(rational)g(n)m(um)m(b)s(ers.)-30 -1891 y Fp()450 2000 y Fr(The)f(ring)g(of)h(in)m -(tegers.)-30 2156 y Fp()450 2266 y Fr(Num)m(b)s(er)d -(threory)i(functions.)-30 2421 y Fp()450 -2531 y Fr(Mo)s(dular)g(in)m(tegers.)-30 2687 y Fp()96 -b Fr(V)-8 b(ectors.)-30 2842 y Fp()450 2952 -y Fr(General)31 b(v)m(ectors.)-30 3108 y Fp()450 -3217 y Fr(General)g(v)m(ectors)h(o)m(v)m(er)g(cl)p 1363 -3217 28 4 v 33 w(n)m(um)m(b)s(er.)-30 3373 y Fp()450 -3483 y Fr(General)f(v)m(ectors)h(o)m(v)m(er)g(cl)p 1363 -3483 V 33 w(N.)-30 3638 y Fp()450 3748 -y Fr(General)f(v)m(ectors)h(o)m(v)m(er)g(cl)p 1363 3748 -V 33 w(R.)-30 3904 y Fp()450 4013 y -Fr(General)f(v)m(ectors)h(o)m(v)m(er)g(cl)p 1363 4013 -V 33 w(RA.)-30 4169 y Fp()450 4279 y -Fr(General)f(v)m(ectors)h(o)m(v)m(er)g(cl)p 1363 4279 -V 33 w(I.)-30 4434 y Fp()450 4544 -y Fr(General)f(v)m(ectors)h(of)f(mo)s(dular)d(in)m(tegers.)-30 -4700 y Fp()450 4809 y Fr(Simple)h(v)m(ectors.)-30 -4965 y Fp()450 5075 y Fr(Simple)g(v)m(ectors)j(o)m(v)m -(er)g(cl)p 1322 5075 V 33 w(n)m(um)m(b)s(er.)-30 5230 -y Fp()450 5340 y Fr(Simple)d(v)m(ectors)j(o)m(v)m(er)g -(cl)p 1322 5340 V 33 w(N.)p eop +b(the)f(library)2681 b(47)-30 299 y Fp()450 +408 y Fr(Input/Output)28 b(for)j(class)g(cl)p 1461 408 +28 4 v 33 w(I,)f(the)h(in)m(tegers.)-30 573 y Fp()450 +682 y Fr(Flags)h(for)e(customizing)g(input)g(op)s(erations.)-30 +847 y Fp()450 956 y Fr(Flags)i(for)e(customizing)g +(output)g(op)s(erations.)-30 1121 y Fp()450 +1230 y(malloc_hook)p Fr(,)e Fp(free_hook)p Fr(.)-30 1395 +y Fp()450 1504 y(cl_abort)p Fr(.)-30 1669 +y Fp()450 1778 y Fr(Conditions/exceptions.)-30 +1943 y Fp()450 2052 y Fr(Strings.)-30 2217 +y Fp()450 2326 y Fr(Sym)m(b)s(ols.)-30 +2491 y Fp()450 2600 y Fr(Prop)s(ert)m(y)i(lists.)-30 +2765 y Fp()450 2874 y Fr(General)h(rings.)-30 +3039 y Fp()450 3148 y Fr(The)f(n)m(ull)g(ring.)-30 +3313 y Fp()450 3422 y Fr(The)g(ring)g(of)h(complex) +f(n)m(um)m(b)s(ers.)-30 3587 y Fp()450 +3696 y Fr(The)g(ring)g(of)h(real)g(n)m(um)m(b)s(ers.)-30 +3861 y Fp()450 3970 y Fr(The)f(ring)g(of)h +(rational)g(n)m(um)m(b)s(ers.)-30 4134 y Fp()450 +4244 y Fr(The)f(ring)g(of)h(in)m(tegers.)-30 4408 y Fp +()450 4518 y Fr(Num)m(b)s(er)d(threory)i(functions.) +-30 4682 y Fp()450 4792 y Fr(Mo)s(dular)g(in)m +(tegers.)-30 4956 y Fp()450 5066 y Fr(V)-8 b(ectors.)-30 +5230 y Fp()450 5340 y Fr(General)31 b(v)m(ectors.)p +eop %%Page: 48 50 48 49 bop -30 -116 a Fr(Chapter)30 b(11:)41 b(Using)31 -b(the)f(library)2681 b(48)-30 299 y Fp()450 -408 y Fr(Simple)29 b(v)m(ectors)j(o)m(v)m(er)g(cl)p 1322 -408 28 4 v 33 w(R.)-30 575 y Fp()450 -685 y Fr(Simple)d(v)m(ectors)j(o)m(v)m(er)g(cl)p 1322 -685 V 33 w(RA.)-30 852 y Fp()450 961 -y Fr(Simple)d(v)m(ectors)j(o)m(v)m(er)g(cl)p 1322 961 -V 33 w(I.)-30 1128 y Fp()450 1238 y -Fr(Simple)d(v)m(ectors)j(of)e(general)i(ring)e(elemen)m(ts.)-30 -1405 y Fp()450 1514 y Fr(Univ)-5 b(ariate)32 -b(p)s(olynomials.)-30 1681 y Fp()450 -1791 y Fr(Univ)-5 b(ariate)32 b(p)s(olynomials)d(o)m(v)m(er)j(the)f(in) -m(tegers.)-30 1958 y Fp()450 -2067 y Fr(Univ)-5 b(ariate)32 b(p)s(olynomials)d(o)m(v)m(er)j(the)f -(rational)g(n)m(um)m(b)s(ers.)-30 2234 y Fp()450 -2344 y Fr(Univ)-5 b(ariate)32 b(p)s(olynomials)d(o)m(v)m(er)j(the)f -(real)g(n)m(um)m(b)s(ers.)-30 2511 y Fp()450 -2620 y Fr(Univ)-5 b(ariate)32 b(p)s(olynomials)d(o)m(v)m(er)j(the)f -(complex)f(n)m(um)m(b)s(ers.)-30 2787 y Fp()450 -2897 y Fr(Univ)-5 b(ariate)32 b(p)s(olynomials)d(o)m(v)m(er)j(mo)s -(dular)c(in)m(teger)k(rings.)-30 3064 y Fp()450 -3173 y Fr(Timing)d(facilities.)-30 3340 y Fp()144 -b Fr(Includes)30 b(all)h(of)f(the)h(ab)s(o)m(v)m(e.)-30 -3616 y Fs(11.3)68 b(An)44 b(Example)-30 3816 y Fr(A)30 +b(the)f(library)2681 b(48)-30 299 y Fp()450 +408 y Fr(General)31 b(v)m(ectors)h(o)m(v)m(er)g(cl)p +1363 408 28 4 v 33 w(n)m(um)m(b)s(er.)-30 573 y Fp() +450 682 y Fr(General)f(v)m(ectors)h(o)m(v)m(er)g(cl)p +1363 682 V 33 w(N.)-30 847 y Fp()450 956 +y Fr(General)f(v)m(ectors)h(o)m(v)m(er)g(cl)p 1363 956 +V 33 w(R.)-30 1121 y Fp()450 1230 +y Fr(General)f(v)m(ectors)h(o)m(v)m(er)g(cl)p 1363 1230 +V 33 w(RA.)-30 1395 y Fp()450 1504 +y Fr(General)f(v)m(ectors)h(o)m(v)m(er)g(cl)p 1363 1504 +V 33 w(I.)-30 1669 y Fp()450 1778 +y Fr(General)f(v)m(ectors)h(of)f(mo)s(dular)d(in)m(tegers.)-30 +1943 y Fp()450 2052 y Fr(Simple)h(v)m(ectors.)-30 +2217 y Fp()450 2326 y Fr(Simple)g(v)m(ectors)j(o)m(v)m +(er)g(cl)p 1322 2326 V 33 w(n)m(um)m(b)s(er.)-30 2491 +y Fp()450 2600 y Fr(Simple)d(v)m(ectors)j(o)m(v)m(er) +g(cl)p 1322 2600 V 33 w(N.)-30 2765 y Fp()450 +2874 y Fr(Simple)d(v)m(ectors)j(o)m(v)m(er)g(cl)p 1322 +2874 V 33 w(R.)-30 3039 y Fp()450 +3148 y Fr(Simple)d(v)m(ectors)j(o)m(v)m(er)g(cl)p 1322 +3148 V 33 w(RA.)-30 3313 y Fp()450 +3422 y Fr(Simple)d(v)m(ectors)j(o)m(v)m(er)g(cl)p 1322 +3422 V 33 w(I.)-30 3587 y Fp()450 3696 +y Fr(Simple)d(v)m(ectors)j(of)e(general)i(ring)e(elemen)m(ts.)-30 +3861 y Fp()450 3970 y Fr(Univ)-5 b(ariate)32 +b(p)s(olynomials.)-30 4134 y Fp()450 +4244 y Fr(Univ)-5 b(ariate)32 b(p)s(olynomials)d(o)m(v)m(er)j(the)f(in) +m(tegers.)-30 4408 y Fp()450 +4518 y Fr(Univ)-5 b(ariate)32 b(p)s(olynomials)d(o)m(v)m(er)j(the)f +(rational)g(n)m(um)m(b)s(ers.)-30 4682 y Fp()450 +4792 y Fr(Univ)-5 b(ariate)32 b(p)s(olynomials)d(o)m(v)m(er)j(the)f +(real)g(n)m(um)m(b)s(ers.)-30 4956 y Fp()450 +5066 y Fr(Univ)-5 b(ariate)32 b(p)s(olynomials)d(o)m(v)m(er)j(the)f +(complex)f(n)m(um)m(b)s(ers.)-30 5230 y Fp()450 +5340 y Fr(Univ)-5 b(ariate)32 b(p)s(olynomials)d(o)m(v)m(er)j(mo)s +(dular)c(in)m(teger)k(rings.)p eop +%%Page: 49 51 +49 50 bop -30 -116 a Fr(Chapter)30 b(11:)41 b(Using)31 +b(the)f(library)2681 b(49)-30 299 y Fp()450 +408 y Fr(Timing)29 b(facilities.)-30 576 y Fp()450 +686 y Fr(Includes)h(all)h(of)f(the)h(ab)s(o)m(v)m(e.)-30 +965 y Fs(11.4)68 b(An)44 b(Example)-30 1166 y Fr(A)30 b(function)h(whic)m(h)f(computes)f(the)i(n)m(th)f(Fib)s(onacci)h(n)m (um)m(b)s(er)d(can)j(b)s(e)f(written)g(as)h(follo)m(ws.)210 -3953 y Fp(#include)46 b()210 4056 y(#include)g -()210 4264 y(//)h(Returns)f(F_n,)h(computed)e(as)i(the)g -(nearest)f(integer)g(to)210 4368 y(//)h -(\(\(1+sqrt\(5\)\)/2\)^n/sqrt\(5\))o(.)42 b(Assume)k(n>=0.)210 -4472 y(const)g(cl_I)h(fibonacci)e(\(int)i(n\))210 4575 -y({)592 4679 y(//)g(Need)g(a)g(precision)e(of)j -(\(\(1+sqrt\(5\)\)/2\)^-n.)592 4783 y(cl_float_format_t)43 +1303 y Fp(#include)46 b()210 1407 y(#include)g +()210 1511 y(using)g(namespace)g(cln;)210 +1718 y(//)h(Returns)f(F_n,)h(computed)e(as)i(the)g(nearest)f(integer)g +(to)210 1822 y(//)h(\(\(1+sqrt\(5\)\)/2\)^n/sqrt\(5\))o(.)42 +b(Assume)k(n>=0.)210 1926 y(const)g(cl_I)h(fibonacci)e(\(int)i(n\))210 +2030 y({)592 2133 y(//)g(Need)g(a)g(precision)e(of)j +(\(\(1+sqrt\(5\)\)/2\)^-n.)592 2237 y(cl_float_format_t)43 b(prec)k(=)g(cl_float_format\(\(int\)\(0.)o(2089)o(8764)o(1*n)o(+5\)\)) -o(;)592 4887 y(cl_R)f(sqrt5)h(=)g(sqrt\(cl_float\(5,prec\)\);)592 -4990 y(cl_R)f(phi)h(=)h(\(1+sqrt5\)/2;)592 5094 y(return)e(round1\()g -(expt\(phi,n\)/sqrt5)d(\);)210 5198 y(})-30 5340 y Fr(Let's)31 -b(explain)g(what)f(is)g(going)i(on)e(in)g(detail.)p eop -%%Page: 49 51 -49 50 bop -30 -116 a Fr(Chapter)30 b(11:)41 b(Using)31 -b(the)f(library)2681 b(49)-30 299 y(The)27 b(include)g(\014le)h -Fp()c Fr(is)k(necessary)g(b)s(ecause)f(the)h(t)m(yp)s(e)g -Fp(cl_I)e Fr(is)i(used)f(in)g(the)h(function,)g(and)f(the)-30 -408 y(include)k(\014le)g Fp()e Fr(is)i(needed)g(for)g(the)g -(t)m(yp)s(e)h Fp(cl_R)e Fr(and)h(the)g(\015oating)h(p)s(oin)m(t)f(n)m -(um)m(b)s(er)e(functions.)43 b(The)-30 518 y(order)30 -b(of)g(the)h(include)f(\014les)g(do)s(es)g(not)h(matter.)-30 -657 y(Then)23 b(comes)i(the)f(function)h(declaration.)40 +o(;)592 2341 y(cl_R)f(sqrt5)h(=)g(sqrt\(cl_float\(5,prec\)\);)592 +2445 y(cl_R)f(phi)h(=)h(\(1+sqrt5\)/2;)592 2548 y(return)e(round1\()g +(expt\(phi,n\)/sqrt5)d(\);)210 2652 y(})-30 2795 y Fr(Let's)31 +b(explain)g(what)f(is)g(going)i(on)e(in)g(detail.)-30 +2938 y(The)k(include)h(\014le)f Fp()d +Fr(is)j(necessary)h(b)s(ecause)g(the)g(t)m(yp)s(e)g Fp(cl_I)e +Fr(is)i(used)f(in)g(the)h(function,)h(and)-30 3048 y(the)31 +b(include)g(\014le)g Fp()c Fr(is)k(needed)g(for)f(the)i(t)m +(yp)s(e)f Fp(cl_R)e Fr(and)i(the)g(\015oating)h(p)s(oin)m(t)f(n)m(um)m +(b)s(er)d(functions.)-30 3157 y(The)37 b(order)g(of)h(the)f(include)h +(\014les)f(do)s(es)g(not)h(matter.)62 b(In)37 b(order)g(not)h(to)g +(write)g(out)g Fp(cln::)p Fl(fo)s(o)i Fr(w)m(e)e(can)g(safely)-30 +3267 y(imp)s(ort)29 b(the)h(whole)h(namespace)f Fp(cln)p +Fr(.)-30 3410 y(Then)23 b(comes)i(the)f(function)h(declaration.)40 b(The)24 b(argumen)m(t)g(is)g(an)h Fp(int)p Fr(,)g(the)f(result)h(an)f -(in)m(teger.)40 b(The)24 b(return)g(t)m(yp)s(e)-30 767 +(in)m(teger.)40 b(The)24 b(return)g(t)m(yp)s(e)-30 3520 y(is)33 b(de\014ned)e(as)i(`)p Fp(const)c(cl_I)p Fr(',)j(not)h(simply)e (`)p Fp(cl_I)p Fr(',)i(b)s(ecause)f(that)h(allo)m(ws)h(the)f(compiler)f -(to)h(detect)h(t)m(yp)s(os)f(lik)m(e)-30 876 y(`)p Fp(fibonacci\(n\))27 -b(=)j(100)p Fr('.)40 b(It)29 b(w)m(ould)f(b)s(e)h(p)s(ossible)f(to)i +(to)h(detect)h(t)m(yp)s(os)f(lik)m(e)-30 3629 y(`)p Fp(fibonacci\(n\)) +27 b(=)j(100)p Fr('.)40 b(It)29 b(w)m(ould)f(b)s(e)h(p)s(ossible)f(to)i (declare)f(the)h(return)d(t)m(yp)s(e)i(as)g Fp(const)g(cl_R)f -Fr(\(real)i(n)m(um)m(b)s(er\))-30 986 y(or)36 b(ev)m(en)g +Fr(\(real)i(n)m(um)m(b)s(er\))-30 3739 y(or)36 b(ev)m(en)g Fp(const)29 b(cl_N)35 b Fr(\(complex)h(n)m(um)m(b)s(er\).)55 b(W)-8 b(e)37 b(use)f(the)g(most)f(sp)s(ecialized)i(p)s(ossible)e -(return)g(t)m(yp)s(e)h(b)s(ecause)-30 1095 y(functions)26 +(return)g(t)m(yp)s(e)h(b)s(ecause)-30 3848 y(functions)26 b(whic)m(h)g(call)h(`)p Fp(fibonacci)p Fr(')d(will)j(b)s(e)e(able)i(to) g(pro\014t)f(from)e(the)j(compiler's)f(t)m(yp)s(e)g(analysis:)39 -b(Adding)26 b(t)m(w)m(o)-30 1205 y(in)m(tegers)g(is)e(sligh)m(tly)i +b(Adding)26 b(t)m(w)m(o)-30 3958 y(in)m(tegers)g(is)e(sligh)m(tly)i (more)e(e\016cien)m(t)i(than)e(adding)g(the)h(same)f(ob)5 b(jects)25 b(declared)g(as)g(complex)f(n)m(um)m(b)s(ers,)g(b)s(ecause) --30 1314 y(it)34 b(needs)f(less)h(t)m(yp)s(e)f(dispatc)m(h.)51 +-30 4068 y(it)34 b(needs)f(less)h(t)m(yp)s(e)f(dispatc)m(h.)51 b(Also,)35 b(when)d(linking)i(to)g(CLN)f(as)h(a)g(non-shared)e(library) --8 b(,)35 b(this)e(minimizes)f(the)-30 1424 y(size)f(of)g(the)f -(resulting)h(executable)h(program.)-30 1563 y(The)f(result)g(will)h(b)s +-8 b(,)35 b(this)e(minimizes)f(the)-30 4177 y(size)f(of)g(the)f +(resulting)h(executable)h(program.)-30 4320 y(The)f(result)g(will)h(b)s (e)f(computed)f(as)i(expt\(phi,n\)/sqrt\(5\),)h(rounded)d(to)j(the)e (nearest)h(in)m(teger.)46 b(In)31 b(order)g(to)h(get)-30 -1673 y(a)c(correct)h(result,)g(the)f(absolute)h(error)e(should)g(b)s(e) +4430 y(a)c(correct)h(result,)g(the)f(absolute)h(error)e(should)g(b)s(e) g(less)i(than)e(1/2,)j(i.e.)41 b(the)28 b(relativ)m(e)i(error)e(should) -f(b)s(e)g(less)h(than)-30 1782 y(sqrt\(5\)/\(2*expt\(phi,n\)\).)65 +f(b)s(e)g(less)h(than)-30 4539 y(sqrt\(5\)/\(2*expt\(phi,n\)\).)65 b(T)-8 b(o)38 b(this)g(end,)h(the)e(\014rst)g(line)h(computes)f(a)h (\015oating)g(p)s(oin)m(t)g(precision)g(for)f(sqrt\(5\))-30 -1892 y(and)30 b(phi.)-30 2031 y(Then)41 b(sqrt\(5\))h(is)g(computed)e +4649 y(and)30 b(phi.)-30 4792 y(Then)41 b(sqrt\(5\))h(is)g(computed)e (b)m(y)i(\014rst)e(con)m(v)m(erting)k(the)e(in)m(teger)h(5)f(to)g(a)g (\015oating)g(p)s(oin)m(t)g(n)m(um)m(b)s(er)d(and)i(than)-30 -2140 y(taking)i(the)f(square)g(ro)s(ot.)76 b(The)42 b(con)m(v)m(erse,)k +4902 y(taking)i(the)f(square)g(ro)s(ot.)76 b(The)42 b(con)m(v)m(erse,)k (\014rst)c(taking)h(the)f(square)g(ro)s(ot)g(of)g(5,)k(and)c(then)f -(con)m(v)m(erting)j(to)-30 2250 y(the)c(desired)f(precision,)j(w)m +(con)m(v)m(erting)j(to)-30 5011 y(the)c(desired)f(precision,)j(w)m (ould)e(not)g(w)m(ork)f(in)h(CLN:)f(The)g(square)h(ro)s(ot)g(w)m(ould)f -(b)s(e)g(computed)f(to)j(a)f(default)-30 2359 y(precision)g(\(normally) +(b)s(e)g(computed)f(to)j(a)f(default)-30 5121 y(precision)g(\(normally) f(single-\015oat)j(precision\),)h(and)c(the)h(follo)m(wing)i(con)m(v)m -(ersion)f(could)f(not)g(help)f(ab)s(out)h(the)-30 2469 +(ersion)f(could)f(not)g(help)f(ab)s(out)h(the)-30 5230 y(lac)m(king)h(accuracy)-8 b(.)68 b(This)39 b(is)g(b)s(ecause)g(CLN)g (is)g(not)g(a)g(sym)m(b)s(olic)g(computer)f(algebra)i(system)e(and)h -(do)s(es)g(not)-30 2579 y(represen)m(t)30 b(sqrt\(5\))i(in)e(a)h(non-n) -m(umeric)d(w)m(a)m(y)-8 b(.)-30 2717 y(The)29 b(t)m(yp)s(e)i +(do)s(es)g(not)-30 5340 y(represen)m(t)30 b(sqrt\(5\))i(in)e(a)h(non-n) +m(umeric)d(w)m(a)m(y)-8 b(.)p eop +%%Page: 50 52 +50 51 bop -30 -116 a Fr(Chapter)30 b(11:)41 b(Using)31 +b(the)f(library)2681 b(50)-30 299 y(The)29 b(t)m(yp)s(e)i Fp(cl_R)d Fr(for)i(sqrt5)g(and,)g(in)g(the)g(follo)m(wing)h(line,)g (phi)e(is)h(the)h(only)f(p)s(ossible)f(c)m(hoice.)43 -b(Y)-8 b(ou)30 b(cannot)h(write)-30 2827 y Fp(cl_F)26 +b(Y)-8 b(ou)30 b(cannot)h(write)-30 408 y Fp(cl_F)26 b Fr(b)s(ecause)h(the)g(C)p Fp(++)g Fr(compiler)f(can)i(only)f(infer)g (that)g Fp(cl_float\(5,prec\))c Fr(is)k(a)h(real)f(n)m(um)m(b)s(er.)38 -b(Y)-8 b(ou)27 b(cannot)-30 2937 y(write)k Fp(cl_N)e -Fr(b)s(ecause)h(a)h(`)p Fp(round1)p Fr(')e(do)s(es)h(not)h(exist)g(for) -f(general)h(complex)f(n)m(um)m(b)s(ers.)-30 3075 y(When)21 -b(the)g(function)g(returns,)h(all)g(the)f(lo)s(cal)h(v)-5 -b(ariables)22 b(in)f(the)g(function)g(are)g(automatically)i(reclaimed)e -(\(garbage)-30 3185 y(collected\).)43 b(Only)30 b(the)h(result)f -(surviv)m(es)g(and)g(gets)h(passed)f(to)h(the)g(caller.)-30 -3324 y(The)d(\014le)h Fp(fibonacci.cc)c Fr(in)j(the)h(sub)s(directory)e -Fp(examples)f Fr(con)m(tains)k(this)f(implemen)m(tation)f(together)i -(with)e(an)-30 3434 y(ev)m(en)j(faster)g(algorithm.)-30 -3702 y Fs(11.4)68 b(Debugging)46 b(supp)t(ort)-30 3899 -y Fr(When)30 b(debugging)g(a)h(CLN)f(application)i(with)e(GNU)h -Fp(gdb)p Fr(,)f(t)m(w)m(o)h(facilities)i(are)e(a)m(v)-5 -b(ailable)33 b(from)28 b(the)j(library:)45 4038 y Fq(\017)60 -b Fr(The)36 b(library)g(do)s(es)g(t)m(yp)s(e)h(c)m(hec)m(ks,)j(range)d -(c)m(hec)m(ks,)i(consistency)f(c)m(hec)m(ks)g(at)f(man)m(y)f(places.)60 -b(When)36 b(one)h(of)150 4147 y(these)44 b(fails,)j(the)c(function)g -Fp(cl_abort\(\))e Fr(is)i(called.)81 b(Its)43 b(default)g(implemen)m -(tation)g(is)g(to)h(p)s(erform)d(an)150 4257 y Fp(exit\(1\))p -Fr(,)32 b(so)i(y)m(ou)g(w)m(on't)g(ha)m(v)m(e)h(a)f(core)g(dump.)47 -b(But)34 b(for)f(debugging,)h(it)g(is)g(b)s(est)f(to)h(set)g(a)g -(breakp)s(oin)m(t)f(at)150 4366 y(this)d(function:)390 -4497 y Fp(\(gdb\))46 b(break)h(cl_abort)150 4634 y Fr(When)30 +b(Y)-8 b(ou)27 b(cannot)-30 518 y(write)k Fp(cl_N)e Fr(b)s(ecause)h(a)h +(`)p Fp(round1)p Fr(')e(do)s(es)h(not)h(exist)g(for)f(general)h +(complex)f(n)m(um)m(b)s(ers.)-30 651 y(When)21 b(the)g(function)g +(returns,)h(all)g(the)f(lo)s(cal)h(v)-5 b(ariables)22 +b(in)f(the)g(function)g(are)g(automatically)i(reclaimed)e(\(garbage)-30 +761 y(collected\).)43 b(Only)30 b(the)h(result)f(surviv)m(es)g(and)g +(gets)h(passed)f(to)h(the)g(caller.)-30 894 y(The)d(\014le)h +Fp(fibonacci.cc)c Fr(in)j(the)h(sub)s(directory)e Fp(examples)f +Fr(con)m(tains)k(this)f(implemen)m(tation)f(together)i(with)e(an)-30 +1003 y(ev)m(en)j(faster)g(algorithm.)-30 1257 y Fs(11.5)68 +b(Debugging)46 b(supp)t(ort)-30 1448 y Fr(When)30 b(debugging)g(a)h +(CLN)f(application)i(with)e(GNU)h Fp(gdb)p Fr(,)f(t)m(w)m(o)h +(facilities)i(are)e(a)m(v)-5 b(ailable)33 b(from)28 b(the)j(library:)45 +1581 y Fq(\017)60 b Fr(The)36 b(library)g(do)s(es)g(t)m(yp)s(e)h(c)m +(hec)m(ks,)j(range)d(c)m(hec)m(ks,)i(consistency)f(c)m(hec)m(ks)g(at)f +(man)m(y)f(places.)60 b(When)36 b(one)h(of)150 1691 y(these)44 +b(fails,)j(the)c(function)g Fp(cl_abort\(\))e Fr(is)i(called.)81 +b(Its)43 b(default)g(implemen)m(tation)g(is)g(to)h(p)s(erform)d(an)150 +1800 y Fp(exit\(1\))p Fr(,)32 b(so)i(y)m(ou)g(w)m(on't)g(ha)m(v)m(e)h +(a)f(core)g(dump.)47 b(But)34 b(for)f(debugging,)h(it)g(is)g(b)s(est)f +(to)h(set)g(a)g(breakp)s(oin)m(t)f(at)150 1910 y(this)d(function:)390 +2037 y Fp(\(gdb\))46 b(break)h(cl_abort)150 2170 y Fr(When)30 b(this)g(breakp)s(oin)m(t)h(is)f(hit,)h(lo)s(ok)g(at)g(the)f(stac)m -(k's)i(bac)m(ktrace:)390 4765 y Fp(\(gdb\))46 b(where)45 -4902 y Fq(\017)60 b Fr(The)32 b(debugger's)g(normal)g +(k's)i(bac)m(ktrace:)390 2298 y Fp(\(gdb\))46 b(where)45 +2431 y Fq(\017)60 b Fr(The)32 b(debugger's)g(normal)g Fp(print)f Fr(command)f(do)s(esn't)j(kno)m(w)f(ab)s(out)h(CLN's)f(t)m -(yp)s(es)g(and)g(therefore)h(prin)m(ts)150 5011 y(mostly)j(useless)g +(yp)s(es)g(and)g(therefore)h(prin)m(ts)150 2540 y(mostly)j(useless)g (hexadecimal)h(addresses.)58 b(CLN)35 b(o\013ers)i(a)g(function)f Fp(cl_print)p Fr(,)f(callable)k(from)34 b(the)j(de-)150 -5121 y(bugger,)29 b(for)f(prin)m(ting)g(n)m(um)m(b)s(er)d(ob)5 +2650 y(bugger,)29 b(for)f(prin)m(ting)g(n)m(um)m(b)s(er)d(ob)5 b(jects.)41 b(In)28 b(order)f(to)i(get)g(this)f(function,)h(y)m(ou)f -(ha)m(v)m(e)i(to)f(de\014ne)e(the)h(macro)150 5230 y(`)p +(ha)m(v)m(e)i(to)f(de\014ne)e(the)h(macro)150 2760 y(`)p Fp(CL_DEBUG)p Fr(')21 b(and)h(then)g(include)g(all)i(the)f(header)f (\014les)h(for)f(whic)m(h)g(y)m(ou)h(w)m(an)m(t)h Fp(cl_print)c -Fr(debugging)i(supp)s(ort.)150 5340 y(F)-8 b(or)31 b(example:)p -eop -%%Page: 50 52 -50 51 bop -30 -116 a Fr(Chapter)30 b(11:)41 b(Using)31 -b(the)f(library)2681 b(50)390 299 y Fp(#define)46 b(CL_DEBUG)390 -403 y(#include)g()150 537 y Fr(No)m(w,)30 -b(if)e(y)m(ou)g(ha)m(v)m(e)i(in)d(y)m(our)h(program)f(a)i(v)-5 -b(ariable)29 b Fp(cl_string)f(s)p Fr(,)g(and)g(insp)s(ect)g(it)g(under) -f Fp(gdb)p Fr(,)h(the)g(output)150 647 y(ma)m(y)i(lo)s(ok)h(lik)m(e)h -(this:)390 775 y Fp(\(gdb\))46 b(print)h(s)390 879 y($7)g(=)h -({)43 b(=)48 b({)f(=)h({pointer)d(=)j(0x8055b60,)d -(heappointer)f(=)k(0x8055b60,)485 983 y(word)f(=)h(134568800}},)c(})390 -1087 y(\(gdb\))i(call)h(cl_print\(s\))390 1191 y(\(cl_string\))e("")390 -1294 y($8)i(=)h(134568800)150 1429 y Fr(Note)38 b(that)f(the)g(output)f +Fr(debugging)i(supp)s(ort.)150 2869 y(F)-8 b(or)31 b(example:)390 +2996 y Fp(#define)46 b(CL_DEBUG)390 3100 y(#include)g() +150 3233 y Fr(No)m(w,)30 b(if)e(y)m(ou)g(ha)m(v)m(e)i(in)d(y)m(our)h +(program)f(a)i(v)-5 b(ariable)29 b Fp(cl_string)f(s)p +Fr(,)g(and)g(insp)s(ect)g(it)g(under)f Fp(gdb)p Fr(,)h(the)g(output)150 +3343 y(ma)m(y)i(lo)s(ok)h(lik)m(e)h(this:)390 3470 y +Fp(\(gdb\))46 b(print)h(s)390 3574 y($7)g(=)h({)43 +b(=)48 b({)f(=)h({pointer)d(=)j(0x8055b60,)d(heappointer)f(=)k +(0x8055b60,)485 3678 y(word)f(=)h(134568800}},)c(})390 +3782 y(\(gdb\))i(call)h(cl_print\(s\))390 3885 y(\(cl_string\))e("")390 +3989 y($8)i(=)h(134568800)150 4122 y Fr(Note)38 b(that)f(the)g(output)f (of)h Fp(cl_print)d Fr(go)s(es)j(to)g(the)g(program's)f(error)g -(output,)i(not)e(to)i(gdb's)e(standard)150 1538 y(output.)150 -1673 y(Note,)43 b(ho)m(w)m(ev)m(er,)f(that)d(the)g(ab)s(o)m(v)m(e)i +(output,)i(not)e(to)i(gdb's)e(standard)150 4232 y(output.)150 +4365 y(Note,)43 b(ho)m(w)m(ev)m(er,)f(that)d(the)g(ab)s(o)m(v)m(e)i (facilit)m(y)f(do)s(es)f(not)g(w)m(ork)g(with)f(all)i(CLN)f(t)m(yp)s -(es,)i(only)e(with)f(n)m(um)m(b)s(er)150 1782 y(ob)5 +(es,)i(only)e(with)f(n)m(um)m(b)s(er)150 4475 y(ob)5 b(jects)27 b(and)e(similar.)38 b(Therefore)26 b(CLN)f(o\013ers)i(a)f (mem)m(b)s(er)d(function)j Fp(debug_print\(\))c Fr(on)j(all)i(CLN)f(t)m -(yp)s(es.)150 1892 y(The)h(same)g(macro)g(`)p Fp(CL_DEBUG)p +(yp)s(es.)150 4584 y(The)h(same)g(macro)g(`)p Fp(CL_DEBUG)p Fr(')f(is)h(needed)h(for)f(this)g(mem)m(b)s(er)e(function)i(to)i(b)s(e) -e(implemen)m(ted.)38 b(Under)27 b Fp(gdb)p Fr(,)150 2002 -y(y)m(ou)k(call)g(it)g(lik)m(e)h(this:)390 2130 y Fp(\(gdb\))46 -b(print)h(s)390 2234 y($7)g(=)h({)43 b(=)48 +e(implemen)m(ted.)38 b(Under)27 b Fp(gdb)p Fr(,)150 4694 +y(y)m(ou)k(call)g(it)g(lik)m(e)h(this:)390 4821 y Fp(\(gdb\))46 +b(print)h(s)390 4925 y($7)g(=)h({)43 b(=)48 b({)f(=)h({pointer)d(=)j(0x8055b60,)d(heappointer)f(=)k(0x8055b60,)485 -2338 y(word)f(=)h(134568800}},)c(})390 2442 y(\(gdb\))i(call)h -(s.debug_print\(\))390 2545 y(\(cl_string\))e("")390 -2649 y(\(gdb\))h(define)g(cprint)390 2753 y(>call)g -(\($1\).debug_print\(\))390 2857 y(>end)390 2961 y(\(gdb\))g(cprint)g -(s)390 3064 y(\(cl_string\))f("")150 3199 y Fr(Unfortunately)-8 +5029 y(word)f(=)h(134568800}},)c(})390 5132 y(\(gdb\))i(call)h +(s.debug_print\(\))390 5236 y(\(cl_string\))e("")390 +5340 y(\(gdb\))h(define)g(cprint)p eop +%%Page: 51 53 +51 52 bop -30 -116 a Fr(Chapter)30 b(11:)41 b(Using)31 +b(the)f(library)2681 b(51)390 299 y Fp(>call)46 b +(\($1\).debug_print\(\))390 403 y(>end)390 506 y(\(gdb\))g(cprint)g(s) +390 610 y(\(cl_string\))f("")150 745 y Fr(Unfortunately)-8 b(,)31 b(this)g(feature)f(do)s(es)g(not)h(seem)f(to)h(w)m(ork)f(under)f (all)i(circumstances.)p eop -%%Page: 51 53 -51 52 bop -30 -116 a Fr(Chapter)30 b(12:)41 b(Customizing)2863 -b(51)-30 299 y Fo(12)80 b(Customizing)-30 656 y Fs(12.1)68 +%%Page: 52 54 +52 53 bop -30 -116 a Fr(Chapter)30 b(12:)41 b(Customizing)2863 +b(52)-30 299 y Fo(12)80 b(Customizing)-30 656 y Fs(12.1)68 b(Error)46 b(handling)-30 848 y Fr(When)30 b(a)h(fatal)g(error)f(o)s (ccurs,)g(an)g(error)g(message)g(is)g(output)g(to)h(the)f(standard)g (error)g(output)f(stream,)h(and)g(the)-30 958 y(function)c @@ -4617,7 +4677,7 @@ Fp(cl_abort)e Fr(is)i(called.)41 b(The)26 b(default)g(v)m(ersion)h(of)g -30 1068 y(the)i(application.)41 b(T)-8 b(o)29 b(catc)m(h)h(suc)m(h)d (a)i(fatal)g(error,)f(y)m(ou)h(need)e(to)i(de\014ne)f(the)g(function)f Fp(cl_abort)f Fr(y)m(ourself,)j(with)-30 1177 y(the)i(protot)m(yp)s(e) -210 1306 y Fp(#include)46 b()210 1410 y(void)h(cl_abort)e +210 1306 y Fp(#include)46 b()210 1410 y(void)h(cl_abort)e (\(void\);)-30 1544 y Fr(This)30 b(function)g(m)m(ust)f(not)i(return)e (con)m(trol)j(to)f(its)f(caller.)-30 1802 y Fs(12.2)68 b(Floating-p)t(oin)l(t)47 b(under\015o)l(w)-30 1994 y @@ -4637,1179 +4697,1205 @@ b(v)-5 b(alue)30 b(of)h Fp(cl_inhibit_floating_poin)o(t_un)o(der)o b(Customizing)46 b(I/O)-30 3036 y Fr(The)31 b(output)g(of)g(the)g (function)g Fp(fprint)f Fr(ma)m(y)h(b)s(e)f(customized)h(b)m(y)g(c)m (hanging)i(the)e(v)-5 b(alue)32 b(of)f(the)h(global)g(v)-5 -b(ariable)-30 3146 y Fp(cl_default_print_flags)p Fr(.)-30 +b(ariable)-30 3146 y Fp(default_print_flags)p Fr(.)-30 3403 y Fs(12.4)68 b(Customizing)46 b(the)f(memory)h(allo)t(cator)-30 -3596 y Fr(Ev)m(ery)38 b(memory)e(allo)s(cation)k(of)e(CLN)f(is)h(done)g -(through)f(the)h(function)g(p)s(oin)m(ter)f Fp(cl_malloc_hook)p -Fr(.)60 b(F)-8 b(reeing)-30 3705 y(of)35 b(this)f(memory)f(is)i(done)f -(through)g(the)h(function)f(p)s(oin)m(ter)h Fp(cl_free_hook)p -Fr(.)50 b(The)34 b(default)h(v)m(ersions)g(of)f(these)-30 -3815 y(functions,)f(pro)m(vided)f(in)g(the)h(library)-8 -b(,)33 b(call)h Fp(malloc)d Fr(and)h Fp(free)f Fr(and)h(c)m(hec)m(k)i -(the)f Fp(malloc)e Fr(result)h(against)i Fp(NULL)p Fr(.)-30 -3924 y(If)c(y)m(ou)g(w)m(an)m(t)h(to)f(pro)m(vide)g(another)h(memory)d -(allo)s(cator,)k(y)m(ou)e(need)g(to)h(de\014ne)e(the)h(v)-5 -b(ariables)31 b Fp(cl_malloc_hook)-30 4034 y Fr(and)f -Fp(cl_free_hook)d Fr(y)m(ourself,)k(lik)m(e)g(this:)210 -4163 y Fp(#include)46 b()210 4267 y(void*)g -(\(*cl_malloc_hook\))d(\(size_t)j(size\))h(=)g(...)o(;)210 -4370 y(void)g(\(*cl_free_hook\))c(\(void*)j(ptr\))286 -b(=)47 b(...)o(;)-30 4505 y Fr(The)30 b Fp(cl_malloc_hook)c +3596 y Fr(Ev)m(ery)28 b(memory)e(allo)s(cation)k(of)e(CLN)g(is)g(done)f +(through)g(the)h(function)g(p)s(oin)m(ter)g Fp(malloc_hook)p +Fr(.)37 b(F)-8 b(reeing)29 b(of)f(this)-30 3705 y(memory)33 +b(is)j(done)f(through)g(the)g(function)g(p)s(oin)m(ter)h +Fp(free_hook)p Fr(.)53 b(The)35 b(default)g(v)m(ersions)h(of)f(these)h +(functions,)-30 3815 y(pro)m(vided)27 b(in)h(the)f(library)-8 +b(,)29 b(call)g Fp(malloc)d Fr(and)h Fp(free)f Fr(and)h(c)m(hec)m(k)i +(the)f Fp(malloc)e Fr(result)h(against)i Fp(NULL)p Fr(.)39 +b(If)27 b(y)m(ou)h(w)m(an)m(t)-30 3924 y(to)i(pro)m(vide)f(another)h +(memory)d(allo)s(cator,)32 b(y)m(ou)e(need)f(to)h(de\014ne)e(the)i(v)-5 +b(ariables)30 b Fp(malloc_hook)c Fr(and)i Fp(free_hook)-30 +4034 y Fr(y)m(ourself,)j(lik)m(e)h(this:)210 4163 y Fp(#include)46 +b()210 4267 y(namespace)f(cln)i({)592 4370 +y(void*)f(\(*malloc_hook\))e(\(size_t)i(size\))g(=)i(...)o(;)592 +4474 y(void)e(\(*free_hook\))f(\(void*)h(ptr\))285 b(=)48 +b(...)o(;)210 4578 y(})-30 4712 y Fr(The)30 b Fp(cl_malloc_hook)c Fr(function)k(m)m(ust)g(not)g(return)g(a)g Fp(NULL)g -Fr(p)s(oin)m(ter.)-30 4639 y(It)e(is)f(not)h(p)s(ossible)f(to)h(c)m +Fr(p)s(oin)m(ter.)-30 4847 y(It)e(is)f(not)h(p)s(ossible)f(to)h(c)m (hange)h(the)e(memory)f(allo)s(cator)j(at)f(run)m(time,)f(b)s(ecause)h -(it)g(is)f(already)h(called)h(at)f(program)-30 4749 y(startup)i(b)m(y)g +(it)g(is)f(already)h(called)h(at)f(program)-30 4956 y(startup)i(b)m(y)g (the)h(constructors)f(of)h(some)f(global)h(v)-5 b(ariables.)p eop -%%Page: 52 54 -52 53 bop -30 -116 a Fr(Index)3646 b(52)-30 299 y Fo(Index)-30 -614 y Fs(A)-30 737 y Fe(abs)26 b(\(\))12 b Fd(.)h(.)f(.)h(.)f(.)g(.)h +%%Page: 53 55 +53 54 bop -30 -116 a Fr(Index)3646 b(53)-30 299 y Fo(Index)-30 +614 y Fs(A)-30 737 y Fd(abs)26 b(\(\))12 b Fc(.)h(.)f(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)38 b Fc(12)-30 829 y(abstract)26 b(class)g Fd(.)12 +(.)g(.)38 b Fb(12)-30 829 y(abstract)26 b(class)g Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)50 b Fc(6)-30 921 y Fe(acos)27 b(\(\))10 b Fd(.)j(.)f(.)g(.)h(.)f +g(.)50 b Fb(6)-30 921 y Fd(acos)27 b(\(\))10 b Fc(.)j(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)36 b Fc(18)-30 1013 y Fe(acosh)27 b(\(\))9 b Fd(.)j(.)h(.)f(.)g +(.)h(.)36 b Fb(18)-30 1013 y Fd(acosh)27 b(\(\))9 b Fc(.)j(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)35 b Fc(19)-30 1105 y(adv)n(o)r(cacy)24 b Fd(.)12 +(.)f(.)35 b Fb(19)-30 1105 y(adv)n(o)r(cacy)24 b Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)50 b Fc(43)-30 1197 y(Arc)n(himedes')25 -b(constan)n(t)17 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +g(.)h(.)f(.)g(.)50 b Fb(43)-30 1197 y(Arc)n(himedes')25 +b(constan)n(t)17 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)43 -b Fc(19)-30 1289 y Fe(As\(\)\(\))6 b Fd(.)14 b(.)e(.)g(.)h(.)f(.)g(.)h +b Fb(19)-30 1289 y Fd(As\(\)\(\))6 b Fc(.)14 b(.)e(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)32 b Fc(9)-30 1381 y Fe(ash)26 b(\(\))12 b Fd(.)h(.)f(.)h(.)f(.) +(.)g(.)32 b Fb(9)-30 1381 y Fd(ash)26 b(\(\))12 b Fc(.)h(.)f(.)h(.)f(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)38 b Fc(22)-30 1473 y Fe(asin)8 b Fd(.)13 +h(.)f(.)g(.)38 b Fb(22)-30 1473 y Fd(asin)8 b Fc(.)13 b(.)g(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)34 b Fc(18)-30 1565 -y Fe(asin)27 b(\(\))10 b Fd(.)j(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)34 b Fb(18)-30 1565 +y Fd(asin)27 b(\(\))10 b Fc(.)j(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)36 -b Fc(18)-30 1657 y Fe(asinh)27 b(\(\))9 b Fd(.)j(.)h(.)f(.)g(.)h(.)f(.) +b Fb(18)-30 1657 y Fd(asinh)27 b(\(\))9 b Fc(.)j(.)h(.)f(.)g(.)h(.)f(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)35 -b Fc(19)-30 1749 y Fe(atan)8 b Fd(.)13 b(.)g(.)f(.)g(.)g(.)h(.)f(.)g(.) +b Fb(19)-30 1749 y Fd(atan)8 b Fc(.)13 b(.)g(.)f(.)g(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)34 b Fc(18)-30 1841 y Fe(atan)27 b(\(\))10 b Fd(.)j(.)f(.)g(.)h(.)f +f(.)34 b Fb(18)-30 1841 y Fd(atan)27 b(\(\))10 b Fc(.)j(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)36 b Fc(18)-30 1933 y Fe(atanh)27 b(\(\))9 b Fd(.)j(.)h(.)f(.)g +(.)h(.)36 b Fb(18)-30 1933 y Fd(atanh)27 b(\(\))9 b Fc(.)j(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)35 b Fc(19)-30 2180 y Fs(B)-30 2303 y Fe(basering)27 -b(\(\))d Fd(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)f(.)35 b Fb(19)-30 2180 y Fs(B)-30 2303 y Fd(basering)27 +b(\(\))d Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)49 b Fc(40)-30 2395 y Fe(binomial)27 -b(\(\))d Fd(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +f(.)g(.)h(.)f(.)g(.)49 b Fb(40)-30 2395 y Fd(binomial)27 +b(\(\))d Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)49 b Fc(23)-30 2487 y Fe(boole)27 -b(\(\))9 b Fd(.)j(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +f(.)g(.)h(.)f(.)g(.)49 b Fb(23)-30 2487 y Fd(boole)27 +b(\(\))9 b Fc(.)j(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)35 b Fc(21)-30 2579 -y Fe(boole_1)23 b Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)35 b Fb(21)-30 2579 +y Fd(boole_1)23 b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)48 b Fc(21)-30 -2671 y Fe(boole_2)23 b Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)48 b Fb(21)-30 +2671 y Fd(boole_2)23 b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)48 -b Fc(21)-30 2763 y Fe(boole_and)21 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g +b Fb(21)-30 2763 y Fd(boole_and)21 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)45 -b Fc(21)-30 2855 y Fe(boole_andc1)16 b Fd(.)f(.)d(.)g(.)h(.)f(.)g(.)h +b Fb(21)-30 2855 y Fd(boole_andc1)16 b Fc(.)f(.)d(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)42 b -Fc(21)-30 2947 y Fe(boole_andc2)16 b Fd(.)f(.)d(.)g(.)h(.)f(.)g(.)h(.)f +Fb(21)-30 2947 y Fd(boole_andc2)16 b Fc(.)f(.)d(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)42 b Fc(21)-30 -3039 y Fe(boole_c1)22 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)42 b Fb(21)-30 +3039 y Fd(boole_c1)22 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)46 b -Fc(21)-30 3131 y Fe(boole_c2)22 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h +Fb(21)-30 3131 y Fd(boole_c2)22 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)46 -b Fc(21)-30 3222 y Fe(boole_clr)21 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g +b Fb(21)-30 3222 y Fd(boole_clr)21 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)45 -b Fc(21)-30 3314 y Fe(boole_eqv)21 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g +b Fb(21)-30 3314 y Fd(boole_eqv)21 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)45 -b Fc(21)-30 3406 y Fe(boole_nand)17 b Fd(.)e(.)d(.)h(.)f(.)g(.)h(.)f(.) +b Fb(21)-30 3406 y Fd(boole_nand)17 b Fc(.)e(.)d(.)h(.)f(.)g(.)h(.)f(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)43 -b Fc(21)-30 3498 y Fe(boole_nor)21 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g +b Fb(21)-30 3498 y Fd(boole_nor)21 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)45 -b Fc(21)-30 3590 y Fe(boole_orc1)17 b Fd(.)e(.)d(.)h(.)f(.)g(.)h(.)f(.) +b Fb(21)-30 3590 y Fd(boole_orc1)17 b Fc(.)e(.)d(.)h(.)f(.)g(.)h(.)f(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)43 -b Fc(21)-30 3682 y Fe(boole_orc2)17 b Fd(.)e(.)d(.)h(.)f(.)g(.)h(.)f(.) +b Fb(21)-30 3682 y Fd(boole_orc2)17 b Fc(.)e(.)d(.)h(.)f(.)g(.)h(.)f(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)43 -b Fc(21)-30 3774 y Fe(boole_set)21 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g +b Fb(21)-30 3774 y Fd(boole_set)21 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)45 -b Fc(21)-30 3866 y Fe(boole_xor)21 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g +b Fb(21)-30 3866 y Fd(boole_xor)21 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)45 -b Fc(21)-30 4114 y Fs(C)-30 4236 y Fe(canonhom)27 b(\(\))15 -b Fd(.)f(.)e(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)41 -b Fc(35,)27 b(40)-30 4328 y(Catalan's)h(constan)n(t)10 -b Fd(.)i(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +b Fb(21)-30 4114 y Fs(C)-30 4236 y Fd(canonhom)27 b(\(\))8 +b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)34 +b Fb(33,)26 b(35,)h(40)-30 4328 y(Catalan's)h(constan)n(t)10 +b Fc(.)i(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)36 -b Fc(20)-30 4420 y Fe(ceiling1)27 b(\(\))d Fd(.)12 b(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)49 -b Fc(14)-30 4512 y Fe(ceiling2)27 b(\(\))d Fd(.)12 b(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)49 -b Fc(15)-30 4604 y Fe(cis)26 b(\(\))12 b Fd(.)h(.)f(.)h(.)f(.)g(.)h(.)f +b Fb(20)-30 4420 y Fd(catalanconst)28 b(\(\))17 b Fc(.)c(.)f(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)43 b Fb(20)-30 +4512 y Fd(ceiling1)27 b(\(\))d Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)49 b Fb(14)-30 +4604 y Fd(ceiling2)27 b(\(\))d Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)49 b Fb(15)-30 +4696 y(Cheb)n(yshev)25 b(p)r(olynomial)16 b Fc(.)c(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) +h(.)f(.)g(.)h(.)42 b Fb(42)-30 4788 y Fd(cis)26 b(\(\))12 +b Fc(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)38 b Fb(18)-30 4880 +y Fd(cl_abort)27 b(\(\))d Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)38 b Fc(18)-30 4696 y Fe(cl_idecoded_float)7 b Fd(.)16 -b(.)d(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)33 -b Fc(24)-30 4788 y Fe(cl_abort)27 b(\(\))d Fd(.)12 b(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)49 -b Fc(51)-30 4880 y Fe(cl_byte)23 b Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)48 -b Fc(21)-30 4972 y Fe(cl_catalanconst)29 b(\(\))13 b -Fd(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)39 -b Fc(20)-30 5064 y Fe(cl_compare)28 b(\(\))20 b Fd(.)13 -b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)46 -b Fc(13)-30 5156 y Fe(cl_cos_sin)28 b(\(\))20 b Fd(.)13 -b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)46 -b Fc(18)-30 5248 y Fe(cl_cos_sin_t)15 b Fd(.)g(.)d(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)40 b Fc(18)-30 -5340 y Fe(cl_cosh_sinh)28 b(\(\))17 b Fd(.)c(.)f(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)43 b Fc(19)2032 614 y -Fe(cl_cosh_sinh_t)12 b Fd(.)j(.)e(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)37 b Fc(19)2032 707 y Fe(CL_DEBUG)22 -b Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)46 b Fc(49)2032 800 y Fe(cl_decoded_dfloat)7 -b Fd(.)17 b(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)33 -b Fc(24)2032 892 y Fe(cl_decoded_ffloat)7 b Fd(.)17 b(.)12 -b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)33 b Fc(24)2032 -985 y Fe(cl_decoded_float)9 b Fd(.)16 b(.)c(.)h(.)f(.)g(.)h(.)f(.)g(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)34 b Fc(24)2032 1078 y Fe(cl_decoded_lfloat)7 -b Fd(.)17 b(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)33 -b Fc(24)2032 1170 y Fe(cl_decoded_sfloat)7 b Fd(.)17 -b(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)33 -b Fc(24)2032 1263 y Fe(cl_default_float_format)17 b Fd(.)g(.)c(.)f(.)g +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)49 b Fb(52)-30 4972 +y Fd(cl_byte)23 b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)48 b Fb(21)-30 +5064 y Fd(CL_DEBUG)22 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)42 b Fc(25)2032 1356 y Fe(cl_default_print_flags)18 -b Fd(.)g(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)44 b Fc(51)2032 1448 -y Fe(cl_default_random_state)17 b Fd(.)g(.)c(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)42 -b Fc(26)2032 1541 y Fe(cl_DF)8 b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h +g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)46 b +Fb(50)-30 5156 y Fd(cl_DF)8 b Fc(.)13 b(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)33 b Fb(7)-30 5248 y Fd(cl_DF_fdiv_t)15 b Fc(.)g(.)d(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)40 b +Fb(15)-30 5340 y Fd(cl_F)22 b Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)47 +b Fb(6,)26 b(7)2032 614 y Fd(cl_F_fdiv_t)16 b Fc(.)f(.)d(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)42 +b Fb(15)2032 707 y Fd(cl_FF)8 b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h -(.)f(.)34 b Fc(7)2032 1634 y Fe(cl_DF_fdiv_t)15 b Fd(.)g(.)d(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)40 -b Fc(15)2032 1726 y Fe(cl_double_approx)29 b(\(\))12 -b Fd(.)h(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)39 -b Fc(9)2032 1819 y Fe(cl_equal_hashcode)30 b(\(\))10 -b Fd(.)i(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)35 b Fc(13)2032 -1912 y Fe(cl_eulerconst)29 b(\(\))16 b Fd(.)c(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)g(.)h(.)f(.)g(.)h(.)41 b Fc(20)2032 2004 y Fe(cl_F)22 -b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f +(.)f(.)34 b Fb(7)2032 799 y Fd(cl_FF_fdiv_t)15 b Fc(.)g(.)d(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)46 b Fc(6,)27 b(7)2032 -2097 y Fe(cl_F_fdiv_t)16 b Fd(.)f(.)d(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)42 b Fc(15)2032 2190 -y Fe(cl_FF)8 b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)34 -b Fc(7)2032 2282 y Fe(cl_FF_fdiv_t)15 b Fd(.)g(.)d(.)g(.)h(.)f(.)g(.)h +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)40 +b Fb(15)2032 891 y Fd(cl_float)28 b(\(\))23 b Fc(.)12 +b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)40 b Fc(15)2032 -2375 y Fe(cl_find_modint_ring)30 b(\(\))7 b Fd(.)13 b(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)g(.)33 b Fc(34)2032 2468 y Fe(cl_find_univpoly_ring)e(\(\))22 -b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)48 b Fc(40)2032 2560 y Fe(cl_float)28 -b(\(\))23 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)48 b Fc(25)2032 2653 y Fe(cl_float_approx)29 -b(\(\))14 b Fd(.)f(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)40 -b Fc(9)2032 2746 y Fe(cl_float_format)29 b(\(\))13 b -Fd(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)38 -b Fc(25)2032 2838 y Fe(cl_float_format_t)7 b Fd(.)17 +h(.)48 b Fb(25)2032 984 y Fd(cl_float_format)29 b(\(\))13 +b Fc(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)38 +b Fb(25)2032 1076 y Fd(cl_float_format_t)7 b Fc(.)17 b(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)33 -b Fc(25)2032 2931 y Fe(cl_free_hook)c(\(\))17 b Fd(.)12 -b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)43 -b Fc(51)2032 3023 y Fe(cl_hermite)28 b(\(\))20 b Fd(.)13 -b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)46 -b Fc(42)2032 3116 y Fe(cl_I_to_int)28 b(\(\))20 b Fd(.)13 +b Fb(25)2032 1168 y Fd(cl_I_to_int)28 b(\(\))20 b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)46 -b Fc(9)2032 3209 y Fe(cl_I_to_long)29 b(\(\))18 b Fd(.)12 +b Fb(9)2032 1261 y Fd(cl_I_to_long)29 b(\(\))18 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)44 -b Fc(9)2032 3301 y Fe(cl_I_to_uint)29 b(\(\))18 b Fd(.)12 +b Fb(9)2032 1353 y Fd(cl_I_to_uint)29 b(\(\))18 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)44 -b Fc(9)2032 3394 y Fe(cl_I_to_ulong)29 b(\(\))17 b Fd(.)12 +b Fb(9)2032 1445 y Fd(cl_I_to_ulong)29 b(\(\))17 b Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)43 -b Fc(9)2032 3487 y Fe(cl_laguerre)28 b(\(\))18 b Fd(.)c(.)e(.)g(.)h(.)f -(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)44 b Fc(42)2032 -3579 y Fe(cl_legendre)28 b(\(\))18 b Fd(.)c(.)e(.)g(.)h(.)f(.)g(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)44 b Fc(42)2032 3672 -y Fe(cl_LF)8 b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)34 -b Fc(7)2032 3765 y Fe(cl_LF_fdiv_t)15 b Fd(.)g(.)d(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)40 b Fc(15)2032 -3857 y Fe(cl_malloc_hook)29 b(\(\))14 b Fd(.)f(.)f(.)h(.)f(.)g(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)40 b Fc(51)2032 3950 y Fe(cl_modint_ring)12 -b Fd(.)j(.)e(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)37 -b Fc(34)2032 4043 y Fe(cl_N)9 b Fd(.)k(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)35 b Fc(6)2032 4135 y Fe(cl_number)22 b Fd(.)13 -b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) -h(.)f(.)g(.)h(.)46 b Fc(6)2032 4228 y Fe(cl_pi)27 b(\(\))9 -b Fd(.)k(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)35 b Fc(19)2032 4321 y Fe(cl_R)9 -b Fd(.)k(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)35 b Fc(6)2032 -4413 y Fe(cl_R_fdiv_t)16 b Fd(.)f(.)d(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)42 b Fc(15)2032 4506 -y Fe(cl_RA)8 b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)34 -b Fc(6)2032 4599 y Fe(cl_random_state)10 b Fd(.)16 b(.)c(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)36 b Fc(26)2032 -4691 y Fe(cl_SF)8 b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g +b Fb(9)2032 1538 y Fd(cl_idecoded_float)7 b Fc(.)17 b(.)12 +b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)33 b Fb(24)2032 +1630 y Fd(cl_LF)8 b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)34 -b Fc(7)2032 4784 y Fe(cl_SF_fdiv_t)15 b Fd(.)g(.)d(.)g(.)h(.)f(.)g(.)h +b Fb(7)2032 1722 y Fd(cl_LF_fdiv_t)15 b Fc(.)g(.)d(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)40 b Fc(15)2032 -4877 y Fe(cl_string)28 b(\(\))22 b Fd(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.) +h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)40 b Fb(15)2032 +1815 y Fd(cl_modint_ring)12 b Fc(.)j(.)e(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)47 b Fc(37)2032 -4969 y Fe(cl_symbol)28 b(\(\))22 b Fd(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)47 b Fc(37)2032 -5062 y Fe(cl_tschebychev)29 b(\(\))14 b Fd(.)f(.)f(.)h(.)f(.)g(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)40 b Fc(42)2032 5155 y Fe(cl_zeta)27 -b(\(\))6 b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)32 b Fc(20)2032 5247 y -Fe(coeff)27 b(\(\))9 b Fd(.)k(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)35 b -Fc(41)2032 5340 y(comparison)24 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)37 b Fb(34)2032 1907 y Fd(cl_N)9 +b Fc(.)k(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)35 b Fb(6)2032 +1999 y Fd(cl_number)22 b Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)46 b +Fb(6)2032 2092 y Fd(cl_R)9 b Fc(.)k(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)35 b Fb(6)2032 2184 y Fd(cl_R_fdiv_t)16 b Fc(.)f(.)d(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)42 +b Fb(15)2032 2276 y Fd(cl_RA)8 b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)49 b -Fc(13)p eop -%%Page: 53 55 -53 54 bop -30 -116 a Fr(Index)3646 b(53)-30 299 y Fc(compiler)26 -b(options)9 b Fd(.)j(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)g(.)35 b Fc(45)-30 391 y Fe(complex)27 b(\(\))6 -b Fd(.)13 b(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h +(.)f(.)34 b Fb(6)2032 2369 y Fd(cl_SF)8 b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)32 b Fc(12)-30 482 y(complex)25 b(n)n(um)n(b)r(er) -19 b Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)48 -b Fc(6,)26 b(8)-30 574 y Fe(conjugate)i(\(\))21 b Fd(.)13 -b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -47 b Fc(12)-30 666 y(con)n(v)n(ersion)15 b Fd(.)e(.)f(.)g(.)h(.)f(.)g +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)g(.)h(.)f(.)34 b Fb(7)2032 2461 y Fd(cl_SF_fdiv_t)15 +b Fc(.)g(.)d(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g +(.)h(.)40 b Fb(15)2032 2553 y Fd(cl_string)21 b Fc(.)12 +b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)45 b Fb(37)2032 2646 y Fd(cl_symbol)21 b +Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)45 b Fb(37)2032 2738 y Fd(coeff)27 +b(\(\))9 b Fc(.)k(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)35 b Fb(41)2032 2830 +y Fd(compare)27 b(\(\))6 b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)32 b Fb(13)2032 +2923 y(comparison)24 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)49 b Fb(13)2032 +3015 y(compatibilit)n(y)10 b Fc(.)i(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)41 -b Fc(8,)26 b(25)-30 758 y Fe(cos)g(\(\))12 b Fd(.)h(.)f(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)36 b Fb(45)2032 3107 +y(compiler)26 b(options)9 b Fc(.)j(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)34 b Fb(45)2032 3200 y Fd(complex)27 +b(\(\))6 b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)38 b Fc(18)-30 849 y Fe(cosh)27 b(\(\))10 b Fd(.)j(.)f(.)g(.)h +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)32 b Fb(12)2032 3292 y(complex)25 +b(n)n(um)n(b)r(er)20 b Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)47 b Fb(6,)27 b(8)2032 3384 y Fd(conjugate)h(\(\))22 +b Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)47 b Fb(12)2032 3477 y(con)n(v)n(ersion)15 b +Fc(.)e(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)41 b Fb(8,)26 b(25)2032 3569 y Fd(cos)h(\(\))12 +b Fc(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)38 b Fb(18)2032 3661 +y Fd(cos_sin)27 b(\(\))6 b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)32 b Fb(18)2032 +3754 y Fd(cos_sin_t)21 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)45 b Fb(18)2032 +3846 y Fd(cosh)27 b(\(\))10 b Fc(.)j(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)36 +b Fb(19)2032 3938 y Fd(cosh_sinh)28 b(\(\))22 b Fc(.)12 +b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +47 b Fb(19)2032 4031 y Fd(cosh_sinh_t)16 b Fc(.)f(.)d(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)42 +b Fb(19)2032 4123 y Fd(create)27 b(\(\))8 b Fc(.)13 b(.)f(.)g(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)33 +b Fb(40)2032 4215 y(customizing)15 b Fc(.)e(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)41 b +Fb(52)2032 4478 y Fs(D)2032 4601 y Fd(debug_print)28 +b(\(\))18 b Fc(.)c(.)e(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)44 b Fb(50)2032 4694 y(debugging)7 b Fc(.)12 +b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)32 b Fb(50)2032 4786 y Fd(decode_float)d(\(\))17 +b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)43 +b Fb(24)2032 4878 y Fd(decoded_dfloat)12 b Fc(.)j(.)e(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)37 b Fb(24)2032 +4971 y Fd(decoded_ffloat)12 b Fc(.)j(.)e(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)37 b Fb(24)2032 5063 y Fd(decoded_float)13 +b Fc(.)j(.)c(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)39 b Fb(24)2032 5155 y Fd(decoded_lfloat)12 b Fc(.)j(.)e(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)37 b Fb(24)2032 +5248 y Fd(decoded_sfloat)12 b Fc(.)j(.)e(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)37 b Fb(24)2032 5340 y Fd +(default_float_format)26 b Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)47 +b Fb(25)p eop +%%Page: 54 56 +54 55 bop -30 -116 a Fr(Index)3646 b(54)-30 299 y Fd +(default_print_flags)27 b Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +48 b Fb(52)-30 391 y Fd(default_random_state)26 b Fc(.)12 +b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)47 b Fb(26)-30 483 +y Fd(degree)27 b(\(\))8 b Fc(.)k(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)36 b Fc(19)-30 941 y Fe(create)27 b(\(\))8 -b Fd(.)k(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.) +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)33 b Fb(41)-30 +575 y Fd(denominator)28 b(\(\))18 b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)44 b Fb(12)-30 667 +y Fd(deposit_field)29 b(\(\))16 b Fc(.)c(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)33 b Fc(40)-30 1033 y(customizing)15 -b Fd(.)d(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f -(.)g(.)h(.)f(.)41 b Fc(51)-30 1292 y Fs(D)-30 1414 y -Fe(debug_print)28 b(\(\))18 b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)44 b Fc(50)-30 1506 y(debugging)7 -b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)41 b Fb(22)-30 759 y Fd(deriv)27 +b(\(\))9 b Fc(.)j(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)35 b Fb(41)-30 851 +y Fd(div)26 b(\(\))12 b Fc(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)g(.)33 b Fc(49)-30 1597 y Fe(decode_float)28 -b(\(\))17 b Fd(.)c(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)43 b Fc(24)-30 1689 y Fe(degree)27 b(\(\))8 b Fd(.)k(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)38 +b Fb(35)-30 943 y Fd(double_approx)29 b(\(\))17 b Fc(.)12 +b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)42 +b Fb(9)-30 1035 y Fd(doublefactorial)29 b(\(\))13 b Fc(.)f(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)39 b Fb(23)-30 1127 y +Fd(dpb)26 b(\(\))12 b Fc(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)38 +b Fb(22)-30 1389 y Fs(E)-30 1512 y Fd(equal)27 b(\(\))20 +b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -33 b Fc(41)-30 1781 y Fe(denominator)28 b(\(\))18 b Fd(.)13 -b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)44 -b Fc(12)-30 1873 y Fe(deposit_field)29 b(\(\))16 b Fd(.)c(.)g(.)g(.)h +f(.)g(.)h(.)45 b Fb(33,)27 b(37)-30 1604 y Fd(equal_hashcode)i(\(\))14 +b Fc(.)f(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)40 +b Fb(13)-30 1696 y(Euler's)27 b(constan)n(t)15 b Fc(.)d(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)41 b Fc(22)-30 -1964 y Fe(deriv)27 b(\(\))9 b Fd(.)j(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)41 b Fb(20)-30 +1788 y Fd(eulerconst)28 b(\(\))20 b Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)46 b Fb(20)-30 +1880 y Fd(evenp)27 b(\(\))9 b Fc(.)j(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)35 -b Fc(41)-30 2056 y Fe(div)26 b(\(\))12 b Fd(.)h(.)f(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)38 b Fc(35)-30 2148 y Fe(doublefactorial)29 b(\(\))13 -b Fd(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)39 -b Fc(23)-30 2240 y Fe(dpb)26 b(\(\))12 b Fd(.)h(.)f(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)38 b Fc(22)-30 2501 y Fs(E)-30 2623 y Fe(equal)27 -b(\(\))9 b Fd(.)j(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)35 b Fc(37)-30 2715 -y(Euler's)27 b(constan)n(t)15 b Fd(.)d(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)41 b Fc(20)-30 2806 y Fe(evenp)27 -b(\(\))9 b Fd(.)j(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)35 b Fc(22)-30 2898 -y(exact)26 b(n)n(um)n(b)r(er)20 b Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)48 b Fc(6)-30 -2990 y Fe(exp)26 b(\(\))12 b Fd(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)38 -b Fc(17)-30 3082 y Fe(exp1)27 b(\(\))10 b Fd(.)j(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f +b Fb(22)-30 1972 y(exact)26 b(n)n(um)n(b)r(er)20 b Fc(.)13 +b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -36 b Fc(17)-30 3173 y Fe(expt)27 b(\(\))14 b Fd(.)e(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)40 b Fc(11,)26 -b(17,)h(35)-30 3265 y Fe(expt_pos)g(\(\))8 b Fd(.)13 -b(.)g(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)34 -b Fc(11,)26 b(35,)h(41)-30 3357 y Fe(exquo)g(\(\))9 b -Fd(.)j(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)35 b Fc(11)-30 3618 y Fs(F)-30 -3740 y Fe(factorial)28 b(\(\))21 b Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)48 b Fb(6)-30 2064 y Fd(exp)26 b(\(\))12 b Fc(.)h(.)f(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)38 b Fb(17)-30 2156 y Fd(exp1)27 b(\(\))10 +b Fc(.)j(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)36 b Fb(17)-30 2248 y +Fd(expt)27 b(\(\))14 b Fc(.)e(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)g(.)h(.)f(.)g(.)h(.)40 b Fb(11,)26 b(17,)h(35)-30 +2340 y Fd(expt_pos)g(\(\))20 b Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)45 b Fb(11,)27 b(33,)f(35,)h(41)-30 2432 y Fd(exquo)g(\(\))9 +b Fc(.)j(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)35 b Fb(11)-30 2694 y Fs(F)-30 +2817 y Fd(factorial)28 b(\(\))21 b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)47 b Fc(23)-30 -3832 y Fe(fceiling)27 b(\(\))d Fd(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)47 b Fb(23)-30 +2909 y Fd(fceiling)27 b(\(\))d Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)49 b Fc(15)-30 -3924 y Fe(fceiling2)28 b(\(\))21 b Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.) +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)49 b Fb(15)-30 +3001 y Fd(fceiling2)28 b(\(\))21 b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)47 b Fc(15)-30 -4015 y Fe(ffloor)27 b(\(\))8 b Fd(.)k(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)47 b Fb(15)-30 +3093 y Fd(ffloor)27 b(\(\))8 b Fc(.)k(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)33 -b Fc(15)-30 4107 y Fe(ffloor2)27 b(\(\))6 b Fd(.)13 b(.)f(.)h(.)f(.)g +b Fb(15)-30 3185 y Fd(ffloor2)27 b(\(\))6 b Fc(.)13 b(.)f(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)32 -b Fc(15)-30 4199 y(Fib)r(onacci)27 b(n)n(um)n(b)r(er)18 -b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +b Fb(15)-30 3277 y(Fib)r(onacci)27 b(n)n(um)n(b)r(er)18 +b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)46 -b Fc(48)-30 4291 y Fe(finalize)27 b(\(\))d Fd(.)12 b(.)g(.)h(.)f(.)g(.) +b Fb(49)-30 3369 y Fd(finalize)27 b(\(\))d Fc(.)12 b(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)49 -b Fc(41)-30 4382 y Fe(float_digits)28 b(\(\))17 b Fd(.)c(.)f(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)43 b Fc(24)-30 -4474 y Fe(float_epsilon)29 b(\(\))16 b Fd(.)c(.)g(.)g(.)h(.)f(.)g(.)h +b Fb(41)-30 3461 y Fd(find_modint_ring)29 b(\(\))11 b +Fc(.)i(.)g(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)37 b Fb(34)-30 +3553 y Fd(find_univpoly_ring)30 b(\(\))8 b Fc(.)13 b(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h +(.)f(.)g(.)h(.)34 b Fb(40)-30 3645 y Fd(float_approx)28 +b(\(\))18 b Fc(.)13 b(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)44 b Fb(9)-30 3737 y Fd(float_digits)28 b(\(\))17 +b Fc(.)c(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)43 +b Fb(24)-30 3829 y Fd(float_epsilon)29 b(\(\))16 b Fc(.)c(.)g(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)41 b Fc(25)-30 4566 y Fe(float_exponent)29 -b(\(\))14 b Fd(.)f(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)40 -b Fc(24)-30 4658 y Fe(float_negative_epsilon)31 b(\(\))21 -b Fd(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)g(.)h(.)f(.)g(.)47 b Fc(25)-30 4749 y Fe(float_precision)29 -b(\(\))13 b Fd(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)39 -b Fc(24)-30 4841 y Fe(float_radix)28 b(\(\))18 b Fd(.)13 +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)41 b Fb(25)-30 +3921 y Fd(float_exponent)29 b(\(\))14 b Fc(.)f(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)40 b Fb(24)-30 4013 y Fd +(float_negative_epsilon)31 b(\(\))21 b Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)47 +b Fb(25)-30 4105 y Fd(float_precision)29 b(\(\))13 b +Fc(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)39 +b Fb(24)-30 4197 y Fd(float_radix)28 b(\(\))18 b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)44 -b Fc(24)-30 4933 y Fe(float_sign)28 b(\(\))20 b Fd(.)13 +b Fb(24)-30 4289 y Fd(float_sign)28 b(\(\))20 b Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)46 -b Fc(24)-30 5024 y(\015oating-p)r(oin)n(t)26 b(n)n(um)n(b)r(er)12 -b Fd(.)e(.)j(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +b Fb(24)-30 4381 y(\015oating-p)r(oin)n(t)26 b(n)n(um)n(b)r(er)12 +b Fc(.)e(.)j(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)38 -b Fc(7)2032 299 y Fe(floor1)27 b(\(\))8 b Fd(.)13 b(.)f(.)g(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)33 -b Fc(14)2032 391 y Fe(floor2)27 b(\(\))8 b Fd(.)13 b(.)f(.)g(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)33 -b Fc(15)2032 482 y Fe(fprint)27 b(\(\))18 b Fd(.)13 b(.)g(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)44 -b Fc(36,)27 b(41)2032 574 y Fe(fround)g(\(\))8 b Fd(.)13 -b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +b Fb(7)-30 4473 y Fd(floor1)27 b(\(\))8 b Fc(.)k(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)33 +b Fb(14)-30 4565 y Fd(floor2)27 b(\(\))8 b Fc(.)k(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)33 +b Fb(15)-30 4657 y Fd(fprint)27 b(\(\))11 b Fc(.)i(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)37 b Fb(33,)26 b(36,)h(41)-30 +4749 y Fd(free_hook)h(\(\))21 b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) -h(.)f(.)g(.)h(.)33 b Fc(15)2032 666 y Fe(fround2)27 b(\(\))6 -b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)32 b Fc(15)2032 758 y Fe(ftruncate)c(\(\))22 -b Fd(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)47 b Fb(52)-30 +4841 y Fd(fround)27 b(\(\))8 b Fc(.)k(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)47 b Fc(15)2032 849 y Fe(ftruncate2)28 b(\(\))20 -b Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)46 b Fc(15)2032 1095 y Fs(G)2032 1218 y Fc(garbage)27 -b(collection)14 b Fd(.)h(.)d(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)40 -b Fc(43,)27 b(44)2032 1310 y Fe(gcd)g(\(\))12 b Fd(.)g(.)h(.)f(.)g(.)g +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)33 +b Fb(15)-30 4933 y Fd(fround2)27 b(\(\))6 b Fc(.)13 b(.)f(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)32 +b Fb(15)-30 5024 y Fd(ftruncate)c(\(\))21 b Fc(.)13 b(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)47 +b Fb(15)2032 299 y Fd(ftruncate2)28 b(\(\))20 b Fc(.)13 +b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)46 +b Fb(15)2032 545 y Fs(G)2032 667 y Fb(garbage)27 b(collection)14 +b Fc(.)h(.)d(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)40 b +Fb(43,)27 b(44)2032 759 y Fd(gcd)g(\(\))12 b Fc(.)g(.)h(.)f(.)g(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)38 b Fb(23)2032 851 y(GMP)8 b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)33 b Fb(1,)27 b(4)2032 1110 y Fs(H)2032 1232 y Fb(header)f(\014les)7 +b Fc(.)13 b(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)33 b Fb(45)2032 1324 y Fd(hermite)27 +b(\(\))6 b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)32 b Fb(42)2032 1416 y(Hermite)25 +b(p)r(olynomial)7 b Fc(.)12 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)38 b Fc(23)2032 1401 y(GMP)8 b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)33 b Fc(1,)27 b(4)2032 1660 y Fs(H)2032 1783 y -Fc(header)f(\014les)7 b Fd(.)13 b(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)33 b Fc(45)2032 -1874 y(Hermite)25 b(p)r(olynomial)7 b Fd(.)12 b(.)h(.)f(.)g(.)g(.)h(.)f +g(.)h(.)32 b Fb(42)2032 1675 y Fs(I)2032 1797 y Fd(imagpart)c(\(\))23 +b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)32 b Fc(42)2032 2133 y Fs(I)2032 -2256 y Fe(imagpart)c(\(\))23 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) +f(.)g(.)h(.)48 b Fb(12)2032 1889 y(include)26 b(\014les)17 +b Fc(.)c(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)48 b Fc(12)2032 -2347 y(include)26 b(\014les)17 b Fd(.)c(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)43 b Fc(45)2032 -2439 y(Input/Output)14 b Fd(.)c(.)i(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)43 b Fb(45)2032 1980 y(Input/Output)14 +b Fc(.)c(.)i(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h +(.)f(.)40 b Fb(28)2032 2072 y(installation)9 b Fc(.)14 +b(.)e(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)g(.)h(.)f(.)40 b Fc(28)2032 2531 y(installation)9 -b Fd(.)14 b(.)e(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)35 b Fc(4)2032 2623 y Fe(instanceof)28 -b(\(\))20 b Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +g(.)h(.)f(.)g(.)35 b Fb(4)2032 2164 y Fd(instanceof)28 +b(\(\))20 b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)46 b Fc(33)2032 2714 y(in)n(teger)10 -b Fd(.)j(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +g(.)h(.)f(.)g(.)46 b Fb(33)2032 2256 y(in)n(teger)10 +b Fc(.)j(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)36 b Fc(6)2032 -2806 y Fe(integer_decode_float)30 b(\(\))24 b Fd(.)13 +(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)36 b Fb(6)2032 +2347 y Fd(integer_decode_float)30 b(\(\))24 b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)g(.)h(.)f(.)g(.)h(.)49 b Fc(24)2032 2898 y Fe(integer_length)29 -b(\(\))14 b Fd(.)f(.)f(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)49 b Fb(24)2032 2439 y Fd(integer_length)29 +b(\(\))14 b Fc(.)f(.)f(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)40 -b Fc(22)2032 2990 y Fe(isqrt)27 b(\(\))9 b Fd(.)k(.)f(.)g(.)h(.)f(.)g +b Fb(22)2032 2531 y Fd(isqrt)27 b(\(\))9 b Fc(.)k(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)35 -b Fc(16)2032 3251 y Fs(L)2032 3373 y Fc(Laguerre)27 b(p)r(olynomial)13 -b Fd(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +b Fb(16)2032 2792 y Fs(L)2032 2914 y Fd(laguerre)28 b(\(\))23 +b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)48 b Fb(42)2032 3006 y(Laguerre)27 b(p)r(olynomial)13 +b Fc(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)38 -b Fc(42)2032 3465 y Fe(lcm)27 b(\(\))12 b Fd(.)g(.)h(.)f(.)g(.)g(.)h(.) +b Fb(42)2032 3098 y Fd(lcm)27 b(\(\))12 b Fc(.)g(.)h(.)f(.)g(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)38 b Fc(23)2032 3557 y Fe(ldb)27 b(\(\))12 b Fd(.)g(.)h(.)f(.)g(.)g +g(.)38 b Fb(23)2032 3190 y Fd(ldb)27 b(\(\))12 b Fc(.)g(.)h(.)f(.)g(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)38 b Fc(22)2032 3648 y Fe(ldb_test)28 b(\(\))23 -b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)f(.)g(.)38 b Fb(22)2032 3281 y Fd(ldb_test)28 b(\(\))23 +b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)48 b Fc(22)2032 3740 y Fe(least_negative_float)30 -b(\(\))24 b Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)49 b Fc(25)2032 -3832 y Fe(least_positive_float)30 b(\(\))24 b Fd(.)13 +f(.)g(.)h(.)48 b Fb(22)2032 3373 y Fd(least_negative_float)30 +b(\(\))24 b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)49 b Fb(25)2032 +3465 y Fd(least_positive_float)30 b(\(\))24 b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)g(.)h(.)f(.)g(.)h(.)49 b Fc(25)2032 3924 y(Legende)26 -b(p)r(olynomial)e Fd(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g +(.)g(.)h(.)f(.)g(.)h(.)49 b Fb(25)2032 3557 y(Legende)26 +b(p)r(olynomial)e Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -49 b Fc(42)2032 4015 y Fe(length)27 b(\(\))8 b Fd(.)13 +49 b Fb(42)2032 3648 y Fd(legendre)28 b(\(\))23 b Fc(.)12 +b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)48 b Fb(42)2032 3740 y Fd(length)27 b(\(\))8 b Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) -h(.)f(.)g(.)h(.)33 b Fc(37)2032 4107 y Fe(ln)26 b(\(\))13 -b Fd(.)g(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)33 b Fb(37)2032 3832 y Fd(ln)26 b(\(\))13 +b Fc(.)g(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)39 b Fc(17)2032 -4199 y Fe(log)27 b(\(\))12 b Fd(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)39 b Fb(17)2032 +3924 y Fd(log)27 b(\(\))12 b Fc(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)38 -b Fc(17)2032 4291 y Fe(logand)27 b(\(\))8 b Fd(.)13 b(.)f(.)g(.)g(.)h +b Fb(17)2032 4015 y Fd(logand)27 b(\(\))8 b Fc(.)13 b(.)f(.)g(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)33 -b Fc(21)2032 4382 y Fe(logandc1)28 b(\(\))23 b Fd(.)12 +b Fb(21)2032 4107 y Fd(logandc1)28 b(\(\))23 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)48 b Fc(21)2032 4474 y Fe(logandc2)28 b(\(\))23 b -Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +h(.)48 b Fb(21)2032 4199 y Fd(logandc2)28 b(\(\))23 b +Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)48 b Fc(21)2032 4566 y Fe(logbitp)27 b(\(\))6 -b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f +f(.)g(.)h(.)48 b Fb(21)2032 4291 y Fd(logbitp)27 b(\(\))6 +b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)32 b Fc(21)2032 4658 y Fe(logcount)c(\(\))23 -b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +f(.)g(.)h(.)f(.)g(.)32 b Fb(21)2032 4382 y Fd(logcount)c(\(\))23 +b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)48 b Fc(21)2032 4749 y Fe(logeqv)27 b(\(\))8 -b Fd(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +f(.)g(.)h(.)48 b Fb(21)2032 4474 y Fd(logeqv)27 b(\(\))8 +b Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)g(.)h(.)f(.)g(.)h(.)33 b Fc(21)2032 4841 y Fe(logior)27 -b(\(\))8 b Fd(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +g(.)g(.)h(.)f(.)g(.)h(.)33 b Fb(21)2032 4566 y Fd(logior)27 +b(\(\))8 b Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)33 b Fc(21)2032 4933 -y Fe(lognand)27 b(\(\))6 b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)33 b Fb(21)2032 4658 +y Fd(lognand)27 b(\(\))6 b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)32 b Fc(21)2032 -5024 y Fe(lognor)27 b(\(\))8 b Fd(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.) +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)32 b Fb(21)2032 +4749 y Fd(lognor)27 b(\(\))8 b Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)33 -b Fc(21)p eop -%%Page: 54 56 -54 55 bop -30 -116 a Fr(Index)3646 b(54)-30 299 y Fe(lognot)27 -b(\(\))8 b Fd(.)k(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)33 b Fc(20)-30 391 y -Fe(logorc1)27 b(\(\))6 b Fd(.)13 b(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)32 b Fc(21)-30 -483 y Fe(logorc2)27 b(\(\))6 b Fd(.)13 b(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.) +b Fb(21)2032 4841 y Fd(lognot)27 b(\(\))8 b Fc(.)13 b(.)f(.)g(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)33 +b Fb(20)2032 4933 y Fd(logorc1)27 b(\(\))6 b Fc(.)13 +b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)32 b Fb(21)2032 5024 y Fd(logorc2)27 b(\(\))6 +b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)32 b Fb(21)p eop +%%Page: 55 57 +55 56 bop -30 -116 a Fr(Index)3646 b(55)-30 299 y Fd(logp)27 +b(\(\))10 b Fc(.)j(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)36 b Fb(23)-30 +391 y Fd(logtest)27 b(\(\))6 b Fc(.)13 b(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)32 -b Fc(21)-30 575 y Fe(logp)27 b(\(\))10 b Fd(.)j(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)36 -b Fc(23)-30 667 y Fe(logtest)27 b(\(\))6 b Fd(.)13 b(.)f(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)32 -b Fc(21)-30 759 y Fe(logxor)27 b(\(\))8 b Fd(.)k(.)h(.)f(.)g(.)h(.)f(.) +b Fb(21)-30 483 y Fd(logxor)27 b(\(\))8 b Fc(.)k(.)h(.)f(.)g(.)h(.)f(.) g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)33 -b Fc(21)-30 1021 y Fs(M)-30 1144 y Fe(make)9 b Fd(.)k(.)g(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)35 b Fc(3)-30 1235 y Fe(mask_field)28 -b(\(\))20 b Fd(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +b Fb(21)-30 747 y Fs(M)-30 870 y Fd(make)9 b Fc(.)k(.)g(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)35 b Fb(3)-30 962 y Fd(malloc_hook)28 +b(\(\))18 b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)44 b Fb(52)-30 1054 y Fd(mask_field)28 b(\(\))20 +b Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)46 b Fc(22)-30 1327 y Fe(max)26 b(\(\))12 -b Fd(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.) +g(.)46 b Fb(22)-30 1147 y Fd(max)26 b(\(\))12 b Fc(.)h(.)f(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)38 b Fc(13)-30 1419 -y Fe(min)26 b(\(\))12 b Fd(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)38 -b Fc(13)-30 1511 y Fe(minus1)27 b(\(\))8 b Fd(.)k(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)33 -b Fc(11)-30 1603 y Fe(minusp)27 b(\(\))8 b Fd(.)k(.)h(.)f(.)g(.)h(.)f +(.)f(.)g(.)38 b Fb(13)-30 1239 y Fd(min)26 b(\(\))12 +b Fc(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)38 b Fb(13)-30 1331 +y Fd(minus)27 b(\(\))9 b Fc(.)j(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)35 b +Fb(33)-30 1423 y Fd(minus1)27 b(\(\))8 b Fc(.)k(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)33 +b Fb(11)-30 1515 y Fd(minusp)27 b(\(\))8 b Fc(.)k(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)33 -b Fc(13)-30 1695 y Fe(mod)26 b(\(\))12 b Fd(.)h(.)f(.)h(.)f(.)g(.)h(.)f +b Fb(13)-30 1607 y Fd(mod)26 b(\(\))12 b Fc(.)h(.)f(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)38 b Fc(16)-30 1787 y(mo)r(difying)26 b(op)r(erators)c -Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g +(.)38 b Fb(16)-30 1700 y(mo)r(difying)26 b(op)r(erators)c +Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)47 -b Fc(27)-30 1879 y(mo)r(dular)25 b(in)n(teger)20 b Fd(.)12 +b Fb(27)-30 1792 y(mo)r(dular)25 b(in)n(teger)20 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)45 -b Fc(34)-30 1971 y Fe(modulus)23 b Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.) +b Fb(34)-30 1884 y Fd(modulus)23 b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)48 -b Fc(34)-30 2063 y Fe(monomial)27 b(\(\))d Fd(.)12 b(.)g(.)h(.)f(.)g(.) +b Fb(34)-30 1976 y Fd(monomial)27 b(\(\))d Fc(.)12 b(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)49 -b Fc(40)-30 2155 y(Mon)n(tgomery)25 b(m)n(ultiplication)9 -b Fd(.)k(.)f(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)35 b Fc(34)-30 2247 y Fe -(most_negative_float)30 b(\(\))7 b Fd(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.) +b Fb(40)-30 2068 y(Mon)n(tgomery)25 b(m)n(ultiplication)9 +b Fc(.)k(.)f(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)35 b Fb(34)-30 2161 y Fd +(most_negative_float)30 b(\(\))7 b Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)33 b Fc(25)-30 2339 y Fe(most_positive_float)d(\(\))7 -b Fd(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)33 b Fc(25)-30 -2601 y Fs(N)-30 2724 y Fe(numerator)28 b(\(\))21 b Fd(.)13 -b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -47 b Fc(12)-30 2971 y Fs(O)-30 3094 y Fe(oddp)27 b(\(\))10 -b Fd(.)j(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)36 b Fc(22)-30 3186 y -Fe(one)26 b(\(\))d Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)48 b Fc(35,)27 -b(40)-30 3278 y Fe(operator)g(!=)f(\(\))c Fd(.)13 b(.)f(.)g(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -47 b Fc(13,)27 b(34,)f(36,)h(41)-30 3370 y Fe(operator)g(&)f(\(\))9 -b Fd(.)k(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +(.)33 b Fb(25)-30 2253 y Fd(most_positive_float)d(\(\))7 +b Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)33 b Fb(25)-30 +2345 y Fd(mul)26 b(\(\))12 b Fc(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)38 +b Fb(33)-30 2594 y Fs(N)-30 2717 y Fb(namespace)10 b +Fc(.)i(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) +h(.)f(.)36 b Fb(2,)26 b(45)-30 2809 y Fd(numerator)i(\(\))21 +b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)47 b Fb(12)-30 3058 y Fs(O)-30 3181 y Fd(oddp)27 +b(\(\))10 b Fc(.)j(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)36 b Fb(22)-30 +3273 y Fd(one)26 b(\(\))15 b Fc(.)e(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)42 b Fb(33,)26 b(35,)h(40)-30 +3365 y Fd(operator)g(!=)f(\(\))c Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)47 +b Fb(13,)27 b(34,)f(36,)h(41)-30 3457 y Fd(operator)g(&)f(\(\))9 +b Fc(.)k(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)34 b Fc(21)-30 3461 y Fe(operator)27 b(&=)f(\(\))7 -b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)34 b Fb(21)-30 3550 y Fd(operator)27 b(&=)f(\(\))7 +b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)33 b Fc(27)-30 3553 y Fe(operator)27 b(\(\))f(\(\))7 -b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +f(.)33 b Fb(27)-30 3642 y Fd(operator)27 b(\(\))f(\(\))7 +b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)33 b Fc(41)-30 3645 y Fe(operator)27 b(*)f(\(\))12 -b Fd(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.) +f(.)33 b Fb(41)-30 3734 y Fd(operator)27 b(*)f(\(\))12 +b Fc(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)38 b -Fc(11,)26 b(35,)h(41)-30 3737 y Fe(operator)g(*=)f(\(\))7 -b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +Fb(11,)26 b(35,)h(41)-30 3826 y Fd(operator)g(*=)f(\(\))7 +b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)33 b Fc(27)-30 3829 y Fe(operator)27 b(-)f(\(\))12 -b Fd(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.) +f(.)33 b Fb(27)-30 3918 y Fd(operator)27 b(-)f(\(\))12 +b Fc(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)38 b -Fc(11,)26 b(35,)h(41)-30 3921 y Fe(operator)g(--)f(\(\))7 -b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +Fb(11,)26 b(35,)h(41)-30 4010 y Fd(operator)g(--)f(\(\))7 +b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)33 b Fc(27)-30 4013 y Fe(operator)27 b(-=)f(\(\))7 -b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +f(.)33 b Fb(27)-30 4103 y Fd(operator)27 b(-=)f(\(\))7 +b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)33 b Fc(27)-30 4105 y Fe(operator)27 b(/)f(\(\))9 -b Fd(.)k(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +f(.)33 b Fb(27)-30 4195 y Fd(operator)27 b(/)f(\(\))9 +b Fc(.)k(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)34 b Fc(11)-30 4197 y Fe(operator)27 b(/=)f(\(\))7 -b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)34 b Fb(11)-30 4287 y Fd(operator)27 b(/=)f(\(\))7 +b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)33 b Fc(27)-30 4289 y Fe(operator)27 b(==)f(\(\))c -Fd(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)47 b Fc(13,)27 b(34,)f(36,)h(41)-30 -4381 y Fe(operator)g([])f(\(\))7 b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.) +f(.)33 b Fb(27)-30 4379 y Fd(operator)27 b(==)f(\(\))c +Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)47 b Fb(13,)27 b(34,)f(36,)h(41)-30 +4471 y Fd(operator)g([])f(\(\))7 b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)33 b Fc(37)-30 -4473 y Fe(operator)27 b(|)f(\(\))9 b Fd(.)k(.)f(.)g(.)h(.)f(.)g(.)g(.)h +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)33 b Fb(37)-30 +4564 y Fd(operator)27 b(|)f(\(\))9 b Fc(.)k(.)f(.)g(.)h(.)f(.)g(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)34 b Fc(21)-30 -4565 y Fe(operator)27 b(|=)f(\(\))7 b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)34 b Fb(21)-30 +4656 y Fd(operator)27 b(|=)f(\(\))7 b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)33 b Fc(27)-30 -4657 y Fe(operator)27 b(~)f(\(\))9 b Fd(.)k(.)f(.)g(.)h(.)f(.)g(.)g(.)h +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)33 b Fb(27)-30 +4748 y Fd(operator)27 b(~)f(\(\))9 b Fc(.)k(.)f(.)g(.)h(.)f(.)g(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)34 b Fc(20)-30 -4749 y Fe(operator)27 b(+)f(\(\))12 b Fd(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)34 b Fb(20)-30 +4840 y Fd(operator)27 b(+)f(\(\))12 b Fc(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)38 b Fc(11,)26 b(35,)h(41)-30 4841 y Fe(operator)g(+=)f -(\(\))7 b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)38 b Fb(11,)26 b(35,)h(41)-30 4932 y Fd(operator)g(+=)f +(\(\))7 b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)33 b Fc(27)-30 4933 y Fe(operator)27 b(++)f(\(\))7 -b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +g(.)h(.)f(.)33 b Fb(27)-30 5024 y Fd(operator)27 b(++)f(\(\))7 +b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)33 b Fc(27)-30 5024 y Fe(operator)27 b(>)f(\(\))9 -b Fd(.)k(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)34 b Fc(13)2032 299 y Fe(operator)28 b(>=)e(\(\))7 -b Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g +f(.)33 b Fb(27)2032 299 y Fd(operator)28 b(>)d(\(\))9 +b Fc(.)k(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)34 b Fb(13)2032 391 y Fd(operator)28 b(>=)e(\(\))7 +b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)33 b Fc(13)2032 396 y Fe(operator)28 b(>>)e(\(\))18 -b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +g(.)33 b Fb(13)2032 483 y Fd(operator)28 b(>>)e(\(\))18 +b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)43 -b Fc(22,)27 b(36)2032 493 y Fe(operator)h(>>=)e(\(\))e -Fd(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +b Fb(22,)27 b(36)2032 576 y Fd(operator)h(>>=)e(\(\))e +Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)50 -b Fc(27)2032 591 y Fe(operator)28 b(^)d(\(\))9 b Fd(.)k(.)f(.)g(.)h(.)f +b Fb(27)2032 668 y Fd(operator)28 b(^)d(\(\))9 b Fc(.)k(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)34 -b Fc(21)2032 688 y Fe(operator)28 b(^=)e(\(\))7 b Fd(.)13 +b Fb(21)2032 760 y Fd(operator)28 b(^=)e(\(\))7 b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)33 -b Fc(27)2032 785 y Fe(operator)28 b(<)d(\(\))9 b Fd(.)k(.)f(.)g(.)h(.)f +b Fb(27)2032 853 y Fd(operator)28 b(<)d(\(\))9 b Fc(.)k(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)34 -b Fc(13)2032 883 y Fe(operator)28 b(<=)e(\(\))7 b Fd(.)13 +b Fb(13)2032 945 y Fd(operator)28 b(<=)e(\(\))7 b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)33 -b Fc(13)2032 980 y Fe(operator)28 b(<<)e(\(\))21 b Fd(.)13 +b Fb(13)2032 1037 y Fd(operator)28 b(<<)e(\(\))21 b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)47 b Fc(22,)27 b(35,)f(36,)h(41)2032 -1077 y Fe(operator)h(<<=)e(\(\))e Fd(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h +(.)h(.)f(.)g(.)h(.)f(.)47 b Fb(22,)27 b(35,)f(36,)h(41)2032 +1129 y Fd(operator)h(<<=)e(\(\))e Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)g(.)50 b Fc(27)2032 1174 y Fe(ord2)27 -b(\(\))10 b Fd(.)j(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +h(.)f(.)g(.)h(.)f(.)g(.)g(.)50 b Fb(27)2032 1222 y Fd(ord2)27 +b(\(\))10 b Fc(.)j(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)36 b Fc(22)2032 -1451 y Fs(P)2032 1585 y Fe(phase)27 b(\(\))9 b Fd(.)k(.)f(.)g(.)h(.)f +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)36 b Fb(22)2032 +1471 y Fs(P)2032 1594 y Fd(phase)27 b(\(\))9 b Fc(.)k(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)35 b Fc(17)2032 1682 y(pi)18 b Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)35 b Fb(17)2032 1686 y(pi)18 b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)44 b Fc(19)2032 1780 y Fe(plus1)27 b(\(\))9 -b Fd(.)k(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)35 b Fc(11)2032 1877 y Fe(plusp)27 -b(\(\))9 b Fd(.)k(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)35 b Fc(13)2032 1974 -y(p)r(olynomial)10 b Fd(.)j(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)36 b Fc(38)2032 2072 -y(p)r(ortabilit)n(y)17 b Fd(.)c(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)44 b Fb(19)2032 1779 y Fd(pi)26 b(\(\))13 +b Fc(.)g(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)39 b Fb(19)2032 +1871 y Fd(plus)27 b(\(\))10 b Fc(.)j(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)36 +b Fb(33)2032 1963 y Fd(plus1)27 b(\(\))9 b Fc(.)k(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)43 b Fc(43)2032 -2169 y Fe(power2p)27 b(\(\))6 b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)32 -b Fc(23)2032 2266 y(prin)n(ting)8 b Fd(.)k(.)g(.)h(.)f(.)g(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)33 -b Fc(28)2032 2556 y Fs(R)2032 2690 y Fe(random)27 b(\(\))8 -b Fd(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)35 +b Fb(11)2032 2055 y Fd(plusp)27 b(\(\))9 b Fc(.)k(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)g(.)h(.)f(.)g(.)h(.)33 b Fc(35)2032 2787 y Fe(random_F)28 -b(\(\))23 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)48 b Fc(26)2032 2884 y Fe(random_I)28 -b(\(\))23 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)48 b Fc(26)2032 2981 y Fe(random_R)28 -b(\(\))23 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)48 b Fc(26)2032 3079 y Fe(random32)28 -b(\(\))23 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)48 b Fc(26)2032 3176 y Fe(rational)28 -b(\(\))23 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)48 b Fc(26)2032 3273 y(rational)27 -b(n)n(um)n(b)r(er)17 b Fd(.)11 b(.)h(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)g(.)44 b Fc(6)2032 3371 y Fe(rationalize)28 -b(\(\))18 b Fd(.)c(.)e(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)35 +b Fb(13)2032 2148 y(p)r(olynomial)10 b Fc(.)j(.)f(.)g(.)h(.)f(.)g(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)36 +b Fb(38)2032 2240 y(p)r(ortabilit)n(y)17 b Fc(.)c(.)f(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)44 b Fc(26)2032 3468 y(reading)17 b Fd(.)c(.)g(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)43 +b Fb(43)2032 2332 y Fd(power2p)27 b(\(\))6 b Fc(.)13 +b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)32 b Fb(23)2032 2425 y(prin)n(ting)8 b Fc(.)k(.)g(.)h(.)f +(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f +(.)g(.)h(.)33 b Fb(28)2032 2686 y Fs(R)2032 2810 y Fd(random)27 +b(\(\))8 b Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)43 b Fc(28)2032 3565 y(real)27 b(n)n(um)n(b)r(er)13 -b Fd(.)d(.)i(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)39 b Fc(6)2032 3662 y Fe(realpart)28 -b(\(\))23 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)48 b Fc(12)2032 3760 y Fe(recip)27 -b(\(\))20 b Fd(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)33 b Fb(35)2032 2902 +y Fd(random_F)28 b(\(\))23 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)48 b Fb(26)2032 +2994 y Fd(random_I)28 b(\(\))23 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)g(.)h(.)45 b Fc(11,)27 b(35)2032 3857 -y(reference)g(coun)n(ting)17 b Fd(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)43 b Fc(43)2032 3954 y Fe(rem)27 -b(\(\))12 b Fd(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)48 b Fb(26)2032 +3087 y Fd(random_R)28 b(\(\))23 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)38 b Fc(16)2032 -4052 y(represen)n(tation)12 b Fd(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)37 b Fc(28)2032 4149 -y Fe(retract)27 b(\(\))6 b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)32 b Fc(35)2032 -4246 y(Riemann's)25 b(zeta)11 b Fd(.)i(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)37 b Fc(20)2032 4343 -y(ring)21 b Fd(.)12 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)46 -b Fc(34)2032 4441 y Fe(ring)27 b(\(\))21 b Fd(.)13 b(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)47 -b Fc(35,)27 b(41)2032 4538 y Fe(rootp)g(\(\))9 b Fd(.)k(.)f(.)g(.)h(.)f +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)48 b Fb(26)2032 +3179 y Fd(random_state)15 b Fc(.)g(.)d(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)40 b Fb(26)2032 3271 +y Fd(random32)28 b(\(\))23 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)48 b Fb(26)2032 +3364 y Fd(rational)28 b(\(\))23 b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)48 b Fb(26)2032 +3456 y(rational)27 b(n)n(um)n(b)r(er)17 b Fc(.)11 b(.)h(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)44 b Fb(6)2032 +3548 y Fd(rationalize)28 b(\(\))18 b Fc(.)c(.)e(.)g(.)h(.)f(.)g(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)44 b Fb(26)2032 3640 +y(reading)17 b Fc(.)c(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)35 b Fc(16)2032 4635 y Fe(round1)27 b(\(\))8 b Fd(.)13 +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)43 b Fb(28)2032 +3733 y(real)27 b(n)n(um)n(b)r(er)13 b Fc(.)d(.)i(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)39 +b Fb(6)2032 3825 y Fd(realpart)28 b(\(\))23 b Fc(.)12 +b(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)48 b Fb(12)2032 3917 y Fd(recip)27 b(\(\))20 b Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) -h(.)f(.)g(.)h(.)33 b Fc(14)2032 4733 y Fe(round2)27 b(\(\))8 -b Fd(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +h(.)45 b Fb(11,)27 b(35)2032 4009 y(reference)g(coun)n(ting)17 +b Fc(.)12 b(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)43 +b Fb(43)2032 4102 y Fd(rem)27 b(\(\))12 b Fc(.)g(.)h(.)f(.)g(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)38 b Fb(16)2032 4194 y(represen)n(tation)12 b Fc(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)37 +b Fb(28)2032 4286 y Fd(retract)27 b(\(\))6 b Fc(.)13 +b(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)32 b Fb(35)2032 4379 y(Riemann's)25 b(zeta)11 +b Fc(.)i(.)g(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)37 b Fb(20)2032 4471 y(ring)21 b Fc(.)12 b(.)h(.)f(.)g(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)46 b Fb(34)2032 4563 y Fd(ring)27 b(\(\))21 +b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)47 b Fb(35,)27 b(41)2032 4655 y Fd(rootp)g(\(\))9 +b Fc(.)k(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)35 b Fb(16)2032 4748 y Fd(round1)27 +b(\(\))8 b Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)33 b Fb(14)2032 4840 +y Fd(round2)27 b(\(\))8 b Fc(.)13 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)g(.)h(.)f(.)g(.)h(.)33 b Fc(15)2032 4830 y(rounding)10 -b Fd(.)i(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)35 b Fc(13)2032 4927 y(rounding)26 -b(error)7 b Fd(.)13 b(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f -(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)g(.)h(.)f(.)g(.)34 b Fc(7)2032 5024 y(Rubik's)25 -b(cub)r(e)14 b Fd(.)f(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)41 b Fc(8)p eop -%%Page: 55 57 -55 56 bop -30 -116 a Fr(Index)3646 b(55)-30 299 y Fs(S)-30 -421 y Fe(scale_float)28 b(\(\))18 b Fd(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g +g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)33 b +Fb(15)2032 4932 y(rounding)10 b Fc(.)i(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.) +g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)35 +b Fb(13)2032 5024 y(rounding)26 b(error)7 b Fc(.)13 b(.)f(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)34 +b Fb(7)p eop +%%Page: 56 58 +56 57 bop -30 -116 a Fr(Index)3646 b(56)-30 299 y Fb(Rubik's)25 +b(cub)r(e)14 b Fc(.)e(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)40 b Fb(8)-30 548 y Fs(S)-30 +672 y Fd(scale_float)28 b(\(\))18 b Fc(.)13 b(.)g(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)44 b Fc(23)-30 512 +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)44 b Fb(23)-30 764 y(Sc)n(h\177)-38 b(onhage-Strassen)26 b(m)n(ultiplication)14 -b Fd(.)e(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)41 -b Fc(1,)26 b(44)-30 603 y Fe(sed)10 b Fd(.)j(.)g(.)f(.)g(.)h(.)f(.)g(.) +b Fc(.)e(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)41 +b Fb(1,)26 b(44)-30 857 y Fd(sed)10 b Fc(.)j(.)g(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)36 b Fc(3)-30 695 y Fe(set_coeff)28 b(\(\))21 -b Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +f(.)g(.)h(.)f(.)36 b Fb(3)-30 949 y Fd(set_coeff)28 b(\(\))21 +b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)47 b Fc(40)-30 786 y Fe(signum)27 b(\(\))8 b -Fd(.)k(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g +g(.)h(.)47 b Fb(40)-30 1042 y Fd(signum)27 b(\(\))8 b +Fc(.)k(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)33 b Fc(12)-30 878 y Fe(sin)26 b(\(\))12 -b Fd(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.) +g(.)h(.)f(.)g(.)h(.)33 b Fb(12)-30 1134 y Fd(sin)26 b(\(\))12 +b Fc(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)38 b Fc(17)-30 969 -y Fe(sinh)27 b(\(\))10 b Fd(.)j(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)38 b Fb(17)-30 1226 +y Fd(sinh)27 b(\(\))10 b Fc(.)j(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)36 -b Fc(19)-30 1061 y Fe(sqrt)27 b(\(\))10 b Fd(.)j(.)f(.)g(.)h(.)f(.)g(.) +b Fb(19)-30 1319 y Fd(sqrt)27 b(\(\))10 b Fc(.)j(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -36 b Fc(16)-30 1152 y Fe(sqrtp)27 b(\(\))9 b Fd(.)j(.)h(.)f(.)g(.)h(.)f +36 b Fb(16)-30 1411 y Fd(sqrtp)27 b(\(\))9 b Fc(.)j(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)35 -b Fc(16)-30 1244 y Fe(square)27 b(\(\))11 b Fd(.)i(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)37 b Fc(11,)26 b(35,)h(41)-30 -1335 y(string)8 b Fd(.)13 b(.)g(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +b Fb(16)-30 1503 y Fd(square)27 b(\(\))22 b Fc(.)12 b(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)48 b Fb(11,)27 b(33,)f(35,)h(41)-30 +1596 y(string)8 b Fc(.)13 b(.)g(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)34 -b Fc(37)-30 1426 y Fe(strlen)27 b(\(\))8 b Fd(.)k(.)h(.)f(.)g(.)h(.)f +b Fb(37)-30 1688 y Fd(strlen)27 b(\(\))8 b Fc(.)k(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)33 -b Fc(37)-30 1518 y(sym)n(b)r(ol)22 b Fd(.)12 b(.)g(.)g(.)h(.)f(.)g(.)h +b Fb(37)-30 1781 y(sym)n(b)r(ol)22 b Fc(.)12 b(.)g(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)48 -b Fc(37)-30 1609 y(sym)n(b)r(olic)25 b(t)n(yp)r(e)17 -b Fd(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h +b Fb(37)-30 1873 y(sym)n(b)r(olic)25 b(t)n(yp)r(e)17 +b Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) -h(.)f(.)43 b Fc(37)-30 1867 y Fs(T)-30 1988 y Fe(tan)26 -b(\(\))12 b Fd(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f +h(.)f(.)43 b Fb(37)-30 2135 y Fs(T)-30 2259 y Fd(tan)26 +b(\(\))12 b Fc(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)38 b Fc(18)-30 -2080 y Fe(tanh)27 b(\(\))10 b Fd(.)j(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)38 b Fb(18)-30 +2351 y Fd(tanh)27 b(\(\))10 b Fc(.)j(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)36 -b Fc(19)-30 2171 y Fe(The\(\)\(\))24 b Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.) +b Fb(19)-30 2444 y Fd(The\(\)\(\))24 b Fc(.)13 b(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -48 b Fc(9)-30 2263 y(transcenden)n(tal)26 b(functions)c -Fd(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)47 b Fc(17)2032 -299 y Fe(truncate1)28 b(\(\))22 b Fd(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g +48 b Fb(9)2032 299 y(transcenden)n(tal)26 b(functions)c +Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)47 b Fb(17)2032 +390 y Fd(truncate1)28 b(\(\))22 b Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)47 b Fc(14)2032 -393 y Fe(truncate2)28 b(\(\))22 b Fd(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)47 b Fb(14)2032 +482 y Fd(truncate2)28 b(\(\))22 b Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) -f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)47 b Fc(15)2032 -487 y(Tsc)n(heb)n(yc)n(hev)25 b(p)r(olynomial)c Fd(.)12 -b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)46 b Fc(42)2032 759 y -Fs(U)2032 887 y Fc(under\015o)n(w)14 b Fd(.)e(.)g(.)h(.)f(.)g(.)h(.)f +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)47 b Fb(15)2032 +573 y Fd(tschebychev)28 b(\(\))18 b Fc(.)c(.)e(.)g(.)h(.)f(.)g(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)44 b Fb(42)2032 832 y +Fs(U)2032 954 y Fd(uminus)27 b(\(\))8 b Fc(.)13 b(.)f(.)g(.)g(.)h(.)f +(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)33 +b Fb(33)2032 1045 y(under\015o)n(w)14 b Fc(.)e(.)g(.)h(.)f(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)40 -b Fc(51)2032 981 y(univ)l(ariate)26 b(p)r(olynomial)11 -b Fd(.)i(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +b Fb(52)2032 1136 y(univ)l(ariate)26 b(p)r(olynomial)11 +b Fc(.)i(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)37 b -Fc(38)2032 1253 y Fs(W)2032 1380 y Fe(WANT_OBFUSCATING_OPERATORS)13 -b Fd(.)18 b(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)h(.)f(.)g(.)h(.)f(.)38 b Fc(27)2032 1640 y Fs(X)2032 -1767 y Fe(xgcd)27 b(\(\))10 b Fd(.)j(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) +Fb(38)2032 1393 y Fs(W)2032 1515 y Fd(WANT_OBFUSCATING_OPERATORS)13 +b Fc(.)18 b(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g +(.)h(.)f(.)g(.)h(.)f(.)38 b Fb(27)2032 1759 y Fs(X)2032 +1880 y Fd(xgcd)27 b(\(\))10 b Fc(.)j(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)36 -b Fc(23)2032 2041 y Fs(Z)2032 2168 y Fe(zero)27 b(\(\))21 -b Fd(.)13 b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)47 b Fc(34,)27 b(40)2032 2263 y Fe(zerop)g(\(\))12 -b Fd(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)39 -b Fc(13,)26 b(36,)h(41)p eop -%%Page: -1 58 --1 57 bop 3905 -116 a Fr(i)-30 299 y Fo(T)-13 b(able)54 +b Fb(23)2032 2139 y Fs(Z)2032 2261 y Fd(zero)27 b(\(\))14 +b Fc(.)e(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.) +h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f +(.)40 b Fb(33,)26 b(34,)h(40)2032 2352 y Fd(zerop)g(\(\))d +Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)49 +b Fb(13,)27 b(33,)f(36,)h(41)2032 2444 y Fd(zeta)g(\(\))10 +b Fc(.)j(.)f(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.) +f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h +(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)36 b Fb(20)p eop +%%Page: -1 59 +-1 58 bop 3905 -116 a Fr(i)-30 299 y Fo(T)-13 b(able)54 b(of)g(Con)l(ten)l(ts)-30 641 y Fs(1)135 b(In)l(tro)t(duction)39 -b Fb(.)20 b(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f +b Fa(.)20 b(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f (.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.) h(.)f(.)84 b Fs(1)-30 911 y(2)135 b(Installation)13 b -Fb(.)22 b(.)d(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f +Fa(.)22 b(.)d(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f (.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.) f(.)g(.)h(.)f(.)58 b Fs(3)269 1048 y Fr(2.1)92 b(Prerequisites)24 -b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +b Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)53 b Fr(3)568 1157 y(2.1.1)93 b(C)p Fp(++)29 b Fr(compiler)22 -b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +b Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)52 b Fr(3)568 1267 -y(2.1.2)93 b(Mak)m(e)31 b(utilit)m(y)22 b Fa(.)17 b(.)e(.)g(.)g(.)g(.)g +y(2.1.2)93 b(Mak)m(e)31 b(utilit)m(y)22 b Fe(.)17 b(.)e(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)52 b Fr(3)568 1377 y(2.1.3)93 b(Sed)29 b(utilit)m(y)16 -b Fa(.)g(.)f(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +b Fe(.)g(.)f(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)45 b Fr(3)269 -1486 y(2.2)92 b(Building)30 b(the)h(library)13 b Fa(.)h(.)h(.)g(.)g(.)g +1486 y(2.2)92 b(Building)30 b(the)h(library)13 b Fe(.)h(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)h(.)f(.)g(.)42 b Fr(3)568 1596 y(2.2.1)93 -b(Using)30 b(the)h(GNU)g(MP)f(Library)c Fa(.)15 b(.)g(.)g(.)h(.)f(.)g +b(Using)30 b(the)h(GNU)g(MP)f(Library)c Fe(.)15 b(.)g(.)g(.)h(.)f(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)57 b Fr(4)269 1705 y(2.3)92 b(Installing)31 -b(the)g(library)17 b Fa(.)d(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +b(the)g(library)17 b Fe(.)d(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)47 -b Fr(4)269 1815 y(2.4)92 b(Cleaning)31 b(up)17 b Fa(.)d(.)h(.)g(.)g(.)g +b Fr(4)269 1815 y(2.4)92 b(Cleaning)31 b(up)17 b Fe(.)d(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)47 b Fr(5)-30 2057 y Fs(3)135 b(Ordinary)45 b(n)l(um)l(b)t(er)f(t)l(yp)t -(es)29 b Fb(.)20 b(.)g(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h +(es)29 b Fa(.)20 b(.)g(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h (.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)74 b Fs(6)269 -2194 y Fr(3.1)92 b(Exact)31 b(n)m(um)m(b)s(ers)22 b Fa(.)13 +2194 y Fr(3.1)92 b(Exact)31 b(n)m(um)m(b)s(ers)22 b Fe(.)13 b(.)i(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)52 b Fr(6)269 2304 y(3.2)92 b(Floating-p)s(oin)m(t)33 b(n)m(um)m(b)s(ers) -23 b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +23 b Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)55 b Fr(7)269 2413 -y(3.3)92 b(Complex)29 b(n)m(um)m(b)s(ers)c Fa(.)15 b(.)g(.)g(.)g(.)g(.) +y(3.3)92 b(Complex)29 b(n)m(um)m(b)s(ers)c Fe(.)15 b(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)57 b Fr(8)269 2523 y(3.4)92 b(Con)m(v)m -(ersions)20 b Fa(.)c(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +(ersions)20 b Fe(.)c(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)50 b Fr(8)-30 2765 y Fs(4)135 b(F)-11 -b(unctions)44 b(on)h(n)l(um)l(b)t(ers)37 b Fb(.)19 b(.)h(.)f(.)h(.)f(.) +b(unctions)44 b(on)h(n)l(um)l(b)t(ers)37 b Fa(.)19 b(.)h(.)f(.)h(.)f(.) h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h (.)f(.)h(.)82 b Fs(10)269 2902 y Fr(4.1)92 b(Constructing)30 -b(n)m(um)m(b)s(ers)d Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +b(n)m(um)m(b)s(ers)d Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)59 b Fr(10)568 3012 y(4.1.1)93 b(Constructing)30 b(in)m(tegers)10 -b Fa(.)16 b(.)f(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +b Fe(.)16 b(.)f(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)40 b Fr(10)568 3122 y(4.1.2)93 b(Constructing)30 -b(rational)h(n)m(um)m(b)s(ers)20 b Fa(.)13 b(.)i(.)g(.)g(.)g(.)g(.)g(.) +b(rational)h(n)m(um)m(b)s(ers)20 b Fe(.)13 b(.)i(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)49 b Fr(10)568 3231 y(4.1.3)93 b(Constructing)30 b(\015oating-p)s -(oin)m(t)h(n)m(um)m(b)s(ers)14 b Fa(.)f(.)i(.)g(.)g(.)g(.)g(.)g(.)g(.)g +(oin)m(t)h(n)m(um)m(b)s(ers)14 b Fe(.)f(.)i(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)43 b Fr(10)568 3341 y(4.1.4)93 b(Constructing)30 b(complex)g(n)m(um)m(b)s(ers)11 -b Fa(.)h(.)j(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.) +b Fe(.)h(.)j(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)40 b Fr(10)269 3450 -y(4.2)92 b(Elemen)m(tary)30 b(functions)25 b Fa(.)15 +y(4.2)92 b(Elemen)m(tary)30 b(functions)25 b Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)55 b Fr(11)269 3560 y(4.3)92 -b(Elemen)m(tary)30 b(rational)i(functions)c Fa(.)15 b(.)g(.)g(.)g(.)g +b(Elemen)m(tary)30 b(rational)i(functions)c Fe(.)15 b(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)57 b Fr(12)269 3670 y(4.4)92 b(Elemen)m(tary)30 b(complex)g(functions)19 -b Fa(.)c(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +b Fe(.)c(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g -(.)49 b Fr(12)269 3779 y(4.5)92 b(Comparisons)21 b Fa(.)14 +(.)49 b Fr(12)269 3779 y(4.5)92 b(Comparisons)21 b Fe(.)14 b(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)51 b Fr(13)269 3889 y(4.6)92 b(Rounding)29 b(functions)18 -b Fa(.)d(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +b Fe(.)d(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)47 b Fr(13)269 -3998 y(4.7)92 b(Ro)s(ots)11 b Fa(.)k(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.) +3998 y(4.7)92 b(Ro)s(ots)11 b Fe(.)k(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)40 b Fr(16)269 4108 y(4.8)92 b(T)-8 b(ranscenden)m(tal)31 -b(functions)17 b Fa(.)e(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +b(functions)17 b Fe(.)e(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.) f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)46 b Fr(17)568 4218 y(4.8.1)93 b(Exp)s(onen)m(tial)30 b(and)g(logarithmic)h(functions)17 -b Fa(.)e(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +b Fe(.)e(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) h(.)f(.)46 b Fr(17)568 4327 y(4.8.2)93 b(T)-8 b(rigonometric)30 -b(functions)c Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +b(functions)c Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)55 b Fr(17)568 4437 y(4.8.3)93 b(Hyp)s(erb)s(olic)29 -b(functions)23 b Fa(.)15 b(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g +b(functions)23 b Fe(.)15 b(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)53 b Fr(19)568 4546 y(4.8.4)93 b(Euler)29 -b(gamma)20 b Fa(.)14 b(.)i(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +b(gamma)20 b Fe(.)14 b(.)i(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)49 b Fr(20)568 -4656 y(4.8.5)93 b(Riemann)29 b(zeta)13 b Fa(.)j(.)f(.)g(.)g(.)g(.)g(.)g +4656 y(4.8.5)93 b(Riemann)29 b(zeta)13 b Fe(.)j(.)f(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)42 b Fr(20)269 4765 y(4.9)92 b(F)-8 b(unctions)31 b(on)f(in)m(tegers)c -Fa(.)16 b(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +Fe(.)16 b(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)54 b Fr(20)568 4875 -y(4.9.1)93 b(Logical)32 b(functions)13 b Fa(.)h(.)h(.)g(.)g(.)g(.)g(.)g +y(4.9.1)93 b(Logical)32 b(functions)13 b Fe(.)h(.)h(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)42 b Fr(20)568 4985 y(4.9.2)93 b(Num)m(b)s(er)28 b(theoretic)k(functions) -20 b Fa(.)14 b(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g +20 b Fe(.)14 b(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)49 b Fr(23)568 5094 y(4.9.3)93 b(Com)m(binatorial)30 b(functions)21 -b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +b Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)50 b Fr(23)269 5204 y(4.10)92 b(F)-8 b(unctions)31 b(on)g(\015oating-p)s -(oin)m(t)g(n)m(um)m(b)s(ers)25 b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g +(oin)m(t)g(n)m(um)m(b)s(ers)25 b Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.) g(.)g(.)56 b Fr(23)269 5313 y(4.11)92 b(Con)m(v)m(ersion)31 -b(functions)12 b Fa(.)j(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +b(functions)12 b Fe(.)j(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)41 b Fr(25)p eop -%%Page: -2 59 --2 58 bop 3879 -116 a Fr(ii)568 83 y(4.11.1)93 b(Con)m(v)m(ersion)31 +%%Page: -2 60 +-2 59 bop 3879 -116 a Fr(ii)568 83 y(4.11.1)93 b(Con)m(v)m(ersion)31 b(to)g(\015oating-p)s(oin)m(t)h(n)m(um)m(b)s(ers)17 b -Fa(.)c(.)i(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +Fe(.)c(.)i(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)47 b Fr(25)568 193 y(4.11.2)93 b(Con)m(v)m(ersion)31 -b(to)g(rational)h(n)m(um)m(b)s(ers)21 b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g +b(to)g(rational)h(n)m(um)m(b)s(ers)21 b Fe(.)15 b(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) 53 b Fr(26)269 302 y(4.12)92 b(Random)29 b(n)m(um)m(b)s(er)f -(generators)e Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +(generators)e Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) h(.)f(.)g(.)g(.)g(.)53 b Fr(26)269 412 y(4.13)92 b(Obfuscating)30 -b(op)s(erators)g Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +b(op)s(erators)g Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)59 b Fr(27)-30 -654 y Fs(5)135 b(Input/Output)26 b Fb(.)19 b(.)h(.)f(.)g(.)h(.)f(.)h(.) +652 y Fs(5)135 b(Input/Output)26 b Fa(.)19 b(.)h(.)f(.)g(.)h(.)f(.)h(.) f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g -(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)71 b Fs(28)269 791 +(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)71 b Fs(28)269 789 y Fr(5.1)92 b(In)m(ternal)31 b(and)e(prin)m(ted)h(represen)m(tation)g -Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g +Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)58 -b Fr(28)269 901 y(5.2)92 b(Input)29 b(functions)14 b -Fa(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +b Fr(28)269 898 y(5.2)92 b(Input)29 b(functions)14 b +Fe(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)44 -b Fr(29)269 1010 y(5.3)92 b(Output)29 b(functions)21 -b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +b Fr(29)269 1008 y(5.3)92 b(Output)29 b(functions)21 +b Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)50 -b Fr(30)-30 1253 y Fs(6)135 b(Rings)22 b Fb(.)e(.)f(.)h(.)f(.)h(.)f(.)h +b Fr(30)-30 1248 y Fs(6)135 b(Rings)22 b Fa(.)e(.)f(.)h(.)f(.)h(.)f(.)h (.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.) f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)67 -b Fs(33)-30 1523 y(7)135 b(Mo)t(dular)44 b(in)l(tegers)27 -b Fb(.)22 b(.)d(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f +b Fs(33)-30 1516 y(7)135 b(Mo)t(dular)44 b(in)l(tegers)27 +b Fa(.)22 b(.)d(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f (.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)72 -b Fs(34)269 1660 y Fr(7.1)92 b(Mo)s(dular)30 b(in)m(teger)i(rings)18 -b Fa(.)c(.)h(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +b Fs(34)269 1653 y Fr(7.1)92 b(Mo)s(dular)30 b(in)m(teger)i(rings)18 +b Fe(.)c(.)h(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g -(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)47 b Fr(34)269 1769 +(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)47 b Fr(34)269 1762 y(7.2)92 b(F)-8 b(unctions)31 b(on)f(mo)s(dular)e(in)m(tegers)16 -b Fa(.)h(.)e(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +b Fe(.)h(.)e(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g -(.)46 b Fr(34)-30 2012 y Fs(8)135 b(Sym)l(b)t(olic)45 -b(data)g(t)l(yp)t(es)28 b Fb(.)21 b(.)e(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h +(.)46 b Fr(34)-30 2002 y Fs(8)135 b(Sym)l(b)t(olic)45 +b(data)g(t)l(yp)t(es)28 b Fa(.)21 b(.)e(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h (.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.) -73 b Fs(37)269 2149 y Fr(8.1)92 b(Strings)9 b Fa(.)14 +73 b Fs(37)269 2139 y Fr(8.1)92 b(Strings)9 b Fe(.)14 b(.)h(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g -(.)g(.)g(.)g(.)38 b Fr(37)269 2258 y(8.2)92 b(Sym)m(b)s(ols)24 -b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +(.)g(.)g(.)g(.)38 b Fr(37)269 2249 y(8.2)92 b(Sym)m(b)s(ols)24 +b Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g -(.)g(.)g(.)g(.)55 b Fr(37)-30 2501 y Fs(9)135 b(Univ)-7 -b(ariate)46 b(p)t(olynomials)40 b Fb(.)19 b(.)h(.)f(.)g(.)h(.)f(.)h(.)f +(.)g(.)g(.)g(.)55 b Fr(37)-30 2489 y Fs(9)135 b(Univ)-7 +b(ariate)46 b(p)t(olynomials)40 b Fa(.)19 b(.)h(.)f(.)g(.)h(.)f(.)h(.)f (.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)83 -b Fs(38)269 2638 y Fr(9.1)92 b(Univ)-5 b(ariate)32 b(p)s(olynomial)d -(rings)c Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +b Fs(38)269 2626 y Fr(9.1)92 b(Univ)-5 b(ariate)32 b(p)s(olynomial)d +(rings)c Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) -g(.)g(.)g(.)g(.)g(.)54 b Fr(38)269 2747 y(9.2)92 b(F)-8 +g(.)g(.)g(.)g(.)g(.)54 b Fr(38)269 2736 y(9.2)92 b(F)-8 b(unctions)31 b(on)f(univ)-5 b(ariate)31 b(p)s(olynomials)d -Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)58 -b Fr(40)269 2857 y(9.3)92 b(Sp)s(ecial)31 b(p)s(olynomials)13 -b Fa(.)h(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.) +b Fr(40)269 2845 y(9.3)92 b(Sp)s(ecial)31 b(p)s(olynomials)13 +b Fe(.)h(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)43 b Fr(42)-30 -3099 y Fs(10)135 b(In)l(ternals)20 b Fb(.)g(.)g(.)f(.)g(.)h(.)f(.)h(.)f +3085 y Fs(10)135 b(In)l(ternals)20 b Fa(.)g(.)g(.)f(.)g(.)h(.)f(.)h(.)f (.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.) f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)64 b -Fs(43)269 3236 y Fr(10.1)92 b(Wh)m(y)31 b(C)p Fp(++)f -Fr(?)d Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +Fs(43)269 3222 y Fr(10.1)92 b(Wh)m(y)31 b(C)p Fp(++)f +Fr(?)d Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) -g(.)57 b Fr(43)269 3346 y(10.2)92 b(Memory)30 b(e\016ciency)25 -b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +g(.)57 b Fr(43)269 3332 y(10.2)92 b(Memory)30 b(e\016ciency)25 +b Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)53 b Fr(43)269 -3455 y(10.3)92 b(Sp)s(eed)30 b(e\016ciency)e Fa(.)15 +3442 y(10.3)92 b(Sp)s(eed)30 b(e\016ciency)e Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)57 b Fr(43)269 -3565 y(10.4)92 b(Garbage)32 b(collection)14 b Fa(.)k(.)d(.)g(.)g(.)g(.) +3551 y(10.4)92 b(Garbage)32 b(collection)14 b Fe(.)k(.)d(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) -g(.)g(.)g(.)g(.)44 b Fr(44)-30 3807 y Fs(11)135 b(Using)46 -b(the)f(library)25 b Fb(.)20 b(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h +g(.)g(.)g(.)g(.)44 b Fr(44)-30 3791 y Fs(11)135 b(Using)46 +b(the)f(library)25 b Fa(.)20 b(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h (.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.) -h(.)69 b Fs(45)269 3944 y Fr(11.1)92 b(Compiler)30 b(options)21 -b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +h(.)69 b Fs(45)269 3928 y Fr(11.1)92 b(Compiler)30 b(options)21 +b Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)50 b -Fr(45)269 4054 y(11.2)92 b(Include)30 b(\014les)18 b -Fa(.)d(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g -(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) -g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)47 -b Fr(45)269 4164 y(11.3)92 b(An)30 b(Example)d Fa(.)15 +Fr(45)269 4038 y(11.2)92 b(Compatibilit)m(y)31 b(to)g(old)g(CLN)f(v)m +(ersions)17 b Fe(.)e(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)46 +b Fr(45)269 4147 y(11.3)92 b(Include)30 b(\014les)18 +b Fe(.)d(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.) +g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)47 +b Fr(45)269 4257 y(11.4)92 b(An)30 b(Example)d Fe(.)15 b(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)57 -b Fr(48)269 4273 y(11.4)92 b(Debugging)32 b(supp)s(ort)23 -b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g +b Fr(49)269 4367 y(11.5)92 b(Debugging)32 b(supp)s(ort)23 +b Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) -g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)54 b Fr(49)-30 -4516 y Fs(12)135 b(Customizing)39 b Fb(.)19 b(.)h(.)f(.)h(.)f(.)h(.)f +g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)54 b Fr(50)-30 +4607 y Fs(12)135 b(Customizing)39 b Fa(.)19 b(.)h(.)f(.)h(.)f(.)h(.)f (.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.) -h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)83 b Fs(51)269 4653 -y Fr(12.1)92 b(Error)30 b(handling)24 b Fa(.)15 b(.)g(.)g(.)g(.)g(.)h +h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)83 b Fs(52)269 4744 +y Fr(12.1)92 b(Error)30 b(handling)24 b Fe(.)15 b(.)g(.)g(.)g(.)g(.)h (.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f -(.)g(.)g(.)g(.)g(.)g(.)g(.)54 b Fr(51)269 4762 y(12.2)92 -b(Floating-p)s(oin)m(t)33 b(under\015o)m(w)19 b Fa(.)14 +(.)g(.)g(.)g(.)g(.)g(.)g(.)54 b Fr(52)269 4853 y(12.2)92 +b(Floating-p)s(oin)m(t)33 b(under\015o)m(w)19 b Fe(.)14 b(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) -g(.)g(.)g(.)49 b Fr(51)269 4872 y(12.3)92 b(Customizing)30 -b(I/O)25 b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +g(.)g(.)g(.)49 b Fr(52)269 4963 y(12.3)92 b(Customizing)30 +b(I/O)25 b Fe(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)54 -b Fr(51)269 4981 y(12.4)92 b(Customizing)30 b(the)h(memory)d(allo)s -(cator)16 b Fa(.)i(.)d(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +b Fr(52)269 5072 y(12.4)92 b(Customizing)30 b(the)h(memory)d(allo)s +(cator)16 b Fe(.)i(.)d(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)46 -b Fr(51)-30 5224 y Fs(Index)30 b Fb(.)19 b(.)g(.)h(.)f(.)h(.)f(.)h(.)f +b Fr(52)-30 5313 y Fs(Index)30 b Fa(.)19 b(.)g(.)h(.)f(.)h(.)f(.)h(.)f (.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.) h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f -(.)h(.)74 b Fs(52)p eop +(.)h(.)74 b Fs(53)p eop %%Trailer end userdict /end-hook known{end-hook}if diff --git a/doc/cln.tex b/doc/cln.tex index f65cb3f..d718288 100644 --- a/doc/cln.tex +++ b/doc/cln.tex @@ -219,6 +219,10 @@ CLN aims at being easily integrated into larger software packages: The garbage collection imposes no burden on the main application. @item The library provides hooks for memory allocation and exceptions. +@item +@cindex namespace +All non-macro identifiers are hidden in namespace @code{cln} in +order to avoid name clashes. @end itemize @@ -232,19 +236,17 @@ This section describes how to install the CLN package on your system. @subsection C++ compiler To build CLN, you need a C++ compiler. -Actually, you need GNU @code{g++ 2.7.0} or newer. -On HPPA, you need GNU @code{g++ 2.8.0} or newer. +Actually, you need GNU @code{g++ 2.90} or newer, the EGCS compilers will +do. I recommend GNU @code{g++ 2.95} or newer. The following C++ features are used: -classes, member functions, -overloading of functions and operators, -constructors and destructors, inline, const, -multiple inheritance, templates. +classes, member functions, overloading of functions and operators, +constructors and destructors, inline, const, multiple inheritance, +templates and namespaces. The following C++ features are not used: -@code{new}, @code{delete}, virtual inheritance, -exceptions. +@code{new}, @code{delete}, virtual inheritance, exceptions. CLN relies on semi-automatic ordering of initializations of static and global variables, a feature which I could @@ -345,12 +347,10 @@ Examples: @example $ CC="gcc" CFLAGS="-O" CXX="g++" CXXFLAGS="-O" ./configure -$ CC="gcc -V 2.7.2" CFLAGS="-O -g" \ - CXX="g++ -V 2.7.2" CXXFLAGS="-O -g" ./configure -$ CC="gcc -V 2.8.1" CFLAGS="-O -fno-exceptions" \ - CXX="g++ -V 2.8.1" CXXFLAGS="-O -fno-exceptions" ./configure -$ CC="gcc -V egcs-2.91.60" CFLAGS="-O2 -fno-exceptions" \ - CXX="g++ -V egcs-2.91.60" CFLAGS="-O2 -fno-exceptions" ./configure +$ CC="gcc -V egcs-2.91.60" CFLAGS="-O -g" \ + CXX="g++ -V egcs-2.91.60" CXXFLAGS="-O -g" ./configure +$ CC="gcc -V 2.95.2" CFLAGS="-O2 -fno-exceptions" \ + CXX="g++ -V 2.95.2" CFLAGS="-O2 -fno-exceptions" ./configure @end example @ignore @comment cl_modules.h requires g++ @@ -390,12 +390,6 @@ Currently CLN works only with the GNU @code{g++} compiler, and only in optimizing mode. So you should specify at least @code{-O} in the CXXFLAGS, or no CXXFLAGS at all. (If CXXFLAGS is not set, CLN will use @code{-O}.) -On Linux, @code{g++} needs 15 MB to compile the tests. So you should better -have 17 MB swap space and 1 MB room in $TMPDIR. - -If you use @code{g++} version 2.7.x, don't add @samp{-O2} to the CXXFLAGS, -because @samp{g++ -O} generates better code for CLN than @samp{g++ -O2}. - If you use @code{g++} version 2.8.x or egcs-2.91.x (a.k.a. egcs-1.1) or gcc-2.95.x, I recommend adding @samp{-fno-exceptions} to the CXXFLAGS. This will likely generate better code. @@ -479,30 +473,30 @@ CLN implements the following class hierarchy: @example Number - cl_number - + cl_number + | | Real or complex number cl_N - + | | Real number cl_R - + | +-------------------+-------------------+ | | Rational number Floating-point number cl_RA cl_F - + | | - | +-------------+-------------+-------------+ - Integer | | | | - cl_I Short-Float Single-Float Double-Float Long-Float - cl_SF cl_FF cl_DF cl_LF - + | +--------------+--------------+--------------+ + Integer | | | | + cl_I Short-Float Single-Float Double-Float Long-Float + cl_SF cl_FF cl_DF cl_LF + @end example @cindex @code{cl_number} @@ -734,10 +728,10 @@ to the C built-in types @samp{float} and @samp{double} are provided through the functions @table @code -@item float cl_float_approx (const @var{type}& x) -@cindex @code{cl_float_approx ()} -@itemx double cl_double_approx (const @var{type}& x) -@cindex @code{cl_double_approx ()} +@item float float_approx (const @var{type}& x) +@cindex @code{float_approx ()} +@itemx double double_approx (const @var{type}& x) +@cindex @code{double_approx ()} Returns an approximation of @code{x} of C type @var{ctype}. If @code{abs(x)} is too close to 0 (underflow), 0 is returned. If @code{abs(x)} is too large (overflow), an IEEE infinity is returned. @@ -770,7 +764,7 @@ Example: Each of the number classes declares its mathematical operations in the corresponding include file. For example, if your code operates with -objects of type @code{cl_I}, it should @code{#include }. +objects of type @code{cl_I}, it should @code{#include }. @section Constructing numbers @@ -1003,8 +997,8 @@ defines the following operations: @cindex @code{operator != ()} Comparison, as in C and C++. -@item uint32 cl_equal_hashcode (const @var{type}&) -@cindex @code{cl_equal_hashcode ()} +@item uint32 equal_hashcode (const @var{type}&) +@cindex @code{equal_hashcode ()} Returns a 32-bit hash code that is the same for any two numbers which are the same according to @code{==}. This hash code depends on the number's value, not its type or precision. @@ -1019,8 +1013,8 @@ Each of the classes @code{cl_R}, @code{cl_RA}, @code{cl_I}, defines the following operations: @table @code -@item cl_signean cl_compare (const @var{type}& x, const @var{type}& y) -@cindex @code{cl_compare ()} +@item cl_signean compare (const @var{type}& x, const @var{type}& y) +@cindex @code{compare ()} Compares @code{x} and @code{y}. Returns +1 if @code{x}>@code{y}, -1 if @code{x}<@code{y}, 0 if @code{x}=@code{y}. @@ -1397,15 +1391,15 @@ Exponentiation: Returns @code{x^y = exp(y*log(x))}. The constant e = exp(1) = 2.71828@dots{} is returned by the following functions: @table @code -@item cl_F cl_exp1 (cl_float_format_t f) +@item cl_F exp1 (cl_float_format_t f) @cindex @code{exp1 ()} Returns e as a float of format @code{f}. -@item cl_F cl_exp1 (const cl_F& y) +@item cl_F exp1 (const cl_F& y) Returns e in the float format of @code{y}. -@item cl_F cl_exp1 (void) -Returns e as a float of format @code{cl_default_float_format}. +@item cl_F exp1 (void) +Returns e as a float of format @code{default_float_format}. @end table @@ -1428,11 +1422,11 @@ Returns @code{cos(x)}. The range of the result is the interval @item cl_N cos (const cl_N& x) Returns @code{cos(z)}. The range of the result is the entire complex plane. -@item struct cl_cos_sin_t @{ cl_R cos; cl_R sin; @}; -@cindex @code{cl_cos_sin_t} -@itemx cl_cos_sin_t cl_cos_sin (const cl_R& x) +@item struct cos_sin_t @{ cl_R cos; cl_R sin; @}; +@cindex @code{cos_sin_t} +@itemx cos_sin_t cos_sin (const cl_R& x) Returns both @code{sin(x)} and @code{cos(x)}. This is more efficient than -@cindex @code{cl_cos_sin ()} +@cindex @code{cos_sin ()} computing them separately. The relation @code{cos^2 + sin^2 = 1} will hold only approximately. @@ -1513,15 +1507,15 @@ Proof: arctan(z) = artanh(iz)/i, we know the range of the artanh function. Archimedes' constant pi = 3.14@dots{} is returned by the following functions: @table @code -@item cl_F cl_pi (cl_float_format_t f) -@cindex @code{cl_pi ()} +@item cl_F pi (cl_float_format_t f) +@cindex @code{pi ()} Returns pi as a float of format @code{f}. -@item cl_F cl_pi (const cl_F& y) +@item cl_F pi (const cl_F& y) Returns pi in the float format of @code{y}. -@item cl_F cl_pi (void) -Returns pi as a float of format @code{cl_default_float_format}. +@item cl_F pi (void) +Returns pi as a float of format @code{default_float_format}. @end table @@ -1543,10 +1537,10 @@ Returns @code{cosh(x)}. The range of the result is the interval @item cl_N cosh (const cl_N& z) Returns @code{cosh(z)}. The range of the result is the entire complex plane. -@item struct cl_cosh_sinh_t @{ cl_R cosh; cl_R sinh; @}; -@cindex @code{cl_cosh_sinh_t} -@itemx cl_cosh_sinh_t cl_cosh_sinh (const cl_R& x) -@cindex @code{cl_cosh_sinh ()} +@item struct cosh_sinh_t @{ cl_R cosh; cl_R sinh; @}; +@cindex @code{cosh_sinh_t} +@itemx cosh_sinh_t cosh_sinh (const cl_R& x) +@cindex @code{cosh_sinh ()} Returns both @code{sinh(x)} and @code{cosh(x)}. This is more efficient than computing them separately. The relation @code{cosh^2 - sinh^2 = 1} will hold only approximately. @@ -1672,30 +1666,30 @@ Proof: Write z = x+iy. Examine Euler's constant C = 0.577@dots{} is returned by the following functions: @table @code -@item cl_F cl_eulerconst (cl_float_format_t f) -@cindex @code{cl_eulerconst ()} +@item cl_F eulerconst (cl_float_format_t f) +@cindex @code{eulerconst ()} Returns Euler's constant as a float of format @code{f}. -@item cl_F cl_eulerconst (const cl_F& y) +@item cl_F eulerconst (const cl_F& y) Returns Euler's constant in the float format of @code{y}. -@item cl_F cl_eulerconst (void) -Returns Euler's constant as a float of format @code{cl_default_float_format}. +@item cl_F eulerconst (void) +Returns Euler's constant as a float of format @code{default_float_format}. @end table Catalan's constant G = 0.915@dots{} is returned by the following functions: @cindex Catalan's constant @table @code -@item cl_F cl_catalanconst (cl_float_format_t f) -@cindex @code{cl_catalanconst ()} +@item cl_F catalanconst (cl_float_format_t f) +@cindex @code{catalanconst ()} Returns Catalan's constant as a float of format @code{f}. -@item cl_F cl_catalanconst (const cl_F& y) +@item cl_F catalanconst (const cl_F& y) Returns Catalan's constant in the float format of @code{y}. -@item cl_F cl_catalanconst (void) -Returns Catalan's constant as a float of format @code{cl_default_float_format}. +@item cl_F catalanconst (void) +Returns Catalan's constant as a float of format @code{default_float_format}. @end table @@ -1706,16 +1700,16 @@ Riemann's zeta function at an integral point @code{s>1} is returned by the following functions: @table @code -@item cl_F cl_zeta (int s, cl_float_format_t f) -@cindex @code{cl_zeta ()} +@item cl_F zeta (int s, cl_float_format_t f) +@cindex @code{zeta ()} Returns Riemann's zeta function at @code{s} as a float of format @code{f}. -@item cl_F cl_zeta (int s, const cl_F& y) +@item cl_F zeta (int s, const cl_F& y) Returns Riemann's zeta function at @code{s} in the float format of @code{y}. -@item cl_F cl_zeta (int s) +@item cl_F zeta (int s) Returns Riemann's zeta function at @code{s} as a float of format -@code{cl_default_float_format}. +@code{default_float_format}. @end table @@ -2055,15 +2049,15 @@ this is the same as @code{float_digits(x)} if @code{x} is non-zero, and @end table The complete internal representation of a float is encoded in the type -@cindex @code{cl_decoded_float} -@cindex @code{cl_decoded_sfloat} -@cindex @code{cl_decoded_ffloat} -@cindex @code{cl_decoded_dfloat} -@cindex @code{cl_decoded_lfloat} -@code{cl_decoded_float} (or @code{cl_decoded_sfloat}, @code{cl_decoded_ffloat}, -@code{cl_decoded_dfloat}, @code{cl_decoded_lfloat}, respectively), defined by +@cindex @code{decoded_float} +@cindex @code{decoded_sfloat} +@cindex @code{decoded_ffloat} +@cindex @code{decoded_dfloat} +@cindex @code{decoded_lfloat} +@code{decoded_float} (or @code{decoded_sfloat}, @code{decoded_ffloat}, +@code{decoded_dfloat}, @code{decoded_lfloat}, respectively), defined by @example -struct cl_decoded_@var{type}float @{ +struct decoded_@var{type}float @{ @var{type} mantissa; cl_I exponent; @var{type} sign; @}; @end example @@ -2071,7 +2065,7 @@ struct cl_decoded_@var{type}float @{ and returned by the function @table @code -@item cl_decoded_@var{type}float decode_float (const @var{type}& x) +@item decoded_@var{type}float decode_float (const @var{type}& x) @cindex @code{decode_float ()} For @code{x} non-zero, this returns @code{(-1)^s}, @code{e}, @code{m} with @code{x = (-1)^s * 2^e * m} and @code{0.5 <= m < 1.0}. For @code{x} = 0, @@ -2080,8 +2074,8 @@ it returns @code{(-1)^s}=1, @code{e}=0, @code{m}=0. @end table A complete decoding in terms of integers is provided as type -@example @cindex @code{cl_idecoded_float} +@example struct cl_idecoded_float @{ cl_I mantissa; cl_I exponent; cl_I sign; @}; @@ -2126,8 +2120,8 @@ decimal digits in the mantissa (after the decimal point). @item cl_float_format_t cl_float_format (const cl_F& x) Returns the floating point format of @code{x}. -@item cl_float_format_t cl_default_float_format -@cindex @code{cl_default_float_format} +@item cl_float_format_t default_float_format +@cindex @code{default_float_format} Global variable: the default float format used when converting rational numbers to floats. @end table @@ -2144,7 +2138,7 @@ Returns @code{x} as a float of format @code{f}. @item cl_F cl_float (const @var{type}&x, const cl_F& y) Returns @code{x} in the float format of @code{y}. @item cl_F cl_float (const @var{type}&x) -Returns @code{x} as a float of format @code{cl_default_float_format} if +Returns @code{x} as a float of format @code{default_float_format} if it is an exact number, or @code{x} itself if it is already a float. @end table @@ -2221,7 +2215,7 @@ If @code{x} is any float, one has A random generator is a machine which produces (pseudo-)random numbers. -The include file @code{} defines a class @code{cl_random_state} +The include file @code{} defines a class @code{random_state} which contains the state of a random generator. If you make a copy of the random number generator, the original one and the copy will produce the same sequence of random numbers. @@ -2231,33 +2225,33 @@ Calling one of these modifies the state of the random number generator in a complicated but deterministic way. The global variable -@cindex @code{cl_random_state} -@cindex @code{cl_default_random_state} +@cindex @code{random_state} +@cindex @code{default_random_state} @example -cl_random_state cl_default_random_state +random_state default_random_state @end example contains a default random number generator. It is used when the functions -below are called without @code{cl_random_state} argument. +below are called without @code{random_state} argument. @table @code -@item uint32 random32 (cl_random_state& randomstate) +@item uint32 random32 (random_state& randomstate) @itemx uint32 random32 () @cindex @code{random32 ()} Returns a random unsigned 32-bit number. All bits are equally random. -@item cl_I random_I (cl_random_state& randomstate, const cl_I& n) +@item cl_I random_I (random_state& randomstate, const cl_I& n) @itemx cl_I random_I (const cl_I& n) @cindex @code{random_I ()} @code{n} must be an integer > 0. This function returns a random integer @code{x} in the range @code{0 <= x < n}. -@item cl_F random_F (cl_random_state& randomstate, const cl_F& n) +@item cl_F random_F (random_state& randomstate, const cl_F& n) @itemx cl_F random_F (const cl_F& n) @cindex @code{random_F ()} @code{n} must be a float > 0. This function returns a random floating-point number of the same format as @code{n} in the range @code{0 <= x < n}. -@item cl_R random_R (cl_random_state& randomstate, const cl_R& n) +@item cl_R random_R (random_state& randomstate, const cl_R& n) @itemx cl_R random_R (const cl_R& n) @cindex @code{random_R ()} Behaves like @code{random_I} if @code{n} is an integer and like @code{random_F} @@ -2416,15 +2410,14 @@ In Common Lisp notation: @code{#C(@var{realpart} @var{imagpart})}. @section Input functions -Including @code{} defines a type @code{cl_istream}, which is -the type of the first argument to all input functions. Unless you build -and use CLN with the macro CL_IO_STDIO being defined, @code{cl_istream} -is the same as @code{istream&}. +Including @code{} defines a type @code{cl_istream}, which is +the type of the first argument to all input functions. @code{cl_istream} +is the same as @code{std::istream&}. The variable @itemize @asis @item -@code{cl_istream cl_stdin} +@code{cl_istream stdin} @end itemize contains the standard input stream. @@ -2442,14 +2435,14 @@ last @code{freadchar} operation on @code{stream}. Each of the classes @code{cl_N}, @code{cl_R}, @code{cl_RA}, @code{cl_I}, @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF} -defines, in @code{}, the following input function: +defines, in @code{}, the following input function: @table @code @item cl_istream operator>> (cl_istream stream, @var{type}& result) Reads a number from @code{stream} and stores it in the @code{result}. @end table -The most flexible input functions, defined in @code{}, +The most flexible input functions, defined in @code{}, are the following: @table @code @@ -2523,22 +2516,21 @@ precision corresponding to their number of significant digits. @section Output functions -Including @code{} defines a type @code{cl_ostream}, which is -the type of the first argument to all output functions. Unless you build -and use CLN with the macro CL_IO_STDIO being defined, @code{cl_ostream} -is the same as @code{ostream&}. +Including @code{} defines a type @code{cl_ostream}, which is +the type of the first argument to all output functions. @code{cl_ostream} +is the same as @code{std::ostream&}. The variable @itemize @asis @item -@code{cl_ostream cl_stdout} +@code{cl_ostream stdout} @end itemize contains the standard output stream. The variable @itemize @asis @item -@code{cl_ostream cl_stderr} +@code{cl_ostream stderr} @end itemize contains the standard error output stream. @@ -2570,18 +2562,18 @@ on the @code{stream}. Each of the classes @code{cl_N}, @code{cl_R}, @code{cl_RA}, @code{cl_I}, @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF} -defines, in @code{}, the following output functions: +defines, in @code{}, the following output functions: @table @code @item void fprint (cl_ostream stream, const @var{type}& x) @itemx cl_ostream operator<< (cl_ostream stream, const @var{type}& x) Prints the number @code{x} on the @code{stream}. The output may depend -on the global printer settings in the variable @code{cl_default_print_flags}. +on the global printer settings in the variable @code{default_print_flags}. The @code{ostream} flags and settings (flags, width and locale) are ignored. @end table -The most flexible output function, defined in @code{}, +The most flexible output function, defined in @code{}, are the following: @example void print_complex (cl_ostream stream, const cl_print_flags& flags, @@ -2626,7 +2618,7 @@ Univariate polynomials with no explicit indeterminate name will be printed using this variable name. Default is @code{"x"}. @end table -The global variable @code{cl_default_print_flags} contains the default values, +The global variable @code{default_print_flags} contains the default values, used by the function @code{fprint}. @@ -2637,7 +2629,7 @@ CLN has a class of abstract rings. @example Ring cl_ring - + @end example Rings can be compared for equality: @@ -2652,17 +2644,29 @@ Given a ring @code{R}, the following members can be used. @table @code @item void R->fprint (cl_ostream stream, const cl_ring_element& x) +@cindex @code{fprint ()} @itemx cl_boolean R->equal (const cl_ring_element& x, const cl_ring_element& y) +@cindex @code{equal ()} @itemx cl_ring_element R->zero () +@cindex @code{zero ()} @itemx cl_boolean R->zerop (const cl_ring_element& x) +@cindex @code{zerop ()} @itemx cl_ring_element R->plus (const cl_ring_element& x, const cl_ring_element& y) +@cindex @code{plus ()} @itemx cl_ring_element R->minus (const cl_ring_element& x, const cl_ring_element& y) +@cindex @code{minus ()} @itemx cl_ring_element R->uminus (const cl_ring_element& x) +@cindex @code{uminus ()} @itemx cl_ring_element R->one () +@cindex @code{one ()} @itemx cl_ring_element R->canonhom (const cl_I& x) +@cindex @code{canonhom ()} @itemx cl_ring_element R->mul (const cl_ring_element& x, const cl_ring_element& y) +@cindex @code{mul ()} @itemx cl_ring_element R->square (const cl_ring_element& x) +@cindex @code{square ()} @itemx cl_ring_element R->expt_pos (const cl_ring_element& x, const cl_I& y) +@cindex @code{expt_pos ()} @end table The following rings are built-in. @@ -2712,12 +2716,12 @@ The class of modular integer rings is @example Ring cl_ring - + | | Modular integer ring cl_modint_ring - + @end example @cindex @code{cl_modint_ring} @@ -2726,14 +2730,14 @@ and the class of all modular integers (elements of modular integer rings) is @example Modular integer cl_MI - + @end example Modular integer rings are constructed using the function @table @code -@item cl_modint_ring cl_find_modint_ring (const cl_I& N) -@cindex @code{cl_find_modint_ring ()} +@item cl_modint_ring find_modint_ring (const cl_I& N) +@cindex @code{find_modint_ring ()} This function returns the modular ring @samp{Z/NZ}. It takes care of finding out about special cases of @code{N}, like powers of two and odd numbers for which Montgomery multiplication will be a win, @@ -2752,7 +2756,7 @@ Modular integer rings can be compared for equality: @itemx bool operator!= (const cl_modint_ring&, const cl_modint_ring&) @cindex @code{operator != ()} These compare two modular integer rings for equality. Two different calls -to @code{cl_find_modint_ring} with the same argument necessarily return the +to @code{find_modint_ring} with the same argument necessarily return the same ring because it is memoized in the cache table. @end table @@ -2782,7 +2786,7 @@ This returns @code{x mod N}. This is a partial inverse function to @code{R->canonhom}. It returns the standard representative (@code{>=0}, @code{random(cl_random_state& randomstate) +@item cl_MI R->random(random_state& randomstate) @itemx cl_MI R->random() @cindex @code{random ()} This returns a random integer modulo @code{N}. @@ -2866,7 +2870,7 @@ input/output). @itemx cl_ostream operator<< (cl_ostream stream, const cl_MI& x) @cindex @code{operator << ()} Prints the modular integer @code{x} on the @code{stream}. The output may depend -on the global printer settings in the variable @code{cl_default_print_flags}. +on the global printer settings in the variable @code{default_print_flags}. @end table @@ -2877,13 +2881,14 @@ CLN implements two symbolic (non-numeric) data types: strings and symbols. @section Strings @cindex string +@cindex @code{cl_string} The class @example String cl_string - + @end example implements immutable strings. @@ -2892,7 +2897,6 @@ Strings are constructed through the following constructors: @table @code @item cl_string (const char * s) -@cindex @code{cl_string ()} Returns an immutable copy of the (zero-terminated) C string @code{s}. @item cl_string (const char * ptr, unsigned long len) @@ -2925,6 +2929,7 @@ plain @code{const char *}. @section Symbols @cindex symbol +@cindex @code{cl_symbol} Symbols are uniquified strings: all symbols with the same name are shared. This means that comparison of two symbols is fast (effectively just a pointer @@ -2937,7 +2942,6 @@ Symbols are constructed through the following constructor: @table @code @item cl_symbol (const cl_string& s) -@cindex @code{cl_symbol ()} Looks up or creates a new symbol with a given name. @end table @@ -2962,7 +2966,7 @@ Compares two symbols for equality. This is very fast. CLN implements univariate polynomials (polynomials in one variable) over an arbitrary ring. The indeterminate variable may be either unnamed (and will be -printed according to @code{cl_default_print_flags.univpoly_varname}, which +printed according to @code{default_print_flags.univpoly_varname}, which defaults to @samp{x}) or carry a given name. The base ring and the indeterminate are explicitly part of every polynomial. CLN doesn't allow you to (accidentally) mix elements of different polynomial rings, e.g. @@ -2974,36 +2978,36 @@ The classes of univariate polynomial rings are @example Ring cl_ring - + | | Univariate polynomial ring cl_univpoly_ring - + | +----------------+-------------------+ | | | Complex polynomial ring | Modular integer polynomial ring cl_univpoly_complex_ring | cl_univpoly_modint_ring - | + | | +----------------+ | | Real polynomial ring | cl_univpoly_real_ring | - | + | | +----------------+ | | Rational polynomial ring | cl_univpoly_rational_ring | - | + | | +----------------+ | Integer polynomial ring cl_univpoly_integer_ring - + @end example and the corresponding classes of univariate polynomials are @@ -3011,38 +3015,38 @@ and the corresponding classes of univariate polynomials are @example Univariate polynomial cl_UP - + | +----------------+-------------------+ | | | Complex polynomial | Modular integer polynomial cl_UP_N | cl_UP_MI - | + | | +----------------+ | | Real polynomial | cl_UP_R | - | + | | +----------------+ | | Rational polynomial | cl_UP_RA | - | + | | +----------------+ | Integer polynomial cl_UP_I - + @end example Univariate polynomial rings are constructed using the functions @table @code -@item cl_univpoly_ring cl_find_univpoly_ring (const cl_ring& R) -@itemx cl_univpoly_ring cl_find_univpoly_ring (const cl_ring& R, const cl_symbol& varname) +@item cl_univpoly_ring find_univpoly_ring (const cl_ring& R) +@itemx cl_univpoly_ring find_univpoly_ring (const cl_ring& R, const cl_symbol& varname) This function returns the polynomial ring @samp{R[X]}, unnamed or named. @code{R} may be an arbitrary ring. This function takes care of finding out about special cases of @code{R}, such as the rings of complex numbers, @@ -3051,18 +3055,18 @@ There is a cache table of rings, indexed by @code{R} and @code{varname}. This ensures that two calls of this function with the same arguments will return the same polynomial ring. -@itemx cl_univpoly_complex_ring cl_find_univpoly_ring (const cl_complex_ring& R) -@cindex @code{cl_find_univpoly_ring ()} -@itemx cl_univpoly_complex_ring cl_find_univpoly_ring (const cl_complex_ring& R, const cl_symbol& varname) -@itemx cl_univpoly_real_ring cl_find_univpoly_ring (const cl_real_ring& R) -@itemx cl_univpoly_real_ring cl_find_univpoly_ring (const cl_real_ring& R, const cl_symbol& varname) -@itemx cl_univpoly_rational_ring cl_find_univpoly_ring (const cl_rational_ring& R) -@itemx cl_univpoly_rational_ring cl_find_univpoly_ring (const cl_rational_ring& R, const cl_symbol& varname) -@itemx cl_univpoly_integer_ring cl_find_univpoly_ring (const cl_integer_ring& R) -@itemx cl_univpoly_integer_ring cl_find_univpoly_ring (const cl_integer_ring& R, const cl_symbol& varname) -@itemx cl_univpoly_modint_ring cl_find_univpoly_ring (const cl_modint_ring& R) -@itemx cl_univpoly_modint_ring cl_find_univpoly_ring (const cl_modint_ring& R, const cl_symbol& varname) -These functions are equivalent to the general @code{cl_find_univpoly_ring}, +@itemx cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R) +@cindex @code{find_univpoly_ring ()} +@itemx cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R, const cl_symbol& varname) +@itemx cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R) +@itemx cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R, const cl_symbol& varname) +@itemx cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R) +@itemx cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R, const cl_symbol& varname) +@itemx cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R) +@itemx cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R, const cl_symbol& varname) +@itemx cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R) +@itemx cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R, const cl_symbol& varname) +These functions are equivalent to the general @code{find_univpoly_ring}, only the return type is more specific, according to the base ring's type. @end table @@ -3073,7 +3077,7 @@ Given a univariate polynomial ring @code{R}, the following members can be used. @table @code @item cl_ring R->basering() @cindex @code{basering ()} -This returns the base ring, as passed to @samp{cl_find_univpoly_ring}. +This returns the base ring, as passed to @samp{find_univpoly_ring}. @item cl_UP R->zero() @cindex @code{zero ()} @@ -3189,7 +3193,7 @@ input/output). @cindex @code{operator << ()} Prints the univariate polynomial @code{x} on the @code{stream}. The output may depend on the global printer settings in the variable -@code{cl_default_print_flags}. +@code{default_print_flags}. @end table @section Special polynomials @@ -3197,23 +3201,23 @@ depend on the global printer settings in the variable The following functions return special polynomials. @table @code -@item cl_UP_I cl_tschebychev (sintL n) -@cindex @code{cl_tschebychev ()} -@cindex Tschebychev polynomial -Returns the n-th Tchebychev polynomial (n >= 0). +@item cl_UP_I tschebychev (sintL n) +@cindex @code{tschebychev ()} +@cindex Chebyshev polynomial +Returns the n-th Chebyshev polynomial (n >= 0). -@item cl_UP_I cl_hermite (sintL n) -@cindex @code{cl_hermite ()} +@item cl_UP_I hermite (sintL n) +@cindex @code{hermite ()} @cindex Hermite polynomial Returns the n-th Hermite polynomial (n >= 0). -@item cl_UP_RA cl_legendre (sintL n) -@cindex @code{cl_legendre ()} +@item cl_UP_RA legendre (sintL n) +@cindex @code{legendre ()} @cindex Legende polynomial Returns the n-th Legendre polynomial (n >= 0). -@item cl_UP_I cl_laguerre (sintL n) -@cindex @code{cl_laguerre ()} +@item cl_UP_I laguerre (sintL n) +@cindex @code{laguerre ()} @cindex Laguerre polynomial Returns the n-th Laguerre polynomial (n >= 0). @end table @@ -3379,6 +3383,38 @@ public directory as well (normally @code{/usr/local/lib}), hence when linking a CLN application it is sufficient to give the flag @code{-lcln}. +@section Compatibility to old CLN versions +@cindex namespace +@cindex compatibility + +As of CLN version 1.1 all non-macro identifiers were hidden in namespace +@code{cln} in order to avoid potential name clashes with other C++ +libraries. If you have an old application, you will have to manually +port it to the new scheme. The following principles will help during +the transition: +@itemize @bullet +@item +All headers are now in a separate subdirectory. Instead of including +@code{cl_}@var{something}@code{.h}, include +@code{cln/}@var{something}@code{.h} now. +@item +All public identifiers (typenames and functions) have lost their +@code{cl_} prefix. Exceptions are all the typenames of number types, +(cl_N, cl_I, cl_MI, @dots{}), rings, symbolic types (cl_string, +cl_symbol) and polynomials (cl_UP_@var{type}). (This is because their +names would not be mnemonic enough once the namespace @code{cln} is +imported. Even in a namespace we favor @code{cl_N} over @code{N}.) +@item +All public @emph{functions} that had by a @code{cl_} in their name still +carry that @code{cl_} if it is intrinsic part of a typename (as in +@code{cl_I_to_int ()}). +@end itemize +When developing other libraries, please keep in mind not to import the +namespace @code{cln} in one of your public header files by saying +@code{using namespace cln;}. This would propagate to other applications +and can cause name clashes there. + + @section Include files @cindex include files @cindex header files @@ -3386,125 +3422,125 @@ linking a CLN application it is sufficient to give the flag @code{-lcln}. Here is a summary of the include files and their contents. @table @code -@item +@item General definitions, reference counting, garbage collection. -@item +@item The class cl_number. -@item +@item Functions for class cl_N, the complex numbers. -@item +@item Functions for class cl_R, the real numbers. -@item +@item Functions for class cl_F, the floats. -@item +@item Functions for class cl_SF, the short-floats. -@item +@item Functions for class cl_FF, the single-floats. -@item +@item Functions for class cl_DF, the double-floats. -@item +@item Functions for class cl_LF, the long-floats. -@item +@item Functions for class cl_RA, the rational numbers. -@item +@item Functions for class cl_I, the integers. -@item +@item Input/Output. -@item +@item Input/Output for class cl_N, the complex numbers. -@item +@item Input/Output for class cl_R, the real numbers. -@item +@item Input/Output for class cl_F, the floats. -@item +@item Input/Output for class cl_SF, the short-floats. -@item +@item Input/Output for class cl_FF, the single-floats. -@item +@item Input/Output for class cl_DF, the double-floats. -@item +@item Input/Output for class cl_LF, the long-floats. -@item +@item Input/Output for class cl_RA, the rational numbers. -@item +@item Input/Output for class cl_I, the integers. -@item +@item Flags for customizing input operations. -@item +@item Flags for customizing output operations. -@item -@code{cl_malloc_hook}, @code{cl_free_hook}. -@item +@item +@code{malloc_hook}, @code{free_hook}. +@item @code{cl_abort}. -@item +@item Conditions/exceptions. -@item +@item Strings. -@item +@item Symbols. -@item +@item Property lists. -@item +@item General rings. -@item +@item The null ring. -@item +@item The ring of complex numbers. -@item +@item The ring of real numbers. -@item +@item The ring of rational numbers. -@item +@item The ring of integers. -@item +@item Number threory functions. -@item +@item Modular integers. -@item +@item Vectors. -@item +@item General vectors. -@item +@item General vectors over cl_number. -@item +@item General vectors over cl_N. -@item +@item General vectors over cl_R. -@item +@item General vectors over cl_RA. -@item +@item General vectors over cl_I. -@item +@item General vectors of modular integers. -@item +@item Simple vectors. -@item +@item Simple vectors over cl_number. -@item +@item Simple vectors over cl_N. -@item +@item Simple vectors over cl_R. -@item +@item Simple vectors over cl_RA. -@item +@item Simple vectors over cl_I. -@item +@item Simple vectors of general ring elements. -@item +@item Univariate polynomials. -@item +@item Univariate polynomials over the integers. -@item +@item Univariate polynomials over the rational numbers. -@item +@item Univariate polynomials over the real numbers. -@item +@item Univariate polynomials over the complex numbers. -@item +@item Univariate polynomials over modular integer rings. -@item +@item Timing facilities. -@item +@item Includes all of the above. @end table @@ -3515,8 +3551,9 @@ A function which computes the nth Fibonacci number can be written as follows. @cindex Fibonacci number @example -#include -#include +#include +#include +using namespace cln; // Returns F_n, computed as the nearest integer to // ((1+sqrt(5))/2)^n/sqrt(5). Assume n>=0. @@ -3532,10 +3569,11 @@ const cl_I fibonacci (int n) Let's explain what is going on in detail. -The include file @code{} is necessary because the type -@code{cl_I} is used in the function, and the include file @code{} +The include file @code{} is necessary because the type +@code{cl_I} is used in the function, and the include file @code{} is needed for the type @code{cl_R} and the floating point number functions. -The order of the include files does not matter. +The order of the include files does not matter. In order not to write out +@code{cln::}@var{foo} we can safely import the whole namespace @code{cln}. Then comes the function declaration. The argument is an @code{int}, the result an integer. The return type is defined as @samp{const cl_I}, not @@ -3605,7 +3643,7 @@ for which you want @code{cl_print} debugging support. For example: @cindex @code{CL_DEBUG} @example #define CL_DEBUG -#include +#include @end example Now, if you have in your program a variable @code{cl_string s}, and inspect it under @code{gdb}, the output may look like this: @@ -3653,7 +3691,7 @@ version of this function (provided in the library) terminates the application. To catch such a fatal error, you need to define the function @code{cl_abort} yourself, with the prototype @example -#include +#include void cl_abort (void); @end example @cindex @code{cl_abort ()} @@ -3678,27 +3716,29 @@ will be generated instead. The default value of @section Customizing I/O The output of the function @code{fprint} may be customized by changing the -value of the global variable @code{cl_default_print_flags}. -@cindex @code{cl_default_print_flags} +value of the global variable @code{default_print_flags}. +@cindex @code{default_print_flags} @section Customizing the memory allocator Every memory allocation of CLN is done through the function pointer -@code{cl_malloc_hook}. Freeing of this memory is done through the function -pointer @code{cl_free_hook}. The default versions of these functions, +@code{malloc_hook}. Freeing of this memory is done through the function +pointer @code{free_hook}. The default versions of these functions, provided in the library, call @code{malloc} and @code{free} and check the @code{malloc} result against @code{NULL}. If you want to provide another memory allocator, you need to define -the variables @code{cl_malloc_hook} and @code{cl_free_hook} yourself, +the variables @code{malloc_hook} and @code{free_hook} yourself, like this: @example -#include -void* (*cl_malloc_hook) (size_t size) = @dots{}; -void (*cl_free_hook) (void* ptr) = @dots{}; +#include +namespace cln @{ + void* (*malloc_hook) (size_t size) = @dots{}; + void (*free_hook) (void* ptr) = @dots{}; +@} @end example -@cindex @code{cl_malloc_hook ()} -@cindex @code{cl_free_hook ()} +@cindex @code{malloc_hook ()} +@cindex @code{free_hook ()} The @code{cl_malloc_hook} function must not return a @code{NULL} pointer. It is not possible to change the memory allocator at runtime, because diff --git a/doc/cln.texi b/doc/cln.texi index 37c3260..8582c21 100644 --- a/doc/cln.texi +++ b/doc/cln.texi @@ -211,6 +211,7 @@ Internals Using the library * Compiler options:: +* Compatibility to old CLN versions:: * Include files:: * An Example:: * Debugging support:: @@ -348,6 +349,10 @@ CLN aims at being easily integrated into larger software packages: The garbage collection imposes no burden on the main application. @item The library provides hooks for memory allocation and exceptions. +@item +@cindex namespace +All non-macro identifiers are hidden in namespace @code{cln} in +order to avoid name clashes. @end itemize @@ -377,19 +382,17 @@ This section describes how to install the CLN package on your system. @subsection C++ compiler To build CLN, you need a C++ compiler. -Actually, you need GNU @code{g++ 2.7.0} or newer. -On HPPA, you need GNU @code{g++ 2.8.0} or newer. +Actually, you need GNU @code{g++ 2.90} or newer, the EGCS compilers will +do. I recommend GNU @code{g++ 2.95} or newer. The following C++ features are used: -classes, member functions, -overloading of functions and operators, -constructors and destructors, inline, const, -multiple inheritance, templates. +classes, member functions, overloading of functions and operators, +constructors and destructors, inline, const, multiple inheritance, +templates and namespaces. The following C++ features are not used: -@code{new}, @code{delete}, virtual inheritance, -exceptions. +@code{new}, @code{delete}, virtual inheritance, exceptions. CLN relies on semi-automatic ordering of initializations of static and global variables, a feature which I could @@ -493,12 +496,10 @@ Examples: @example $ CC="gcc" CFLAGS="-O" CXX="g++" CXXFLAGS="-O" ./configure -$ CC="gcc -V 2.7.2" CFLAGS="-O -g" \ - CXX="g++ -V 2.7.2" CXXFLAGS="-O -g" ./configure -$ CC="gcc -V 2.8.1" CFLAGS="-O -fno-exceptions" \ - CXX="g++ -V 2.8.1" CXXFLAGS="-O -fno-exceptions" ./configure -$ CC="gcc -V egcs-2.91.60" CFLAGS="-O2 -fno-exceptions" \ - CXX="g++ -V egcs-2.91.60" CFLAGS="-O2 -fno-exceptions" ./configure +$ CC="gcc -V egcs-2.91.60" CFLAGS="-O -g" \ + CXX="g++ -V egcs-2.91.60" CXXFLAGS="-O -g" ./configure +$ CC="gcc -V 2.95.2" CFLAGS="-O2 -fno-exceptions" \ + CXX="g++ -V 2.95.2" CFLAGS="-O2 -fno-exceptions" ./configure @end example @ignore @comment cl_modules.h requires g++ @@ -534,11 +535,9 @@ commands, you have to @code{export} the environment variables before calling @code{configure}. In a @code{csh} shell, you have to use the @samp{setenv} command for setting each of the environment variables. -On Linux, @code{g++} needs 15 MB to compile the tests. So you should better -have 17 MB swap space and 1 MB room in $TMPDIR. - -If you use @code{g++} version 2.7.x, don't add @samp{-O2} to the CXXFLAGS, -because @samp{g++ -O} generates better code for CLN than @samp{g++ -O2}. +Currently CLN works only with the GNU @code{g++} compiler, and only in +optimizing mode. So you should specify at least @code{-O} in the CXXFLAGS, +or no CXXFLAGS at all. (If CXXFLAGS is not set, CLN will use @code{-O}.) If you use @code{g++} version 2.8.x or egcs-2.91.x (a.k.a. egcs-1.1) or gcc-2.95.x, I recommend adding @samp{-fno-exceptions} to the CXXFLAGS. @@ -631,30 +630,30 @@ CLN implements the following class hierarchy: @example Number - cl_number - + cl_number + | | Real or complex number cl_N - + | | Real number cl_R - + | +-------------------+-------------------+ | | Rational number Floating-point number cl_RA cl_F - + | | - | +-------------+-------------+-------------+ - Integer | | | | - cl_I Short-Float Single-Float Double-Float Long-Float - cl_SF cl_FF cl_DF cl_LF - + | +--------------+--------------+--------------+ + Integer | | | | + cl_I Short-Float Single-Float Double-Float Long-Float + cl_SF cl_FF cl_DF cl_LF + @end example @cindex @code{cl_number} @@ -897,10 +896,10 @@ to the C built-in types @samp{float} and @samp{double} are provided through the functions @table @code -@item float cl_float_approx (const @var{type}& x) -@cindex @code{cl_float_approx ()} -@itemx double cl_double_approx (const @var{type}& x) -@cindex @code{cl_double_approx ()} +@item float float_approx (const @var{type}& x) +@cindex @code{float_approx ()} +@itemx double double_approx (const @var{type}& x) +@cindex @code{double_approx ()} Returns an approximation of @code{x} of C type @var{ctype}. If @code{abs(x)} is too close to 0 (underflow), 0 is returned. If @code{abs(x)} is too large (overflow), an IEEE infinity is returned. @@ -934,7 +933,7 @@ Example: Each of the number classes declares its mathematical operations in the corresponding include file. For example, if your code operates with -objects of type @code{cl_I}, it should @code{#include }. +objects of type @code{cl_I}, it should @code{#include }. @menu @@ -1199,8 +1198,8 @@ defines the following operations: @cindex @code{operator != ()} Comparison, as in C and C++. -@item uint32 cl_equal_hashcode (const @var{type}&) -@cindex @code{cl_equal_hashcode ()} +@item uint32 equal_hashcode (const @var{type}&) +@cindex @code{equal_hashcode ()} Returns a 32-bit hash code that is the same for any two numbers which are the same according to @code{==}. This hash code depends on the number's value, not its type or precision. @@ -1215,8 +1214,8 @@ Each of the classes @code{cl_R}, @code{cl_RA}, @code{cl_I}, defines the following operations: @table @code -@item cl_signean cl_compare (const @var{type}& x, const @var{type}& y) -@cindex @code{cl_compare ()} +@item cl_signean compare (const @var{type}& x, const @var{type}& y) +@cindex @code{compare ()} Compares @code{x} and @code{y}. Returns +1 if @code{x}>@code{y}, -1 if @code{x}<@code{y}, 0 if @code{x}=@code{y}. @@ -1605,15 +1604,15 @@ Exponentiation: Returns @code{x^y = exp(y*log(x))}. The constant e = exp(1) = 2.71828@dots{} is returned by the following functions: @table @code -@item cl_F cl_exp1 (cl_float_format_t f) +@item cl_F exp1 (cl_float_format_t f) @cindex @code{exp1 ()} Returns e as a float of format @code{f}. -@item cl_F cl_exp1 (const cl_F& y) +@item cl_F exp1 (const cl_F& y) Returns e in the float format of @code{y}. -@item cl_F cl_exp1 (void) -Returns e as a float of format @code{cl_default_float_format}. +@item cl_F exp1 (void) +Returns e as a float of format @code{default_float_format}. @end table @@ -1637,11 +1636,11 @@ Returns @code{cos(x)}. The range of the result is the interval @item cl_N cos (const cl_N& x) Returns @code{cos(z)}. The range of the result is the entire complex plane. -@item struct cl_cos_sin_t @{ cl_R cos; cl_R sin; @}; -@cindex @code{cl_cos_sin_t} -@itemx cl_cos_sin_t cl_cos_sin (const cl_R& x) +@item struct cos_sin_t @{ cl_R cos; cl_R sin; @}; +@cindex @code{cos_sin_t} +@itemx cos_sin_t cos_sin (const cl_R& x) Returns both @code{sin(x)} and @code{cos(x)}. This is more efficient than -@cindex @code{cl_cos_sin ()} +@cindex @code{cos_sin ()} computing them separately. The relation @code{cos^2 + sin^2 = 1} will hold only approximately. @@ -1722,15 +1721,15 @@ Proof: arctan(z) = artanh(iz)/i, we know the range of the artanh function. Archimedes' constant pi = 3.14@dots{} is returned by the following functions: @table @code -@item cl_F cl_pi (cl_float_format_t f) -@cindex @code{cl_pi ()} +@item cl_F pi (cl_float_format_t f) +@cindex @code{pi ()} Returns pi as a float of format @code{f}. -@item cl_F cl_pi (const cl_F& y) +@item cl_F pi (const cl_F& y) Returns pi in the float format of @code{y}. -@item cl_F cl_pi (void) -Returns pi as a float of format @code{cl_default_float_format}. +@item cl_F pi (void) +Returns pi as a float of format @code{default_float_format}. @end table @@ -1753,10 +1752,10 @@ Returns @code{cosh(x)}. The range of the result is the interval @item cl_N cosh (const cl_N& z) Returns @code{cosh(z)}. The range of the result is the entire complex plane. -@item struct cl_cosh_sinh_t @{ cl_R cosh; cl_R sinh; @}; -@cindex @code{cl_cosh_sinh_t} -@itemx cl_cosh_sinh_t cl_cosh_sinh (const cl_R& x) -@cindex @code{cl_cosh_sinh ()} +@item struct cosh_sinh_t @{ cl_R cosh; cl_R sinh; @}; +@cindex @code{cosh_sinh_t} +@itemx cosh_sinh_t cosh_sinh (const cl_R& x) +@cindex @code{cosh_sinh ()} Returns both @code{sinh(x)} and @code{cosh(x)}. This is more efficient than computing them separately. The relation @code{cosh^2 - sinh^2 = 1} will hold only approximately. @@ -1883,30 +1882,30 @@ Proof: Write z = x+iy. Examine Euler's constant C = 0.577@dots{} is returned by the following functions: @table @code -@item cl_F cl_eulerconst (cl_float_format_t f) -@cindex @code{cl_eulerconst ()} +@item cl_F eulerconst (cl_float_format_t f) +@cindex @code{eulerconst ()} Returns Euler's constant as a float of format @code{f}. -@item cl_F cl_eulerconst (const cl_F& y) +@item cl_F eulerconst (const cl_F& y) Returns Euler's constant in the float format of @code{y}. -@item cl_F cl_eulerconst (void) -Returns Euler's constant as a float of format @code{cl_default_float_format}. +@item cl_F eulerconst (void) +Returns Euler's constant as a float of format @code{default_float_format}. @end table Catalan's constant G = 0.915@dots{} is returned by the following functions: @cindex Catalan's constant @table @code -@item cl_F cl_catalanconst (cl_float_format_t f) -@cindex @code{cl_catalanconst ()} +@item cl_F catalanconst (cl_float_format_t f) +@cindex @code{catalanconst ()} Returns Catalan's constant as a float of format @code{f}. -@item cl_F cl_catalanconst (const cl_F& y) +@item cl_F catalanconst (const cl_F& y) Returns Catalan's constant in the float format of @code{y}. -@item cl_F cl_catalanconst (void) -Returns Catalan's constant as a float of format @code{cl_default_float_format}. +@item cl_F catalanconst (void) +Returns Catalan's constant as a float of format @code{default_float_format}. @end table @@ -1918,16 +1917,16 @@ Riemann's zeta function at an integral point @code{s>1} is returned by the following functions: @table @code -@item cl_F cl_zeta (int s, cl_float_format_t f) -@cindex @code{cl_zeta ()} +@item cl_F zeta (int s, cl_float_format_t f) +@cindex @code{zeta ()} Returns Riemann's zeta function at @code{s} as a float of format @code{f}. -@item cl_F cl_zeta (int s, const cl_F& y) +@item cl_F zeta (int s, const cl_F& y) Returns Riemann's zeta function at @code{s} in the float format of @code{y}. -@item cl_F cl_zeta (int s) +@item cl_F zeta (int s) Returns Riemann's zeta function at @code{s} as a float of format -@code{cl_default_float_format}. +@code{default_float_format}. @end table @@ -2278,15 +2277,15 @@ this is the same as @code{float_digits(x)} if @code{x} is non-zero, and @end table The complete internal representation of a float is encoded in the type -@cindex @code{cl_decoded_float} -@cindex @code{cl_decoded_sfloat} -@cindex @code{cl_decoded_ffloat} -@cindex @code{cl_decoded_dfloat} -@cindex @code{cl_decoded_lfloat} -@code{cl_decoded_float} (or @code{cl_decoded_sfloat}, @code{cl_decoded_ffloat}, -@code{cl_decoded_dfloat}, @code{cl_decoded_lfloat}, respectively), defined by +@cindex @code{decoded_float} +@cindex @code{decoded_sfloat} +@cindex @code{decoded_ffloat} +@cindex @code{decoded_dfloat} +@cindex @code{decoded_lfloat} +@code{decoded_float} (or @code{decoded_sfloat}, @code{decoded_ffloat}, +@code{decoded_dfloat}, @code{decoded_lfloat}, respectively), defined by @example -struct cl_decoded_@var{type}float @{ +struct decoded_@var{type}float @{ @var{type} mantissa; cl_I exponent; @var{type} sign; @}; @end example @@ -2294,7 +2293,7 @@ struct cl_decoded_@var{type}float @{ and returned by the function @table @code -@item cl_decoded_@var{type}float decode_float (const @var{type}& x) +@item decoded_@var{type}float decode_float (const @var{type}& x) @cindex @code{decode_float ()} For @code{x} non-zero, this returns @code{(-1)^s}, @code{e}, @code{m} with @code{x = (-1)^s * 2^e * m} and @code{0.5 <= m < 1.0}. For @code{x} = 0, @@ -2303,8 +2302,8 @@ it returns @code{(-1)^s}=1, @code{e}=0, @code{m}=0. @end table A complete decoding in terms of integers is provided as type -@example @cindex @code{cl_idecoded_float} +@example struct cl_idecoded_float @{ cl_I mantissa; cl_I exponent; cl_I sign; @}; @@ -2356,8 +2355,8 @@ decimal digits in the mantissa (after the decimal point). @item cl_float_format_t cl_float_format (const cl_F& x) Returns the floating point format of @code{x}. -@item cl_float_format_t cl_default_float_format -@cindex @code{cl_default_float_format} +@item cl_float_format_t default_float_format +@cindex @code{default_float_format} Global variable: the default float format used when converting rational numbers to floats. @end table @@ -2374,7 +2373,7 @@ Returns @code{x} as a float of format @code{f}. @item cl_F cl_float (const @var{type}&x, const cl_F& y) Returns @code{x} in the float format of @code{y}. @item cl_F cl_float (const @var{type}&x) -Returns @code{x} as a float of format @code{cl_default_float_format} if +Returns @code{x} as a float of format @code{default_float_format} if it is an exact number, or @code{x} itself if it is already a float. @end table @@ -2453,7 +2452,7 @@ If @code{x} is any float, one has A random generator is a machine which produces (pseudo-)random numbers. -The include file @code{} defines a class @code{cl_random_state} +The include file @code{} defines a class @code{random_state} which contains the state of a random generator. If you make a copy of the random number generator, the original one and the copy will produce the same sequence of random numbers. @@ -2463,33 +2462,33 @@ Calling one of these modifies the state of the random number generator in a complicated but deterministic way. The global variable -@cindex @code{cl_random_state} -@cindex @code{cl_default_random_state} +@cindex @code{random_state} +@cindex @code{default_random_state} @example -cl_random_state cl_default_random_state +random_state default_random_state @end example contains a default random number generator. It is used when the functions -below are called without @code{cl_random_state} argument. +below are called without @code{random_state} argument. @table @code -@item uint32 random32 (cl_random_state& randomstate) +@item uint32 random32 (random_state& randomstate) @itemx uint32 random32 () @cindex @code{random32 ()} Returns a random unsigned 32-bit number. All bits are equally random. -@item cl_I random_I (cl_random_state& randomstate, const cl_I& n) +@item cl_I random_I (random_state& randomstate, const cl_I& n) @itemx cl_I random_I (const cl_I& n) @cindex @code{random_I ()} @code{n} must be an integer > 0. This function returns a random integer @code{x} in the range @code{0 <= x < n}. -@item cl_F random_F (cl_random_state& randomstate, const cl_F& n) +@item cl_F random_F (random_state& randomstate, const cl_F& n) @itemx cl_F random_F (const cl_F& n) @cindex @code{random_F ()} @code{n} must be a float > 0. This function returns a random floating-point number of the same format as @code{n} in the range @code{0 <= x < n}. -@item cl_R random_R (cl_random_state& randomstate, const cl_R& n) +@item cl_R random_R (random_state& randomstate, const cl_R& n) @itemx cl_R random_R (const cl_R& n) @cindex @code{random_R ()} Behaves like @code{random_I} if @code{n} is an integer and like @code{random_F} @@ -2658,15 +2657,14 @@ In Common Lisp notation: @code{#C(@var{realpart} @var{imagpart})}. @node Input functions, Output functions, Internal and printed representation, Input/Output @section Input functions -Including @code{} defines a type @code{cl_istream}, which is -the type of the first argument to all input functions. Unless you build -and use CLN with the macro CL_IO_STDIO being defined, @code{cl_istream} -is the same as @code{istream&}. +Including @code{} defines a type @code{cl_istream}, which is +the type of the first argument to all input functions. @code{cl_istream} +is the same as @code{std::istream&}. The variable @itemize @asis @item -@code{cl_istream cl_stdin} +@code{cl_istream stdin} @end itemize contains the standard input stream. @@ -2684,14 +2682,14 @@ last @code{freadchar} operation on @code{stream}. Each of the classes @code{cl_N}, @code{cl_R}, @code{cl_RA}, @code{cl_I}, @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF} -defines, in @code{}, the following input function: +defines, in @code{}, the following input function: @table @code @item cl_istream operator>> (cl_istream stream, @var{type}& result) Reads a number from @code{stream} and stores it in the @code{result}. @end table -The most flexible input functions, defined in @code{}, +The most flexible input functions, defined in @code{}, are the following: @table @code @@ -2766,22 +2764,21 @@ precision corresponding to their number of significant digits. @node Output functions, , Input functions, Input/Output @section Output functions -Including @code{} defines a type @code{cl_ostream}, which is -the type of the first argument to all output functions. Unless you build -and use CLN with the macro CL_IO_STDIO being defined, @code{cl_ostream} -is the same as @code{ostream&}. +Including @code{} defines a type @code{cl_ostream}, which is +the type of the first argument to all output functions. @code{cl_ostream} +is the same as @code{std::ostream&}. The variable @itemize @asis @item -@code{cl_ostream cl_stdout} +@code{cl_ostream stdout} @end itemize contains the standard output stream. The variable @itemize @asis @item -@code{cl_ostream cl_stderr} +@code{cl_ostream stderr} @end itemize contains the standard error output stream. @@ -2813,18 +2810,18 @@ on the @code{stream}. Each of the classes @code{cl_N}, @code{cl_R}, @code{cl_RA}, @code{cl_I}, @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF} -defines, in @code{}, the following output functions: +defines, in @code{}, the following output functions: @table @code @item void fprint (cl_ostream stream, const @var{type}& x) @itemx cl_ostream operator<< (cl_ostream stream, const @var{type}& x) Prints the number @code{x} on the @code{stream}. The output may depend -on the global printer settings in the variable @code{cl_default_print_flags}. +on the global printer settings in the variable @code{default_print_flags}. The @code{ostream} flags and settings (flags, width and locale) are ignored. @end table -The most flexible output function, defined in @code{}, +The most flexible output function, defined in @code{}, are the following: @example void print_complex (cl_ostream stream, const cl_print_flags& flags, @@ -2869,7 +2866,7 @@ Univariate polynomials with no explicit indeterminate name will be printed using this variable name. Default is @code{"x"}. @end table -The global variable @code{cl_default_print_flags} contains the default values, +The global variable @code{default_print_flags} contains the default values, used by the function @code{fprint}. @@ -2881,7 +2878,7 @@ CLN has a class of abstract rings. @example Ring cl_ring - + @end example Rings can be compared for equality: @@ -2896,17 +2893,29 @@ Given a ring @code{R}, the following members can be used. @table @code @item void R->fprint (cl_ostream stream, const cl_ring_element& x) +@cindex @code{fprint ()} @itemx cl_boolean R->equal (const cl_ring_element& x, const cl_ring_element& y) +@cindex @code{equal ()} @itemx cl_ring_element R->zero () +@cindex @code{zero ()} @itemx cl_boolean R->zerop (const cl_ring_element& x) +@cindex @code{zerop ()} @itemx cl_ring_element R->plus (const cl_ring_element& x, const cl_ring_element& y) +@cindex @code{plus ()} @itemx cl_ring_element R->minus (const cl_ring_element& x, const cl_ring_element& y) +@cindex @code{minus ()} @itemx cl_ring_element R->uminus (const cl_ring_element& x) +@cindex @code{uminus ()} @itemx cl_ring_element R->one () +@cindex @code{one ()} @itemx cl_ring_element R->canonhom (const cl_I& x) +@cindex @code{canonhom ()} @itemx cl_ring_element R->mul (const cl_ring_element& x, const cl_ring_element& y) +@cindex @code{mul ()} @itemx cl_ring_element R->square (const cl_ring_element& x) +@cindex @code{square ()} @itemx cl_ring_element R->expt_pos (const cl_ring_element& x, const cl_I& y) +@cindex @code{expt_pos ()} @end table The following rings are built-in. @@ -2963,12 +2972,12 @@ The class of modular integer rings is @example Ring cl_ring - + | | Modular integer ring cl_modint_ring - + @end example @cindex @code{cl_modint_ring} @@ -2977,14 +2986,14 @@ and the class of all modular integers (elements of modular integer rings) is @example Modular integer cl_MI - + @end example Modular integer rings are constructed using the function @table @code -@item cl_modint_ring cl_find_modint_ring (const cl_I& N) -@cindex @code{cl_find_modint_ring ()} +@item cl_modint_ring find_modint_ring (const cl_I& N) +@cindex @code{find_modint_ring ()} This function returns the modular ring @samp{Z/NZ}. It takes care of finding out about special cases of @code{N}, like powers of two and odd numbers for which Montgomery multiplication will be a win, @@ -3003,7 +3012,7 @@ Modular integer rings can be compared for equality: @itemx bool operator!= (const cl_modint_ring&, const cl_modint_ring&) @cindex @code{operator != ()} These compare two modular integer rings for equality. Two different calls -to @code{cl_find_modint_ring} with the same argument necessarily return the +to @code{find_modint_ring} with the same argument necessarily return the same ring because it is memoized in the cache table. @end table @@ -3034,7 +3043,7 @@ This returns @code{x mod N}. This is a partial inverse function to @code{R->canonhom}. It returns the standard representative (@code{>=0}, @code{random(cl_random_state& randomstate) +@item cl_MI R->random(random_state& randomstate) @itemx cl_MI R->random() @cindex @code{random ()} This returns a random integer modulo @code{N}. @@ -3118,7 +3127,7 @@ input/output). @itemx cl_ostream operator<< (cl_ostream stream, const cl_MI& x) @cindex @code{operator << ()} Prints the modular integer @code{x} on the @code{stream}. The output may depend -on the global printer settings in the variable @code{cl_default_print_flags}. +on the global printer settings in the variable @code{default_print_flags}. @end table @@ -3136,13 +3145,14 @@ CLN implements two symbolic (non-numeric) data types: strings and symbols. @node Strings, Symbols, Symbolic data types, Symbolic data types @section Strings @cindex string +@cindex @code{cl_string} The class @example String cl_string - + @end example implements immutable strings. @@ -3151,7 +3161,6 @@ Strings are constructed through the following constructors: @table @code @item cl_string (const char * s) -@cindex @code{cl_string ()} Returns an immutable copy of the (zero-terminated) C string @code{s}. @item cl_string (const char * ptr, unsigned long len) @@ -3185,6 +3194,7 @@ plain @code{const char *}. @node Symbols, , Strings, Symbolic data types @section Symbols @cindex symbol +@cindex @code{cl_symbol} Symbols are uniquified strings: all symbols with the same name are shared. This means that comparison of two symbols is fast (effectively just a pointer @@ -3197,7 +3207,6 @@ Symbols are constructed through the following constructor: @table @code @item cl_symbol (const cl_string& s) -@cindex @code{cl_symbol ()} Looks up or creates a new symbol with a given name. @end table @@ -3230,7 +3239,7 @@ Compares two symbols for equality. This is very fast. CLN implements univariate polynomials (polynomials in one variable) over an arbitrary ring. The indeterminate variable may be either unnamed (and will be -printed according to @code{cl_default_print_flags.univpoly_varname}, which +printed according to @code{default_print_flags.univpoly_varname}, which defaults to @samp{x}) or carry a given name. The base ring and the indeterminate are explicitly part of every polynomial. CLN doesn't allow you to (accidentally) mix elements of different polynomial rings, e.g. @@ -3242,36 +3251,36 @@ The classes of univariate polynomial rings are @example Ring cl_ring - + | | Univariate polynomial ring cl_univpoly_ring - + | +----------------+-------------------+ | | | Complex polynomial ring | Modular integer polynomial ring cl_univpoly_complex_ring | cl_univpoly_modint_ring - | + | | +----------------+ | | Real polynomial ring | cl_univpoly_real_ring | - | + | | +----------------+ | | Rational polynomial ring | cl_univpoly_rational_ring | - | + | | +----------------+ | Integer polynomial ring cl_univpoly_integer_ring - + @end example and the corresponding classes of univariate polynomials are @@ -3279,38 +3288,38 @@ and the corresponding classes of univariate polynomials are @example Univariate polynomial cl_UP - + | +----------------+-------------------+ | | | Complex polynomial | Modular integer polynomial cl_UP_N | cl_UP_MI - | + | | +----------------+ | | Real polynomial | cl_UP_R | - | + | | +----------------+ | | Rational polynomial | cl_UP_RA | - | + | | +----------------+ | Integer polynomial cl_UP_I - + @end example Univariate polynomial rings are constructed using the functions @table @code -@item cl_univpoly_ring cl_find_univpoly_ring (const cl_ring& R) -@itemx cl_univpoly_ring cl_find_univpoly_ring (const cl_ring& R, const cl_symbol& varname) +@item cl_univpoly_ring find_univpoly_ring (const cl_ring& R) +@itemx cl_univpoly_ring find_univpoly_ring (const cl_ring& R, const cl_symbol& varname) This function returns the polynomial ring @samp{R[X]}, unnamed or named. @code{R} may be an arbitrary ring. This function takes care of finding out about special cases of @code{R}, such as the rings of complex numbers, @@ -3319,18 +3328,18 @@ There is a cache table of rings, indexed by @code{R} and @code{varname}. This ensures that two calls of this function with the same arguments will return the same polynomial ring. -@itemx cl_univpoly_complex_ring cl_find_univpoly_ring (const cl_complex_ring& R) -@cindex @code{cl_find_univpoly_ring ()} -@itemx cl_univpoly_complex_ring cl_find_univpoly_ring (const cl_complex_ring& R, const cl_symbol& varname) -@itemx cl_univpoly_real_ring cl_find_univpoly_ring (const cl_real_ring& R) -@itemx cl_univpoly_real_ring cl_find_univpoly_ring (const cl_real_ring& R, const cl_symbol& varname) -@itemx cl_univpoly_rational_ring cl_find_univpoly_ring (const cl_rational_ring& R) -@itemx cl_univpoly_rational_ring cl_find_univpoly_ring (const cl_rational_ring& R, const cl_symbol& varname) -@itemx cl_univpoly_integer_ring cl_find_univpoly_ring (const cl_integer_ring& R) -@itemx cl_univpoly_integer_ring cl_find_univpoly_ring (const cl_integer_ring& R, const cl_symbol& varname) -@itemx cl_univpoly_modint_ring cl_find_univpoly_ring (const cl_modint_ring& R) -@itemx cl_univpoly_modint_ring cl_find_univpoly_ring (const cl_modint_ring& R, const cl_symbol& varname) -These functions are equivalent to the general @code{cl_find_univpoly_ring}, +@itemx cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R) +@cindex @code{find_univpoly_ring ()} +@itemx cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R, const cl_symbol& varname) +@itemx cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R) +@itemx cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R, const cl_symbol& varname) +@itemx cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R) +@itemx cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R, const cl_symbol& varname) +@itemx cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R) +@itemx cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R, const cl_symbol& varname) +@itemx cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R) +@itemx cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R, const cl_symbol& varname) +These functions are equivalent to the general @code{find_univpoly_ring}, only the return type is more specific, according to the base ring's type. @end table @@ -3342,7 +3351,7 @@ Given a univariate polynomial ring @code{R}, the following members can be used. @table @code @item cl_ring R->basering() @cindex @code{basering ()} -This returns the base ring, as passed to @samp{cl_find_univpoly_ring}. +This returns the base ring, as passed to @samp{find_univpoly_ring}. @item cl_UP R->zero() @cindex @code{zero ()} @@ -3458,7 +3467,7 @@ input/output). @cindex @code{operator << ()} Prints the univariate polynomial @code{x} on the @code{stream}. The output may depend on the global printer settings in the variable -@code{cl_default_print_flags}. +@code{default_print_flags}. @end table @node Special polynomials, , Functions on univariate polynomials, Univariate polynomials @@ -3467,23 +3476,23 @@ depend on the global printer settings in the variable The following functions return special polynomials. @table @code -@item cl_UP_I cl_tschebychev (sintL n) -@cindex @code{cl_tschebychev ()} -@cindex Tschebychev polynomial -Returns the n-th Tchebychev polynomial (n >= 0). +@item cl_UP_I tschebychev (sintL n) +@cindex @code{tschebychev ()} +@cindex Chebyshev polynomial +Returns the n-th Chebyshev polynomial (n >= 0). -@item cl_UP_I cl_hermite (sintL n) -@cindex @code{cl_hermite ()} +@item cl_UP_I hermite (sintL n) +@cindex @code{hermite ()} @cindex Hermite polynomial Returns the n-th Hermite polynomial (n >= 0). -@item cl_UP_RA cl_legendre (sintL n) -@cindex @code{cl_legendre ()} +@item cl_UP_RA legendre (sintL n) +@cindex @code{legendre ()} @cindex Legende polynomial Returns the n-th Legendre polynomial (n >= 0). -@item cl_UP_I cl_laguerre (sintL n) -@cindex @code{cl_laguerre ()} +@item cl_UP_I laguerre (sintL n) +@cindex @code{laguerre ()} @cindex Laguerre polynomial Returns the n-th Laguerre polynomial (n >= 0). @end table @@ -3640,12 +3649,13 @@ environment variables, or directly substitute the appropriate values. @menu * Compiler options:: +* Compatibility to old CLN versions:: * Include files:: * An Example:: * Debugging support:: @end menu -@node Compiler options, Include files, Using the library, Using the library +@node Compiler options, Compatibility to old CLN versions, Using the library, Using the library @section Compiler options @cindex compiler options @@ -3670,7 +3680,40 @@ public directory as well (normally @code{/usr/local/lib}), hence when linking a CLN application it is sufficient to give the flag @code{-lcln}. -@node Include files, An Example, Compiler options, Using the library +@node Compatibility to old CLN versions, Include files, Compiler options, Using the library +@section Compatibility to old CLN versions +@cindex namespace +@cindex compatibility + +As of CLN version 1.1 all non-macro identifiers were hidden in namespace +@code{cln} in order to avoid potential name clashes with other C++ +libraries. If you have an old application, you will have to manually +port it to the new scheme. The following principles will help during +the transition: +@itemize @bullet +@item +All headers are now in a separate subdirectory. Instead of including +@code{cl_}@var{something}@code{.h}, include +@code{cln/}@var{something}@code{.h} now. +@item +All public identifiers (typenames and functions) have lost their +@code{cl_} prefix. Exceptions are all the typenames of number types, +(cl_N, cl_I, cl_MI, @dots{}), rings, symbolic types (cl_string, +cl_symbol) and polynomials (cl_UP_@var{type}). (This is because their +names would not be mnemonic enough once the namespace @code{cln} is +imported. Even in a namespace we favor @code{cl_N} over @code{N}.) +@item +All public @emph{functions} that had by a @code{cl_} in their name still +carry that @code{cl_} if it is intrinsic part of a typename (as in +@code{cl_I_to_int ()}). +@end itemize +When developing other libraries, please keep in mind not to import the +namespace @code{cln} in one of your public header files by saying +@code{using namespace cln;}. This would propagate to other applications +and can cause name clashes there. + + +@node Include files, An Example, Compatibility to old CLN versions, Using the library @section Include files @cindex include files @cindex header files @@ -3678,125 +3721,125 @@ linking a CLN application it is sufficient to give the flag @code{-lcln}. Here is a summary of the include files and their contents. @table @code -@item +@item General definitions, reference counting, garbage collection. -@item +@item The class cl_number. -@item +@item Functions for class cl_N, the complex numbers. -@item +@item Functions for class cl_R, the real numbers. -@item +@item Functions for class cl_F, the floats. -@item +@item Functions for class cl_SF, the short-floats. -@item +@item Functions for class cl_FF, the single-floats. -@item +@item Functions for class cl_DF, the double-floats. -@item +@item Functions for class cl_LF, the long-floats. -@item +@item Functions for class cl_RA, the rational numbers. -@item +@item Functions for class cl_I, the integers. -@item +@item Input/Output. -@item +@item Input/Output for class cl_N, the complex numbers. -@item +@item Input/Output for class cl_R, the real numbers. -@item +@item Input/Output for class cl_F, the floats. -@item +@item Input/Output for class cl_SF, the short-floats. -@item +@item Input/Output for class cl_FF, the single-floats. -@item +@item Input/Output for class cl_DF, the double-floats. -@item +@item Input/Output for class cl_LF, the long-floats. -@item +@item Input/Output for class cl_RA, the rational numbers. -@item +@item Input/Output for class cl_I, the integers. -@item +@item Flags for customizing input operations. -@item +@item Flags for customizing output operations. -@item -@code{cl_malloc_hook}, @code{cl_free_hook}. -@item +@item +@code{malloc_hook}, @code{free_hook}. +@item @code{cl_abort}. -@item +@item Conditions/exceptions. -@item +@item Strings. -@item +@item Symbols. -@item +@item Property lists. -@item +@item General rings. -@item +@item The null ring. -@item +@item The ring of complex numbers. -@item +@item The ring of real numbers. -@item +@item The ring of rational numbers. -@item +@item The ring of integers. -@item +@item Number threory functions. -@item +@item Modular integers. -@item +@item Vectors. -@item +@item General vectors. -@item +@item General vectors over cl_number. -@item +@item General vectors over cl_N. -@item +@item General vectors over cl_R. -@item +@item General vectors over cl_RA. -@item +@item General vectors over cl_I. -@item +@item General vectors of modular integers. -@item +@item Simple vectors. -@item +@item Simple vectors over cl_number. -@item +@item Simple vectors over cl_N. -@item +@item Simple vectors over cl_R. -@item +@item Simple vectors over cl_RA. -@item +@item Simple vectors over cl_I. -@item +@item Simple vectors of general ring elements. -@item +@item Univariate polynomials. -@item +@item Univariate polynomials over the integers. -@item +@item Univariate polynomials over the rational numbers. -@item +@item Univariate polynomials over the real numbers. -@item +@item Univariate polynomials over the complex numbers. -@item +@item Univariate polynomials over modular integer rings. -@item +@item Timing facilities. -@item +@item Includes all of the above. @end table @@ -3808,8 +3851,9 @@ A function which computes the nth Fibonacci number can be written as follows. @cindex Fibonacci number @example -#include -#include +#include +#include +using namespace cln; // Returns F_n, computed as the nearest integer to // ((1+sqrt(5))/2)^n/sqrt(5). Assume n>=0. @@ -3825,10 +3869,11 @@ const cl_I fibonacci (int n) Let's explain what is going on in detail. -The include file @code{} is necessary because the type -@code{cl_I} is used in the function, and the include file @code{} +The include file @code{} is necessary because the type +@code{cl_I} is used in the function, and the include file @code{} is needed for the type @code{cl_R} and the floating point number functions. -The order of the include files does not matter. +The order of the include files does not matter. In order not to write out +@code{cln::}@var{foo} we can safely import the whole namespace @code{cln}. Then comes the function declaration. The argument is an @code{int}, the result an integer. The return type is defined as @samp{const cl_I}, not @@ -3899,7 +3944,7 @@ for which you want @code{cl_print} debugging support. For example: @cindex @code{CL_DEBUG} @example #define CL_DEBUG -#include +#include @end example Now, if you have in your program a variable @code{cl_string s}, and inspect it under @code{gdb}, the output may look like this: @@ -3956,7 +4001,7 @@ version of this function (provided in the library) terminates the application. To catch such a fatal error, you need to define the function @code{cl_abort} yourself, with the prototype @example -#include +#include void cl_abort (void); @end example @cindex @code{cl_abort ()} @@ -3983,28 +4028,30 @@ will be generated instead. The default value of @section Customizing I/O The output of the function @code{fprint} may be customized by changing the -value of the global variable @code{cl_default_print_flags}. -@cindex @code{cl_default_print_flags} +value of the global variable @code{default_print_flags}. +@cindex @code{default_print_flags} @node Customizing the memory allocator, , Customizing I/O, Customizing @section Customizing the memory allocator Every memory allocation of CLN is done through the function pointer -@code{cl_malloc_hook}. Freeing of this memory is done through the function -pointer @code{cl_free_hook}. The default versions of these functions, +@code{malloc_hook}. Freeing of this memory is done through the function +pointer @code{free_hook}. The default versions of these functions, provided in the library, call @code{malloc} and @code{free} and check the @code{malloc} result against @code{NULL}. If you want to provide another memory allocator, you need to define -the variables @code{cl_malloc_hook} and @code{cl_free_hook} yourself, +the variables @code{malloc_hook} and @code{free_hook} yourself, like this: @example -#include -void* (*cl_malloc_hook) (size_t size) = @dots{}; -void (*cl_free_hook) (void* ptr) = @dots{}; +#include +namespace cln @{ + void* (*malloc_hook) (size_t size) = @dots{}; + void (*free_hook) (void* ptr) = @dots{}; +@} @end example -@cindex @code{cl_malloc_hook ()} -@cindex @code{cl_free_hook ()} +@cindex @code{malloc_hook ()} +@cindex @code{free_hook ()} The @code{cl_malloc_hook} function must not return a @code{NULL} pointer. It is not possible to change the memory allocator at runtime, because diff --git a/doc/cln_1.html b/doc/cln_1.html index 28e1732..2b5c237 100644 --- a/doc/cln_1.html +++ b/doc/cln_1.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 1. Introduction @@ -162,6 +162,11 @@ The garbage collection imposes no burden on the main application.

    • The library provides hooks for memory allocation and exceptions. +
    • + + +All non-macro identifiers are hidden in namespace cln in +order to avoid name clashes.


    diff --git a/doc/cln_10.html b/doc/cln_10.html index e17a248..f66fa70 100644 --- a/doc/cln_10.html +++ b/doc/cln_10.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 10. Internals @@ -15,7 +15,7 @@ Go to the first, previous, 10.1 Why C++ ?

    - +

    @@ -30,7 +30,7 @@ Efficiency: It compiles to machine code.

  • - + Portability: It runs on all platforms supporting a C++ compiler. Because of the availability of GNU C++, this includes all currently used 32-bit and 64-bit platforms, independently of the quality of the vendor's C++ compiler. @@ -76,8 +76,8 @@ Object sharing: An operation like x+0 returns x withou it.
  • - - + + Garbage collection: A reference counting mechanism makes sure that any number object's storage is freed immediately when the last reference to the object is gone. @@ -122,7 +122,7 @@ algorithm. For very large numbers (more than 12000 decimal digits), CLN uses Schönhage-Strassen - + multiplication, which is an asymptotically optimal multiplication algorithm.
  • @@ -135,7 +135,7 @@ of division and radix conversion.

    10.4 Garbage collection

    - +

    diff --git a/doc/cln_11.html b/doc/cln_11.html index 4e306c4..2ff22a4 100644 --- a/doc/cln_11.html +++ b/doc/cln_11.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 11. Using the library @@ -23,7 +23,7 @@ environment variables, or directly substitute the appropriate values.

    11.1 Compiler options

    - +

    @@ -60,10 +60,53 @@ linking a CLN application it is sufficient to give the flag -lcln. -

    11.2 Include files

    +

    11.2 Compatibility to old CLN versions

    - - + + + + +

    +As of CLN version 1.1 all non-macro identifiers were hidden in namespace +cln in order to avoid potential name clashes with other C++ +libraries. If you have an old application, you will have to manually +port it to the new scheme. The following principles will help during +the transition: + +

      +
    • + +All headers are now in a separate subdirectory. Instead of including +cl_something.h, include +cln/something.h now. +
    • + +All public identifiers (typenames and functions) have lost their +cl_ prefix. Exceptions are all the typenames of number types, +(cl_N, cl_I, cl_MI, ...), rings, symbolic types (cl_string, +cl_symbol) and polynomials (cl_UP_type). (This is because their +names would not be mnemonic enough once the namespace cln is +imported. Even in a namespace we favor cl_N over N.) +
    • + +All public functions that had by a cl_ in their name still +carry that cl_ if it is intrinsic part of a typename (as in +cl_I_to_int ()). +
    + +

    +When developing other libraries, please keep in mind not to import the +namespace cln in one of your public header files by saying +using namespace cln;. This would propagate to other applications +and can cause name clashes there. + + + + +

    11.3 Include files

    +

    + +

    @@ -72,201 +115,202 @@ Here is a summary of the include files and their contents.

    -
    <cl_object.h> +
    <cln/object.h>
    General definitions, reference counting, garbage collection. -
    <cl_number.h> +
    <cln/number.h>
    The class cl_number. -
    <cl_complex.h> +
    <cln/complex.h>
    Functions for class cl_N, the complex numbers. -
    <cl_real.h> +
    <cln/real.h>
    Functions for class cl_R, the real numbers. -
    <cl_float.h> +
    <cln/float.h>
    Functions for class cl_F, the floats. -
    <cl_sfloat.h> +
    <cln/sfloat.h>
    Functions for class cl_SF, the short-floats. -
    <cl_ffloat.h> +
    <cln/ffloat.h>
    Functions for class cl_FF, the single-floats. -
    <cl_dfloat.h> +
    <cln/dfloat.h>
    Functions for class cl_DF, the double-floats. -
    <cl_lfloat.h> +
    <cln/lfloat.h>
    Functions for class cl_LF, the long-floats. -
    <cl_rational.h> +
    <cln/rational.h>
    Functions for class cl_RA, the rational numbers. -
    <cl_integer.h> +
    <cln/integer.h>
    Functions for class cl_I, the integers. -
    <cl_io.h> +
    <cln/io.h>
    Input/Output. -
    <cl_complex_io.h> +
    <cln/complex_io.h>
    Input/Output for class cl_N, the complex numbers. -
    <cl_real_io.h> +
    <cln/real_io.h>
    Input/Output for class cl_R, the real numbers. -
    <cl_float_io.h> +
    <cln/float_io.h>
    Input/Output for class cl_F, the floats. -
    <cl_sfloat_io.h> +
    <cln/sfloat_io.h>
    Input/Output for class cl_SF, the short-floats. -
    <cl_ffloat_io.h> +
    <cln/ffloat_io.h>
    Input/Output for class cl_FF, the single-floats. -
    <cl_dfloat_io.h> +
    <cln/dfloat_io.h>
    Input/Output for class cl_DF, the double-floats. -
    <cl_lfloat_io.h> +
    <cln/lfloat_io.h>
    Input/Output for class cl_LF, the long-floats. -
    <cl_rational_io.h> +
    <cln/rational_io.h>
    Input/Output for class cl_RA, the rational numbers. -
    <cl_integer_io.h> +
    <cln/integer_io.h>
    Input/Output for class cl_I, the integers. -
    <cl_input.h> +
    <cln/input.h>
    Flags for customizing input operations. -
    <cl_output.h> +
    <cln/output.h>
    Flags for customizing output operations. -
    <cl_malloc.h> +
    <cln/malloc.h>
    -cl_malloc_hook, cl_free_hook. -
    <cl_abort.h> +malloc_hook, free_hook. +
    <cln/abort.h>
    cl_abort. -
    <cl_condition.h> +
    <cln/condition.h>
    Conditions/exceptions. -
    <cl_string.h> +
    <cln/string.h>
    Strings. -
    <cl_symbol.h> +
    <cln/symbol.h>
    Symbols. -
    <cl_proplist.h> +
    <cln/proplist.h>
    Property lists. -
    <cl_ring.h> +
    <cln/ring.h>
    General rings. -
    <cl_null_ring.h> +
    <cln/null_ring.h>
    The null ring. -
    <cl_complex_ring.h> +
    <cln/complex_ring.h>
    The ring of complex numbers. -
    <cl_real_ring.h> +
    <cln/real_ring.h>
    The ring of real numbers. -
    <cl_rational_ring.h> +
    <cln/rational_ring.h>
    The ring of rational numbers. -
    <cl_integer_ring.h> +
    <cln/integer_ring.h>
    The ring of integers. -
    <cl_numtheory.h> +
    <cln/numtheory.h>
    Number threory functions. -
    <cl_modinteger.h> +
    <cln/modinteger.h>
    Modular integers. -
    <cl_V.h> +
    <cln/V.h>
    Vectors. -
    <cl_GV.h> +
    <cln/GV.h>
    General vectors. -
    <cl_GV_number.h> +
    <cln/GV_number.h>
    General vectors over cl_number. -
    <cl_GV_complex.h> +
    <cln/GV_complex.h>
    General vectors over cl_N. -
    <cl_GV_real.h> +
    <cln/GV_real.h>
    General vectors over cl_R. -
    <cl_GV_rational.h> +
    <cln/GV_rational.h>
    General vectors over cl_RA. -
    <cl_GV_integer.h> +
    <cln/GV_integer.h>
    General vectors over cl_I. -
    <cl_GV_modinteger.h> +
    <cln/GV_modinteger.h>
    General vectors of modular integers. -
    <cl_SV.h> +
    <cln/SV.h>
    Simple vectors. -
    <cl_SV_number.h> +
    <cln/SV_number.h>
    Simple vectors over cl_number. -
    <cl_SV_complex.h> +
    <cln/SV_complex.h>
    Simple vectors over cl_N. -
    <cl_SV_real.h> +
    <cln/SV_real.h>
    Simple vectors over cl_R. -
    <cl_SV_rational.h> +
    <cln/SV_rational.h>
    Simple vectors over cl_RA. -
    <cl_SV_integer.h> +
    <cln/SV_integer.h>
    Simple vectors over cl_I. -
    <cl_SV_ringelt.h> +
    <cln/SV_ringelt.h>
    Simple vectors of general ring elements. -
    <cl_univpoly.h> +
    <cln/univpoly.h>
    Univariate polynomials. -
    <cl_univpoly_integer.h> +
    <cln/univpoly_integer.h>
    Univariate polynomials over the integers. -
    <cl_univpoly_rational.h> +
    <cln/univpoly_rational.h>
    Univariate polynomials over the rational numbers. -
    <cl_univpoly_real.h> +
    <cln/univpoly_real.h>
    Univariate polynomials over the real numbers. -
    <cl_univpoly_complex.h> +
    <cln/univpoly_complex.h>
    Univariate polynomials over the complex numbers. -
    <cl_univpoly_modint.h> +
    <cln/univpoly_modint.h>
    Univariate polynomials over modular integer rings. -
    <cl_timing.h> +
    <cln/timing.h>
    Timing facilities. -
    <cln.h> +
    <cln/cln.h>
    Includes all of the above.
    -

    11.3 An Example

    +

    11.4 An Example

    A function which computes the nth Fibonacci number can be written as follows. - +

    -#include <cl_integer.h>
    -#include <cl_real.h>
    +#include <cln/integer.h>
    +#include <cln/real.h>
    +using namespace cln;
     
     // Returns F_n, computed as the nearest integer to
     // ((1+sqrt(5))/2)^n/sqrt(5). Assume n>=0.
    @@ -285,10 +329,11 @@ Let's explain what is going on in detail.
     
     
     

    -The include file <cl_integer.h> is necessary because the type -cl_I is used in the function, and the include file <cl_real.h> +The include file <cln/integer.h> is necessary because the type +cl_I is used in the function, and the include file <cln/real.h> is needed for the type cl_R and the floating point number functions. -The order of the include files does not matter. +The order of the include files does not matter. In order not to write out +cln::foo we can safely import the whole namespace cln.

    @@ -344,9 +389,9 @@ contains this implementation together with an even faster algorithm. -

    11.4 Debugging support

    +

    11.5 Debugging support

    - +

    @@ -380,11 +425,11 @@ CLN offers a function cl_print, callable from the debugger, for printing number objects. In order to get this function, you have to define the macro `CL_DEBUG' and then include all the header files for which you want cl_print debugging support. For example: - +

     #define CL_DEBUG
    -#include <cl_string.h>
    +#include <cln/string.h>
     
    Now, if you have in your program a variable cl_string s, and @@ -407,7 +452,7 @@ only with number objects and similar. Therefore CLN offers a member function debug_print() on all CLN types. The same macro `CL_DEBUG' is needed for this member function to be implemented. Under gdb, you call it like this: - +
     (gdb) print s
    diff --git a/doc/cln_12.html b/doc/cln_12.html
    index 2af3120..5c86ada 100644
    --- a/doc/cln_12.html
    +++ b/doc/cln_12.html
    @@ -1,6 +1,6 @@
     
     
    -
    +
     
     CLN, a Class Library for Numbers - 12. Customizing
     
    @@ -9,14 +9,14 @@ Go to the first, previous, 

    -

    12. Customizing

    +

    12. Customizing

    - + -

    12.1 Error handling

    +

    12.1 Error handling

    When a fatal error occurs, an error message is output to the standard error @@ -26,20 +26,20 @@ To catch such a fatal error, you need to define the function cl_abort -#include <cl_abort.h> +#include <cln/abort.h> void cl_abort (void);

    - + This function must not return control to its caller. -

    12.2 Floating-point underflow

    +

    12.2 Floating-point underflow

    - +

    @@ -60,37 +60,39 @@ will be generated instead. The default value of -

    12.3 Customizing I/O

    +

    12.3 Customizing I/O

    The output of the function fprint may be customized by changing the -value of the global variable cl_default_print_flags. - +value of the global variable default_print_flags. + -

    12.4 Customizing the memory allocator

    +

    12.4 Customizing the memory allocator

    Every memory allocation of CLN is done through the function pointer -cl_malloc_hook. Freeing of this memory is done through the function -pointer cl_free_hook. The default versions of these functions, +malloc_hook. Freeing of this memory is done through the function +pointer free_hook. The default versions of these functions, provided in the library, call malloc and free and check the malloc result against NULL. If you want to provide another memory allocator, you need to define -the variables cl_malloc_hook and cl_free_hook yourself, +the variables malloc_hook and free_hook yourself, like this:

    -#include <cl_malloc.h>
    -void* (*cl_malloc_hook) (size_t size) = ...;
    -void (*cl_free_hook) (void* ptr)      = ...;
    +#include <cln/malloc.h>
    +namespace cln {
    +        void* (*malloc_hook) (size_t size) = ...;
    +        void (*free_hook) (void* ptr)      = ...;
    +}
     

    - - + + The cl_malloc_hook function must not return a NULL pointer. diff --git a/doc/cln_13.html b/doc/cln_13.html index e18aa87..d485564 100644 --- a/doc/cln_13.html +++ b/doc/cln_13.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - Index @@ -9,7 +9,7 @@ Go to the first, previous, ne


    -

    Index

    +

    Index

    Jump to: diff --git a/doc/cln_2.html b/doc/cln_2.html index 516165b..16bfa17 100644 --- a/doc/cln_2.html +++ b/doc/cln_2.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 2. Installation @@ -25,23 +25,21 @@ This section describes how to install the CLN package on your system.

    To build CLN, you need a C++ compiler. -Actually, you need GNU g++ 2.7.0 or newer. -On HPPA, you need GNU g++ 2.8.0 or newer. +Actually, you need GNU g++ 2.90 or newer, the EGCS compilers will +do. I recommend GNU g++ 2.95 or newer.

    The following C++ features are used: -classes, member functions, -overloading of functions and operators, -constructors and destructors, inline, const, -multiple inheritance, templates. +classes, member functions, overloading of functions and operators, +constructors and destructors, inline, const, multiple inheritance, +templates and namespaces.

    The following C++ features are not used: -new, delete, virtual inheritance, -exceptions. +new, delete, virtual inheritance, exceptions.

    @@ -54,7 +52,7 @@ implement for GNU g++ only.

    2.1.2 Make utility

    - +

    @@ -65,7 +63,7 @@ To build CLN, you also need to have GNU make installed.

    2.1.3 Sed utility

    - +

    @@ -147,12 +145,10 @@ Examples:

     $ CC="gcc" CFLAGS="-O" CXX="g++" CXXFLAGS="-O" ./configure
    -$ CC="gcc -V 2.7.2" CFLAGS="-O -g" \
    -  CXX="g++ -V 2.7.2" CXXFLAGS="-O -g" ./configure
    -$ CC="gcc -V 2.8.1" CFLAGS="-O -fno-exceptions" \
    -  CXX="g++ -V 2.8.1" CXXFLAGS="-O -fno-exceptions" ./configure
    -$ CC="gcc -V egcs-2.91.60" CFLAGS="-O2 -fno-exceptions" \
    -  CXX="g++ -V egcs-2.91.60" CFLAGS="-O2 -fno-exceptions" ./configure
    +$ CC="gcc -V egcs-2.91.60" CFLAGS="-O -g" \
    +  CXX="g++ -V egcs-2.91.60" CXXFLAGS="-O -g" ./configure
    +$ CC="gcc -V 2.95.2" CFLAGS="-O2 -fno-exceptions" \
    +  CXX="g++ -V 2.95.2" CFLAGS="-O2 -fno-exceptions" ./configure
     

    @@ -165,13 +161,9 @@ calling configure. In a csh shell, you have to use the

    -On Linux, g++ needs 15 MB to compile the tests. So you should better -have 17 MB swap space and 1 MB room in $TMPDIR. - - -

    -If you use g++ version 2.7.x, don't add `-O2' to the CXXFLAGS, -because `g++ -O' generates better code for CLN than `g++ -O2'. +Currently CLN works only with the GNU g++ compiler, and only in +optimizing mode. So you should specify at least -O in the CXXFLAGS, +or no CXXFLAGS at all. (If CXXFLAGS is not set, CLN will use -O.)

    @@ -203,7 +195,7 @@ libraries so runtime-critical applications should be linked statically.

    2.2.1 Using the GNU MP Library

    - +

    @@ -232,7 +224,7 @@ $ CC="gcc" CFLAGS="-O2" CXX="g++" CXXFLAGS="-O2 -fno-exceptions" \

    2.3 Installing the library

    - +

    diff --git a/doc/cln_3.html b/doc/cln_3.html index 6311b3e..154d8d6 100644 --- a/doc/cln_3.html +++ b/doc/cln_3.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 3. Ordinary number types @@ -18,35 +18,35 @@ CLN implements the following class hierarchy:

                             Number
    -                       cl_number
    -                     <cl_number.h>
    +                      cl_number
    +                    <cln/number.h>
                               |
                               |
                      Real or complex number
                             cl_N
    -                     <cl_complex.h>
    +                    <cln/complex.h>
                               |
                               |
                          Real number
                             cl_R
    -                      <cl_real.h>
    +                     <cln/real.h>
                               |
           +-------------------+-------------------+
           |                                       |
     Rational number                     Floating-point number
         cl_RA                                   cl_F
    -<cl_rational.h>                          <cl_float.h>
    +<cln/rational.h>                         <cln/float.h>
           |                                       |
    -      |                  +-------------+-------------+-------------+
    -   Integer               |             |             |             |
    -    cl_I            Short-Float   Single-Float  Double-Float   Long-Float
    - <cl_integer.h>        cl_SF         cl_FF         cl_DF         cl_LF
    -                   <cl_sfloat.h> <cl_ffloat.h> <cl_dfloat.h> <cl_lfloat.h>
    +      |                +--------------+--------------+--------------+
    +   Integer             |              |              |              |
    +    cl_I          Short-Float    Single-Float   Double-Float    Long-Float
    +<cln/integer.h>      cl_SF          cl_FF          cl_DF          cl_LF
    +                 <cln/sfloat.h> <cln/ffloat.h> <cln/dfloat.h> <cln/lfloat.h>
     

    - + The base class cl_number is an abstract base class. It is not useful to declare a variable of this type except if you want to completely disable compile-time type checking and use run-time type @@ -54,24 +54,24 @@ checking instead.

    - + The class cl_N comprises real and complex numbers. There is no special class for complex numbers since complex numbers with imaginary part 0 are automatically converted to real numbers.

    - + The class cl_R comprises real numbers of different kinds. It is an abstract class.

    - + The class cl_RA comprises exact real numbers: rational numbers, including integers. There is no special class for non-integral rational numbers since rational numbers with denominator 1 are automatically converted @@ -79,7 +79,7 @@ to integers.

    - + The class cl_F implements floating-point approximations to real numbers. It is an abstract class. @@ -88,7 +88,7 @@ It is an abstract class.

    3.1 Exact numbers

    - +

    @@ -132,7 +132,7 @@ is completely transparent.

    3.2 Floating-point numbers

    - +

    @@ -144,7 +144,7 @@ CLN implements ordinary floating-point numbers, with mantissa and exponent.

    - + The elementary operations (+, -, *, /, ...) only return approximate results. For example, the value of the expression (cl_F) 0.3 + (cl_F) 0.4 prints as `0.70000005', not as @@ -175,7 +175,7 @@ Floating point numbers come in four flavors:

    • - + Short floats, type cl_SF. They have 1 sign bit, 8 exponent bits (including the exponent's sign), and 17 mantissa bits (including the "hidden" bit). @@ -183,7 +183,7 @@ They don't consume heap allocation.
    • - + Single floats, type cl_FF. They have 1 sign bit, 8 exponent bits (including the exponent's sign), and 24 mantissa bits (including the "hidden" bit). @@ -192,7 +192,7 @@ This corresponds closely to the C/C++ type `float'.
    • - + Double floats, type cl_DF. They have 1 sign bit, 11 exponent bits (including the exponent's sign), and 53 mantissa bits (including the "hidden" bit). @@ -201,7 +201,7 @@ This corresponds closely to the C/C++ type `double'.
    • - + Long floats, type cl_LF. They have 1 sign bit, 32 exponent bits (including the exponent's sign), and n mantissa bits (including the "hidden" bit), where n >= 64. @@ -222,7 +222,7 @@ with larger exponent range.

      - + As a user of CLN, you can forget about the differences between the four floating-point types and just declare all your floating-point variables as being of type cl_F. This has the advantage that @@ -239,7 +239,7 @@ the floating point contagion rule happened to change in the future.)

      3.3 Complex numbers

      - +

      @@ -258,7 +258,7 @@ through application of sqrt or transcendental functions.

      3.4 Conversions

      - +

      @@ -317,7 +317,7 @@ Conversions from `const char *' are provided for the classes cl_R, cl_N. The easiest way to specify a value which is outside of the range of the C++ built-in types is therefore to specify it as a string, like this: - +

          cl_I order_of_rubiks_cube_group = "43252003274489856000";
      @@ -337,16 +337,16 @@ the functions
       
       
      int cl_I_to_int (const cl_I& x)
      - +
      unsigned int cl_I_to_uint (const cl_I& x)
      - +
      long cl_I_to_long (const cl_I& x)
      - +
      unsigned long cl_I_to_ulong (const cl_I& x)
      - + Returns x as element of the C type ctype. If x is not representable in the range of ctype, a runtime error occurs. @@ -361,12 +361,12 @@ the functions
      -
      float cl_float_approx (const type& x) -
      - -
      double cl_double_approx (const type& x) +
      float float_approx (const type& x)
      +
      double double_approx (const type& x) +
      + Returns an approximation of x of C type ctype. If abs(x) is too close to 0 (underflow), 0 is returned. If abs(x) is too large (overflow), an IEEE infinity is returned. @@ -377,10 +377,10 @@ Conversions from any class to any of its subclasses ("derived classes" in C++ terminology) are not provided. Instead, you can assert and check that a value belongs to a certain subclass, and return it as element of that class, using the `As' and `The' macros. - + As(type)(value) checks that value belongs to type and returns it as such. - + The(type)(value) assumes that value belongs to type and returns it as such. It is your responsibility to ensure that this assumption is valid. diff --git a/doc/cln_4.html b/doc/cln_4.html index d2210cb..43ff034 100644 --- a/doc/cln_4.html +++ b/doc/cln_4.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 4. Functions on numbers @@ -14,7 +14,7 @@ Go to the first, previous, Each of the number classes declares its mathematical operations in the corresponding include file. For example, if your code operates with -objects of type cl_I, it should #include <cl_integer.h>. +objects of type cl_I, it should #include <cln/integer.h>. @@ -109,12 +109,12 @@ defines the following operations:
      type operator + (const type&, const type&)
      - + Addition.
      type operator - (const type&, const type&)
      - + Subtraction.
      type operator - (const type&) @@ -123,22 +123,22 @@ Returns the negative of the argument.
      type plus1 (const type& x)
      - + Returns x + 1.
      type minus1 (const type& x)
      - + Returns x - 1.
      type operator * (const type&, const type&)
      - + Multiplication.
      type square (const type& x)
      - + Returns x * x.
      @@ -152,12 +152,12 @@ defines the following operations:
      type operator / (const type&, const type&)
      - + Division.
      type recip (const type&)
      - + Returns the reciprocal of the argument. @@ -173,7 +173,7 @@ Instead, cl_I defines an "exact quotient" function:
      cl_I exquo (const cl_I& x, const cl_I& y)
      - + Checks that y divides x, and returns the quotient x/y. @@ -185,14 +185,14 @@ The following exponentiation functions are defined:
      cl_I expt_pos (const cl_I& x, const cl_I& y)
      - +
      cl_RA expt_pos (const cl_RA& x, const cl_I& y)
      y must be > 0. Returns x^y.
      cl_RA expt (const cl_RA& x, const cl_I& y)
      - +
      cl_R expt (const cl_R& x, const cl_I& y)
      cl_N expt (const cl_N& x, const cl_I& y) @@ -210,7 +210,7 @@ defines the following operation:
      type abs (const type& x)
      - + Returns the absolute value of x. This is x if x >= 0, and -x if x <= 0. @@ -236,7 +236,7 @@ defines the following operation:
      type signum (const type& x)
      - + Returns the sign of x, in the same number format as x. This is defined as x / abs(x) if x is non-zero, and x if x is zero. If x is real, the value is either @@ -255,12 +255,12 @@ Each of the classes cl_RA, cl_I defines the following
      cl_I numerator (const type& x)
      - + Returns the numerator of x.
      cl_I denominator (const type& x)
      - + Returns the denominator of x. @@ -281,7 +281,7 @@ The class cl_N defines the following operation:
      cl_N complex (const cl_R& a, const cl_R& b)
      - + Returns the complex number a+bi, that is, the complex number with real part a and imaginary part b. @@ -294,17 +294,17 @@ Each of the classes cl_N, cl_R defines the following o
      cl_R realpart (const type& x)
      - + Returns the real part of x.
      cl_R imagpart (const type& x)
      - + Returns the imaginary part of x.
      type conjugate (const type& x)
      - + Returns the complex conjugate of x. @@ -326,7 +326,7 @@ We have the relations

      4.5 Comparisons

      - +

      @@ -339,22 +339,22 @@ defines the following operations:

      bool operator == (const type&, const type&)
      - +
      bool operator != (const type&, const type&)
      - + Comparison, as in C and C++. -
      uint32 cl_equal_hashcode (const type&) +
      uint32 equal_hashcode (const type&)
      - + Returns a 32-bit hash code that is the same for any two numbers which are the same according to ==. This hash code depends on the number's value, not its type or precision.
      cl_boolean zerop (const type& x)
      - + Compare against zero: x == 0 @@ -366,44 +366,44 @@ defines the following operations:
      -
      cl_signean cl_compare (const type& x, const type& y) +
      cl_signean compare (const type& x, const type& y)
      - + Compares x and y. Returns +1 if x>y, -1 if x<y, 0 if x=y.
      bool operator <= (const type&, const type&)
      - +
      bool operator < (const type&, const type&)
      - +
      bool operator >= (const type&, const type&)
      - +
      bool operator > (const type&, const type&)
      - + Comparison, as in C and C++.
      cl_boolean minusp (const type& x)
      - + Compare against zero: x < 0
      cl_boolean plusp (const type& x)
      - + Compare against zero: x > 0
      type max (const type& x, const type& y)
      - + Return the maximum of x and y.
      type min (const type& x, const type& y)
      - + Return the minimum of x and y.
      @@ -420,7 +420,7 @@ there is no floating point number whose value is exactly 1/3.

      4.6 Rounding functions

      - +

      @@ -491,19 +491,19 @@ defines the following operations:

      cl_I floor1 (const type& x)
      - + Returns floor(x).
      cl_I ceiling1 (const type& x)
      - + Returns ceiling(x).
      cl_I truncate1 (const type& x)
      - + Returns truncate(x).
      cl_I round1 (const type& x)
      - + Returns round(x). @@ -592,16 +592,16 @@ defines the following operations:
      type_div_t floor2 (const type& x, const type& y)
      - +
      type_div_t ceiling2 (const type& x, const type& y)
      - +
      type_div_t truncate2 (const type& x, const type& y)
      - +
      type_div_t round2 (const type& x, const type& y)
      - +

      @@ -620,16 +620,16 @@ defines the following operations:

      type ffloor (const type& x)
      - +
      type fceiling (const type& x)
      - +
      type ftruncate (const type& x)
      - +
      type fround (const type& x)
      - +

      @@ -661,11 +661,11 @@ and the remainder. The suffix `2' indicates this. Each of the classes cl_F, cl_SF, cl_FF, cl_DF, cl_LF defines the following operations: - +

      @@ -674,20 +674,20 @@ defines the following operations:
      type_fdiv_t ffloor2 (const type& x)
      - +
      type_fdiv_t fceiling2 (const type& x)
      - +
      type_fdiv_t ftruncate2 (const type& x)
      - +
      type_fdiv_t fround2 (const type& x)
      - +

      and similarly for class cl_R, but with quotient type cl_F. - +

      @@ -739,10 +739,10 @@ The classes cl_R, cl_I define the following operations

      type mod (const type& x, const type& y)
      - +
      type rem (const type& x, const type& y)
      - + @@ -759,7 +759,7 @@ defines the following operation:
      type sqrt (const type& x)
      - + x must be >= 0. This function returns the square root of x, normalized to be >= 0. If x is the square of a rational number, sqrt(x) will be a rational number, else it will return a @@ -774,7 +774,7 @@ The classes cl_RA, cl_I define the following operation
      cl_boolean sqrtp (const type& x, type* root)
      - + This tests whether x is a perfect square. If so, it returns true and the exact square root in *root, else it returns false. @@ -787,7 +787,7 @@ Furthermore, for integers, similarly:
      cl_boolean isqrt (const type& x, type* root)
      - + x should be >= 0. This function sets *root to floor(sqrt(x)) and returns the same value as sqrtp: the boolean value (expt(*root,2) == x). @@ -802,7 +802,7 @@ define the following operation:
      cl_boolean rootp (const type& x, const cl_I& n, type* root)
      - + x must be >= 0. n must be > 0. This tests whether x is an nth power of a rational number. If so, it returns true and the exact root in *root, else it returns @@ -818,7 +818,7 @@ for class cl_N:
      cl_N sqrt (const cl_N& z)
      - + Returns the square root of z, as defined by the formula sqrt(z) = exp(log(z)/2). Conversion to a floating-point type or to a complex number are done if necessary. The range of the result is the @@ -832,7 +832,7 @@ The result is an exact number only if z is an exact number.

      4.8 Transcendental functions

      - +

      @@ -850,7 +850,7 @@ For example, cos(0) = 1 returns the rational number 1.

      cl_R exp (const cl_R& x)
      - +
      cl_N exp (const cl_N& x)
      Returns the exponential function of x. This is e^x where @@ -859,12 +859,12 @@ is the entire complex plane excluding 0.
      cl_R ln (const cl_R& x)
      - + x must be > 0. Returns the (natural) logarithm of x.
      cl_N log (const cl_N& x)
      - + Returns the (natural) logarithm of x. If x is real and positive, this is ln(x). In general, log(x) = log(abs(x)) + i*phase(x). The range of the result is the strip in the complex plane @@ -872,7 +872,7 @@ The range of the result is the strip in the complex plane
      cl_R phase (const cl_N& x)
      - + Returns the angle part of x in its polar representation as a complex number. That is, phase(x) = atan(realpart(x),imagpart(x)). This is also the imaginary part of log(x). @@ -894,7 +894,7 @@ Returns the logarithm of a with respect to base b.
      cl_N expt (const cl_N& x, const cl_N& y)
      - + Exponentiation: Returns x^y = exp(y*log(x)). @@ -904,18 +904,18 @@ The constant e = exp(1) = 2.71828... is returned by the following functions:
      -
      cl_F cl_exp1 (cl_float_format_t f) +
      cl_F exp1 (cl_float_format_t f)
      - + Returns e as a float of format f. -
      cl_F cl_exp1 (const cl_F& y) +
      cl_F exp1 (const cl_F& y)
      Returns e in the float format of y. -
      cl_F cl_exp1 (void) +
      cl_F exp1 (void)
      -Returns e as a float of format cl_default_float_format. +Returns e as a float of format default_float_format.
      @@ -926,7 +926,7 @@ Returns e as a float of format cl_default_float_format.
      cl_R sin (const cl_R& x)
      - + Returns sin(x). The range of the result is the interval -1 <= sin(x) <= 1. @@ -936,7 +936,7 @@ Returns sin(z). The range of the result is the entire complex plane
      cl_R cos (const cl_R& x)
      - + Returns cos(x). The range of the result is the interval -1 <= cos(x) <= 1. @@ -944,33 +944,33 @@ Returns cos(x). The range of the result is the interval
      Returns cos(z). The range of the result is the entire complex plane. -
      struct cl_cos_sin_t { cl_R cos; cl_R sin; }; +
      struct cos_sin_t { cl_R cos; cl_R sin; };
      - -
      cl_cos_sin_t cl_cos_sin (const cl_R& x) + +
      cos_sin_t cos_sin (const cl_R& x)
      Returns both sin(x) and cos(x). This is more efficient than - + computing them separately. The relation cos^2 + sin^2 = 1 will hold only approximately.
      cl_R tan (const cl_R& x)
      - +
      cl_N tan (const cl_N& x)
      Returns tan(x) = sin(x)/cos(x).
      cl_N cis (const cl_R& x)
      - +
      cl_N cis (const cl_N& x)
      Returns exp(i*x). The name `cis' means "cos + i sin", because e^(i*x) = cos(x) + i*sin(x). - +
      cl_N asin (const cl_N& z)
      Returns arcsin(z). This is defined as @@ -983,7 +983,7 @@ with realpart = pi/2 and imagpart > 0.
      cl_N acos (const cl_N& z)
      - + Returns arccos(z). This is defined as arccos(z) = pi/2 - arcsin(z) = log(z+i*sqrt(1-z^2))/i and satisfies arccos(-z) = pi - arccos(z). @@ -992,8 +992,8 @@ The range of the result is the strip in the complex domain with realpart = 0 and imagpart < 0 and the numbers with realpart = pi and imagpart > 0. - +
      cl_R atan (const cl_R& x, const cl_R& y)
      Returns the angle of the polar representation of the complex number @@ -1022,25 +1022,25 @@ with realpart = pi/2 and imagpart <= 0.

      - + Archimedes' constant pi = 3.14... is returned by the following functions:

      -
      cl_F cl_pi (cl_float_format_t f) +
      cl_F pi (cl_float_format_t f)
      - + Returns pi as a float of format f. -
      cl_F cl_pi (const cl_F& y) +
      cl_F pi (const cl_F& y)
      Returns pi in the float format of y. -
      cl_F cl_pi (void) +
      cl_F pi (void)
      -Returns pi as a float of format cl_default_float_format. +Returns pi as a float of format default_float_format.
      @@ -1051,7 +1051,7 @@ Returns pi as a float of format cl_default_float_format.
      cl_R sinh (const cl_R& x)
      - + Returns sinh(x).
      cl_N sinh (const cl_N& z) @@ -1060,7 +1060,7 @@ Returns sinh(z). The range of the result is the entire complex plan
      cl_R cosh (const cl_R& x)
      - + Returns cosh(x). The range of the result is the interval cosh(x) >= 1. @@ -1068,26 +1068,26 @@ Returns cosh(x). The range of the result is the interval
      Returns cosh(z). The range of the result is the entire complex plane. -
      struct cl_cosh_sinh_t { cl_R cosh; cl_R sinh; }; -
      - -
      cl_cosh_sinh_t cl_cosh_sinh (const cl_R& x) +
      struct cosh_sinh_t { cl_R cosh; cl_R sinh; };
      +
      cosh_sinh_t cosh_sinh (const cl_R& x) +
      + Returns both sinh(x) and cosh(x). This is more efficient than computing them separately. The relation cosh^2 - sinh^2 = 1 will hold only approximately.
      cl_R tanh (const cl_R& x)
      - +
      cl_N tanh (const cl_N& x)
      Returns tanh(x) = sinh(x)/cosh(x).
      cl_N asinh (const cl_N& z)
      - + Returns arsinh(z). This is defined as arsinh(z) = log(z+sqrt(1+z^2)) and satisfies arsinh(-z) = -arsinh(z). @@ -1098,7 +1098,7 @@ with imagpart = pi/2 and realpart < 0.
      cl_N acosh (const cl_N& z)
      - + Returns arcosh(z). This is defined as arcosh(z) = 2*log(sqrt((z+1)/2)+sqrt((z-1)/2)). The range of the result is the half-strip in the complex domain @@ -1107,7 +1107,7 @@ excluding the numbers with realpart = 0 and -pi < imagpar
      cl_N atanh (const cl_N& z)
      - + Returns artanh(z). This is defined as artanh(z) = (log(1+z)-log(1-z)) / 2 and satisfies artanh(-z) = -artanh(z). The range of the result is @@ -1121,7 +1121,7 @@ with imagpart = pi/2 and realpart >= 0.

      4.8.4 Euler gamma

      - +

      @@ -1130,46 +1130,46 @@ Euler's constant C = 0.577... is returned by the following functions:

      -
      cl_F cl_eulerconst (cl_float_format_t f) +
      cl_F eulerconst (cl_float_format_t f)
      - + Returns Euler's constant as a float of format f. -
      cl_F cl_eulerconst (const cl_F& y) +
      cl_F eulerconst (const cl_F& y)
      Returns Euler's constant in the float format of y. -
      cl_F cl_eulerconst (void) +
      cl_F eulerconst (void)
      -Returns Euler's constant as a float of format cl_default_float_format. +Returns Euler's constant as a float of format default_float_format.

      Catalan's constant G = 0.915... is returned by the following functions: - +

      -
      cl_F cl_catalanconst (cl_float_format_t f) +
      cl_F catalanconst (cl_float_format_t f)
      - + Returns Catalan's constant as a float of format f. -
      cl_F cl_catalanconst (const cl_F& y) +
      cl_F catalanconst (const cl_F& y)
      Returns Catalan's constant in the float format of y. -
      cl_F cl_catalanconst (void) +
      cl_F catalanconst (void)
      -Returns Catalan's constant as a float of format cl_default_float_format. +Returns Catalan's constant as a float of format default_float_format.

      4.8.5 Riemann zeta

      - +

      @@ -1179,19 +1179,19 @@ following functions:

      -
      cl_F cl_zeta (int s, cl_float_format_t f) +
      cl_F zeta (int s, cl_float_format_t f)
      - + Returns Riemann's zeta function at s as a float of format f. -
      cl_F cl_zeta (int s, const cl_F& y) +
      cl_F zeta (int s, const cl_F& y)
      Returns Riemann's zeta function at s in the float format of y. -
      cl_F cl_zeta (int s) +
      cl_F zeta (int s)
      Returns Riemann's zeta function at s as a float of format -cl_default_float_format. +default_float_format.
      @@ -1221,69 +1221,69 @@ on each of the bit positions in parallel.
      cl_I lognot (const cl_I& x)
      - +
      cl_I operator ~ (const cl_I& x)
      - + Logical not, like ~x in C. This is the same as -1-x.
      cl_I logand (const cl_I& x, const cl_I& y)
      - +
      cl_I operator & (const cl_I& x, const cl_I& y)
      - + Logical and, like x & y in C.
      cl_I logior (const cl_I& x, const cl_I& y)
      - +
      cl_I operator | (const cl_I& x, const cl_I& y)
      - + Logical (inclusive) or, like x | y in C.
      cl_I logxor (const cl_I& x, const cl_I& y)
      - +
      cl_I operator ^ (const cl_I& x, const cl_I& y)
      - + Exclusive or, like x ^ y in C.
      cl_I logeqv (const cl_I& x, const cl_I& y)
      - + Bitwise equivalence, like ~(x ^ y) in C.
      cl_I lognand (const cl_I& x, const cl_I& y)
      - + Bitwise not and, like ~(x & y) in C.
      cl_I lognor (const cl_I& x, const cl_I& y)
      - + Bitwise not or, like ~(x | y) in C.
      cl_I logandc1 (const cl_I& x, const cl_I& y)
      - + Logical and, complementing the first argument, like ~x & y in C.
      cl_I logandc2 (const cl_I& x, const cl_I& y)
      - + Logical and, complementing the second argument, like x & ~y in C.
      cl_I logorc1 (const cl_I& x, const cl_I& y)
      - + Logical or, complementing the first argument, like ~x | y in C.
      cl_I logorc2 (const cl_I& x, const cl_I& y)
      - + Logical or, complementing the second argument, like x | ~y in C. @@ -1293,7 +1293,7 @@ These operations are all available though the function
      cl_I boole (cl_boole op, const cl_I& x, const cl_I& y)
      - +

      where op must have one of the 16 values (each one stands for a function @@ -1302,7 +1302,6 @@ which combines two bits into one bit): boole_clr, boole_setboole_and, boole_ior, boole_xor, boole_eqv, boole_nand, boole_nor, boole_andc1, boole_andc2, boole_orc1, boole_orc2. - @@ -1317,6 +1316,7 @@ which combines two bits into one bit): boole_clr, boole_set +

      @@ -1327,19 +1327,19 @@ Other functions that view integers as bit strings:

      cl_boolean logtest (const cl_I& x, const cl_I& y)
      - + Returns true if some bit is set in both x and y, i.e. if logand(x,y) != 0.
      cl_boolean logbitp (const cl_I& n, const cl_I& x)
      - + Returns true if the nth bit (from the right) of x is set. Bit 0 is the least significant bit.
      uintL logcount (const cl_I& x)
      - + Returns the number of one bits in x, if x >= 0, or the number of zero bits in x, if x < 0. @@ -1353,7 +1353,7 @@ struct cl_byte { uintL size; uintL position; };

      - + represents the bit interval containing the bits position...position+size-1 of an integer. The constructor cl_byte(size,position) constructs a cl_byte. @@ -1363,19 +1363,19 @@ The constructor cl_byte(size,position) constructs a cl_bytecl_I ldb (const cl_I& n, const cl_byte& b)

      - + extracts the bits of n described by the bit interval b and returns them as a nonnegative integer with b.size bits.
      cl_boolean ldb_test (const cl_I& n, const cl_byte& b)
      - + Returns true if some bit described by the bit interval b is set in n.
      cl_I dpb (const cl_I& newbyte, const cl_I& n, const cl_byte& b)
      - + Returns n, with the bits described by the bit interval b replaced by newbyte. Only the lowest b.size bits of newbyte are relevant. @@ -1390,13 +1390,13 @@ functions are their counterparts without shifting:
      cl_I mask_field (const cl_I& n, const cl_byte& b)
      - + returns an integer with the bits described by the bit interval b copied from the corresponding bits in n, the other bits zero.
      cl_I deposit_field (const cl_I& newbyte, const cl_I& n, const cl_byte& b)
      - + returns an integer where the bits described by the bit interval b come from newbyte and the other bits come from n. @@ -1427,39 +1427,39 @@ for common arithmetic operations:
      cl_boolean oddp (const cl_I& x)
      - + Returns true if the least significant bit of x is 1. Equivalent to mod(x,2) != 0.
      cl_boolean evenp (const cl_I& x)
      - + Returns true if the least significant bit of x is 0. Equivalent to mod(x,2) == 0.
      cl_I operator << (const cl_I& x, const cl_I& n)
      - + Shifts x by n bits to the left. n should be >=0. Equivalent to x * expt(2,n).
      cl_I operator >> (const cl_I& x, const cl_I& n)
      - + Shifts x by n bits to the right. n should be >=0. Bits shifted out to the right are thrown away. Equivalent to floor(x / expt(2,n)).
      cl_I ash (const cl_I& x, const cl_I& y)
      - + Shifts x by y bits to the left (if y>=0) or by -y bits to the right (if y<=0). In other words, this returns floor(x * expt(2,y)).
      uintL integer_length (const cl_I& x)
      - + Returns the number of bits (excluding the sign bit) needed to represent x in two's complement notation. This is the smallest n >= 0 such that -2^n <= x < 2^n. If x > 0, this is the unique n > 0 such that @@ -1467,14 +1467,14 @@ in two's complement notation. This is the smallest n >= 0 such that
      uintL ord2 (const cl_I& x)
      - + x must be non-zero. This function returns the number of 0 bits at the right of x in two's complement notation. This is the largest n >= 0 such that 2^n divides x.
      uintL power2p (const cl_I& x)
      - + x must be > 0. This function checks whether x is a power of 2. If x = 2^(n-1), it returns n. Else it returns 0. (See also the function logp.) @@ -1488,7 +1488,7 @@ If x = 2^(n-1), it returns n. Else it returns 0.
      uint32 gcd (uint32 a, uint32 b)
      - +
      cl_I gcd (const cl_I& a, const cl_I& b)
      This function returns the greatest common divisor of a and b, @@ -1496,7 +1496,7 @@ normalized to be >= 0.
      cl_I xgcd (const cl_I& a, const cl_I& b, cl_I* u, cl_I* v)
      - + This function ("extended gcd") returns the greatest common divisor g of a and b and at the same time the representation of g as an integral linear combination of a and b: @@ -1508,13 +1508,13 @@ value, in the following sense: If a and b are non-zero
      cl_I lcm (const cl_I& a, const cl_I& b)
      - + This function returns the least common multiple of a and b, normalized to be >= 0.
      cl_boolean logp (const cl_I& a, const cl_I& b, cl_RA* l)
      - +
      cl_boolean logp (const cl_RA& a, const cl_RA& b, cl_RA* l)
      a must be > 0. b must be >0 and != 1. If log(a,b) is @@ -1530,20 +1530,20 @@ it returns false.
      cl_I factorial (uintL n)
      - + n must be a small integer >= 0. This function returns the factorial n! = 1*2*...*n.
      cl_I doublefactorial (uintL n)
      - + n must be a small integer >= 0. This function returns the doublefactorial n!! = 1*3*...*n or n!! = 2*4*...*n, respectively.
      cl_I binomial (uintL n, uintL k)
      - + n and k must be small integers >= 0. This function returns the binomial coefficient (n choose k) = n! / k! (n-k)! @@ -1570,7 +1570,7 @@ defines the following operations.
      type scale_float (const type& x, sintL delta)
      - +
      type scale_float (const type& x, const cl_I& delta)
      Returns x*2^delta. This is more efficient than an explicit multiplication @@ -1586,32 +1586,32 @@ representation of floating-point numbers.
      sintL float_exponent (const type& x)
      - + Returns the exponent e of x. For x = 0.0, this is 0. For x non-zero, this is the unique integer with 2^(e-1) <= abs(x) < 2^e.
      sintL float_radix (const type& x)
      - + Returns the base of the floating-point representation. This is always 2.
      type float_sign (const type& x)
      - + Returns the sign s of x as a float. The value is 1 for x >= 0, -1 for x < 0.
      uintL float_digits (const type& x)
      - + Returns the number of mantissa bits in the floating-point representation of x, including the hidden bit. The value only depends on the type of x, not on its value.
      uintL float_precision (const type& x)
      - + Returns the number of significant mantissa bits in the floating-point representation of x. Since denormalized numbers are not supported, this is the same as float_digits(x) if x is non-zero, and @@ -1620,16 +1620,16 @@ this is the same as float_digits(x) if x is non-zero,

      The complete internal representation of a float is encoded in the type - -cl_decoded_float (or cl_decoded_sfloat, cl_decoded_ffloat, -cl_decoded_dfloat, cl_decoded_lfloat, respectively), defined by + +decoded_float (or decoded_sfloat, decoded_ffloat, +decoded_dfloat, decoded_lfloat, respectively), defined by

      -struct cl_decoded_typefloat {
      +struct decoded_typefloat {
               type mantissa; cl_I exponent; type sign;
       };
       
      @@ -1640,9 +1640,9 @@ and returned by the function
      -
      cl_decoded_typefloat decode_float (const type& x) +
      decoded_typefloat decode_float (const type& x)
      - + For x non-zero, this returns (-1)^s, e, m with x = (-1)^s * 2^e * m and 0.5 <= m < 1.0. For x = 0, it returns (-1)^s=1, e=0, m=0. @@ -1651,9 +1651,10 @@ it returns (-1)^s=1, e=0, m=0.

      A complete decoding in terms of integers is provided as type +

      -struct cl_idecoded_float {
      +struct cl_idecoded_float {
               cl_I mantissa; cl_I exponent; cl_I sign;
       };
       
      @@ -1666,7 +1667,7 @@ by the following function:
      cl_idecoded_float integer_decode_float (const type& x)
      - + For x non-zero, this returns (-1)^s, e, m with x = (-1)^s * 2^e * m and m an integer with float_digits(x) bits. For x = 0, it returns (-1)^s=1, e=0, m=0. @@ -1682,7 +1683,7 @@ Some other function, implemented only for class cl_F:
      cl_F float_sign (const cl_F& x, const cl_F& y)
      - + This returns a floating point number whose precision and absolute value is that of y and whose sign is that of x. If x is zero, it is treated as positive. Same for y. @@ -1692,7 +1693,7 @@ zero, it is treated as positive. Same for y.

      4.11 Conversion functions

      - + @@ -1701,14 +1702,14 @@ zero, it is treated as positive. Same for y.

      The type cl_float_format_t describes a floating-point format. - +

      cl_float_format_t cl_float_format (uintL n)
      - + Returns the smallest float format which guarantees at least n decimal digits in the mantissa (after the decimal point). @@ -1716,9 +1717,9 @@ decimal digits in the mantissa (after the decimal point).
      Returns the floating point format of x. -
      cl_float_format_t cl_default_float_format +
      cl_float_format_t default_float_format
      - + Global variable: the default float format used when converting rational numbers to floats.
      @@ -1734,14 +1735,14 @@ defines the following operations:
      cl_F cl_float (const type&x, cl_float_format_t f)
      - + Returns x as a float of format f.
      cl_F cl_float (const type&x, const cl_F& y)
      Returns x in the float format of y.
      cl_F cl_float (const type&x)
      -Returns x as a float of format cl_default_float_format if +Returns x as a float of format default_float_format if it is an exact number, or x itself if it is already a float.
      @@ -1757,34 +1758,34 @@ Every floating-point format has some characteristic numbers:
      cl_F most_positive_float (cl_float_format_t f)
      - + Returns the largest (most positive) floating point number in float format f.
      cl_F most_negative_float (cl_float_format_t f)
      - + Returns the smallest (most negative) floating point number in float format f.
      cl_F least_positive_float (cl_float_format_t f)
      - + Returns the least positive floating point number (i.e. > 0 but closest to 0) in float format f.
      cl_F least_negative_float (cl_float_format_t f)
      - + Returns the least negative floating point number (i.e. < 0 but closest to 0) in float format f.
      cl_F float_epsilon (cl_float_format_t f)
      - + Returns the smallest floating point number e > 0 such that 1+e != 1.
      cl_F float_negative_epsilon (cl_float_format_t f)
      - + Returns the smallest floating point number e > 0 such that 1-e != 1. @@ -1801,7 +1802,7 @@ defines the following operation:
      cl_RA rational (const type& x)
      - + Returns the value of x as an exact number. If x is already an exact number, this is x. If x is a floating-point number, the value is a rational number whose denominator is a power of 2. @@ -1816,7 +1817,7 @@ the function
      cl_RA rationalize (const cl_R& x)
      - + If x is a floating-point number, it actually represents an interval of real numbers, and this function returns the rational number with smallest denominator (and smallest numerator, in magnitude) @@ -1844,7 +1845,7 @@ If x is any float, one has

      A random generator is a machine which produces (pseudo-)random numbers. -The include file <cl_random.h> defines a class cl_random_state +The include file <cln/random.h> defines a class random_state which contains the state of a random generator. If you make a copy of the random number generator, the original one and the copy will produce the same sequence of random numbers. @@ -1858,48 +1859,48 @@ a complicated but deterministic way.

      The global variable - +

      -cl_random_state cl_default_random_state
      +random_state default_random_state
       

      contains a default random number generator. It is used when the functions -below are called without cl_random_state argument. +below are called without random_state argument.

      -
      uint32 random32 (cl_random_state& randomstate) +
      uint32 random32 (random_state& randomstate)
      uint32 random32 ()
      - + Returns a random unsigned 32-bit number. All bits are equally random. -
      cl_I random_I (cl_random_state& randomstate, const cl_I& n) +
      cl_I random_I (random_state& randomstate, const cl_I& n)
      cl_I random_I (const cl_I& n)
      - + n must be an integer > 0. This function returns a random integer x in the range 0 <= x < n. -
      cl_F random_F (cl_random_state& randomstate, const cl_F& n) +
      cl_F random_F (random_state& randomstate, const cl_F& n)
      cl_F random_F (const cl_F& n)
      - + n must be a float > 0. This function returns a random floating-point number of the same format as n in the range 0 <= x < n. -
      cl_R random_R (cl_random_state& randomstate, const cl_R& n) +
      cl_R random_R (random_state& randomstate, const cl_R& n)
      cl_R random_R (const cl_R& n)
      - + Behaves like random_I if n is an integer and like random_F if n is a float.
      @@ -1908,7 +1909,7 @@ if n is a float.

      4.13 Obfuscating operators

      - +

      @@ -1924,7 +1925,7 @@ to get happy, then add

    - + to the beginning of your source files, before the inclusion of any CLN include files. This flag will enable the following operators: @@ -1938,16 +1939,16 @@ For the classes cl_N, cl_R, cl_RA,

    type& operator += (type&, const type&)
    - +
    type& operator -= (type&, const type&)
    - +
    type& operator *= (type&, const type&)
    - +
    type& operator /= (type&, const type&)
    - +

    @@ -1964,19 +1965,19 @@ For the class cl_I:

    type& operator &= (type&, const type&)
    - +
    type& operator |= (type&, const type&)
    - +
    type& operator ^= (type&, const type&)
    - +
    type& operator <<= (type&, const type&)
    - +
    type& operator >>= (type&, const type&)
    - +

    @@ -1988,7 +1989,7 @@ For the classes cl_N, cl_R, cl_RA,

    type& operator ++ (type& x)
    - + The prefix operator ++x.
    void operator ++ (type& x, int) @@ -1997,7 +1998,7 @@ The postfix operator x++.
    type& operator -- (type& x)
    - + The prefix operator --x.
    void operator -- (type& x, int) diff --git a/doc/cln_5.html b/doc/cln_5.html index 0f1135b..42ea42d 100644 --- a/doc/cln_5.html +++ b/doc/cln_5.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 5. Input/Output @@ -11,14 +11,14 @@ Go to the first, previous, 5. Input/Output

    - +

    5.1 Internal and printed representation

    - +

    @@ -33,9 +33,9 @@ Several external representations may denote the same number, for example,

    Converting an internal to an external representation is called "printing", - -converting an external to an internal representation is called "reading". +converting an external to an internal representation is called "reading". + In CLN, it is always true that conversion of an internal to an external representation and then back to an internal representation will yield the same internal representation. Symbolically: read(print(x)) == x. @@ -118,10 +118,9 @@ In Common Lisp notation: #C(realpart imagpart)5.2 Input functions

    -Including <cl_io.h> defines a type cl_istream, which is -the type of the first argument to all input functions. Unless you build -and use CLN with the macro CL_IO_STDIO being defined, cl_istream -is the same as istream&. +Including <cln/io.h> defines a type cl_istream, which is +the type of the first argument to all input functions. cl_istream +is the same as std::istream&.

    @@ -130,7 +129,7 @@ The variable

    • -cl_istream cl_stdin +cl_istream stdin

    @@ -157,7 +156,7 @@ last freadchar operation on stream.

    Each of the classes cl_N, cl_R, cl_RA, cl_I, cl_F, cl_SF, cl_FF, cl_DF, cl_LF -defines, in <cl_type_io.h>, the following input function: +defines, in <cln/type_io.h>, the following input function:

    @@ -168,7 +167,7 @@ Reads a number from stream and stores it in the result

    -The most flexible input functions, defined in <cl_type_io.h>, +The most flexible input functions, defined in <cln/type_io.h>, are the following: @@ -270,10 +269,9 @@ precision corresponding to their number of significant digits.

    5.3 Output functions

    -Including <cl_io.h> defines a type cl_ostream, which is -the type of the first argument to all output functions. Unless you build -and use CLN with the macro CL_IO_STDIO being defined, cl_ostream -is the same as ostream&. +Including <cln/io.h> defines a type cl_ostream, which is +the type of the first argument to all output functions. cl_ostream +is the same as std::ostream&.

    @@ -282,7 +280,7 @@ The variable

    • -cl_ostream cl_stdout +cl_ostream stdout

    @@ -295,7 +293,7 @@ The variable

    • -cl_ostream cl_stderr +cl_ostream stderr

    @@ -341,7 +339,7 @@ on the stream.

    Each of the classes cl_N, cl_R, cl_RA, cl_I, cl_F, cl_SF, cl_FF, cl_DF, cl_LF -defines, in <cl_type_io.h>, the following output functions: +defines, in <cln/type_io.h>, the following output functions:

    @@ -351,13 +349,13 @@ defines, in <cl_type_io.h>, the following output
    cl_ostream operator<< (cl_ostream stream, const type& x)
    Prints the number x on the stream. The output may depend -on the global printer settings in the variable cl_default_print_flags. +on the global printer settings in the variable default_print_flags. The ostream flags and settings (flags, width and locale) are ignored.

    -The most flexible output function, defined in <cl_type_io.h>, +The most flexible output function, defined in <cln/type_io.h>, are the following:

    @@ -416,7 +414,7 @@ using this variable name. Default is "x".
     
     
     

    -The global variable cl_default_print_flags contains the default values, +The global variable default_print_flags contains the default values, used by the function fprint. diff --git a/doc/cln_6.html b/doc/cln_6.html index 9daa068..efab2fe 100644 --- a/doc/cln_6.html +++ b/doc/cln_6.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 6. Rings @@ -19,7 +19,7 @@ CLN has a class of abstract rings.

                              Ring
                            cl_ring
    -                      <cl_ring.h>
    +                     <cln/ring.h>
     

    @@ -43,28 +43,40 @@ Given a ring R, the following members can be used.

    void R->fprint (cl_ostream stream, const cl_ring_element& x)
    +
    cl_boolean R->equal (const cl_ring_element& x, const cl_ring_element& y)
    +
    cl_ring_element R->zero ()
    +
    cl_boolean R->zerop (const cl_ring_element& x)
    +
    cl_ring_element R->plus (const cl_ring_element& x, const cl_ring_element& y)
    +
    cl_ring_element R->minus (const cl_ring_element& x, const cl_ring_element& y)
    +
    cl_ring_element R->uminus (const cl_ring_element& x)
    +
    cl_ring_element R->one ()
    +
    cl_ring_element R->canonhom (const cl_I& x)
    +
    cl_ring_element R->mul (const cl_ring_element& x, const cl_ring_element& y)
    +
    cl_ring_element R->square (const cl_ring_element& x)
    +
    cl_ring_element R->expt_pos (const cl_ring_element& x, const cl_I& y)
    +

    @@ -103,7 +115,7 @@ Type tests can be performed for any of cl_C_ring, cl_R_ringcl_boolean instanceof (const cl_number& x, const cl_number_ring& R)

    - + Tests whether the given number is an element of the number ring R. diff --git a/doc/cln_7.html b/doc/cln_7.html index 815662b..50d7716 100644 --- a/doc/cln_7.html +++ b/doc/cln_7.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 7. Modular integers @@ -11,14 +11,14 @@ Go to the first, previous, 7. Modular integers

    - +

    7.1 Modular integer rings

    - +

    @@ -38,16 +38,16 @@ The class of modular integer rings is

                              Ring
                            cl_ring
    -                      <cl_ring.h>
    +                     <cln/ring.h>
                               |
                               |
                      Modular integer ring
                         cl_modint_ring
    -                   <cl_modinteger.h>
    +                  <cln/modinteger.h>
     

    - +

    @@ -58,7 +58,7 @@ and the class of all modular integers (elements of modular integer rings) is

                         Modular integer
                              cl_MI
    -                   <cl_modinteger.h>
    +                   <cln/modinteger.h>
     

    @@ -67,13 +67,13 @@ Modular integer rings are constructed using the function

    -
    cl_modint_ring cl_find_modint_ring (const cl_I& N) +
    cl_modint_ring find_modint_ring (const cl_I& N)
    - + This function returns the modular ring `Z/NZ'. It takes care of finding out about special cases of N, like powers of two and odd numbers for which Montgomery multiplication will be a win, - + and precomputes any necessary auxiliary data for computing modulo N. There is a cache table of rings, indexed by N (or, more precisely, by abs(N)). This ensures that the precomputation costs are reduced @@ -88,12 +88,12 @@ Modular integer rings can be compared for equality:
    bool operator== (const cl_modint_ring&, const cl_modint_ring&)
    - +
    bool operator!= (const cl_modint_ring&, const cl_modint_ring&)
    - + These compare two modular integer rings for equality. Two different calls -to cl_find_modint_ring with the same argument necessarily return the +to find_modint_ring with the same argument necessarily return the same ring because it is memoized in the cache table.
    @@ -109,35 +109,35 @@ Given a modular integer ring R, the following members can be used.
    cl_I R->modulus
    - + This is the ring's modulus, normalized to be nonnegative: abs(N).
    cl_MI R->zero()
    - + This returns 0 mod N.
    cl_MI R->one()
    - + This returns 1 mod N.
    cl_MI R->canonhom (const cl_I& x)
    - + This returns x mod N.
    cl_I R->retract (const cl_MI& x)
    - + This is a partial inverse function to R->canonhom. It returns the standard representative (>=0, <N) of x. -
    cl_MI R->random(cl_random_state& randomstate) +
    cl_MI R->random(random_state& randomstate)
    cl_MI R->random()
    - + This returns a random integer modulo N. @@ -149,18 +149,18 @@ The following operations are defined on modular integers.
    cl_modint_ring x.ring ()
    - + Returns the ring to which the modular integer x belongs.
    cl_MI operator+ (const cl_MI&, const cl_MI&)
    - + Returns the sum of two modular integers. One of the arguments may also be a plain integer.
    cl_MI operator- (const cl_MI&, const cl_MI&)
    - + Returns the difference of two modular integers. One of the arguments may also be a plain integer. @@ -170,61 +170,61 @@ Returns the negative of a modular integer.
    cl_MI operator* (const cl_MI&, const cl_MI&)
    - + Returns the product of two modular integers. One of the arguments may also be a plain integer.
    cl_MI square (const cl_MI&)
    - + Returns the square of a modular integer.
    cl_MI recip (const cl_MI& x)
    - + Returns the reciprocal x^-1 of a modular integer x. x must be coprime to the modulus, otherwise an error message is issued.
    cl_MI div (const cl_MI& x, const cl_MI& y)
    - + Returns the quotient x*y^-1 of two modular integers x, y. y must be coprime to the modulus, otherwise an error message is issued.
    cl_MI expt_pos (const cl_MI& x, const cl_I& y)
    - + y must be > 0. Returns x^y.
    cl_MI expt (const cl_MI& x, const cl_I& y)
    - + Returns x^y. If y is negative, x must be coprime to the modulus, else an error message is issued.
    cl_MI operator<< (const cl_MI& x, const cl_I& y)
    - + Returns x*2^y.
    cl_MI operator>> (const cl_MI& x, const cl_I& y)
    - + Returns x*2^-y. When y is positive, the modulus must be odd, or an error message is issued.
    bool operator== (const cl_MI&, const cl_MI&)
    - +
    bool operator!= (const cl_MI&, const cl_MI&)
    - + Compares two modular integers, belonging to the same modular integer ring, for equality.
    cl_boolean zerop (const cl_MI& x)
    - + Returns true if x is 0 mod N. @@ -237,12 +237,12 @@ input/output).
    void fprint (cl_ostream stream, const cl_MI& x)
    - +
    cl_ostream operator<< (cl_ostream stream, const cl_MI& x)
    - + Prints the modular integer x on the stream. The output may depend -on the global printer settings in the variable cl_default_print_flags. +on the global printer settings in the variable default_print_flags.


    diff --git a/doc/cln_8.html b/doc/cln_8.html index 8dc4901..22c6343 100644 --- a/doc/cln_8.html +++ b/doc/cln_8.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 8. Symbolic data types @@ -11,7 +11,7 @@ Go to the first, previous, 8. Symbolic data types

    - +

    @@ -22,7 +22,8 @@ CLN implements two symbolic (non-numeric) data types: strings and symbols.

    8.1 Strings

    - + +

    @@ -33,7 +34,7 @@ The class

                           String
                          cl_string
    -                    <cl_string.h>
    +                   <cln/string.h>
     

    @@ -48,7 +49,6 @@ Strings are constructed through the following constructors:

    cl_string (const char * s)
    - Returns an immutable copy of the (zero-terminated) C string s.
    cl_string (const char * ptr, unsigned long len) @@ -69,21 +69,21 @@ Assignment from cl_string and const char *.
    s.length()
    - +
    strlen(s)
    - + Returns the length of the string s.
    s[i]
    - + Returns the ith character of the string s. i must be in the range 0 <= i < s.length().
    bool equal (const cl_string& s1, const cl_string& s2)
    - + Compares two strings for equality. One of the arguments may also be a plain const char *. @@ -92,7 +92,8 @@ plain const char *.

    8.2 Symbols

    - + +

    @@ -112,7 +113,6 @@ Symbols are constructed through the following constructor:

    cl_symbol (const cl_string& s)
    - Looks up or creates a new symbol with a given name. @@ -129,7 +129,7 @@ Conversion to cl_string: Returns the string which names the symbol
    bool equal (const cl_symbol& sym1, const cl_symbol& sym2)
    - + Compares two symbols for equality. This is very fast. diff --git a/doc/cln_9.html b/doc/cln_9.html index 5e0e61b..4e5ae21 100644 --- a/doc/cln_9.html +++ b/doc/cln_9.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - 9. Univariate polynomials @@ -11,8 +11,8 @@ Go to the first, previous, 9. Univariate polynomials

    - - + + @@ -22,7 +22,7 @@ Go to the first, previous, CLN implements univariate polynomials (polynomials in one variable) over an arbitrary ring. The indeterminate variable may be either unnamed (and will be -printed according to cl_default_print_flags.univpoly_varname, which +printed according to default_print_flags.univpoly_varname, which defaults to `x') or carry a given name. The base ring and the indeterminate are explicitly part of every polynomial. CLN doesn't allow you to (accidentally) mix elements of different polynomial rings, e.g. @@ -38,36 +38,36 @@ The classes of univariate polynomial rings are

                                Ring
                              cl_ring
    -                        <cl_ring.h>
    +                       <cln/ring.h>
                                 |
                                 |
                      Univariate polynomial ring
                           cl_univpoly_ring
    -                      <cl_univpoly.h>
    +                      <cln/univpoly.h>
                                 |
                +----------------+-------------------+
                |                |                   |
      Complex polynomial ring    |    Modular integer polynomial ring
      cl_univpoly_complex_ring   |        cl_univpoly_modint_ring
    -  <cl_univpoly_complex.h>   |        <cl_univpoly_modint.h>
    + <cln/univpoly_complex.h>   |        <cln/univpoly_modint.h>
                                 |
                +----------------+
                |                |
        Real polynomial ring     |
        cl_univpoly_real_ring    |
    -    <cl_univpoly_real.h>    |
    +   <cln/univpoly_real.h>    |
                                 |
                +----------------+
                |                |
      Rational polynomial ring   |
      cl_univpoly_rational_ring  |
    -  <cl_univpoly_rational.h>  |
    + <cln/univpoly_rational.h>  |
                                 |
                +----------------+
                |
      Integer polynomial ring
      cl_univpoly_integer_ring
    -  <cl_univpoly_integer.h>
    + <cln/univpoly_integer.h>
     

    @@ -78,31 +78,31 @@ and the corresponding classes of univariate polynomials are

                        Univariate polynomial
                               cl_UP
    -                      <cl_univpoly.h>
    +                      <cln/univpoly.h>
                                 |
                +----------------+-------------------+
                |                |                   |
        Complex polynomial       |      Modular integer polynomial
             cl_UP_N             |                cl_UP_MI
    -  <cl_univpoly_complex.h>   |        <cl_univpoly_modint.h>
    + <cln/univpoly_complex.h>   |        <cln/univpoly_modint.h>
                                 |
                +----------------+
                |                |
          Real polynomial        |
             cl_UP_R             |
    -    <cl_univpoly_real.h>    |
    +  <cln/univpoly_real.h>     |
                                 |
                +----------------+
                |                |
        Rational polynomial      |
             cl_UP_RA            |
    -  <cl_univpoly_rational.h>  |
    + <cln/univpoly_rational.h>  |
                                 |
                +----------------+
                |
        Integer polynomial
             cl_UP_I
    -  <cl_univpoly_integer.h>
    + <cln/univpoly_integer.h>
     

    @@ -111,9 +111,9 @@ Univariate polynomial rings are constructed using the functions

    -
    cl_univpoly_ring cl_find_univpoly_ring (const cl_ring& R) +
    cl_univpoly_ring find_univpoly_ring (const cl_ring& R)
    -
    cl_univpoly_ring cl_find_univpoly_ring (const cl_ring& R, const cl_symbol& varname) +
    cl_univpoly_ring find_univpoly_ring (const cl_ring& R, const cl_symbol& varname)
    This function returns the polynomial ring `R[X]', unnamed or named. R may be an arbitrary ring. This function takes care of finding out @@ -123,28 +123,28 @@ There is a cache table of rings, indexed by R and varnamecl_univpoly_complex_ring cl_find_univpoly_ring (const cl_complex_ring& R) +
    cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R)
    - -
    cl_univpoly_complex_ring cl_find_univpoly_ring (const cl_complex_ring& R, const cl_symbol& varname) + +
    cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R, const cl_symbol& varname)
    -
    cl_univpoly_real_ring cl_find_univpoly_ring (const cl_real_ring& R) +
    cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R)
    -
    cl_univpoly_real_ring cl_find_univpoly_ring (const cl_real_ring& R, const cl_symbol& varname) +
    cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R, const cl_symbol& varname)
    -
    cl_univpoly_rational_ring cl_find_univpoly_ring (const cl_rational_ring& R) +
    cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R)
    -
    cl_univpoly_rational_ring cl_find_univpoly_ring (const cl_rational_ring& R, const cl_symbol& varname) +
    cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R, const cl_symbol& varname)
    -
    cl_univpoly_integer_ring cl_find_univpoly_ring (const cl_integer_ring& R) +
    cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R)
    -
    cl_univpoly_integer_ring cl_find_univpoly_ring (const cl_integer_ring& R, const cl_symbol& varname) +
    cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R, const cl_symbol& varname)
    -
    cl_univpoly_modint_ring cl_find_univpoly_ring (const cl_modint_ring& R) +
    cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R)
    -
    cl_univpoly_modint_ring cl_find_univpoly_ring (const cl_modint_ring& R, const cl_symbol& varname) +
    cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R, const cl_symbol& varname)
    -These functions are equivalent to the general cl_find_univpoly_ring, +These functions are equivalent to the general find_univpoly_ring, only the return type is more specific, according to the base ring's type.
    @@ -160,33 +160,33 @@ Given a univariate polynomial ring R, the following members can be
    cl_ring R->basering()
    - -This returns the base ring, as passed to `cl_find_univpoly_ring'. + +This returns the base ring, as passed to `find_univpoly_ring'.
    cl_UP R->zero()
    - + This returns 0 in R, a polynomial of degree -1.
    cl_UP R->one()
    - + This returns 1 in R, a polynomial of degree <= 0.
    cl_UP R->canonhom (const cl_I& x)
    - + This returns x in R, a polynomial of degree <= 0.
    cl_UP R->monomial (const cl_ring_element& x, uintL e)
    - + This returns a sparse polynomial: x * X^e, where X is the indeterminate.
    cl_UP R->create (sintL degree)
    - + Creates a new polynomial with a given degree. The zero polynomial has degree -1. After creating the polynomial, you should put in the coefficients, using the set_coeff member function, and then call the finalize @@ -201,14 +201,14 @@ The following are the only destructive operations on univariate polynomials.
    void set_coeff (cl_UP& x, uintL index, const cl_ring_element& y)
    - + This changes the coefficient of X^index in x to be y. After changing a polynomial and before applying any "normal" operation on it, you should call its finalize member function.
    void finalize (cl_UP& x)
    - + This function marks the endpoint of destructive modifications of a polynomial. It normalizes the internal representation so that subsequent computations have less overhead. Doing normal computations on unnormalized polynomials may @@ -223,17 +223,17 @@ The following operations are defined on univariate polynomials.
    cl_univpoly_ring x.ring ()
    - + Returns the ring to which the univariate polynomial x belongs.
    cl_UP operator+ (const cl_UP&, const cl_UP&)
    - + Returns the sum of two univariate polynomials.
    cl_UP operator- (const cl_UP&, const cl_UP&)
    - + Returns the difference of two univariate polynomials.
    cl_UP operator- (const cl_UP&) @@ -242,54 +242,54 @@ Returns the negative of a univariate polynomial.
    cl_UP operator* (const cl_UP&, const cl_UP&)
    - + Returns the product of two univariate polynomials. One of the arguments may also be a plain integer or an element of the base ring.
    cl_UP square (const cl_UP&)
    - + Returns the square of a univariate polynomial.
    cl_UP expt_pos (const cl_UP& x, const cl_I& y)
    - + y must be > 0. Returns x^y.
    bool operator== (const cl_UP&, const cl_UP&)
    - +
    bool operator!= (const cl_UP&, const cl_UP&)
    - + Compares two univariate polynomials, belonging to the same univariate polynomial ring, for equality.
    cl_boolean zerop (const cl_UP& x)
    - + Returns true if x is 0 in R.
    sintL degree (const cl_UP& x)
    - + Returns the degree of the polynomial. The zero polynomial has degree -1.
    cl_ring_element coeff (const cl_UP& x, uintL index)
    - + Returns the coefficient of X^index in the polynomial x.
    cl_ring_element x (const cl_ring_element& y)
    - + Evaluation: If x is a polynomial and y belongs to the base ring, then `x(y)' returns the value of the substitution of y into x.
    cl_UP deriv (const cl_UP& x)
    - + Returns the derivative of the polynomial x with respect to the indeterminate X. @@ -303,13 +303,13 @@ input/output).
    void fprint (cl_ostream stream, const cl_UP& x)
    - +
    cl_ostream operator<< (cl_ostream stream, const cl_UP& x)
    - + Prints the univariate polynomial x on the stream. The output may depend on the global printer settings in the variable -cl_default_print_flags. +default_print_flags. @@ -322,28 +322,28 @@ The following functions return special polynomials.
    -
    cl_UP_I cl_tschebychev (sintL n) +
    cl_UP_I tschebychev (sintL n)
    - - -Returns the n-th Tchebychev polynomial (n >= 0). + + +Returns the n-th Chebyshev polynomial (n >= 0). -
    cl_UP_I cl_hermite (sintL n) +
    cl_UP_I hermite (sintL n)
    - - + + Returns the n-th Hermite polynomial (n >= 0). -
    cl_UP_RA cl_legendre (sintL n) +
    cl_UP_RA legendre (sintL n)
    - - + + Returns the n-th Legendre polynomial (n >= 0). -
    cl_UP_I cl_laguerre (sintL n) +
    cl_UP_I laguerre (sintL n)
    - - + + Returns the n-th Laguerre polynomial (n >= 0).
    diff --git a/doc/cln_toc.html b/doc/cln_toc.html index 271850d..8bd5aca 100644 --- a/doc/cln_toc.html +++ b/doc/cln_toc.html @@ -1,6 +1,6 @@ - + CLN, a Class Library for Numbers - Table of Contents @@ -104,21 +104,22 @@
  • 11. Using the library -
  • 12. Customizing +
  • 12. Customizing -
  • Index +
  • Index


    -This document was generated on 2 June 2000 using +This document was generated on 28 August 2000 using texi2html 1.56k. diff --git a/examples/Makefile.in b/examples/Makefile.in index 0a4fbb9..c6540a5 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -102,6 +102,7 @@ mostlyclean : clean clean : force $(RM) *.s *.o *.a $(PROGRAMS) a.out core + $(RM) -r .libs _libs distclean : clean $(RM) config.status config.log config.cache Makefile diff --git a/examples/atan_recip.cc b/examples/atan_recip.cc index 2db8ffc..188e7e7 100644 --- a/examples/atan_recip.cc +++ b/examples/atan_recip.cc @@ -1,20 +1,21 @@ // Computation of arctan(1/m) (m integer) to high precision. -#include "cl_integer.h" -#include "cl_rational.h" -#include "cl_real.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/rational.h" +#include "cln/real.h" +#include "cln/lfloat.h" #include "cl_LF.h" #include "cl_LF_tran.h" #include "cl_alloca.h" #include #include -#include "cl_timing.h" +#include "cln/timing.h" #undef floor #include #define floor cln_floor +using namespace cln; // Method 1: atan(1/m) = sum(n=0..infty, (-1)^n/(2n+1) * 1/m^(2n+1)) // Method 2: atan(1/m) = sum(n=0..infty, 4^n*n!^2/(2n+1)! * m/(m^2+1)^(n+1)) @@ -65,7 +66,7 @@ const cl_LF atan_recip_1c (cl_I m, uintC len) { var uintC actuallen = len + 1; var cl_I m2 = m*m; - var sintL N = (sintL)(0.69314718*intDsize/2*actuallen/log(cl_double_approx(m))) + 1; + var sintL N = (sintL)(0.69314718*intDsize/2*actuallen/log(double_approx(m))) + 1; var cl_I num = 0, den = 1; // "lazy rational number" for (sintL n = N-1; n>=0; n--) { // Multiply sum with 1/m^2: @@ -86,7 +87,7 @@ const cl_LF atan_recip_1d (cl_I m, uintC len) { var uintC actuallen = len + 1; var cl_I m2 = m*m; - var uintL N = (uintL)(0.69314718*intDsize/2*actuallen/log(cl_double_approx(m))) + 1; + var uintL N = (uintL)(0.69314718*intDsize/2*actuallen/log(double_approx(m))) + 1; CL_ALLOCA_STACK; var cl_I* bv = (cl_I*) cl_alloca(N*sizeof(cl_I)); var cl_I* qv = (cl_I*) cl_alloca(N*sizeof(cl_I)); @@ -141,7 +142,7 @@ const cl_LF atan_recip_2c (cl_I m, uintC len) { var uintC actuallen = len + 1; var cl_I m2 = m*m+1; - var uintL N = (uintL)(0.69314718*intDsize*actuallen/log(cl_double_approx(m2))) + 1; + var uintL N = (uintL)(0.69314718*intDsize*actuallen/log(double_approx(m2))) + 1; var cl_I num = 0, den = 1; // "lazy rational number" for (uintL n = N; n>0; n--) { // Multiply sum with (2n)/(2n+1)(m^2+1): @@ -160,7 +161,7 @@ const cl_LF atan_recip_2d (cl_I m, uintC len) { var uintC actuallen = len + 1; var cl_I m2 = m*m+1; - var uintL N = (uintL)(0.69314718*intDsize*actuallen/log(cl_double_approx(m2))) + 1; + var uintL N = (uintL)(0.69314718*intDsize*actuallen/log(double_approx(m2))) + 1; CL_ALLOCA_STACK; var cl_I* pv = (cl_I*) cl_alloca(N*sizeof(cl_I)); var cl_I* qv = (cl_I*) cl_alloca(N*sizeof(cl_I)); diff --git a/examples/atanh_recip.cc b/examples/atanh_recip.cc index 240b8b4..ae3aa10 100644 --- a/examples/atanh_recip.cc +++ b/examples/atanh_recip.cc @@ -1,19 +1,19 @@ // Computation of artanh(1/m) (m integer) to high precision. -#include "cl_integer.h" -#include "cl_rational.h" -#include "cl_real.h" -#include "cl_complex.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/rational.h" +#include "cln/real.h" +#include "cln/complex.h" +#include "cln/lfloat.h" #include "cl_LF.h" #include "cl_LF_tran.h" #include "cl_alloca.h" #include #include -#include "cl_timing.h" +#include "cln/timing.h" #undef floor -#include +#include #define floor cln_floor @@ -62,7 +62,7 @@ const cl_LF atanh_recip_1c (cl_I m, uintC len) { var uintC actuallen = len + 1; var cl_I m2 = m*m; - var sintL N = (sintL)(0.69314718*intDsize/2*actuallen/log(cl_double_approx(m))) + 1; + var sintL N = (sintL)(0.69314718*intDsize/2*actuallen/log(double_approx(m))) + 1; var cl_I num = 0, den = 1; // "lazy rational number" for (sintL n = N-1; n>=0; n--) { // Multiply sum with 1/m^2: @@ -80,7 +80,7 @@ const cl_LF atanh_recip_1d (cl_I m, uintC len) { var uintC actuallen = len + 1; var cl_I m2 = m*m; - var uintL N = (uintL)(0.69314718*intDsize/2*actuallen/log(cl_double_approx(m))) + 1; + var uintL N = (uintL)(0.69314718*intDsize/2*actuallen/log(double_approx(m))) + 1; CL_ALLOCA_STACK; var cl_I* bv = (cl_I*) cl_alloca(N*sizeof(cl_I)); var cl_I* qv = (cl_I*) cl_alloca(N*sizeof(cl_I)); @@ -141,7 +141,7 @@ const cl_LF atanh_recip_2c (cl_I m, uintC len) { var uintC actuallen = len + 1; var cl_I m2 = m*m-1; - var uintL N = (uintL)(0.69314718*intDsize*actuallen/log(cl_double_approx(m2))) + 1; + var uintL N = (uintL)(0.69314718*intDsize*actuallen/log(double_approx(m2))) + 1; var cl_I num = 0, den = 1; // "lazy rational number" for (uintL n = N; n>0; n--) { // Multiply sum with -(2n)/(2n+1)(m^2+1): @@ -160,7 +160,7 @@ const cl_LF atanh_recip_2d (cl_I m, uintC len) { var uintC actuallen = len + 1; var cl_I m2 = m*m-1; - var uintL N = (uintL)(0.69314718*intDsize*actuallen/log(cl_double_approx(m2))) + 1; + var uintL N = (uintL)(0.69314718*intDsize*actuallen/log(double_approx(m2))) + 1; CL_ALLOCA_STACK; var cl_I* pv = (cl_I*) cl_alloca(N*sizeof(cl_I)); var cl_I* qv = (cl_I*) cl_alloca(N*sizeof(cl_I)); diff --git a/examples/contfrac.cc b/examples/contfrac.cc index f93f869..ba1e3d4 100644 --- a/examples/contfrac.cc +++ b/examples/contfrac.cc @@ -1,17 +1,21 @@ // Print the continued fraction of a real number. // We work with real numbers and integers. -#include -#include +#include +#include // We do I/O. -#include -#include +#include +#include + +using namespace cln; // Our private error handling: return to the main program. #include jmp_buf restartpoint; -void cl_abort (void) { longjmp(restartpoint,1); } +namespace cln { + void cl_abort (void) { longjmp(restartpoint,1); } +} int main (int argc, char* argv[]) { @@ -23,23 +27,23 @@ int main (int argc, char* argv[]) cl_R x = arg; // Check sign. if (minusp(x)) { - fprint(cl_stdout, "-"); + stdout << '-'; x = -x; } - fprint(cl_stdout, "["); + fprint(stdout, "["); const char* separator = "; "; for (;;) { // Split x into integral and fractional part. cl_R_div_t x_split = floor2(x); - fprint(cl_stdout, x_split.quotient); + stdout << x_split.quotient; x = x_split.remainder; if (zerop(x)) break; - fprint(cl_stdout, separator); + stdout << separator; separator = ", "; // Invert x. x = recip(x); } - fprint(cl_stdout, "]\n"); + stdout << ']' << std::endl; } } diff --git a/examples/e.cc b/examples/e.cc index 61a733c..b0e9730 100644 --- a/examples/e.cc +++ b/examples/e.cc @@ -27,18 +27,20 @@ * conversion to decimal: real time: 54507.003 s, run time: 40063.510 s */ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include +#include +#include + +using namespace std; +using namespace cln; void sum_exp1 (uintL a, uintL b, cl_I & first, cl_I & second) @@ -69,15 +71,19 @@ sum_exp1 (uintL a, uintL b, cl_I & first, cl_I & second) } } +namespace cln { + extern cl_LF cl_I_to_LF(const cl_I&, uintC); +}; + void const_exp1 (cl_LF & result, uintL dec) { - uintL c = (uintL) (dec * log (10)); + uintL c = (uintL) (dec * ::log (10)); uintL n = dec; uintC actuallen = (uintC)(3.321928094 * dec / intDsize); - n = (uintL) ((n + c) / log ((double)n)); - n = (uintL) ((n + c) / log ((double)n)); - n = (uintL) ((n + c) / log ((double)n)); + n = (uintL) ((n + c) / ::log ((double)n)); + n = (uintL) ((n + c) / ::log ((double)n)); + n = (uintL) ((n + c) / ::log ((double)n)); n += 2; actuallen += 2; @@ -87,7 +93,6 @@ const_exp1 (cl_LF & result, uintL dec) cl_I p, q; sum_exp1 (0, n, p, q); cout << "sum_exp1 ends ok" << endl; - extern cl_LF cl_I_to_LF(const cl_I&, uintC); result = The(cl_LF)(cl_I_to_LF (p, actuallen) / cl_I_to_LF (q, actuallen)); cout << "const_exp1 returns ok" << endl; } @@ -105,7 +110,7 @@ main (int argc, char *argv[]) break; } if (argc < 1) - exit(1); + return(1); cl_LF c1; long l = digits; @@ -118,4 +123,5 @@ main (int argc, char *argv[]) cout << c1 << endl; cout << "@" << endl; } + return(0); } diff --git a/examples/fibonacci.cc b/examples/fibonacci.cc index fb80ab6..a0fb554 100644 --- a/examples/fibonacci.cc +++ b/examples/fibonacci.cc @@ -1,18 +1,18 @@ // Compute and print the n-th Fibonacci number. // We work with integers and real numbers. -#include -#include +#include +#include // We do I/O. -#include -#include +#include +#include // We use the timing functions. -#include +#include -// Declare the exit() function. -#include +using namespace std; +using namespace cln; // F_n is defined through the recurrence relation // F_0 = 0, F_1 = 1, F_(n+2) = F_(n+1) + F_n. @@ -79,12 +79,42 @@ const cl_I fibonacci (int n) } } +// The next routine is a variation of the above. It is mathematically +// equivalent but implemented in a non-recursive way. +const cl_I fibonacci_compact (int n) +{ + if (n==0) + return 0; + cl_I u = 0; + cl_I v = 1; + cl_I m = n/2; // floor(n/2) + for (uintL bit=integer_length(m); bit>0; --bit) { + // Since a squaring is cheaper than a multiplication, better use + // three squarings instead of one multiplication and two squarings. + cl_I u2 = square(u); + cl_I v2 = square(v); + if (logbitp(bit-1, m)) { + v = square(u + v) - u2; + u = u2 + v2; + } else { + u = v2 - square(v - u); + v = u2 + v2; + } + } + if (n==2*m) + // Here we don't use the squaring formula because + // one multiplication is cheaper than two squarings. + return u * ((v << 1) - u); + else + return square(u) + square(v); +} + // Returns just F_n, computed as the nearest integer to // ((1+sqrt(5))/2)^n/sqrt(5). Assume n>=0. const cl_I fibonacci_slow (int n) { // Need a precision of ((1+sqrt(5))/2)^-n. - cl_float_format_t prec = cl_float_format((int)(0.208987641*n+5)); + float_format_t prec = float_format((int)(0.208987641*n+5)); cl_R sqrt5 = sqrt(cl_float(5,prec)); cl_R phi = (1+sqrt5)/2; return round1( expt(phi,n)/sqrt5 ); @@ -95,49 +125,47 @@ const cl_I fibonacci_slow (int n) int main (int argc, char* argv[]) { if (argc != 2) { - fprint(cl_stderr, "Usage: fibonacci n\n"); - exit(1); + stderr << "Usage: fibonacci n" << endl; + return(1); } int n = atoi(argv[1]); - fprint(cl_stdout, "fib("); - fprintdecimal(cl_stdout, n); - fprint(cl_stdout, ") = "); - fprint(cl_stdout, fibonacci(n)); - fprint(cl_stdout, "\n"); + stdout << "fib(" << n << ") = " << fibonacci(n) << endl; + return(0); } #else // TIMING int main (int argc, char* argv[]) { - int repetitions = 1; + int repetitions = 100; if ((argc >= 3) && !strcmp(argv[1],"-r")) { repetitions = atoi(argv[2]); argc -= 2; argv += 2; } if (argc != 2) { - fprint(cl_stderr, "Usage: fibonacci n\n"); - exit(1); + stderr << "Usage: fibonacci n" << endl; + return(1); } int n = atoi(argv[1]); { CL_TIMING; - fprint(cl_stdout, "fib("); - fprintdecimal(cl_stdout, n); - fprint(cl_stdout, ") = "); + stdout << "fib(" << n << ") = "; for (int rep = repetitions-1; rep > 0; rep--) fibonacci(n); - fprint(cl_stdout, fibonacci(n)); - fprint(cl_stdout, "\n"); + stdout << fibonacci(n) << endl; + } + { CL_TIMING; + stdout << "fib(" << n << ") = "; + for (int rep = repetitions-1; rep > 0; rep--) + fibonacci_compact(n); + stdout << fibonacci_compact(n) << endl; } { CL_TIMING; - fprint(cl_stdout, "fib("); - fprintdecimal(cl_stdout, n); - fprint(cl_stdout, ") = "); + stdout << "fib(" << n << ") = "; for (int rep = repetitions-1; rep > 0; rep--) fibonacci_slow(n); - fprint(cl_stdout, fibonacci_slow(n)); - fprint(cl_stdout, "\n"); + stdout << fibonacci_slow(n) << endl; } + return(0); } #endif diff --git a/examples/legendre.cc b/examples/legendre.cc index 6441043..6805767 100644 --- a/examples/legendre.cc +++ b/examples/legendre.cc @@ -1,21 +1,23 @@ // Compute the Legendre polynomials. -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include +using namespace cln; + // Computes the n-th Legendre polynomial in R[x], using the formula // P_n(x) = 1/(2^n n!) * (d/dx)^n (x^2-1)^n. (Assume n >= 0.) const cl_UP_RA legendre (const cl_rational_ring& R, int n) { - cl_univpoly_rational_ring PR = cl_find_univpoly_ring(R); + cl_univpoly_rational_ring PR = find_univpoly_ring(R); cl_UP_RA b = PR->create(2); b.set_coeff(2,1); b.set_coeff(1,0); @@ -33,7 +35,7 @@ const cl_UP_RA legendre (const cl_rational_ring& R, int n) const cl_UP_MI legendre (const cl_modint_ring& R, int n) { - cl_univpoly_modint_ring PR = cl_find_univpoly_ring(R); + cl_univpoly_modint_ring PR = find_univpoly_ring(R); cl_UP_MI b = PR->create(2); b.set_coeff(2,R->canonhom(1)); b.set_coeff(1,R->canonhom(0)); @@ -52,21 +54,21 @@ const cl_UP_MI legendre (const cl_modint_ring& R, int n) int main (int argc, char* argv[]) { if (!(argc == 2 || argc == 3)) { - fprint(cl_stderr, "Usage: legendre n [m]\n"); + fprint(stderr, "Usage: legendre n [m]\n"); exit(1); } int n = atoi(argv[1]); if (!(n >= 0)) { - fprint(cl_stderr, "Usage: legendre n [m] with n >= 0\n"); + fprint(stderr, "Usage: legendre n [m] with n >= 0\n"); exit(1); } if (argc == 2) { cl_UP p = legendre(cl_RA_ring,n); - fprint(cl_stdout, p); + fprint(stdout, p); } else { cl_I m = argv[2]; - cl_UP p = legendre(cl_find_modint_ring(m),n); - fprint(cl_stdout, p); + cl_UP p = legendre(find_modint_ring(m),n); + fprint(stdout, p); } - fprint(cl_stdout, "\n"); + fprint(stdout, "\n"); } diff --git a/examples/lucaslehmer.cc b/examples/lucaslehmer.cc index 4cf7f24..3df392e 100644 --- a/examples/lucaslehmer.cc +++ b/examples/lucaslehmer.cc @@ -4,7 +4,10 @@ // Seminumerical Algorithms, second edition. Section 4.5.4, p. 391.] // We work with integers. -#include +#include + +using namespace std; +using namespace cln; // Checks whether 2^q-1 is prime, q an odd prime. bool mersenne_prime_p (int q) @@ -33,13 +36,13 @@ bool mersenne_prime_p_opt (int q) } // Now we work with modular integers. -#include +#include // Same thing, but using modular integers. bool mersenne_prime_p_modint (int q) { cl_I m = ((cl_I)1 << q) - 1; - cl_modint_ring R = cl_find_modint_ring(m); // Z/mZ + cl_modint_ring R = find_modint_ring(m); // Z/mZ int i; cl_MI L_i; for (i = 0, L_i = R->canonhom(4); i < q-2; i++) @@ -47,33 +50,30 @@ bool mersenne_prime_p_modint (int q) return R->equal(L_i,R->zero()); } -#include // we do I/O +#include // we do I/O #include // declares exit() -#include +#include int main (int argc, char* argv[]) { if (!(argc == 2)) { - fprint(cl_stderr, "Usage: lucaslehmer exponent\n"); + cerr << "Usage: lucaslehmer exponent" << endl; exit(1); } int q = atoi(argv[1]); if (!(q >= 2 && ((q % 2)==1))) { - fprint(cl_stderr, "Usage: lucaslehmer q with q odd prime\n"); + cerr << "Usage: lucaslehmer q with q odd prime" << endl; exit(1); } bool isprime; { CL_TIMING; isprime = mersenne_prime_p(q); } { CL_TIMING; isprime = mersenne_prime_p_opt(q); } { CL_TIMING; isprime = mersenne_prime_p_modint(q); } - fprint(cl_stdout, "2^"); - fprintdecimal(cl_stdout, q); - fprint(cl_stdout, "-1 is "); + cout << "2^" << q << "-1 is "; if (isprime) - fprint(cl_stdout, "prime"); + cout << "prime" << endl; else - fprint(cl_stdout, "composite"); - fprint(cl_stdout, "\n"); + cout << "composite" << endl; } // Computing time on a i486, 33 MHz: diff --git a/examples/nextprime.cc b/examples/nextprime.cc index 2559eed..b7aa26d 100644 --- a/examples/nextprime.cc +++ b/examples/nextprime.cc @@ -2,24 +2,24 @@ // command line. // We work with real numbers and integers. -#include -#include +#include +#include // We do I/O. -#include -#include +#include +#include // The function nextprobprime() is part of the number theory package. -#include +#include int main (int argc, char* argv[]) { if (argc != 2) { - fprint(cl_stderr, "Usage: nextprime x\n"); - exit(1); + cln::stderr << "Usage: nextprime x" << std::endl; + return(1); } - cl_R x = (cl_R)argv[1]; - cl_I p = nextprobprime(x); - fprint(cl_stdout, p); - fprint(cl_stdout, "\n"); + cln::cl_R x = (cln::cl_R)argv[1]; + cln::cl_I p = cln::nextprobprime(x); + cln::stdout << p << std::endl; + return(0); } diff --git a/examples/perfnum.cc b/examples/perfnum.cc index 2d930e9..d317075 100644 --- a/examples/perfnum.cc +++ b/examples/perfnum.cc @@ -1,11 +1,15 @@ -// This program prints the largest now known perfect number. +// This program prints the largest now known even perfect number. -#include -#include +#include +#include + +using namespace std; +using namespace cln; int main () { - int p = 1398269; // previous one was 1257787 + // previous ones were 1257787, 1398269, 2976221, 3021377 + int p = 6972593; cl_I x = (((cl_I)1 << p) - 1) << (p-1); cout << x << endl; } diff --git a/include/cl_config.h.in b/include/cl_config.h.in deleted file mode 100644 index c9cb2f6..0000000 --- a/include/cl_config.h.in +++ /dev/null @@ -1,127 +0,0 @@ -// Defines CPU and compiler dependent macros - -#ifndef _CL_CONFIG_H -#define _CL_CONFIG_H - -/* These definitions are adjusted by `configure' automatically. */ - - -/* release version */ - -#undef CL_VERSION -#undef CL_VERSION_MINOR -#undef CL_VERSION_PATCHLEVEL - - -/* CPU */ -#ifndef __i386__ -#undef __i386__ -#endif -#ifndef __m68k__ -#undef __m68k__ -#endif -#ifndef __mips__ -#undef __mips__ -#endif -#ifndef __mips64__ -#undef __mips64__ -#endif -#ifndef __sparc__ -#undef __sparc__ -#endif -#ifndef __sparc64__ -#undef __sparc64__ -#endif -#ifndef __alpha__ -#undef __alpha__ -#endif -#ifndef __hppa__ -#undef __hppa__ -#endif -#ifndef __arm__ -#undef __arm__ -#endif -#ifndef __rs6000__ -#undef __rs6000__ -#endif -#ifndef __m88k__ -#undef __m88k__ -#endif -#ifndef __convex__ -#undef __convex__ -#endif - - -/* assembler syntax */ - -/* CL_AS_UNDERSCORE */ -/* Define if C symbols are prefixed by an underscore in assembly language. */ -#undef ASM_UNDERSCORE - - -/* compiler characteristics */ - -/* CL_BOOL */ -/* Define if your compiler understands the bool type. */ -#undef HAVE_BOOL -/* Define this as `int' if your compiler doesn't understand the bool type. */ -#undef bool - -/* CL_LONGLONG */ -/* Define if your compiler supports the `long long' type. */ -#undef HAVE_LONGLONG - -/* CL_LONGDOUBLE */ -/* Define if your compiler supports the `long double' type. */ -#undef HAVE_LONGDOUBLE - -/* CL_TEMPLATE_NULL */ -/* Define if your compiler supports the `template <>' syntax. */ -#undef HAVE_TEMPLATE_NULL - - -/* header files */ - -/* CL_UNISTD_H */ -/* Define if you have . */ -#undef HAVE_UNISTD_H - - -/* functions and declarations */ - -/* CL_ALLOCA */ -/* Define if you have and it should be used (not Ultrix). */ -#undef HAVE_ALLOCA_H -/* Define if you need to link with an external alloca.o when using alloca(). */ -#undef NO_ALLOCA - - -/* compiler characteristics */ - -/* CL_GLOBAL_CONSTRUCTORS */ -/* Define as the prefix of the name of a module's global constructor function, - cf. macro FILE_FUNCTION_FORMAT in gcc/tree.c. */ -#ifndef CL_GLOBAL_CONSTRUCTOR_PREFIX -#undef CL_GLOBAL_CONSTRUCTOR_PREFIX -#endif -/* Define as the prefix of the name of a module's global destructor function, - cf. macro FILE_FUNCTION_FORMAT in gcc/tree.c. */ -#ifndef CL_GLOBAL_DESTRUCTOR_PREFIX -#undef CL_GLOBAL_DESTRUCTOR_PREFIX -#endif -/* Define if a module's global constructor function and global destructor - function need to be exported in order to be accessible from other modules. */ -#undef CL_NEED_GLOBALIZE_CTORDTOR - -/* CL_CHAR_UNSIGNED */ -#ifndef __CHAR_UNSIGNED__ -#undef __CHAR_UNSIGNED__ -#endif - -/* CL_MACHINE */ -/* see cl_intparam.h */ -/* see cl_floatparam.h */ - - -#endif /* _CL_CONFIG_H */ - diff --git a/include/cl_floatformat.h b/include/cl_floatformat.h deleted file mode 100644 index 84bc185..0000000 --- a/include/cl_floatformat.h +++ /dev/null @@ -1,16 +0,0 @@ -// Floating point format specifiers. - -#ifndef _CL_FLOATFORMAT_H -#define _CL_FLOATFORMAT_H - -#include "cl_types.h" - -// Float format specifier type. (Float mantissa precision in bits.) -typedef enum cl_float_format_t { - cl_float_format_sfloat = 17, - cl_float_format_ffloat = 24, - cl_float_format_dfloat = 53, - cl_float_format_lfloat_min = ((53+intDsize-1)/intDsize)*intDsize // = round_up(53,intDsize) -}; - -#endif /* _CL_FLOATFORMAT_H */ diff --git a/include/cln.h b/include/cln.h deleted file mode 100644 index d12ff38..0000000 --- a/include/cln.h +++ /dev/null @@ -1,141 +0,0 @@ -// CLN exported types and functions - -#ifndef _CLN_H -#define _CLN_H - -// Automatically generated by configure -//#include "cl_config.h" // included by "cl_types.h" below -//#include "cl_intparam.h" // included by "cl_types.h" below -//#include "cl_floatparam.h" // not needed by any public header file - -// ============================== base ============================== - -// Basic types and definitions. -#include "cl_types.h" -#include "cl_modules.h" -#include "cl_object.h" - -// Miscellaneous. -#include "cl_random.h" -#include "cl_malloc.h" -#include "cl_abort.h" -#include "cl_floatformat.h" -#include "cl_io.h" -#include "cl_condition.h" - -// Symbolic facilities. -#include "cl_string.h" -#include "cl_symbol.h" -#include "cl_proplist.h" - -// Miscellaneous. -#include "cl_input.h" -#include "cl_output.h" - -// Abstract number classes. -#include "cl_number.h" -#include "cl_number_io.h" -#include "cl_complex_class.h" -#include "cl_real_class.h" -#include "cl_rational_class.h" - -// Rings. -#include "cl_ring.h" - -// ============================== integer ============================== - -// Integers. -#include "cl_integer_class.h" -#include "cl_integer.h" -#include "cl_integer_io.h" -#include "cl_integer_ring.h" -#include "cl_null_ring.h" - -// ============================== rational ============================== - -// Rational numbers. -#include "cl_rational.h" -#include "cl_rational_io.h" -#include "cl_rational_ring.h" - -// ============================== float ============================== - -// Floating-point numbers. -#include "cl_float_class.h" -#include "cl_sfloat_class.h" -#include "cl_ffloat_class.h" -#include "cl_dfloat_class.h" -#include "cl_lfloat_class.h" -#include "cl_float.h" -#include "cl_float_io.h" -#include "cl_sfloat.h" -#include "cl_sfloat_io.h" -#include "cl_ffloat.h" -#include "cl_ffloat_io.h" -#include "cl_dfloat.h" -#include "cl_dfloat_io.h" -#include "cl_lfloat.h" -#include "cl_lfloat_io.h" - -// ============================== real ============================== - -// Real numbers. -#include "cl_real.h" -#include "cl_real_io.h" -#include "cl_real_ring.h" - -// ============================== complex ============================== - -// Complex numbers. -#include "cl_complex.h" -#include "cl_complex_io.h" -#include "cl_complex_ring.h" - -// ============================== modinteger ============================== - -// Modular integers. -#include "cl_modinteger.h" - -// ============================== numtheory ============================== - -// Rings for number theory. -#include "cl_numtheory.h" - -// ============================== vector ============================== - -// Vectors. -#include "cl_V.h" -#include "cl_GV.h" -#include "cl_GV_number.h" -#include "cl_GV_complex.h" -#include "cl_GV_real.h" -#include "cl_GV_rational.h" -#include "cl_GV_integer.h" -#include "cl_GV_modinteger.h" -#include "cl_SV.h" -#include "cl_SV_number.h" -#include "cl_SV_complex.h" -#include "cl_SV_real.h" -#include "cl_SV_rational.h" -#include "cl_SV_integer.h" -#include "cl_SV_ringelt.h" - -// ============================== polynomial ============================== - -// Polynomials. -#include "cl_univpoly.h" -#include "cl_univpoly_complex.h" -#include "cl_univpoly_real.h" -#include "cl_univpoly_rational.h" -#include "cl_univpoly_integer.h" -#include "cl_univpoly_modint.h" - -// ============================== modpolynomial ============================== - -// ============================== timing ============================== - -// Environmental facilities. -#include "cl_timing.h" - -#endif /* _CLN_H */ - diff --git a/include/cl_GV.h b/include/cln/GV.h similarity index 98% rename from include/cl_GV.h rename to include/cln/GV.h index b4ce37a..6616c52 100644 --- a/include/cl_GV.h +++ b/include/cln/GV.h @@ -3,11 +3,12 @@ #ifndef _CL_GV_H #define _CL_GV_H -#include "cl_object.h" -#include "cl_V.h" -#include "cl_abort.h" +#include "cln/object.h" +#include "cln/V.h" +#include "cln/abort.h" #include +namespace cln { // A vector is a structure having the following interface: // v.length() returns the number of elements @@ -295,5 +296,6 @@ typedef cl_GV cl_GV_any; // This inline function is for type checking purposes only. inline const cl_GV_any& cl_identity (const cl_GV_any& x) { return x; } +} // namespace cln #endif /* _CL_GV_H */ diff --git a/include/cl_GV_complex.h b/include/cln/GV_complex.h similarity index 88% rename from include/cl_GV_complex.h rename to include/cln/GV_complex.h index 8dc30b5..72a9797 100644 --- a/include/cl_GV_complex.h +++ b/include/cln/GV_complex.h @@ -3,10 +3,12 @@ #ifndef _CL_GV_COMPLEX_H #define _CL_GV_COMPLEX_H -#include "cl_number.h" -#include "cl_GV_number.h" -#include "cl_complex_class.h" -#include "cl_io.h" +#include "cln/number.h" +#include "cln/GV_number.h" +#include "cln/complex_class.h" +#include "cln/io.h" + +namespace cln { // A vector of complex numbers is just a normal vector of numbers. @@ -40,10 +42,10 @@ inline const cl_GV_N copy (const cl_GV_N& vector) // Output. inline void fprint (cl_ostream stream, const cl_GV_N& x) { - extern cl_print_flags cl_default_print_flags; + extern cl_print_flags default_print_flags; extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_GV_number& vector); extern void print_complex (cl_ostream stream, const cl_print_flags& flags, const cl_N& z); - print_vector(stream, cl_default_print_flags, + print_vector(stream, default_print_flags, (void (*) (cl_ostream, const cl_print_flags&, const cl_number&)) (void (*) (cl_ostream, const cl_print_flags&, const cl_N&)) &print_complex, @@ -51,4 +53,6 @@ inline void fprint (cl_ostream stream, const cl_GV_N& x) } CL_DEFINE_PRINT_OPERATOR(cl_GV_N) +} // namespace cln + #endif /* _CL_GV_COMPLEX_H */ diff --git a/include/cl_GV_integer.h b/include/cln/GV_integer.h similarity index 91% rename from include/cl_GV_integer.h rename to include/cln/GV_integer.h index b6f6acf..e2adf95 100644 --- a/include/cl_GV_integer.h +++ b/include/cln/GV_integer.h @@ -3,10 +3,12 @@ #ifndef _CL_GV_INTEGER_H #define _CL_GV_INTEGER_H -#include "cl_number.h" -#include "cl_GV_rational.h" -#include "cl_integer_class.h" -#include "cl_io.h" +#include "cln/number.h" +#include "cln/GV_rational.h" +#include "cln/integer_class.h" +#include "cln/io.h" + +namespace cln { // A vector of integers is *not* just a normal vector of numbers (the vectorops // support the maxbits() operation), but we treat can it like this nevertheless. @@ -62,10 +64,10 @@ extern const cl_GV_I copy (const cl_GV_I&); // Output. inline void fprint (cl_ostream stream, const cl_GV_I& x) { - extern cl_print_flags cl_default_print_flags; + extern cl_print_flags default_print_flags; extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_GV_number& vector); extern void print_integer (cl_ostream stream, const cl_print_flags& flags, const cl_I& z); - print_vector(stream, cl_default_print_flags, + print_vector(stream, default_print_flags, (void (*) (cl_ostream, const cl_print_flags&, const cl_number&)) (void (*) (cl_ostream, const cl_print_flags&, const cl_I&)) &print_integer, @@ -81,4 +83,6 @@ static void* const cl_GV_I_debug_dummy[] = { &cl_GV_I_debug_dummy, }; #endif +} // namespace cln + #endif /* _CL_GV_INTEGER_H */ diff --git a/include/cl_GV_modinteger.h b/include/cln/GV_modinteger.h similarity index 93% rename from include/cl_GV_modinteger.h rename to include/cln/GV_modinteger.h index d37267e..ac4aa97 100644 --- a/include/cl_GV_modinteger.h +++ b/include/cln/GV_modinteger.h @@ -3,8 +3,10 @@ #ifndef _CL_GV_MODINTEGER_H #define _CL_GV_MODINTEGER_H -#include "cl_modinteger.h" -#include "cl_GV_integer.h" +#include "cln/modinteger.h" +#include "cln/GV_integer.h" + +namespace cln { // A vector of modular integers (over the same modular integer ring) // is just a normal vector of integers, with maxbits() operation. @@ -46,5 +48,6 @@ inline const cl_GV_MI copy (const cl_GV_MI& vector) return The(cl_GV_MI) (copy((const cl_GV_I&) vector)); } +} // namespace cln #endif /* _CL_GV_MODINTEGER_H */ diff --git a/include/cl_GV_number.h b/include/cln/GV_number.h similarity index 94% rename from include/cl_GV_number.h rename to include/cln/GV_number.h index 4b5bb18..a9892fb 100644 --- a/include/cl_GV_number.h +++ b/include/cln/GV_number.h @@ -3,8 +3,10 @@ #ifndef _CL_GV_NUMBER_H #define _CL_GV_NUMBER_H -#include "cl_number.h" -#include "cl_GV.h" +#include "cln/number.h" +#include "cln/GV.h" + +namespace cln { typedef cl_heap_GV cl_heap_GV_number; @@ -43,4 +45,6 @@ static void* const cl_GV_number_debug_dummy[] = { &cl_GV_number_debug_dummy, }; #endif +} // namespace cln + #endif /* _CL_GV_NUMBER_H */ diff --git a/include/cl_GV_rational.h b/include/cln/GV_rational.h similarity index 88% rename from include/cl_GV_rational.h rename to include/cln/GV_rational.h index 8f4a4f5..2f7fd9c 100644 --- a/include/cl_GV_rational.h +++ b/include/cln/GV_rational.h @@ -3,10 +3,12 @@ #ifndef _CL_GV_RATIONAL_H #define _CL_GV_RATIONAL_H -#include "cl_number.h" -#include "cl_GV_real.h" -#include "cl_rational_class.h" -#include "cl_io.h" +#include "cln/number.h" +#include "cln/GV_real.h" +#include "cln/rational_class.h" +#include "cln/io.h" + +namespace cln { // A vector of rational numbers is just a normal vector of real numbers. @@ -40,10 +42,10 @@ inline const cl_GV_RA copy (const cl_GV_RA& vector) // Output. inline void fprint (cl_ostream stream, const cl_GV_RA& x) { - extern cl_print_flags cl_default_print_flags; + extern cl_print_flags default_print_flags; extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_GV_number& vector); extern void print_rational (cl_ostream stream, const cl_print_flags& flags, const cl_RA& z); - print_vector(stream, cl_default_print_flags, + print_vector(stream, default_print_flags, (void (*) (cl_ostream, const cl_print_flags&, const cl_number&)) (void (*) (cl_ostream, const cl_print_flags&, const cl_RA&)) &print_rational, @@ -51,4 +53,6 @@ inline void fprint (cl_ostream stream, const cl_GV_RA& x) } CL_DEFINE_PRINT_OPERATOR(cl_GV_RA) +} // namespace cln + #endif /* _CL_GV_RAATIONAL_H */ diff --git a/include/cl_GV_real.h b/include/cln/GV_real.h similarity index 87% rename from include/cl_GV_real.h rename to include/cln/GV_real.h index f4ff825..711ff4d 100644 --- a/include/cl_GV_real.h +++ b/include/cln/GV_real.h @@ -3,10 +3,12 @@ #ifndef _CL_GV_REAL_H #define _CL_GV_REAL_H -#include "cl_number.h" -#include "cl_GV_complex.h" -#include "cl_real_class.h" -#include "cl_io.h" +#include "cln/number.h" +#include "cln/GV_complex.h" +#include "cln/real_class.h" +#include "cln/io.h" + +namespace cln { // A vector of real numbers is just a normal vector of numbers. @@ -40,10 +42,10 @@ inline const cl_GV_R copy (const cl_GV_R& vector) // Output. inline void fprint (cl_ostream stream, const cl_GV_R& x) { - extern cl_print_flags cl_default_print_flags; + extern cl_print_flags default_print_flags; extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_GV_number& vector); extern void print_real (cl_ostream stream, const cl_print_flags& flags, const cl_R& z); - print_vector(stream, cl_default_print_flags, + print_vector(stream, default_print_flags, (void (*) (cl_ostream, const cl_print_flags&, const cl_number&)) (void (*) (cl_ostream, const cl_print_flags&, const cl_R&)) &print_real, @@ -51,4 +53,6 @@ inline void fprint (cl_ostream stream, const cl_GV_R& x) } CL_DEFINE_PRINT_OPERATOR(cl_GV_R) +} // namespace cln + #endif /* _CL_GV_REAL_H */ diff --git a/include/cl_SV.h b/include/cln/SV.h similarity index 98% rename from include/cl_SV.h rename to include/cln/SV.h index f02783b..43ae0dc 100644 --- a/include/cl_SV.h +++ b/include/cln/SV.h @@ -3,11 +3,12 @@ #ifndef _CL_SV_H #define _CL_SV_H -#include "cl_object.h" -#include "cl_V.h" -#include "cl_abort.h" +#include "cln/object.h" +#include "cln/V.h" +#include "cln/abort.h" #include +namespace cln { // A simple vector has the same operations as a vector, but it can store // _only_ cl_gcobject's. @@ -176,5 +177,6 @@ extern const cl_SV_any copy (const cl_SV_any&); // This inline function is for type checking purposes only. inline const cl_SV_any& cl_identity (const cl_SV_any& x) { return x; } +} // namespace cln #endif /* _CL_SV_H */ diff --git a/include/cl_SV_complex.h b/include/cln/SV_complex.h similarity index 87% rename from include/cl_SV_complex.h rename to include/cln/SV_complex.h index 61bdec7..ef0d03e 100644 --- a/include/cl_SV_complex.h +++ b/include/cln/SV_complex.h @@ -3,10 +3,12 @@ #ifndef _CL_SV_COMPLEX_H #define _CL_SV_COMPLEX_H -#include "cl_number.h" -#include "cl_SV_number.h" -#include "cl_complex_class.h" -#include "cl_io.h" +#include "cln/number.h" +#include "cln/SV_number.h" +#include "cln/complex_class.h" +#include "cln/io.h" + +namespace cln { // A vector of complex numbers is just a normal vector of numbers. @@ -36,10 +38,10 @@ inline const cl_SV_N copy (const cl_SV_N& vector) // Output. inline void fprint (cl_ostream stream, const cl_SV_N& x) { - extern cl_print_flags cl_default_print_flags; + extern cl_print_flags default_print_flags; extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_SV_number& vector); extern void print_complex (cl_ostream stream, const cl_print_flags& flags, const cl_N& z); - print_vector(stream, cl_default_print_flags, + print_vector(stream, default_print_flags, (void (*) (cl_ostream, const cl_print_flags&, const cl_number&)) (void (*) (cl_ostream, const cl_print_flags&, const cl_N&)) &print_complex, @@ -47,4 +49,6 @@ inline void fprint (cl_ostream stream, const cl_SV_N& x) } CL_DEFINE_PRINT_OPERATOR(cl_SV_N) +} // namespace cln + #endif /* _CL_SV_COMPLEX_H */ diff --git a/include/cl_SV_integer.h b/include/cln/SV_integer.h similarity index 86% rename from include/cl_SV_integer.h rename to include/cln/SV_integer.h index 29417c2..3a1892b 100644 --- a/include/cl_SV_integer.h +++ b/include/cln/SV_integer.h @@ -3,10 +3,12 @@ #ifndef _CL_SV_INTEGER_H #define _CL_SV_INTEGER_H -#include "cl_number.h" -#include "cl_SV_rational.h" -#include "cl_integer_class.h" -#include "cl_io.h" +#include "cln/number.h" +#include "cln/SV_rational.h" +#include "cln/integer_class.h" +#include "cln/io.h" + +namespace cln { // A vector of integers is just a normal vector of rational numbers. @@ -33,10 +35,10 @@ inline const cl_SV_I copy (const cl_SV_I& vector) // Output. inline void fprint (cl_ostream stream, const cl_SV_I& x) { - extern cl_print_flags cl_default_print_flags; + extern cl_print_flags default_print_flags; extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_SV_number& vector); extern void print_integer (cl_ostream stream, const cl_print_flags& flags, const cl_I& z); - print_vector(stream, cl_default_print_flags, + print_vector(stream, default_print_flags, (void (*) (cl_ostream, const cl_print_flags&, const cl_number&)) (void (*) (cl_ostream, const cl_print_flags&, const cl_I&)) &print_integer, @@ -44,4 +46,6 @@ inline void fprint (cl_ostream stream, const cl_SV_I& x) } CL_DEFINE_PRINT_OPERATOR(cl_SV_I) +} // namespace cln + #endif /* _CL_SV_INTEGER_H */ diff --git a/include/cl_SV_number.h b/include/cln/SV_number.h similarity index 95% rename from include/cl_SV_number.h rename to include/cln/SV_number.h index fb1f344..64db595 100644 --- a/include/cl_SV_number.h +++ b/include/cln/SV_number.h @@ -3,9 +3,11 @@ #ifndef _CL_SV_NUMBER_H #define _CL_SV_NUMBER_H -#include "cl_number.h" -#include "cl_SV.h" -#include "cl_io.h" +#include "cln/number.h" +#include "cln/SV.h" +#include "cln/io.h" + +namespace cln { typedef cl_heap_SV cl_heap_SV_number; @@ -55,4 +57,6 @@ static void* const cl_SV_number_debug_dummy[] = { &cl_SV_number_debug_dummy, }; #endif +} // namespace cln + #endif /* _CL_SV_NUMBER_H */ diff --git a/include/cl_SV_rational.h b/include/cln/SV_rational.h similarity index 87% rename from include/cl_SV_rational.h rename to include/cln/SV_rational.h index 44e58af..860a414 100644 --- a/include/cl_SV_rational.h +++ b/include/cln/SV_rational.h @@ -3,10 +3,12 @@ #ifndef _CL_SV_RATIONAL_H #define _CL_SV_RATIONAL_H -#include "cl_number.h" -#include "cl_SV_real.h" -#include "cl_rational_class.h" -#include "cl_io.h" +#include "cln/number.h" +#include "cln/SV_real.h" +#include "cln/rational_class.h" +#include "cln/io.h" + +namespace cln { // A vector of rational numbers is just a normal vector of real numbers. @@ -36,10 +38,10 @@ inline const cl_SV_RA copy (const cl_SV_RA& vector) // Output. inline void fprint (cl_ostream stream, const cl_SV_RA& x) { - extern cl_print_flags cl_default_print_flags; + extern cl_print_flags default_print_flags; extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_SV_number& vector); extern void print_rational (cl_ostream stream, const cl_print_flags& flags, const cl_RA& z); - print_vector(stream, cl_default_print_flags, + print_vector(stream, default_print_flags, (void (*) (cl_ostream, const cl_print_flags&, const cl_number&)) (void (*) (cl_ostream, const cl_print_flags&, const cl_RA&)) &print_rational, @@ -47,4 +49,6 @@ inline void fprint (cl_ostream stream, const cl_SV_RA& x) } CL_DEFINE_PRINT_OPERATOR(cl_SV_RA) +} // namespace cln + #endif /* _CL_SV_RAATIONAL_H */ diff --git a/include/cl_SV_real.h b/include/cln/SV_real.h similarity index 87% rename from include/cl_SV_real.h rename to include/cln/SV_real.h index 12cf25d..a7d9236 100644 --- a/include/cl_SV_real.h +++ b/include/cln/SV_real.h @@ -3,10 +3,12 @@ #ifndef _CL_SV_REAL_H #define _CL_SV_REAL_H -#include "cl_number.h" -#include "cl_SV_complex.h" -#include "cl_real_class.h" -#include "cl_io.h" +#include "cln/number.h" +#include "cln/SV_complex.h" +#include "cln/real_class.h" +#include "cln/io.h" + +namespace cln { // A vector of real numbers is just a normal vector of numbers. @@ -36,10 +38,10 @@ inline const cl_SV_R copy (const cl_SV_R& vector) // Output. inline void fprint (cl_ostream stream, const cl_SV_R& x) { - extern cl_print_flags cl_default_print_flags; + extern cl_print_flags default_print_flags; extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_SV_number& vector); extern void print_real (cl_ostream stream, const cl_print_flags& flags, const cl_R& z); - print_vector(stream, cl_default_print_flags, + print_vector(stream, default_print_flags, (void (*) (cl_ostream, const cl_print_flags&, const cl_number&)) (void (*) (cl_ostream, const cl_print_flags&, const cl_R&)) &print_real, @@ -47,4 +49,6 @@ inline void fprint (cl_ostream stream, const cl_SV_R& x) } CL_DEFINE_PRINT_OPERATOR(cl_SV_R) +} // namespace cln + #endif /* _CL_SV_REAL_H */ diff --git a/include/cl_SV_ringelt.h b/include/cln/SV_ringelt.h similarity index 95% rename from include/cl_SV_ringelt.h rename to include/cln/SV_ringelt.h index 15a6957..36945c8 100644 --- a/include/cl_SV_ringelt.h +++ b/include/cln/SV_ringelt.h @@ -3,9 +3,11 @@ #ifndef _CL_SV_RINGELT_H #define _CL_SV_RINGELT_H -#include "cl_ring.h" -#include "cl_SV.h" -#include "cl_io.h" +#include "cln/ring.h" +#include "cln/SV.h" +#include "cln/io.h" + +namespace cln { typedef cl_heap_SV<_cl_ring_element> cl_heap_SV_ringelt; @@ -59,4 +61,6 @@ static void* const cl_SV_ringelt_debug_dummy[] = { &cl_SV_ringelt_debug_dummy, }; #endif +} // namespace cln + #endif /* _CL_SV_RINGELT_H */ diff --git a/include/cl_V.h b/include/cln/V.h similarity index 86% rename from include/cl_V.h rename to include/cln/V.h index 44dffcf..a396f34 100644 --- a/include/cl_V.h +++ b/include/cln/V.h @@ -3,7 +3,9 @@ #ifndef _CL_V_H #define _CL_V_H -#include "cl_object.h" +#include "cln/object.h" + +namespace cln { struct cl_V_any : public cl_gcpointer { // Constructors. @@ -16,4 +18,6 @@ struct cl_V_any : public cl_gcpointer { CL_DEFINE_COPY_CONSTRUCTOR2(cl_V_any,cl_gcpointer) CL_DEFINE_ASSIGNMENT_OPERATOR(cl_V_any,cl_V_any) +} // namespace cln + #endif /* _CL_V_H */ diff --git a/include/cl_abort.h b/include/cln/abort.h similarity index 84% rename from include/cl_abort.h rename to include/cln/abort.h index 189b3a1..7bbf0ee 100644 --- a/include/cl_abort.h +++ b/include/cln/abort.h @@ -3,10 +3,14 @@ #ifndef _CL_ABORT_H #define _CL_ABORT_H +namespace cln { + #ifdef _CL_MACROS_H nonreturning_function(extern, cl_abort, (void)); #else extern void cl_abort (void); #endif +} // namespace cln + #endif /* _CL_ABORT_H */ diff --git a/include/cln/cln.h b/include/cln/cln.h new file mode 100644 index 0000000..a56061a --- /dev/null +++ b/include/cln/cln.h @@ -0,0 +1,141 @@ +// CLN exported types and functions + +#ifndef _CLN_H +#define _CLN_H + +// Automatically generated by configure +//#include "cln/config.h" // included by "cln/types.h" below +//#include "cln/intparam.h" // included by "cln/types.h" below +//#include "cln/floatparam.h" // not needed by any public header file + +// ============================== base ============================== + +// Basic types and definitions. +#include "cln/types.h" +#include "cln/modules.h" +#include "cln/object.h" + +// Miscellaneous. +#include "cln/random.h" +#include "cln/malloc.h" +#include "cln/abort.h" +#include "cln/floatformat.h" +#include "cln/io.h" +#include "cln/condition.h" + +// Symbolic facilities. +#include "cln/string.h" +#include "cln/symbol.h" +#include "cln/proplist.h" + +// Miscellaneous. +#include "cln/input.h" +#include "cln/output.h" + +// Abstract number classes. +#include "cln/number.h" +#include "cln/number_io.h" +#include "cln/complex_class.h" +#include "cln/real_class.h" +#include "cln/rational_class.h" + +// Rings. +#include "cln/ring.h" + +// ============================== integer ============================== + +// Integers. +#include "cln/integer_class.h" +#include "cln/integer.h" +#include "cln/integer_io.h" +#include "cln/integer_ring.h" +#include "cln/null_ring.h" + +// ============================== rational ============================== + +// Rational numbers. +#include "cln/rational.h" +#include "cln/rational_io.h" +#include "cln/rational_ring.h" + +// ============================== float ============================== + +// Floating-point numbers. +#include "cln/float_class.h" +#include "cln/sfloat_class.h" +#include "cln/ffloat_class.h" +#include "cln/dfloat_class.h" +#include "cln/lfloat_class.h" +#include "cln/float.h" +#include "cln/float_io.h" +#include "cln/sfloat.h" +#include "cln/sfloat_io.h" +#include "cln/ffloat.h" +#include "cln/ffloat_io.h" +#include "cln/dfloat.h" +#include "cln/dfloat_io.h" +#include "cln/lfloat.h" +#include "cln/lfloat_io.h" + +// ============================== real ============================== + +// Real numbers. +#include "cln/real.h" +#include "cln/real_io.h" +#include "cln/real_ring.h" + +// ============================== complex ============================== + +// Complex numbers. +#include "cln/complex.h" +#include "cln/complex_io.h" +#include "cln/complex_ring.h" + +// ============================== modinteger ============================== + +// Modular integers. +#include "cln/modinteger.h" + +// ============================== numtheory ============================== + +// Rings for number theory. +#include "cln/numtheory.h" + +// ============================== vector ============================== + +// Vectors. +#include "cln/V.h" +#include "cln/GV.h" +#include "cln/GV_number.h" +#include "cln/GV_complex.h" +#include "cln/GV_real.h" +#include "cln/GV_rational.h" +#include "cln/GV_integer.h" +#include "cln/GV_modinteger.h" +#include "cln/SV.h" +#include "cln/SV_number.h" +#include "cln/SV_complex.h" +#include "cln/SV_real.h" +#include "cln/SV_rational.h" +#include "cln/SV_integer.h" +#include "cln/SV_ringelt.h" + +// ============================== polynomial ============================== + +// Polynomials. +#include "cln/univpoly.h" +#include "cln/univpoly_complex.h" +#include "cln/univpoly_real.h" +#include "cln/univpoly_rational.h" +#include "cln/univpoly_integer.h" +#include "cln/univpoly_modint.h" + +// ============================== modpolynomial ============================== + +// ============================== timing ============================== + +// Environmental facilities. +#include "cln/timing.h" + +#endif /* _CLN_H */ + diff --git a/include/cl_complex.h b/include/cln/complex.h similarity index 91% rename from include/cl_complex.h rename to include/cln/complex.h index 5cca361..6820e18 100644 --- a/include/cl_complex.h +++ b/include/cln/complex.h @@ -3,11 +3,12 @@ #ifndef _CL_COMPLEX_H #define _CL_COMPLEX_H -#include "cl_number.h" -#include "cl_complex_class.h" -#include "cl_real_class.h" -#include "cl_integer_class.h" +#include "cln/number.h" +#include "cln/complex_class.h" +#include "cln/real_class.h" +#include "cln/integer_class.h" +namespace cln { CL_DEFINE_AS_CONVERSION(cl_N) @@ -66,15 +67,15 @@ extern const cl_N signum (const cl_N& x); // sqrt(x) = (sqrt x) zieht die Wurzel aus einer Zahl x. extern const cl_N sqrt (const cl_N& x); -// cl_equal(x,y) vergleicht zwei Zahlen x und y auf Gleichheit. -extern cl_boolean cl_equal (const cl_N& x, const cl_N& y); -// cl_equal_hashcode(x) liefert einen cl_equal-invarianten Hashcode für x. -extern uint32 cl_equal_hashcode (const cl_N& x); +// equal(x,y) vergleicht zwei Zahlen x und y auf Gleichheit. +extern cl_boolean equal (const cl_N& x, const cl_N& y); +// equal_hashcode(x) liefert einen equal-invarianten Hashcode für x. +extern uint32 equal_hashcode (const cl_N& x); inline bool operator== (const cl_N& x, const cl_N& y) - { return cl_equal(x,y); } + { return equal(x,y); } inline bool operator!= (const cl_N& x, const cl_N& y) - { return !cl_equal(x,y); } + { return !equal(x,y); } // phase(x) liefert (phase x), wo x eine Zahl ist. // Ergebnis rational nur wenn (= x 0) oder wenn x reell und >0. @@ -153,5 +154,6 @@ inline cl_N& operator/= (cl_N& x, const cl_N& y) { return x = x / y; } // Runtime typing support. extern cl_class cl_class_complex; +} // namespace cln #endif /* _CL_COMPLEX_H */ diff --git a/include/cl_complex_class.h b/include/cln/complex_class.h similarity index 91% rename from include/cl_complex_class.h rename to include/cln/complex_class.h index 44c5ae3..0f4b3c1 100644 --- a/include/cl_complex_class.h +++ b/include/cln/complex_class.h @@ -3,8 +3,9 @@ #ifndef _CL_COMPLEX_CLASS_H #define _CL_COMPLEX_CLASS_H -#include "cl_number.h" +#include "cln/number.h" +namespace cln { class cl_N : public cl_number { public: @@ -34,9 +35,9 @@ public: cl_N (cl_private_thing); cl_N (struct cl_heap_complex *); public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_N* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } private: // Friend declarations. They are for the compiler. Just ignore them. }; @@ -59,5 +60,6 @@ CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_N) CL_DEFINE_FLOAT_CONSTRUCTOR(cl_N) CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_N) +} // namespace cln #endif /* _CL_COMPLEX_CLASS_H */ diff --git a/include/cl_complex_io.h b/include/cln/complex_io.h similarity index 85% rename from include/cl_complex_io.h rename to include/cln/complex_io.h index 79b1d64..14e840f 100644 --- a/include/cl_complex_io.h +++ b/include/cln/complex_io.h @@ -3,9 +3,10 @@ #ifndef _CL_COMPLEX_IO_H #define _CL_COMPLEX_IO_H -#include "cl_number_io.h" -#include "cl_complex.h" +#include "cln/number_io.h" +#include "cln/complex.h" +namespace cln { // Undocumented input functions @@ -36,11 +37,12 @@ extern void print_complex (cl_ostream stream, const cl_print_number_flags& flags inline void fprint (cl_ostream stream, const cl_N& x) { - extern cl_print_flags cl_default_print_flags; - print_complex(stream,cl_default_print_flags,x); + extern cl_print_flags default_print_flags; + print_complex(stream,default_print_flags,x); } CL_DEFINE_PRINT_OPERATOR(cl_N) +} // namespace cln #endif /* _CL_COMPLEX_IO_H */ diff --git a/include/cl_complex_ring.h b/include/cln/complex_ring.h similarity index 76% rename from include/cl_complex_ring.h rename to include/cln/complex_ring.h index ed8f4a1..ea7ca98 100644 --- a/include/cl_complex_ring.h +++ b/include/cln/complex_ring.h @@ -3,12 +3,16 @@ #ifndef _CL_COMPLEX_RING_H #define _CL_COMPLEX_RING_H -#include "cl_ring.h" -#include "cl_complex_class.h" +#include "cln/ring.h" +#include "cln/complex_class.h" + +namespace cln { typedef cl_specialized_number_ring cl_complex_ring; extern const cl_complex_ring cl_C_ring; // math. C extern cl_class cl_class_complex_ring; //CL_REQUIRE(cl_C_ring) +} // namespace cln + #endif /* _CL_COMPLEX_RING_H */ diff --git a/include/cl_condition.h b/include/cln/condition.h similarity index 61% rename from include/cl_condition.h rename to include/cln/condition.h index ff17c89..dc961f3 100644 --- a/include/cl_condition.h +++ b/include/cln/condition.h @@ -3,38 +3,37 @@ #ifndef _CL_CONDITION_H #define _CL_CONDITION_H -#include "cl_malloc.h" -#include "cl_io.h" +#include "cln/malloc.h" +#include "cln/io.h" + +namespace cln { struct cl_condition { // Allocation. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } // Deallocation. - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } // Name. virtual const char * name () const = 0; // Print. virtual void print (cl_ostream) const = 0; // Virtual destructor. - virtual ~cl_condition () - #if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ < 8) // workaround gcc bug - {} - #else - = 0; - #endif + virtual ~cl_condition () = 0; private: virtual void dummy (); }; #define SUBCLASS_cl_condition() \ public: \ /* Allocation. */ \ - void* operator new (size_t size) { return cl_malloc_hook(size); } \ + void* operator new (size_t size) { return malloc_hook(size); } \ /* Deallocation. */ \ - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } // Functions which want to raise a condition return a `cl_condition*'. // The caller checks this value. NULL means no condition. The one who // disposes the condition (handles it without resignalling it) should // call `delete' on the condition pointer. +} // namespace cln + #endif /* _CL_CONDITION_H */ diff --git a/include/cl_dfloat.h b/include/cln/dfloat.h similarity index 91% rename from include/cl_dfloat.h rename to include/cln/dfloat.h index 60821cf..57ca98f 100644 --- a/include/cl_dfloat.h +++ b/include/cln/dfloat.h @@ -3,11 +3,12 @@ #ifndef _CL_DFLOAT_H #define _CL_DFLOAT_H -#include "cl_number.h" -#include "cl_dfloat_class.h" -#include "cl_integer_class.h" -#include "cl_float.h" +#include "cln/number.h" +#include "cln/dfloat_class.h" +#include "cln/integer_class.h" +#include "cln/float.h" +namespace cln { CL_DEFINE_AS_CONVERSION(cl_DF) @@ -15,25 +16,25 @@ CL_DEFINE_AS_CONVERSION(cl_DF) // Liefert zu einem Double-Float x : (- x), ein DF. extern const cl_DF operator- (const cl_DF& x); -// cl_compare(x,y) vergleicht zwei Double-Floats x und y. +// compare(x,y) vergleicht zwei Double-Floats x und y. // Ergebnis: 0 falls x=y, +1 falls x>y, -1 falls x= (const cl_DF& x, const cl_DF& y) - { return cl_compare(x,y)>=0; } + { return compare(x,y)>=0; } inline bool operator> (const cl_DF& x, const cl_DF& y) - { return cl_compare(x,y)>0; } + { return compare(x,y)>0; } // minusp(x) == (< x 0) extern cl_boolean minusp (const cl_DF& x); @@ -204,19 +205,19 @@ inline const cl_I round1 (const cl_DF& x, const cl_DF& y) { return round1(x/y); // Return type for decode_float: -struct cl_decoded_dfloat { +struct decoded_dfloat { cl_DF mantissa; cl_I exponent; cl_DF sign; // Constructor. - cl_decoded_dfloat () {} - cl_decoded_dfloat (const cl_DF& m, const cl_I& e, const cl_DF& s) : mantissa(m), exponent(e), sign(s) {} + decoded_dfloat () {} + decoded_dfloat (const cl_DF& m, const cl_I& e, const cl_DF& s) : mantissa(m), exponent(e), sign(s) {} }; // decode_float(x) liefert zu einem Float x: (decode-float x). // x = 0.0 liefert (0.0, 0, 1.0). // x = (-1)^s * 2^e * m liefert ((-1)^0 * 2^0 * m, e als Integer, (-1)^s). -extern const cl_decoded_dfloat decode_float (const cl_DF& x); +extern const decoded_dfloat decode_float (const cl_DF& x); // float_exponent(x) liefert zu einem Float x: // den Exponenten von (decode-float x). @@ -266,10 +267,10 @@ extern const cl_DF signum (const cl_DF& x); // Konversion zu einem C "float". -extern float cl_float_approx (const cl_DF& x); +extern float float_approx (const cl_DF& x); // Konversion zu einem C "double". -extern double cl_double_approx (const cl_DF& x); +extern double double_approx (const cl_DF& x); #ifdef WANT_OBFUSCATING_OPERATORS @@ -301,5 +302,6 @@ static void* const cl_DF_debug_dummy[] = { &cl_DF_debug_dummy, }; #endif +} // namespace cln #endif /* _CL_DFLOAT_H */ diff --git a/include/cl_dfloat_class.h b/include/cln/dfloat_class.h similarity index 90% rename from include/cl_dfloat_class.h rename to include/cln/dfloat_class.h index ba0c86d..f36f80f 100644 --- a/include/cl_dfloat_class.h +++ b/include/cln/dfloat_class.h @@ -3,9 +3,10 @@ #ifndef _CL_DFLOAT_CLASS_H #define _CL_DFLOAT_CLASS_H -#include "cl_number.h" -#include "cl_float_class.h" +#include "cln/number.h" +#include "cln/float_class.h" +namespace cln { class cl_DF : public cl_F { public: @@ -29,9 +30,9 @@ public: // Private pointer manipulations. operator struct cl_heap_dfloat * () const; public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_DF* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } private: // Friend declarations. They are for the compiler. Just ignore them. }; @@ -61,5 +62,6 @@ CL_DEFINE_COPY_CONSTRUCTOR2(cl_DF,cl_F) // Constructors and assignment operators from C numeric types. CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_DF) +} // namespace cln #endif /* _CL_DFLOAT_CLASS_H */ diff --git a/include/cl_dfloat_io.h b/include/cln/dfloat_io.h similarity index 70% rename from include/cl_dfloat_io.h rename to include/cln/dfloat_io.h index 783c671..78204a2 100644 --- a/include/cl_dfloat_io.h +++ b/include/cln/dfloat_io.h @@ -3,8 +3,10 @@ #ifndef _CL_DFLOAT_IO_H #define _CL_DFLOAT_IO_H -#include "cl_number_io.h" -#include "cl_dfloat.h" +#include "cln/number_io.h" +#include "cln/dfloat.h" + +namespace cln { inline cl_istream operator>> (cl_istream stream, cl_DF& result) { @@ -15,13 +17,15 @@ inline cl_istream operator>> (cl_istream stream, cl_DF& result) } // The following does strictly the same as the general `fprint' for floats. -// It is here only so that people don't need to include . +// It is here only so that people don't need to include . inline void fprint (cl_ostream stream, const cl_DF& x) { extern void print_float (cl_ostream stream, const cl_print_flags& flags, const cl_F& z); - extern cl_print_flags cl_default_print_flags; - print_float(stream,cl_default_print_flags,x); + extern cl_print_flags default_print_flags; + print_float(stream,default_print_flags,x); } CL_DEFINE_PRINT_OPERATOR(cl_DF) +} // namespace cln + #endif /* _CL_DFLOAT_IO_H */ diff --git a/include/cl_ffloat.h b/include/cln/ffloat.h similarity index 91% rename from include/cl_ffloat.h rename to include/cln/ffloat.h index bb85e05..9782e4d 100644 --- a/include/cl_ffloat.h +++ b/include/cln/ffloat.h @@ -3,11 +3,12 @@ #ifndef _CL_FFLOAT_H #define _CL_FFLOAT_H -#include "cl_number.h" -#include "cl_ffloat_class.h" -#include "cl_integer_class.h" -#include "cl_float.h" +#include "cln/number.h" +#include "cln/ffloat_class.h" +#include "cln/integer_class.h" +#include "cln/float.h" +namespace cln { CL_DEFINE_AS_CONVERSION(cl_FF) @@ -15,25 +16,25 @@ CL_DEFINE_AS_CONVERSION(cl_FF) // Liefert zu einem Single-Float x : (- x), ein FF. extern const cl_FF operator- (const cl_FF& x); -// cl_compare(x,y) vergleicht zwei Single-Floats x und y. +// compare(x,y) vergleicht zwei Single-Floats x und y. // Ergebnis: 0 falls x=y, +1 falls x>y, -1 falls x= (const cl_FF& x, const cl_FF& y) - { return cl_compare(x,y)>=0; } + { return compare(x,y)>=0; } inline bool operator> (const cl_FF& x, const cl_FF& y) - { return cl_compare(x,y)>0; } + { return compare(x,y)>0; } // minusp(x) == (< x 0) extern cl_boolean minusp (const cl_FF& x); @@ -204,19 +205,19 @@ inline const cl_I round1 (const cl_FF& x, const cl_FF& y) { return round1(x/y); // Return type for decode_float: -struct cl_decoded_ffloat { +struct decoded_ffloat { cl_FF mantissa; cl_I exponent; cl_FF sign; // Constructor. - cl_decoded_ffloat () {} - cl_decoded_ffloat (const cl_FF& m, const cl_I& e, const cl_FF& s) : mantissa(m), exponent(e), sign(s) {} + decoded_ffloat () {} + decoded_ffloat (const cl_FF& m, const cl_I& e, const cl_FF& s) : mantissa(m), exponent(e), sign(s) {} }; // decode_float(x) liefert zu einem Float x: (decode-float x). // x = 0.0 liefert (0.0, 0, 1.0). // x = (-1)^s * 2^e * m liefert ((-1)^0 * 2^0 * m, e als Integer, (-1)^s). -extern const cl_decoded_ffloat decode_float (const cl_FF& x); +extern const decoded_ffloat decode_float (const cl_FF& x); // float_exponent(x) liefert zu einem Float x: // den Exponenten von (decode-float x). @@ -266,10 +267,10 @@ extern const cl_FF signum (const cl_FF& x); // Konversion zu einem C "float". -extern float cl_float_approx (const cl_FF& x); +extern float float_approx (const cl_FF& x); // Konversion zu einem C "double". -extern double cl_double_approx (const cl_FF& x); +extern double double_approx (const cl_FF& x); #ifdef WANT_OBFUSCATING_OPERATORS @@ -306,5 +307,6 @@ static void* const cl_FF_debug_dummy[] = { &cl_FF_debug_dummy, }; #endif +} // namespace cln #endif /* _CL_FFLOAT_H */ diff --git a/include/cl_ffloat_class.h b/include/cln/ffloat_class.h similarity index 90% rename from include/cl_ffloat_class.h rename to include/cln/ffloat_class.h index 6183819..aaa2481 100644 --- a/include/cl_ffloat_class.h +++ b/include/cln/ffloat_class.h @@ -3,9 +3,10 @@ #ifndef _CL_FFLOAT_CLASS_H #define _CL_FFLOAT_CLASS_H -#include "cl_number.h" -#include "cl_float_class.h" +#include "cln/number.h" +#include "cln/float_class.h" +namespace cln { class cl_FF : public cl_F { public: @@ -37,9 +38,9 @@ public: operator struct cl_heap_ffloat * () const; #endif public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_FF* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } }; // Private constructors. @@ -72,5 +73,6 @@ CL_DEFINE_COPY_CONSTRUCTOR2(cl_FF,cl_F) // Constructors and assignment operators from C numeric types. CL_DEFINE_FLOAT_CONSTRUCTOR(cl_FF) +} // namespace cln #endif /* _CL_FFLOAT_CLASS_H */ diff --git a/include/cl_ffloat_io.h b/include/cln/ffloat_io.h similarity index 70% rename from include/cl_ffloat_io.h rename to include/cln/ffloat_io.h index bf3a165..5731346 100644 --- a/include/cl_ffloat_io.h +++ b/include/cln/ffloat_io.h @@ -3,8 +3,10 @@ #ifndef _CL_FFLOAT_IO_H #define _CL_FFLOAT_IO_H -#include "cl_number_io.h" -#include "cl_ffloat.h" +#include "cln/number_io.h" +#include "cln/ffloat.h" + +namespace cln { inline cl_istream operator>> (cl_istream stream, cl_FF& result) { @@ -15,13 +17,15 @@ inline cl_istream operator>> (cl_istream stream, cl_FF& result) } // The following does strictly the same as the general `fprint' for floats. -// It is here only so that people don't need to include . +// It is here only so that people don't need to include . inline void fprint (cl_ostream stream, const cl_FF& x) { extern void print_float (cl_ostream stream, const cl_print_flags& flags, const cl_F& z); - extern cl_print_flags cl_default_print_flags; - print_float(stream,cl_default_print_flags,x); + extern cl_print_flags default_print_flags; + print_float(stream,default_print_flags,x); } CL_DEFINE_PRINT_OPERATOR(cl_FF) +} // namespace cln + #endif /* _CL_FFLOAT_IO_H */ diff --git a/include/cl_float.h b/include/cln/float.h similarity index 81% rename from include/cl_float.h rename to include/cln/float.h index 6cf0215..4c004a4 100644 --- a/include/cl_float.h +++ b/include/cln/float.h @@ -3,16 +3,17 @@ #ifndef _CL_FLOAT_H #define _CL_FLOAT_H -#include "cl_number.h" -#include "cl_float_class.h" -#include "cl_floatformat.h" -#include "cl_random.h" -#include "cl_integer_class.h" -#include "cl_sfloat_class.h" -#include "cl_ffloat_class.h" -#include "cl_dfloat_class.h" -#include "cl_lfloat_class.h" - +#include "cln/number.h" +#include "cln/float_class.h" +#include "cln/floatformat.h" +#include "cln/random.h" +#include "cln/integer_class.h" +#include "cln/sfloat_class.h" +#include "cln/ffloat_class.h" +#include "cln/dfloat_class.h" +#include "cln/lfloat_class.h" + +namespace cln { CL_DEFINE_AS_CONVERSION(cl_F) @@ -54,11 +55,11 @@ extern const cl_LF cl_F_to_LF (const cl_F& x, uintC len); // The default float format used when converting rational numbers to floats. -extern cl_float_format_t cl_default_float_format; +extern float_format_t default_float_format; // Returns the smallest float format which guarantees at least n decimal digits // in the mantissa (after the decimal point). -extern cl_float_format_t cl_float_format (uintL n); +extern float_format_t float_format (uintL n); // cl_float(x,y) wandelt ein Float x in das Float-Format des Floats y um // und rundet dabei nötigenfalls. @@ -71,13 +72,13 @@ extern const cl_F cl_float (const cl_F& x, const cl_F& y); // > x: ein Float // > f: eine Float-Format-Spezifikation // < ergebnis: (float x f) -extern const cl_F cl_float (const cl_F& x, cl_float_format_t f); +extern const cl_F cl_float (const cl_F& x, float_format_t f); // cl_float(x) wandelt eine reelle Zahl x in ein Float um // und rundet dabei nötigenfalls. // > x: eine reelle Zahl // < ergebnis: (float x) -// Abhängig von cl_default_float_format. +// Abhängig von default_float_format. inline const cl_F cl_float (const cl_F& x) { return x; } // cl_float(x,y) wandelt ein Integer x in das Float-Format des Floats y um @@ -92,12 +93,12 @@ extern const cl_F cl_float (const cl_I& x, const cl_F& y); // > x: ein Integer // > f: eine Float-Format-Spezifikation // < ergebnis: (float x f) -extern const cl_F cl_float (const cl_I& x, cl_float_format_t f); +extern const cl_F cl_float (const cl_I& x, float_format_t f); // cl_float(x) wandelt ein Integer x in ein Float um und rundet dabei. // > x: ein Integer // < ergebnis: (float x) -// Abhängig von cl_default_float_format. +// Abhängig von default_float_format. extern const cl_F cl_float (const cl_I& x); // cl_float(x,y) wandelt eine rationale Zahl x in das Float-Format des @@ -112,12 +113,12 @@ extern const cl_F cl_float (const cl_RA& x, const cl_F& y); // > x: eine rationale Zahl // > f: eine Float-Format-Spezifikation // < ergebnis: (float x f) -extern const cl_F cl_float (const cl_RA& x, cl_float_format_t f); +extern const cl_F cl_float (const cl_RA& x, float_format_t f); // cl_float(x) wandelt eine rationale Zahl x in ein Float um und rundet dabei. // > x: eine rationale Zahl // < ergebnis: (float x) -// Abhängig von cl_default_float_format. +// Abhängig von default_float_format. extern const cl_F cl_float (const cl_RA& x); // The C++ compilers are not clever enough to guess this: @@ -125,9 +126,9 @@ inline const cl_F cl_float (int x, const cl_F& y) { return cl_float(cl_I(x),y); } inline const cl_F cl_float (unsigned int x, const cl_F& y) { return cl_float(cl_I(x),y); } -inline const cl_F cl_float (int x, cl_float_format_t y) +inline const cl_F cl_float (int x, float_format_t y) { return cl_float(cl_I(x),y); } -inline const cl_F cl_float (unsigned int x, cl_float_format_t y) +inline const cl_F cl_float (unsigned int x, float_format_t y) { return cl_float(cl_I(x),y); } inline const cl_F cl_float (int x) { return cl_float(cl_I(x)); } @@ -138,9 +139,9 @@ inline const cl_F cl_float (float x, const cl_F& y) { return cl_float(cl_FF(x),y); } inline const cl_F cl_float (double x, const cl_F& y) { return cl_float(cl_DF(x),y); } -inline const cl_F cl_float (float x, cl_float_format_t y) +inline const cl_F cl_float (float x, float_format_t y) { return cl_float(cl_FF(x),y); } -inline const cl_F cl_float (double x, cl_float_format_t y) +inline const cl_F cl_float (double x, float_format_t y) { return cl_float(cl_DF(x),y); } inline const cl_F cl_float (float x) { return cl_float(cl_FF(x)); } @@ -299,25 +300,25 @@ inline const cl_F minus1 (const cl_F& x) // { return x + cl_I(-1); } return x + cl_float(-1,x); } -// cl_compare(x,y) vergleicht zwei Floats x und y. +// compare(x,y) vergleicht zwei Floats x und y. // Ergebnis: 0 falls x=y, +1 falls x>y, -1 falls x= (const cl_F& x, const cl_F& y) - { return cl_compare(x,y)>=0; } + { return compare(x,y)>=0; } inline bool operator> (const cl_F& x, const cl_F& y) - { return cl_compare(x,y)>0; } + { return compare(x,y)>0; } // ffloor(x) liefert (ffloor x), wo x ein Float ist. @@ -400,19 +401,19 @@ inline const cl_I round1 (const cl_F& x, const cl_F& y) { return round1(x/y); } // Return type for decode_float: -struct cl_decoded_float { +struct decoded_float { cl_F mantissa; cl_I exponent; cl_F sign; // Constructor. - cl_decoded_float () {} - cl_decoded_float (const cl_F& m, const cl_I& e, const cl_F& s) : mantissa(m), exponent(e), sign(s) {} + decoded_float () {} + decoded_float (const cl_F& m, const cl_I& e, const cl_F& s) : mantissa(m), exponent(e), sign(s) {} }; // decode_float(x) liefert zu einem Float x: (decode-float x). // x = 0.0 liefert (0.0, 0, 1.0). // x = (-1)^s * 2^e * m liefert ((-1)^0 * 2^0 * m, e als Integer, (-1)^s). -extern const cl_decoded_float decode_float (const cl_F& x); +extern const decoded_float decode_float (const cl_F& x); // float_exponent(x) liefert zu einem Float x: // den Exponenten von (decode-float x). @@ -442,8 +443,8 @@ extern uintL float_digits (const cl_F& x); extern uintL float_precision (const cl_F& x); // Returns the floating point format of a float. -inline cl_float_format_t cl_float_format (const cl_F& x) - { return (cl_float_format_t) float_digits(x); } +inline float_format_t float_format (const cl_F& x) + { return (float_format_t) float_digits(x); } // integer_decode_float(x) liefert zu einem Float x: (integer-decode-float x). @@ -473,52 +474,52 @@ extern const cl_F signum (const cl_F& x); // Returns the largest (most positive) floating point number in float format f. -extern const cl_F most_positive_float (cl_float_format_t f); +extern const cl_F most_positive_float (float_format_t f); //CL_REQUIRE(cl_F_mostpos) // Returns the smallest (most negative) floating point number in float format f. -extern const cl_F most_negative_float (cl_float_format_t f); +extern const cl_F most_negative_float (float_format_t f); //CL_REQUIRE(cl_F_mostneg) // Returns the least positive floating point number (i.e. > 0 but closest to 0) // in float format f. -extern const cl_F least_positive_float (cl_float_format_t f); +extern const cl_F least_positive_float (float_format_t f); //CL_REQUIRE(cl_F_leastpos) // Returns the least negative floating point number (i.e. < 0 but closest to 0) // in float format f. -extern const cl_F least_negative_float (cl_float_format_t f); +extern const cl_F least_negative_float (float_format_t f); //CL_REQUIRE(cl_F_leastneg) // Returns the smallest floating point number e > 0 such that 1+e != 1. -extern const cl_F float_epsilon (cl_float_format_t f); +extern const cl_F float_epsilon (float_format_t f); //CL_REQUIRE(cl_F_epspos) // Returns the smallest floating point number e > 0 such that 1-e != 1. -extern const cl_F float_negative_epsilon (cl_float_format_t f); +extern const cl_F float_negative_epsilon (float_format_t f); //CL_REQUIRE(cl_F_epsneg) // Konversion zu einem C "float". -extern float cl_float_approx (const cl_F& x); +extern float float_approx (const cl_F& x); // Konversion zu einem C "double". -extern double cl_double_approx (const cl_F& x); +extern double double_approx (const cl_F& x); // Transcendental functions -// cl_pi(y) liefert die Zahl pi im selben Float-Format wie y. +// pi(y) liefert die Zahl pi im selben Float-Format wie y. // > y: ein Float -extern const cl_F cl_pi (const cl_F& y); +extern const cl_F pi (const cl_F& y); -// cl_pi(y) liefert die Zahl pi im Float-Format f. +// pi(y) liefert die Zahl pi im Float-Format f. // > f: eine Float-Format-Spezifikation -extern const cl_F cl_pi (cl_float_format_t f); +extern const cl_F pi (float_format_t f); -// cl_pi() liefert die Zahl pi im Default-Float-Format. -extern const cl_F cl_pi (void); +// pi() liefert die Zahl pi im Default-Float-Format. +extern const cl_F pi (void); //CL_REQUIRE(cl_F_pi_var) @@ -529,31 +530,31 @@ extern const cl_F sin (const cl_F& x); // cos(x) liefert den Cosinus (cos x) eines Float x. extern const cl_F cos (const cl_F& x); -// Return type for cl_cos_sin(): -struct cl_cos_sin_t { +// Return type for cos_sin(): +struct cos_sin_t { cl_R cos; cl_R sin; // Constructor: - cl_cos_sin_t (const cl_R& u, const cl_R& v) : cos (u), sin (v) {} + cos_sin_t (const cl_R& u, const cl_R& v) : cos (u), sin (v) {} }; -// cl_cos_sin(x) liefert ((cos x),(sin x)), beide Werte. -extern const cl_cos_sin_t cl_cos_sin (const cl_F& x); +// cos_sin(x) liefert ((cos x),(sin x)), beide Werte. +extern const cos_sin_t cos_sin (const cl_F& x); // tan(x) liefert den Tangens (tan x) eines Float x. extern const cl_F tan (const cl_F& x); -// cl_exp1(y) liefert die Zahl e = exp(1) im selben Float-Format wie y. +// exp1(y) liefert die Zahl e = exp(1) im selben Float-Format wie y. // > y: ein Float -extern const cl_F cl_exp1 (const cl_F& y); +extern const cl_F exp1 (const cl_F& y); -// cl_exp1(y) liefert die Zahl e = exp(1) im Float-Format f. +// exp1(y) liefert die Zahl e = exp(1) im Float-Format f. // > f: eine Float-Format-Spezifikation -extern const cl_F cl_exp1 (cl_float_format_t f); +extern const cl_F exp1 (float_format_t f); -// cl_exp1() liefert die Zahl e = exp(1) im Default-Float-Format. -extern const cl_F cl_exp1 (void); +// exp1() liefert die Zahl e = exp(1) im Default-Float-Format. +extern const cl_F exp1 (void); //CL_REQUIRE(cl_F_exp1_var) @@ -572,64 +573,64 @@ extern const cl_F sinh (const cl_F& x); // cosh(x) liefert zu einem Float x die Zahl cosh(x). extern const cl_F cosh (const cl_F& x); -// Return type for cl_cosh_sinh(): -struct cl_cosh_sinh_t { +// Return type for cosh_sinh(): +struct cosh_sinh_t { cl_R cosh; cl_R sinh; // Constructor: - cl_cosh_sinh_t (const cl_R& u, const cl_R& v) : cosh (u), sinh (v) {} + cosh_sinh_t (const cl_R& u, const cl_R& v) : cosh (u), sinh (v) {} }; -// cl_cosh_sinh(x) liefert ((cosh x),(sinh x)), beide Werte. -extern const cl_cosh_sinh_t cl_cosh_sinh (const cl_F& x); +// cosh_sinh(x) liefert ((cosh x),(sinh x)), beide Werte. +extern const cosh_sinh_t cosh_sinh (const cl_F& x); // tanh(x) liefert zu einem Float x die Zahl tanh(x). extern const cl_F tanh (const cl_F& x); -// cl_eulerconst(y) liefert die Eulersche Konstante +// eulerconst(y) liefert die Eulersche Konstante // im selben Float-Format wie y. // > y: ein Float -extern const cl_F cl_eulerconst (const cl_F& y); +extern const cl_F eulerconst (const cl_F& y); -// cl_eulerconst(y) liefert die Eulersche Konstante im Float-Format f. +// eulerconst(y) liefert die Eulersche Konstante im Float-Format f. // > f: eine Float-Format-Spezifikation -extern const cl_F cl_eulerconst (cl_float_format_t f); +extern const cl_F eulerconst (float_format_t f); -// cl_eulerconst() liefert die Eulersche Konstante im Default-Float-Format. -extern const cl_F cl_eulerconst (void); +// eulerconst() liefert die Eulersche Konstante im Default-Float-Format. +extern const cl_F eulerconst (void); //CL_REQUIRE(cl_F_eulerconst_var) -// cl_catalanconst(y) liefert die Catalansche Konstante +// catalanconst(y) liefert die Catalansche Konstante // im selben Float-Format wie y. // > y: ein Float -extern const cl_F cl_catalanconst (const cl_F& y); +extern const cl_F catalanconst (const cl_F& y); -// cl_catalanconst(y) liefert die Catalansche Konstante im Float-Format f. +// catalanconst(y) liefert die Catalansche Konstante im Float-Format f. // > f: eine Float-Format-Spezifikation -extern const cl_F cl_catalanconst (cl_float_format_t f); +extern const cl_F catalanconst (float_format_t f); -// cl_catalanconst() liefert die Catalansche Konstante im Default-Float-Format. -extern const cl_F cl_catalanconst (void); +// catalanconst() liefert die Catalansche Konstante im Default-Float-Format. +extern const cl_F catalanconst (void); //CL_REQUIRE(cl_F_catalanconst_var) // zeta(s) returns the Riemann zeta function at s>1. -extern const cl_F cl_zeta (int s, const cl_F& y); -extern const cl_F cl_zeta (int s, cl_float_format_t f); -extern const cl_F cl_zeta (int s); +extern const cl_F zeta (int s, const cl_F& y); +extern const cl_F zeta (int s, float_format_t f); +extern const cl_F zeta (int s); // random_F(randomstate,n) liefert zu einem Float n>0 ein zufälliges // Float x mit 0 <= x < n. // > randomstate: ein Random-State, wird verändert -extern const cl_F random_F (cl_random_state& randomstate, const cl_F& n); +extern const cl_F random_F (random_state& randomstate, const cl_F& n); inline const cl_F random_F (const cl_F& n) - { return random_F(cl_default_random_state,n); } + { return random_F(default_random_state,n); } #ifdef WANT_OBFUSCATING_OPERATORS @@ -651,5 +652,6 @@ CL_REQUIRE(cl_ieee) // If this is true, floating point underflow returns zero instead of an error. extern cl_boolean cl_inhibit_floating_point_underflow; +} // namespace cln #endif /* _CL_FLOAT_H */ diff --git a/include/cl_float_class.h b/include/cln/float_class.h similarity index 85% rename from include/cl_float_class.h rename to include/cln/float_class.h index c3b2302..7a7e955 100644 --- a/include/cl_float_class.h +++ b/include/cln/float_class.h @@ -3,9 +3,10 @@ #ifndef _CL_FLOAT_CLASS_H #define _CL_FLOAT_CLASS_H -#include "cl_number.h" -#include "cl_real_class.h" +#include "cln/number.h" +#include "cln/real_class.h" +namespace cln { class cl_F : public cl_R { public: @@ -26,9 +27,9 @@ public: // Private constructor. cl_F (cl_private_thing); public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_F* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } private: // Friend declarations. They are for the compiler. Just ignore them. }; @@ -46,5 +47,6 @@ CL_DEFINE_COPY_CONSTRUCTOR2(cl_F,cl_R) CL_DEFINE_FLOAT_CONSTRUCTOR(cl_F) CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_F) +} // namespace cln #endif /* _CL_FLOAT_CLASS_H */ diff --git a/include/cl_float_io.h b/include/cln/float_io.h similarity index 91% rename from include/cl_float_io.h rename to include/cln/float_io.h index b02d080..f08ea49 100644 --- a/include/cl_float_io.h +++ b/include/cln/float_io.h @@ -3,9 +3,10 @@ #ifndef _CL_FLOAT_IO_H #define _CL_FLOAT_IO_H -#include "cl_number_io.h" -#include "cl_float.h" +#include "cln/number_io.h" +#include "cln/float.h" +namespace cln { // Undocumented input functions @@ -24,7 +25,7 @@ // index4+1 = Index des Exponenten-Vorzeichens oder der ersten // Exponenten-Ziffer) // < ergebnis: Float -extern const cl_F read_float (unsigned int base, cl_float_format_t prec, +extern const cl_F read_float (unsigned int base, float_format_t prec, cl_signean sign, const char * string, uintL index1, uintL index4, uintL index2, uintL index3); // The following does strictly the same as the general read_complex. @@ -69,11 +70,12 @@ extern void print_float_binary (cl_ostream stream, const cl_F& z); inline void fprint (cl_ostream stream, const cl_F& x) { - extern cl_print_flags cl_default_print_flags; - print_float(stream,cl_default_print_flags,x); + extern cl_print_flags default_print_flags; + print_float(stream,default_print_flags,x); } CL_DEFINE_PRINT_OPERATOR(cl_F) +} // namespace cln #endif /* _CL_FLOAT_IO_H */ diff --git a/include/cln/floatformat.h b/include/cln/floatformat.h new file mode 100644 index 0000000..cbb26b6 --- /dev/null +++ b/include/cln/floatformat.h @@ -0,0 +1,20 @@ +// Floating point format specifiers. + +#ifndef _CL_FLOATFORMAT_H +#define _CL_FLOATFORMAT_H + +#include "cln/types.h" + +namespace cln { + +// Float format specifier type. (Float mantissa precision in bits.) +typedef enum float_format_t { + float_format_sfloat = 17, + float_format_ffloat = 24, + float_format_dfloat = 53, + float_format_lfloat_min = ((53+intDsize-1)/intDsize)*intDsize // = round_up(53,intDsize) +}; + +} // namespace cln + +#endif /* _CL_FLOATFORMAT_H */ diff --git a/include/cl_input.h b/include/cln/input.h similarity index 90% rename from include/cl_input.h rename to include/cln/input.h index a8709a4..5df0ab9 100644 --- a/include/cl_input.h +++ b/include/cln/input.h @@ -3,15 +3,17 @@ #ifndef _CL_INPUT_H #define _CL_INPUT_H -#include "cl_types.h" -#include "cl_floatformat.h" -#include "cl_io.h" +#include "cln/types.h" +#include "cln/floatformat.h" +#include "cln/io.h" + +namespace cln { struct cl_read_float_flags { // The float format used when reading floats with exponent marker 'E'. - cl_float_format_t default_float_format; + float_format_t default_float_format; // The float format used when reading floats with exponent marker 'L'. - cl_float_format_t default_lfloat_format; + float_format_t default_lfloat_format; // Flag whether floats specified with more digits than corresponding // to the exponent marker they contain, but without _nnn suffix, will // get a precision corresponding to their number of significant digits. @@ -54,4 +56,6 @@ struct cl_read_flags { cl_read_float_flags float_flags; }; +} // namespace cln + #endif /* _CL_INPUT_H */ diff --git a/include/cl_integer.h b/include/cln/integer.h similarity index 95% rename from include/cl_integer.h rename to include/cln/integer.h index d5e2597..850cefe 100644 --- a/include/cl_integer.h +++ b/include/cln/integer.h @@ -3,10 +3,11 @@ #ifndef _CL_INTEGER_H #define _CL_INTEGER_H -#include "cl_number.h" -#include "cl_integer_class.h" -#include "cl_random.h" +#include "cln/number.h" +#include "cln/integer_class.h" +#include "cln/random.h" +namespace cln { CL_DEFINE_AS_CONVERSION(cl_I) @@ -238,27 +239,27 @@ inline const cl_I operator>> (const cl_I& x, const cl_I& y) // assume y >= 0 // Vergleich von Integers -// cl_equal(x,y) vergleicht zwei Integers x und y auf Gleichheit. -extern cl_boolean cl_equal (const cl_I& x, const cl_I& y); -// cl_equal_hashcode(x) liefert einen cl_equal-invarianten Hashcode für x. -extern uint32 cl_equal_hashcode (const cl_I& x); +// equal(x,y) vergleicht zwei Integers x und y auf Gleichheit. +extern cl_boolean equal (const cl_I& x, const cl_I& y); +// equal_hashcode(x) liefert einen equal-invarianten Hashcode für x. +extern uint32 equal_hashcode (const cl_I& x); -// cl_compare(x,y) vergleicht zwei Integers x und y. +// compare(x,y) vergleicht zwei Integers x und y. // Ergebnis: 0 falls x=y, +1 falls x>y, -1 falls x= (const cl_I& x, const cl_I& y) - { return cl_compare(x,y)>=0; } + { return compare(x,y)>=0; } inline bool operator> (const cl_I& x, const cl_I& y) - { return cl_compare(x,y)>0; } + { return compare(x,y)>0; } // minusp(x) == (< x 0) extern cl_boolean minusp (const cl_I& x); @@ -522,26 +523,26 @@ inline const cl_I denominator (const cl_I& r) // Konversion zu einem C "float". -extern float cl_float_approx (const cl_I& x); +extern float float_approx (const cl_I& x); // Konversion zu einem C "double". -extern double cl_double_approx (const cl_I& x); +extern double double_approx (const cl_I& x); // random_I(randomstate,n) liefert zu einem Integer n>0 ein zufälliges // Integer x mit 0 <= x < n. // > randomstate: ein Random-State, wird verändert -extern const cl_I random_I (cl_random_state& randomstate, const cl_I& n); +extern const cl_I random_I (random_state& randomstate, const cl_I& n); inline const cl_I random_I (const cl_I& n) - { return random_I(cl_default_random_state,n); } + { return random_I(default_random_state,n); } // testrandom_I(randomstate) liefert ein zufälliges Integer zum Testen. // > randomstate: ein Random-State, wird verändert -extern const cl_I testrandom_I (cl_random_state& randomstate); +extern const cl_I testrandom_I (random_state& randomstate); inline const cl_I testrandom_I () - { return testrandom_I(cl_default_random_state); } + { return testrandom_I(default_random_state); } #ifdef WANT_OBFUSCATING_OPERATORS @@ -598,5 +599,6 @@ static void* const cl_I_debug_dummy[] = { &cl_I_debug_dummy, }; #endif +} // namespace cln #endif /* _CL_INTEGER_H */ diff --git a/include/cl_integer_class.h b/include/cln/integer_class.h similarity index 88% rename from include/cl_integer_class.h rename to include/cln/integer_class.h index 3b463e5..ebf9b6e 100644 --- a/include/cl_integer_class.h +++ b/include/cln/integer_class.h @@ -3,9 +3,10 @@ #ifndef _CL_INTEGER_CLASS_H #define _CL_INTEGER_CLASS_H -#include "cl_number.h" -#include "cl_rational_class.h" +#include "cln/number.h" +#include "cln/rational_class.h" +namespace cln { class cl_I : public cl_RA { public: @@ -31,9 +32,9 @@ public: cl_I (struct cl_fixnum * /* NULL! */, cl_uint); cl_I (struct cl_heap_bignum *); public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_I* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } }; // Private constructors. @@ -51,5 +52,6 @@ CL_DEFINE_INT_ASSIGNMENT_OPERATORS(cl_I) CL_DEFINE_LONG_CONSTRUCTORS(cl_I) CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_I) +} // namespace cln #endif /* _CL_INTEGER_CLASS_H */ diff --git a/include/cl_integer_io.h b/include/cln/integer_io.h similarity index 90% rename from include/cl_integer_io.h rename to include/cln/integer_io.h index ee13ae7..783c7cf 100644 --- a/include/cl_integer_io.h +++ b/include/cln/integer_io.h @@ -3,9 +3,10 @@ #ifndef _CL_INTEGER_IO_H #define _CL_INTEGER_IO_H -#include "cl_number_io.h" -#include "cl_integer_class.h" +#include "cln/number_io.h" +#include "cln/integer_class.h" +namespace cln { // Undocumented input functions @@ -42,7 +43,7 @@ inline cl_istream operator>> (cl_istream stream, cl_I& result) // Liefert zu einem Integer >=0 (write-to-string integer :base 10 :radix nil), // also die Ziffernfolge als String. -// Mit cl_malloc_hook() alloziert, mit cl_free_hook() freizugeben. +// Mit malloc_hook() alloziert, mit free_hook() freizugeben. extern char * cl_decimal_string (const cl_I& x); // Gibt ein Integer aus. @@ -51,7 +52,7 @@ extern char * cl_decimal_string (const cl_I& x); // > base: Basis (>=2, <=36) // > stream: Stream extern void print_integer (cl_ostream stream, unsigned int base, const cl_I& z); -// Dasselbe als String. Mit cl_malloc_hook() alloziert, mit cl_free_hook() freizugeben. +// Dasselbe als String. Mit malloc_hook() alloziert, mit free_hook() freizugeben. extern char * print_integer_to_string (unsigned int base, const cl_I& z); @@ -93,11 +94,12 @@ extern void print_integer (cl_ostream stream, const cl_print_rational_flags& fla inline void fprint (cl_ostream stream, const cl_I& x) { - extern cl_print_flags cl_default_print_flags; - print_integer(stream,cl_default_print_flags,x); + extern cl_print_flags default_print_flags; + print_integer(stream,default_print_flags,x); } CL_DEFINE_PRINT_OPERATOR(cl_I) +} // namespace cln #endif /* _CL_INTEGER_IO_H */ diff --git a/include/cl_integer_ring.h b/include/cln/integer_ring.h similarity index 76% rename from include/cl_integer_ring.h rename to include/cln/integer_ring.h index fe99e54..b8fcb29 100644 --- a/include/cl_integer_ring.h +++ b/include/cln/integer_ring.h @@ -3,12 +3,16 @@ #ifndef _CL_INTEGER_RING_H #define _CL_INTEGER_RING_H -#include "cl_ring.h" -#include "cl_integer_class.h" +#include "cln/ring.h" +#include "cln/integer_class.h" + +namespace cln { typedef cl_specialized_number_ring cl_integer_ring; extern const cl_integer_ring cl_I_ring; // math. Z extern cl_class cl_class_integer_ring; //CL_REQUIRE(cl_I_ring) +} // namespace cln + #endif /* _CL_INTEGER_RING_H */ diff --git a/include/cl_io.h b/include/cln/io.h similarity index 58% rename from include/cl_io.h rename to include/cln/io.h index 67d9a18..e997d84 100644 --- a/include/cl_io.h +++ b/include/cln/io.h @@ -1,80 +1,29 @@ -// I/O through or +// I/O through or #ifndef _CL_IO_H #define _CL_IO_H -#include "cl_types.h" -#include "cl_modules.h" +#include "cln/types.h" +#include "cln/modules.h" -#if !defined(CL_IO_STDIO) && !defined(CL_IO_IOSTREAM) -// Prefer iostream based I/O - this is what people expect. -#define CL_IO_IOSTREAM -#endif - - -#if defined(CL_IO_STDIO) - -// I/O through - -#include - -#define cl_istream FILE * -#define cl_ostream FILE * -#define cl_stdin stdin -#define cl_stdout stdout -#define cl_stderr stderr -extern FILE* cl_debugout; - -// Elementary operations on cl_istream - -#define cl_EOF EOF - -inline int freadchar (cl_istream stream) -{ - // return fgetc(stream); - return getc(stream); -} - -inline int funreadchar (cl_istream stream, int c) -{ - return ungetc(c,stream); -} - -// Elementary operations on cl_ostream - -inline void fprintchar (cl_ostream stream, char c) -{ - // fputc(c,stream); - putc(c,stream); -} - -inline void fprint (cl_ostream stream, const char * string) -{ - // fprintf(stream,"%s",string); - fputs(string,stream); -} - -#endif - - -#if defined(CL_IO_IOSTREAM) - -// I/O through +// I/O through #ifdef floor #undef floor - #include + #include #define floor cln_floor #else - #include + #include #endif -#define cl_istream istream& -#define cl_ostream ostream& -#define cl_stdin cin -#define cl_stdout cout -#define cl_stderr cerr -extern ostream* cl_debugout_stream; +namespace cln { + +typedef std::istream& cl_istream; +typedef std::ostream& cl_ostream; +extern cl_istream stdin; +extern cl_ostream stdout; +extern cl_ostream stderr; +extern std::ostream* cl_debugout_stream; #define cl_debugout (*cl_debugout_stream) // Elementary operations on cl_istream @@ -110,8 +59,6 @@ inline void fprint (cl_ostream stream, const char * string) stream << string; } -#endif - extern void fprintdecimal (cl_ostream stream, unsigned long x); extern void fprintdecimal (cl_ostream stream, long x); @@ -154,6 +101,7 @@ inline cl_ostream operator<< (cl_ostream stream, const _class_& x) \ fprint(stream,x); \ return stream; \ } - + +} // namespace cln #endif /* _CL_IO_H */ diff --git a/include/cl_lfloat.h b/include/cln/lfloat.h similarity index 93% rename from include/cl_lfloat.h rename to include/cln/lfloat.h index 347c148..033ed43 100644 --- a/include/cl_lfloat.h +++ b/include/cln/lfloat.h @@ -3,11 +3,12 @@ #ifndef _CL_LFLOAT_H #define _CL_LFLOAT_H -#include "cl_number.h" -#include "cl_lfloat_class.h" -#include "cl_integer_class.h" -#include "cl_float.h" +#include "cln/number.h" +#include "cln/lfloat_class.h" +#include "cln/integer_class.h" +#include "cln/float.h" +namespace cln { CL_DEFINE_AS_CONVERSION(cl_LF) @@ -15,25 +16,25 @@ CL_DEFINE_AS_CONVERSION(cl_LF) // Liefert zu einem Long-Float x : (- x), ein LF. extern const cl_LF operator- (const cl_LF& x); -// cl_compare(x,y) vergleicht zwei Long-Floats x und y. +// compare(x,y) vergleicht zwei Long-Floats x und y. // Ergebnis: 0 falls x=y, +1 falls x>y, -1 falls x= (const cl_LF& x, const cl_LF& y) - { return cl_compare(x,y)>=0; } + { return compare(x,y)>=0; } inline bool operator> (const cl_LF& x, const cl_LF& y) - { return cl_compare(x,y)>0; } + { return compare(x,y)>0; } // minusp(x) == (< x 0) extern cl_boolean minusp (const cl_LF& x); @@ -314,19 +315,19 @@ inline const cl_LF cl_float (unsigned int x, const cl_LF& y) // Return type for decode_float: -struct cl_decoded_lfloat { +struct decoded_lfloat { cl_LF mantissa; cl_I exponent; cl_LF sign; // Constructor. - cl_decoded_lfloat () {} - cl_decoded_lfloat (const cl_LF& m, const cl_I& e, const cl_LF& s) : mantissa(m), exponent(e), sign(s) {} + decoded_lfloat () {} + decoded_lfloat (const cl_LF& m, const cl_I& e, const cl_LF& s) : mantissa(m), exponent(e), sign(s) {} }; // decode_float(x) liefert zu einem Float x: (decode-float x). // x = 0.0 liefert (0.0, 0, 1.0). // x = (-1)^s * 2^e * m liefert ((-1)^0 * 2^0 * m, e als Integer, (-1)^s). -extern const cl_decoded_lfloat decode_float (const cl_LF& x); +extern const decoded_lfloat decode_float (const cl_LF& x); // float_exponent(x) liefert zu einem Float x: // den Exponenten von (decode-float x). @@ -376,10 +377,10 @@ extern const cl_LF signum (const cl_LF& x); // Konversion zu einem C "float". -extern float cl_float_approx (const cl_LF& x); +extern float float_approx (const cl_LF& x); // Konversion zu einem C "double". -extern double cl_double_approx (const cl_LF& x); +extern double double_approx (const cl_LF& x); #ifdef WANT_OBFUSCATING_OPERATORS @@ -407,5 +408,6 @@ static void* const cl_LF_debug_dummy[] = { &cl_LF_debug_dummy, }; #endif +} // namespace cln #endif /* _CL_LFLOAT_H */ diff --git a/include/cl_lfloat_class.h b/include/cln/lfloat_class.h similarity index 90% rename from include/cl_lfloat_class.h rename to include/cln/lfloat_class.h index 1062652..6d719d0 100644 --- a/include/cl_lfloat_class.h +++ b/include/cln/lfloat_class.h @@ -3,9 +3,10 @@ #ifndef _CL_LFLOAT_CLASS_H #define _CL_LFLOAT_CLASS_H -#include "cl_number.h" -#include "cl_float_class.h" +#include "cln/number.h" +#include "cln/float_class.h" +namespace cln { class cl_LF : public cl_F { public: @@ -26,9 +27,9 @@ public: // Private pointer manipulations. operator struct cl_heap_lfloat * () const; public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_LF* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } }; // Define this if you want the elementary cl_LF operations (+, -, *, /, // sqrt, cl_LF_I_mul) to return results which are always the correctly @@ -60,5 +61,6 @@ inline cl_LF::cl_LF (struct cl_heap_lfloat * ptr) // The copy constructors. CL_DEFINE_COPY_CONSTRUCTOR2(cl_LF,cl_F) +} // namespace cln #endif /* _CL_LFLOAT_CLASS_H */ diff --git a/include/cl_lfloat_io.h b/include/cln/lfloat_io.h similarity index 70% rename from include/cl_lfloat_io.h rename to include/cln/lfloat_io.h index ff66c34..04e8b55 100644 --- a/include/cl_lfloat_io.h +++ b/include/cln/lfloat_io.h @@ -3,8 +3,10 @@ #ifndef _CL_LFLOAT_IO_H #define _CL_LFLOAT_IO_H -#include "cl_number_io.h" -#include "cl_lfloat.h" +#include "cln/number_io.h" +#include "cln/lfloat.h" + +namespace cln { inline cl_istream operator>> (cl_istream stream, cl_LF& result) { @@ -15,13 +17,15 @@ inline cl_istream operator>> (cl_istream stream, cl_LF& result) } // The following does strictly the same as the general `fprint' for floats. -// It is here only so that people don't need to include . +// It is here only so that people don't need to include . inline void fprint (cl_ostream stream, const cl_LF& x) { extern void print_float (cl_ostream stream, const cl_print_flags& flags, const cl_F& z); - extern cl_print_flags cl_default_print_flags; - print_float(stream,cl_default_print_flags,x); + extern cl_print_flags default_print_flags; + print_float(stream,default_print_flags,x); } CL_DEFINE_PRINT_OPERATOR(cl_LF) +} // namespace cln + #endif /* _CL_LFLOAT_IO_H */ diff --git a/include/cl_malloc.h b/include/cln/malloc.h similarity index 69% rename from include/cl_malloc.h rename to include/cln/malloc.h index 1528438..d894ee4 100644 --- a/include/cl_malloc.h +++ b/include/cln/malloc.h @@ -5,9 +5,13 @@ #include +namespace cln { + // Function like malloc() which returns aligned memory of size (> 0) bytes. -extern void* (*cl_malloc_hook) (size_t size); +extern void* (*malloc_hook) (size_t size); // Function like free() which makes available for reuse such memory. -extern void (*cl_free_hook) (void* ptr); +extern void (*free_hook) (void* ptr); + +} // namespace cln #endif /* _CL_MALLOC_H */ diff --git a/include/cl_modinteger.h b/include/cln/modinteger.h similarity index 93% rename from include/cl_modinteger.h rename to include/cln/modinteger.h index 06c9a85..ed3b153 100644 --- a/include/cl_modinteger.h +++ b/include/cln/modinteger.h @@ -3,17 +3,18 @@ #ifndef _CL_MODINTEGER_H #define _CL_MODINTEGER_H -#include "cl_object.h" -#include "cl_ring.h" -#include "cl_integer.h" -#include "cl_random.h" -#include "cl_malloc.h" -#include "cl_io.h" -#include "cl_proplist.h" -#include "cl_condition.h" -#include "cl_abort.h" +#include "cln/object.h" +#include "cln/ring.h" +#include "cln/integer.h" +#include "cln/random.h" +#include "cln/malloc.h" +#include "cln/io.h" +#include "cln/proplist.h" +#include "cln/condition.h" +#include "cln/abort.h" #undef random // Linux defines random() as a macro! +namespace cln { // Representation of an element of a ring Z/mZ. @@ -74,10 +75,10 @@ struct cl_composite_condition : public cl_condition { // Constructors. cl_composite_condition (const cl_I& _p) : p (_p), factor (0) - { print(cl_stderr); } + { print(stderr); } cl_composite_condition (const cl_I& _p, const cl_I& _f) : p (_p), factor (_f) - { print(cl_stderr); } + { print(stderr); } // Implement general condition methods. const char * name () const; void print (cl_ostream) const; @@ -101,9 +102,9 @@ public: // Conversion. CL_DEFINE_CONVERTER(_cl_ring_element) public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, _cl_MI* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } }; class cl_MI /* cf. cl_ring_element */ : public _cl_MI { @@ -123,9 +124,9 @@ public: // Debugging output. void debug_print () const; public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_MI* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } }; @@ -154,7 +155,7 @@ struct _cl_modint_setops /* cf. _cl_ring_setops */ { // equality cl_boolean (* equal) (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y); // random number - const _cl_MI (* random) (cl_heap_modint_ring* R, cl_random_state& randomstate); + const _cl_MI (* random) (cl_heap_modint_ring* R, random_state& randomstate); }; struct _cl_modint_addops /* cf. _cl_ring_addops */ { // 0 @@ -189,15 +190,9 @@ struct _cl_modint_mulops /* cf. _cl_ring_mulops */ { // some inverse of canonical homomorphism const cl_I (* retract) (cl_heap_modint_ring* R, const _cl_MI& x); }; -#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ < 8) // workaround two g++-2.7.0 bugs - #define cl_modint_setops _cl_modint_setops - #define cl_modint_addops _cl_modint_addops - #define cl_modint_mulops _cl_modint_mulops -#else typedef const _cl_modint_setops cl_modint_setops; typedef const _cl_modint_addops cl_modint_addops; typedef const _cl_modint_mulops cl_modint_mulops; -#endif // Representation of the ring Z/mZ. @@ -223,7 +218,7 @@ public: { setops->fprint(this,stream,x); } cl_boolean _equal (const _cl_MI& x, const _cl_MI& y) { return setops->equal(this,x,y); } - const _cl_MI _random (cl_random_state& randomstate) + const _cl_MI _random (random_state& randomstate) { return setops->random(this,randomstate); } const _cl_MI _zero () { return addops->zero(this); } @@ -267,7 +262,7 @@ public: if (!(y.ring() == this)) cl_abort(); return _equal(x,y); } - const cl_MI random (cl_random_state& randomstate = cl_default_random_state) + const cl_MI random (random_state& randomstate = default_random_state) { return cl_MI(this,_random(randomstate)); } @@ -365,7 +360,7 @@ private: SUBCLASS_cl_heap_ring() // Lookup or create a modular integer ring Z/mZ -extern const cl_modint_ring cl_find_modint_ring (const cl_I& m); +extern const cl_modint_ring find_modint_ring (const cl_I& m); CL_REQUIRE(cl_MI) // Runtime typing support. @@ -466,5 +461,6 @@ static void* const cl_MI_debug_dummy[] = { &cl_MI_debug_dummy, }; #endif +} // namespace cln #endif /* _CL_MODINTEGER_H */ diff --git a/include/cl_modules.h b/include/cln/modules.h similarity index 100% rename from include/cl_modules.h rename to include/cln/modules.h diff --git a/include/cl_null_ring.h b/include/cln/null_ring.h similarity index 80% rename from include/cl_null_ring.h rename to include/cln/null_ring.h index 4a49171..474bdea 100644 --- a/include/cl_null_ring.h +++ b/include/cln/null_ring.h @@ -3,10 +3,14 @@ #ifndef _CL_NULL_RING_H #define _CL_NULL_RING_H -#include "cl_ring.h" +#include "cln/ring.h" + +namespace cln { class cl_null_ring : public cl_ring { public: cl_null_ring (); }; extern const cl_null_ring cl_0_ring; // math. {0} //CL_REQUIRE(cl_0_ring) +} // namespace cln + #endif /* _CL_NULL_RING_H */ diff --git a/include/cl_number.h b/include/cln/number.h similarity index 99% rename from include/cl_number.h rename to include/cln/number.h index e46fbab..1f02f3d 100644 --- a/include/cl_number.h +++ b/include/cln/number.h @@ -3,8 +3,10 @@ #ifndef _CL_NUMBER_H #define _CL_NUMBER_H -#include "cl_object.h" -#include "cl_malloc.h" +#include "cln/object.h" +#include "cln/malloc.h" + +namespace cln { // Type hierachy: // Number (N) = @@ -21,7 +23,6 @@ // Ratio (RT) // Complex (C) - // Constructors and assignment operators from C numeric types. #define CL_DEFINE_INT_CONSTRUCTOR(_class_,_type_) \ @@ -241,5 +242,6 @@ CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_number) const type& __tmp_##x = *(const type*) &x; \ const type& x = __tmp_##x; +} // namespace cln #endif /* _CL_NUMBER_H */ diff --git a/include/cl_number_io.h b/include/cln/number_io.h similarity index 91% rename from include/cl_number_io.h rename to include/cln/number_io.h index 0758c2b..bf77a05 100644 --- a/include/cl_number_io.h +++ b/include/cln/number_io.h @@ -3,8 +3,10 @@ #ifndef _CL_NUMBER_IO_H #define _CL_NUMBER_IO_H -#include "cl_io.h" -#include "cl_number.h" +#include "cln/io.h" +#include "cln/number.h" + +namespace cln { // Input. @@ -31,4 +33,6 @@ extern void read_number_eof (void); struct cl_read_flags; +} // namespace cln + #endif /* _CL_NUMBER_IO_H */ diff --git a/include/cl_numtheory.h b/include/cln/numtheory.h similarity index 95% rename from include/cl_numtheory.h rename to include/cln/numtheory.h index f4533f2..f84360a 100644 --- a/include/cl_numtheory.h +++ b/include/cln/numtheory.h @@ -3,10 +3,12 @@ #ifndef _CL_NUMTHEORY_H #define _CL_NUMTHEORY_H -#include "cl_number.h" -#include "cl_integer.h" -#include "cl_modinteger.h" -#include "cl_condition.h" +#include "cln/number.h" +#include "cln/integer.h" +#include "cln/modinteger.h" +#include "cln/condition.h" + +namespace cln { // jacobi(a,b) returns the Jacobi symbol // ( a ) @@ -83,4 +85,6 @@ struct cornacchia_t { extern const cornacchia_t cornacchia1 (const cl_I& d, const cl_I& p); extern const cornacchia_t cornacchia4 (const cl_I& d, const cl_I& p); +} // namespace cln + #endif /* _CL_NUMTHEORY_H */ diff --git a/include/cl_object.h b/include/cln/object.h similarity index 97% rename from include/cl_object.h rename to include/cln/object.h index 605ea26..12857d9 100644 --- a/include/cl_object.h +++ b/include/cln/object.h @@ -3,10 +3,12 @@ #ifndef _CL_OBJECT_H #define _CL_OBJECT_H -#include "cl_types.h" -#include "cl_modules.h" +#include "cln/types.h" +#include "cln/modules.h" #include +namespace cln { + // We don't have to deal with circular structures, so normal reference counting // is sufficient. Is also has the advantage of being mostly non-interrupting. @@ -167,7 +169,7 @@ typedef void (*cl_heap_destructor_function) (cl_heap* pointer); #define cl_class_flags_subclass_rational 8 // all instances belong to cl_RA #define cl_class_flags_number_ring 16 // all instances are rings whose // elements belong to cl_number -// Function to print an object for debugging, to cl_stderr. +// Function to print an object for debugging, to stderr. typedef void (*cl_heap_dprint_function) (cl_heap* pointer); struct cl_class { @@ -543,20 +545,13 @@ inline cl_private_thing as_cl_private_thing (const cl_rcpointer& x) // Define a conversion operator from one object to another object of the // same size. -#if (defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ <= 7)) // workaround g++ bug - #define CL_DEFINE_CONVERTER(target_class) \ - operator target_class () const \ - { \ - if (sizeof(*this) != sizeof(target_class)) cl_abort(); \ - return * (const target_class *) (void*) this; \ - } -#else #define CL_DEFINE_CONVERTER(target_class) \ operator const target_class & () const \ { \ if (sizeof(*this) != sizeof(target_class)) cl_abort(); \ return * (const target_class *) (void*) this; \ } -#endif + +} // namespace cln #endif /* _CL_OBJECT_H */ diff --git a/include/cl_output.h b/include/cln/output.h similarity index 86% rename from include/cl_output.h rename to include/cln/output.h index 3ad224b..907f47f 100644 --- a/include/cl_output.h +++ b/include/cln/output.h @@ -3,10 +3,12 @@ #ifndef _CL_OUTPUT_H #define _CL_OUTPUT_H -#include "cl_types.h" -#include "cl_floatformat.h" -#include "cl_io.h" -#include "cl_string.h" +#include "cln/types.h" +#include "cln/floatformat.h" +#include "cln/io.h" +#include "cln/string.h" + +namespace cln { struct cl_print_rational_flags { // Base in which rational numbers are to be printed. @@ -24,11 +26,11 @@ struct cl_print_float_flags { // Flag whether to prefer type specific exponent markers over 'E'. cl_boolean float_readably; // If !float_readably, the format which earns the 'E' exponent marker. - cl_float_format_t default_float_format; + float_format_t default_float_format; // Constructor. cl_print_float_flags () : float_readably (cl_false), - default_float_format (cl_float_format_ffloat) {} + default_float_format (float_format_ffloat) {} }; struct cl_print_real_flags : cl_print_rational_flags, cl_print_float_flags {}; @@ -65,6 +67,8 @@ struct cl_print_univpoly_flags { struct cl_print_flags : cl_print_number_flags, cl_print_vector_flags, cl_print_univpoly_flags {}; -extern cl_print_flags cl_default_print_flags; +extern cl_print_flags default_print_flags; + +} // namespace cln #endif /* _CL_OUTPUT_H */ diff --git a/include/cl_proplist.h b/include/cln/proplist.h similarity index 79% rename from include/cl_proplist.h rename to include/cln/proplist.h index 15f3dde..02898a8 100644 --- a/include/cl_proplist.h +++ b/include/cln/proplist.h @@ -3,8 +3,10 @@ #ifndef _CL_PROPLIST_H #define _CL_PROPLIST_H -#include "cl_symbol.h" -#include "cl_malloc.h" +#include "cln/symbol.h" +#include "cln/malloc.h" + +namespace cln { // The only extensible way to extend objects at runtime in an extensible // and decentralized way (without having to modify the object's class) @@ -25,16 +27,16 @@ public: // Destructor. virtual ~cl_property () {} // Allocation and deallocation. - void* operator new (size_t size) { return cl_malloc_hook(size); } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void* operator new (size_t size) { return malloc_hook(size); } + void operator delete (void* ptr) { free_hook(ptr); } private: virtual void dummy (); // Friend declarations. They are for the compiler. Just ignore them. friend class cl_property_list; }; #define SUBCLASS_cl_property() \ - void* operator new (size_t size) { return cl_malloc_hook(size); } \ - void operator delete (void* ptr) { cl_free_hook(ptr); } + void* operator new (size_t size) { return malloc_hook(size); } \ + void operator delete (void* ptr) { free_hook(ptr); } struct cl_property_list { private: @@ -48,4 +50,6 @@ public: ~cl_property_list (); }; +} // namespace cln + #endif /* _CL_PROPLIST_H */ diff --git a/include/cl_random.h b/include/cln/random.h similarity index 69% rename from include/cl_random.h rename to include/cln/random.h index 6ea7812..df0ce67 100644 --- a/include/cl_random.h +++ b/include/cln/random.h @@ -3,26 +3,28 @@ #ifndef _CL_RANDOM_H #define _CL_RANDOM_H -#include "cl_types.h" -#include "cl_modules.h" +#include "cln/types.h" +#include "cln/modules.h" -class cl_random_state { +namespace cln { + +class random_state { public: struct { uint32 hi; uint32 lo; } seed; // Constructor: - cl_random_state (); + random_state (); }; // random32(randomstate) liefert eine neue Zufallszahl. // > randomstate: ein Random-State, wird verändert // < ergebnis: eine 32-Bit-Zufallszahl -extern uint32 random32 (cl_random_state& randomstate); +extern uint32 random32 (random_state& randomstate); #if defined(HAVE_FAST_LONGLONG) // random64(randomstate) liefert eine neue Zufallszahl. // > randomstate: ein Random-State, wird verändert // < ergebnis: eine 64-Bit-Zufallszahl -inline uint64 random64 (cl_random_state& randomstate) +inline uint64 random64 (random_state& randomstate) { return ((uint64)random32(randomstate) << 32) | (uint64)random32(randomstate); @@ -30,14 +32,16 @@ inline uint64 random64 (cl_random_state& randomstate) #endif // Ein globaler Zufallszahlengenerator. -extern cl_random_state cl_default_random_state; +extern random_state default_random_state; CL_REQUIRE(cl_random_def) // Das ist der Default-Generator. inline uint32 random32 (void) - { return random32(cl_default_random_state); } + { return random32(default_random_state); } #if defined(HAVE_FAST_LONGLONG) inline uint64 random64 (void) - { return random64(cl_default_random_state); } + { return random64(default_random_state); } #endif +} // namespace cln + #endif /* _CL_RANDOM_H */ diff --git a/include/cl_rational.h b/include/cln/rational.h similarity index 93% rename from include/cl_rational.h rename to include/cln/rational.h index 523a8b6..5992572 100644 --- a/include/cl_rational.h +++ b/include/cln/rational.h @@ -3,10 +3,11 @@ #ifndef _CL_RATIONAL_H #define _CL_RATIONAL_H -#include "cl_number.h" -#include "cl_rational_class.h" -#include "cl_integer_class.h" +#include "cln/number.h" +#include "cln/rational_class.h" +#include "cln/integer_class.h" +namespace cln { CL_DEFINE_AS_CONVERSION(cl_RA) @@ -70,27 +71,27 @@ extern const cl_RA minus1 (const cl_RA& r); // (abs r), wo r eine rationale Zahl ist. extern const cl_RA abs (const cl_RA& r); -// cl_equal(r,s) vergleicht zwei rationale Zahlen r und s auf Gleichheit. -extern cl_boolean cl_equal (const cl_RA& r, const cl_RA& s); -// cl_equal_hashcode(r) liefert einen cl_equal-invarianten Hashcode für r. -extern uint32 cl_equal_hashcode (const cl_RA& r); +// equal(r,s) vergleicht zwei rationale Zahlen r und s auf Gleichheit. +extern cl_boolean equal (const cl_RA& r, const cl_RA& s); +// equal_hashcode(r) liefert einen equal-invarianten Hashcode für r. +extern uint32 equal_hashcode (const cl_RA& r); -// cl_compare(r,s) vergleicht zwei rationale Zahlen r und s. +// compare(r,s) vergleicht zwei rationale Zahlen r und s. // Ergebnis: 0 falls r=s, +1 falls r>s, -1 falls r= (const cl_RA& x, const cl_RA& y) - { return cl_compare(x,y)>=0; } + { return compare(x,y)>=0; } inline bool operator> (const cl_RA& x, const cl_RA& y) - { return cl_compare(x,y)>0; } + { return compare(x,y)>0; } // minusp(x) == (< x 0) extern cl_boolean minusp (const cl_RA& x); @@ -259,10 +260,10 @@ extern const cl_RA expt (const cl_RA& x, const cl_I& y); extern cl_boolean logp (const cl_RA& a, const cl_RA& b, cl_RA* l); // Konversion zu einem C "float". -extern float cl_float_approx (const cl_RA& x); +extern float float_approx (const cl_RA& x); // Konversion zu einem C "double". -extern double cl_double_approx (const cl_RA& x); +extern double double_approx (const cl_RA& x); #ifdef WANT_OBFUSCATING_OPERATORS @@ -298,5 +299,6 @@ static void* const cl_RA_debug_dummy[] = { &cl_RA_debug_dummy, }; #endif +} // namespace cln #endif /* _CL_RATIONAL_H */ diff --git a/include/cl_rational_class.h b/include/cln/rational_class.h similarity index 88% rename from include/cl_rational_class.h rename to include/cln/rational_class.h index 13c0dc0..93470f1 100644 --- a/include/cl_rational_class.h +++ b/include/cln/rational_class.h @@ -3,9 +3,10 @@ #ifndef _CL_RATIONAL_CLASS_H #define _CL_RATIONAL_CLASS_H -#include "cl_number.h" -#include "cl_real_class.h" +#include "cln/number.h" +#include "cln/real_class.h" +namespace cln { class cl_RA : public cl_R { public: @@ -31,9 +32,9 @@ public: cl_RA (cl_private_thing); cl_RA (struct cl_heap_ratio *); public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_RA* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } private: // Friend declarations. They are for the compiler. Just ignore them. }; @@ -53,5 +54,6 @@ CL_DEFINE_INT_ASSIGNMENT_OPERATORS(cl_RA) CL_DEFINE_LONG_CONSTRUCTORS(cl_RA) CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_RA) +} // namespace cln #endif /* _CL_RATIONAL_CLASS_H */ diff --git a/include/cl_rational_io.h b/include/cln/rational_io.h similarity index 93% rename from include/cl_rational_io.h rename to include/cln/rational_io.h index 3ab2721..f96ebc2 100644 --- a/include/cl_rational_io.h +++ b/include/cln/rational_io.h @@ -3,9 +3,10 @@ #ifndef _CL_RATIONAL_IO_H #define _CL_RATIONAL_IO_H -#include "cl_number_io.h" -#include "cl_rational.h" +#include "cln/number_io.h" +#include "cln/rational.h" +namespace cln { // Undocumented input functions @@ -66,11 +67,12 @@ extern void print_rational (cl_ostream stream, const cl_print_rational_flags& fl inline void fprint (cl_ostream stream, const cl_RA& x) { - extern cl_print_flags cl_default_print_flags; - print_rational(stream,cl_default_print_flags,x); + extern cl_print_flags default_print_flags; + print_rational(stream,default_print_flags,x); } CL_DEFINE_PRINT_OPERATOR(cl_RA) +} // namespace cln #endif /* _CL_RATIONAL_IO_H */ diff --git a/include/cl_rational_ring.h b/include/cln/rational_ring.h similarity index 76% rename from include/cl_rational_ring.h rename to include/cln/rational_ring.h index 1f3e4c0..b6026cc 100644 --- a/include/cl_rational_ring.h +++ b/include/cln/rational_ring.h @@ -3,12 +3,16 @@ #ifndef _CL_RATIONAL_RING_H #define _CL_RATIONAL_RING_H -#include "cl_ring.h" -#include "cl_rational_class.h" +#include "cln/ring.h" +#include "cln/rational_class.h" + +namespace cln { typedef cl_specialized_number_ring cl_rational_ring; extern const cl_rational_ring cl_RA_ring; // math. Q extern cl_class cl_class_rational_ring; //CL_REQUIRE(cl_RA_ring) +} // namespace cln + #endif /* _CL_RATIONAL_RING_H */ diff --git a/include/cl_real.h b/include/cln/real.h similarity index 93% rename from include/cl_real.h rename to include/cln/real.h index 74dd5f2..5061ced 100644 --- a/include/cl_real.h +++ b/include/cln/real.h @@ -3,14 +3,15 @@ #ifndef _CL_REAL_H #define _CL_REAL_H -#include "cl_number.h" -#include "cl_real_class.h" -#include "cl_rational_class.h" -#include "cl_integer_class.h" -#include "cl_float.h" -#include "cl_floatformat.h" -#include "cl_random.h" +#include "cln/number.h" +#include "cln/real_class.h" +#include "cln/rational_class.h" +#include "cln/integer_class.h" +#include "cln/float.h" +#include "cln/floatformat.h" +#include "cln/random.h" +namespace cln { CL_DEFINE_AS_CONVERSION(cl_R) @@ -54,13 +55,13 @@ extern const cl_F cl_float (const cl_R& x, const cl_F& y); // > x: eine reelle Zahl // > f: eine Float-Format-Spezifikation // < ergebnis: (float x f) -extern const cl_F cl_float (const cl_R& x, cl_float_format_t f); +extern const cl_F cl_float (const cl_R& x, float_format_t f); // cl_float(x) wandelt eine reelle Zahl x in ein Float um // und rundet dabei nötigenfalls. // > x: eine reelle Zahl // < ergebnis: (float x) -// Abhängig von cl_default_float_format. +// Abhängig von default_float_format. extern const cl_F cl_float (const cl_R& x); @@ -279,27 +280,27 @@ extern const cl_RA rational (const cl_R& x); inline const cl_RA rational (const cl_RA& x) { return x; } -// cl_equal(x,y) vergleicht zwei reelle Zahlen x und y auf Gleichheit. -extern cl_boolean cl_equal (const cl_R& x, const cl_R& y); -// cl_equal_hashcode(x) liefert einen cl_equal-invarianten Hashcode für x. -extern uint32 cl_equal_hashcode (const cl_R& x); +// equal(x,y) vergleicht zwei reelle Zahlen x und y auf Gleichheit. +extern cl_boolean equal (const cl_R& x, const cl_R& y); +// equal_hashcode(x) liefert einen equal-invarianten Hashcode für x. +extern uint32 equal_hashcode (const cl_R& x); -// cl_compare(x,y) vergleicht zwei reelle Zahlen x und y. +// compare(x,y) vergleicht zwei reelle Zahlen x und y. // Ergebnis: 0 falls x=y, +1 falls x>y, -1 falls x= (const cl_R& x, const cl_R& y) - { return cl_compare(x,y)>=0; } + { return compare(x,y)>=0; } inline bool operator> (const cl_R& x, const cl_R& y) - { return cl_compare(x,y)>0; } + { return compare(x,y)>0; } // max(x,y) liefert (max x y), wo x und y reelle Zahlen sind. extern const cl_R max (const cl_R& x, const cl_R& y); @@ -324,10 +325,10 @@ extern const cl_RA rationalize (const cl_R& x); // Konversion zu einem C "float". -extern float cl_float_approx (const cl_R& x); +extern float float_approx (const cl_R& x); // Konversion zu einem C "double". -extern double cl_double_approx (const cl_R& x); +extern double double_approx (const cl_R& x); // Transcendental functions @@ -376,8 +377,8 @@ inline const cl_R cos (const unsigned int x) { return cos(cl_I(x)); } inline const cl_R cos (const long x) { return cos(cl_I(x)); } inline const cl_R cos (const unsigned long x) { return cos(cl_I(x)); } -// cl_cos_sin(x) liefert ((cos x),(sin x)), beide Werte. -extern const cl_cos_sin_t cl_cos_sin (const cl_R& x); +// cos_sin(x) liefert ((cos x),(sin x)), beide Werte. +extern const cos_sin_t cos_sin (const cl_R& x); // tan(x) liefert den Tangens (tan x) einer reellen Zahl x. extern const cl_R tan (const cl_R& x); @@ -424,8 +425,8 @@ inline const cl_R cosh (const unsigned int x) { return cosh(cl_I(x)); } inline const cl_R cosh (const long x) { return cosh(cl_I(x)); } inline const cl_R cosh (const unsigned long x) { return cosh(cl_I(x)); } -// cl_cosh_sinh(x) liefert ((cosh x),(sinh x)), beide Werte. -extern const cl_cosh_sinh_t cl_cosh_sinh (const cl_R& x); +// cosh_sinh(x) liefert ((cosh x),(sinh x)), beide Werte. +extern const cosh_sinh_t cosh_sinh (const cl_R& x); // tanh(x) liefert zu einer reellen Zahl x die Zahl tanh(x). extern const cl_R tanh (const cl_R& x); @@ -438,10 +439,10 @@ inline const cl_R tanh (const unsigned long x) { return tanh(cl_I(x)); } // random_R(randomstate,n) liefert zu einer reellen Zahl n>0 eine Zufallszahl // x mit 0 <= x < n. -extern const cl_R random_R (cl_random_state& randomstate, const cl_R& n); +extern const cl_R random_R (random_state& randomstate, const cl_R& n); inline const cl_R random_R (const cl_R& n) - { return random_R(cl_default_random_state,n); } + { return random_R(default_random_state,n); } #ifdef WANT_OBFUSCATING_OPERATORS @@ -515,5 +516,6 @@ static void* const cl_R_debug_dummy[] = { &cl_R_debug_dummy, }; #endif +} // namespace cln #endif /* _CL_REAL_H */ diff --git a/include/cl_real_class.h b/include/cln/real_class.h similarity index 89% rename from include/cl_real_class.h rename to include/cln/real_class.h index 07274b5..41c0c51 100644 --- a/include/cl_real_class.h +++ b/include/cln/real_class.h @@ -3,9 +3,10 @@ #ifndef _CL_REAL_CLASS_H #define _CL_REAL_CLASS_H -#include "cl_number.h" -#include "cl_complex_class.h" +#include "cln/number.h" +#include "cln/complex_class.h" +namespace cln { class cl_R : public cl_N { public: @@ -34,9 +35,9 @@ public: // Private constructor. cl_R (cl_private_thing); public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_R* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } private: // Friend declarations. They are for the compiler. Just ignore them. }; @@ -58,6 +59,6 @@ CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_R) CL_DEFINE_FLOAT_CONSTRUCTOR(cl_R) CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_R) - +} // namespace cln #endif /* _CL_REAL_CLASS_H */ diff --git a/include/cl_real_io.h b/include/cln/real_io.h similarity index 89% rename from include/cl_real_io.h rename to include/cln/real_io.h index 83e5634..4af765c 100644 --- a/include/cl_real_io.h +++ b/include/cln/real_io.h @@ -3,9 +3,10 @@ #ifndef _CL_REAL_IO_H #define _CL_REAL_IO_H -#include "cl_number_io.h" -#include "cl_real.h" +#include "cln/number_io.h" +#include "cln/real.h" +namespace cln { // Undocumented input functions @@ -45,11 +46,12 @@ extern void print_real (cl_ostream stream, const cl_print_real_flags& flags, con inline void fprint (cl_ostream stream, const cl_R& x) { - extern cl_print_flags cl_default_print_flags; - print_real(stream,cl_default_print_flags,x); + extern cl_print_flags default_print_flags; + print_real(stream,default_print_flags,x); } CL_DEFINE_PRINT_OPERATOR(cl_R) +} // namespace cln #endif /* _CL_REAL_IO_H */ diff --git a/include/cl_real_ring.h b/include/cln/real_ring.h similarity index 75% rename from include/cl_real_ring.h rename to include/cln/real_ring.h index 09f611c..6baeb9f 100644 --- a/include/cl_real_ring.h +++ b/include/cln/real_ring.h @@ -3,12 +3,16 @@ #ifndef _CL_REAL_RING_H #define _CL_REAL_RING_H -#include "cl_ring.h" -#include "cl_real_class.h" +#include "cln/ring.h" +#include "cln/real_class.h" + +namespace cln { typedef cl_specialized_number_ring cl_real_ring; extern const cl_real_ring cl_R_ring; // math. R extern cl_class cl_class_real_ring; //CL_REQUIRE(cl_R_ring) +} // namespace cln + #endif /* _CL_REAL_RING_H */ diff --git a/include/cl_ring.h b/include/cln/ring.h similarity index 94% rename from include/cl_ring.h rename to include/cln/ring.h index c57431e..b815f69 100644 --- a/include/cl_ring.h +++ b/include/cln/ring.h @@ -3,11 +3,14 @@ #ifndef _CL_RING_H #define _CL_RING_H -#include "cl_object.h" -#include "cl_malloc.h" -#include "cl_proplist.h" -#include "cl_number.h" -#include "cl_io.h" +#include "cln/object.h" +#include "cln/malloc.h" +#include "cln/proplist.h" +#include "cln/number.h" +#include "cln/io.h" + +namespace cln { + class cl_I; // This file defines the general layout of rings, ring elements, and @@ -117,9 +120,9 @@ public: /* ugh */ _cl_ring_element (const cl_heap_ring* R, const cl_gcobject& r) : rep (as_cl_private_thing(r)) { (void)R; } _cl_ring_element (const cl_ring& R, const cl_gcobject& r) : rep (as_cl_private_thing(r)) { (void)R; } public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, _cl_ring_element* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } }; class cl_ring_element : public _cl_ring_element { @@ -136,9 +139,9 @@ public: /* ugh */ public: // Debugging output. void debug_print () const; // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_ring_element* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } }; // The ring operations are encoded as vectors of function pointers. You @@ -182,24 +185,18 @@ struct _cl_ring_mulops { const _cl_ring_element (* expt_pos) (cl_heap_ring* R, const _cl_ring_element& x, const cl_I& y); // ... }; -#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ < 8) // workaround two g++-2.7.0 bugs - #define cl_ring_setops _cl_ring_setops - #define cl_ring_addops _cl_ring_addops - #define cl_ring_mulops _cl_ring_mulops -#else typedef const _cl_ring_setops cl_ring_setops; typedef const _cl_ring_addops cl_ring_addops; typedef const _cl_ring_mulops cl_ring_mulops; -#endif // Representation of a ring in memory. class cl_heap_ring : public cl_heap { public: // Allocation. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } // Deallocation. - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } private: cl_property_list properties; protected: @@ -310,9 +307,9 @@ public: #define SUBCLASS_cl_heap_ring() \ public: \ /* Allocation. */ \ - void* operator new (size_t size) { return cl_malloc_hook(size); } \ + void* operator new (size_t size) { return malloc_hook(size); } \ /* Deallocation. */ \ - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } // Operations on ring elements. @@ -442,5 +439,6 @@ static void* const cl_ring_debug_dummy[] = { &cl_ring_debug_dummy, }; #endif +} // namespace cln #endif /* _CL_RING_H */ diff --git a/include/cl_sfloat.h b/include/cln/sfloat.h similarity index 91% rename from include/cl_sfloat.h rename to include/cln/sfloat.h index 868e439..1f69d90 100644 --- a/include/cl_sfloat.h +++ b/include/cln/sfloat.h @@ -3,11 +3,12 @@ #ifndef _CL_SFLOAT_H #define _CL_SFLOAT_H -#include "cl_number.h" -#include "cl_sfloat_class.h" -#include "cl_integer_class.h" -#include "cl_float.h" +#include "cln/number.h" +#include "cln/sfloat_class.h" +#include "cln/integer_class.h" +#include "cln/float.h" +namespace cln { CL_DEFINE_AS_CONVERSION(cl_SF) @@ -15,25 +16,25 @@ CL_DEFINE_AS_CONVERSION(cl_SF) // Liefert zu einem Short-Float x : (- x), ein SF. extern const cl_SF operator- (const cl_SF& x); -// cl_compare(x,y) vergleicht zwei Short-Floats x und y. +// compare(x,y) vergleicht zwei Short-Floats x und y. // Ergebnis: 0 falls x=y, +1 falls x>y, -1 falls x= (const cl_SF& x, const cl_SF& y) - { return cl_compare(x,y)>=0; } + { return compare(x,y)>=0; } inline bool operator> (const cl_SF& x, const cl_SF& y) - { return cl_compare(x,y)>0; } + { return compare(x,y)>0; } // minusp(x) == (< x 0) extern cl_boolean minusp (const cl_SF& x); @@ -204,19 +205,19 @@ inline const cl_I round1 (const cl_SF& x, const cl_SF& y) { return round1(x/y); // Return type for decode_float: -struct cl_decoded_sfloat { +struct decoded_sfloat { cl_SF mantissa; cl_I exponent; cl_SF sign; // Constructor. - cl_decoded_sfloat () {} - cl_decoded_sfloat (const cl_SF& m, const cl_I& e, const cl_SF& s) : mantissa(m), exponent(e), sign(s) {} + decoded_sfloat () {} + decoded_sfloat (const cl_SF& m, const cl_I& e, const cl_SF& s) : mantissa(m), exponent(e), sign(s) {} }; // decode_float(x) liefert zu einem Float x: (decode-float x). // x = 0.0 liefert (0.0, 0, 1.0). // x = (-1)^s * 2^e * m liefert ((-1)^0 * 2^0 * m, e als Integer, (-1)^s). -extern const cl_decoded_sfloat decode_float (const cl_SF& x); +extern const decoded_sfloat decode_float (const cl_SF& x); // float_exponent(x) liefert zu einem Float x: // den Exponenten von (decode-float x). @@ -266,10 +267,10 @@ extern const cl_SF signum (const cl_SF& x); // Konversion zu einem C "float". -extern float cl_float_approx (const cl_SF& x); +extern float float_approx (const cl_SF& x); // Konversion zu einem C "double". -extern double cl_double_approx (const cl_SF& x); +extern double double_approx (const cl_SF& x); #ifdef WANT_OBFUSCATING_OPERATORS @@ -300,5 +301,6 @@ static void* const cl_SF_debug_dummy[] = { &cl_SF_debug_dummy, }; #endif +} // namespace cln #endif /* _CL_SFLOAT_H */ diff --git a/include/cl_sfloat_class.h b/include/cln/sfloat_class.h similarity index 83% rename from include/cl_sfloat_class.h rename to include/cln/sfloat_class.h index ffa2281..9032e15 100644 --- a/include/cl_sfloat_class.h +++ b/include/cln/sfloat_class.h @@ -3,9 +3,10 @@ #ifndef _CL_SFLOAT_CLASS_H #define _CL_SFLOAT_CLASS_H -#include "cl_number.h" -#include "cl_float_class.h" +#include "cln/number.h" +#include "cln/float_class.h" +namespace cln { class cl_SF : public cl_F { public: @@ -24,9 +25,9 @@ public: cl_SF (cl_private_thing); cl_SF (struct cl_sfloat * /* NULL! */, cl_uint); public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_SF* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } }; // Private constructors. @@ -39,5 +40,6 @@ inline cl_SF::cl_SF () // The copy constructors. CL_DEFINE_COPY_CONSTRUCTOR2(cl_SF,cl_F) +} // namespace cln #endif /* _CL_SFLOAT_CLASS_H */ diff --git a/include/cl_sfloat_io.h b/include/cln/sfloat_io.h similarity index 70% rename from include/cl_sfloat_io.h rename to include/cln/sfloat_io.h index 7b72cda..be9ae14 100644 --- a/include/cl_sfloat_io.h +++ b/include/cln/sfloat_io.h @@ -3,8 +3,10 @@ #ifndef _CL_SFLOAT_IO_H #define _CL_SFLOAT_IO_H -#include "cl_number_io.h" -#include "cl_sfloat.h" +#include "cln/number_io.h" +#include "cln/sfloat.h" + +namespace cln { inline cl_istream operator>> (cl_istream stream, cl_SF& result) { @@ -15,13 +17,15 @@ inline cl_istream operator>> (cl_istream stream, cl_SF& result) } // The following does strictly the same as the general `fprint' for floats. -// It is here only so that people don't need to include . +// It is here only so that people don't need to include . inline void fprint (cl_ostream stream, const cl_SF& x) { extern void print_float (cl_ostream stream, const cl_print_flags& flags, const cl_F& z); - extern cl_print_flags cl_default_print_flags; - print_float(stream,cl_default_print_flags,x); + extern cl_print_flags default_print_flags; + print_float(stream,default_print_flags,x); } CL_DEFINE_PRINT_OPERATOR(cl_SF) +} // namespace cln + #endif /* _CL_SFLOAT_IO_H */ diff --git a/include/cl_string.h b/include/cln/string.h similarity index 98% rename from include/cl_string.h rename to include/cln/string.h index ec177c5..b9f2de2 100644 --- a/include/cl_string.h +++ b/include/cln/string.h @@ -3,11 +3,13 @@ #ifndef _CL_STRING_H #define _CL_STRING_H -#include "cl_object.h" -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/object.h" +#include "cln/io.h" +#include "cln/abort.h" #include +namespace cln { + // General, reference counted and garbage collected strings. struct cl_heap_string : public cl_heap { private: @@ -134,8 +136,6 @@ CL_DEFINE_PRINT_OPERATOR(cl_string) // Input. -#ifdef CL_IO_IOSTREAM - // Reads a line. Up to delim. The delimiter character is not placed in the // resulting string. The delimiter character is kept in the input stream. // If EOF is encountered, the stream's eofbit is set. @@ -157,8 +157,6 @@ extern const cl_string cl_fgetline (cl_istream stream, int n, char delim = '\n') // If EOF is encountered, the stream's eofbit is set. extern cl_istream operator>> (cl_istream stream, cl_string& str); -#endif - // Runtime typing support. extern cl_class cl_class_string; @@ -170,4 +168,6 @@ static void* const cl_string_debug_dummy[] = { &cl_string_debug_dummy, }; #endif +} // namespace cln + #endif /* _CL_STRING_H */ diff --git a/include/cl_symbol.h b/include/cln/symbol.h similarity index 95% rename from include/cl_symbol.h rename to include/cln/symbol.h index f4fd0a0..e4ee0d6 100644 --- a/include/cl_symbol.h +++ b/include/cln/symbol.h @@ -3,7 +3,9 @@ #ifndef _CL_SYMBOL_H #define _CL_SYMBOL_H -#include "cl_string.h" +#include "cln/string.h" + +namespace cln { // Symbols are just strings, uniquified through a global hash table. @@ -47,4 +49,6 @@ extern unsigned long hashcode (const cl_symbol& s); CL_REQUIRE(cl_symbol) +} // namespace cln + #endif /* _CL_SYMBOL_H */ diff --git a/include/cl_timing.h b/include/cln/timing.h similarity index 88% rename from include/cl_timing.h rename to include/cln/timing.h index 6a7f72e..2b65006 100644 --- a/include/cl_timing.h +++ b/include/cln/timing.h @@ -3,11 +3,13 @@ #ifndef _CL_TIMING_H #define _CL_TIMING_H -#include "cl_config.h" -#include "cl_intparam.h" -#include "cl_types.h" +#include "cln/config.h" +#include "cln/intparam.h" +#include "cln/types.h" -#include "cl_io.h" +#include "cln/io.h" + +namespace cln { struct cl_timespec { uintL tv_sec; // seconds since 1970-01-01 @@ -50,8 +52,8 @@ extern void cl_timing_report (cl_ostream, const cl_time_consumption&); struct cl_timing { // Constructor, starts the time interval. cl_timing (cl_time_consumption& accumulator); - cl_timing (cl_ostream destination = cl_stderr); - cl_timing (const char *, cl_ostream destination = cl_stderr); + cl_timing (cl_ostream destination = stderr); + cl_timing (const char *, cl_ostream destination = stderr); // Destructor, closes the time interval and does a report. ~cl_timing (); //private: @@ -65,10 +67,12 @@ struct cl_timing { // Usage: // { CL_TIMING; computation(); } // or { CL_TIMING(accumulator); computation(); } -// or { CL_TIMING(cl_stdout); computation(); } +// or { CL_TIMING(stdout); computation(); } // The timing interval starts immediately and ends at the closing brace. #define CL_TIMING CL_TIMING1(__LINE__) #define CL_TIMING1(line) CL_TIMING2(line) #define CL_TIMING2(line) cl_timing cl_timing_dummy_##line +} // namespace cln + #endif /* _CL_TIMING_H */ diff --git a/include/cl_types.h b/include/cln/types.h similarity index 98% rename from include/cl_types.h rename to include/cln/types.h index aba536c..5f4837e 100644 --- a/include/cl_types.h +++ b/include/cln/types.h @@ -4,10 +4,10 @@ #define _CL_TYPES_H // CPU and other -#include "cl_config.h" +#include "cln/config.h" // char_bitsize, short_bitsize, long_bitsize, long_long_bitsize -#include "cl_intparam.h" +#include "cln/intparam.h" // Elementary arithmetic types of given width: // 8 bits diff --git a/include/cl_univpoly.h b/include/cln/univpoly.h similarity index 93% rename from include/cl_univpoly.h rename to include/cln/univpoly.h index 6010a57..b940d21 100644 --- a/include/cl_univpoly.h +++ b/include/cln/univpoly.h @@ -3,13 +3,15 @@ #ifndef _CL_UNIVPOLY_H #define _CL_UNIVPOLY_H -#include "cl_object.h" -#include "cl_ring.h" -#include "cl_malloc.h" -#include "cl_proplist.h" -#include "cl_symbol.h" -#include "cl_V.h" -#include "cl_io.h" +#include "cln/object.h" +#include "cln/ring.h" +#include "cln/malloc.h" +#include "cln/proplist.h" +#include "cln/symbol.h" +#include "cln/V.h" +#include "cln/io.h" + +namespace cln { // To protect against mixing elements of different polynomial rings, every // polynomial carries its ring in itself. @@ -69,9 +71,9 @@ public: // Conversion. CL_DEFINE_CONVERTER(_cl_ring_element) public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, _cl_UP* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } }; class cl_UP /* cf. cl_ring_element */ : public _cl_UP { @@ -99,9 +101,9 @@ public: // Debugging output. void debug_print () const; public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_UP* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } }; @@ -158,19 +160,11 @@ struct _cl_univpoly_polyops { // evaluate, substitute an element of R const cl_ring_element (* eval) (cl_heap_univpoly_ring* R, const _cl_UP& x, const cl_ring_element& y); }; -#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ < 8) // workaround two g++-2.7.0 bugs - #define cl_univpoly_setops _cl_univpoly_setops - #define cl_univpoly_addops _cl_univpoly_addops - #define cl_univpoly_mulops _cl_univpoly_mulops - #define cl_univpoly_modulops _cl_univpoly_modulops - #define cl_univpoly_polyops _cl_univpoly_polyops -#else typedef const _cl_univpoly_setops cl_univpoly_setops; typedef const _cl_univpoly_addops cl_univpoly_addops; typedef const _cl_univpoly_mulops cl_univpoly_mulops; typedef const _cl_univpoly_modulops cl_univpoly_modulops; typedef const _cl_univpoly_polyops cl_univpoly_polyops; -#endif // Representation of a univariate polynomial ring. @@ -347,11 +341,11 @@ private: // Lookup or create the "standard" univariate polynomial ring over a ring r. -extern const cl_univpoly_ring cl_find_univpoly_ring (const cl_ring& r); +extern const cl_univpoly_ring find_univpoly_ring (const cl_ring& r); //CL_REQUIRE(cl_UP_unnamed) // Lookup or create a univariate polynomial ring with a named variable over r. -extern const cl_univpoly_ring cl_find_univpoly_ring (const cl_ring& r, const cl_symbol& varname); +extern const cl_univpoly_ring find_univpoly_ring (const cl_ring& r, const cl_symbol& varname); //CL_REQUIRE(cl_UP_named) CL_REQUIRE(cl_UP) @@ -468,9 +462,11 @@ static void* const cl_UP_debug_dummy[] = { &cl_UP_debug_dummy, }; #endif +} // namespace cln #endif /* _CL_UNIVPOLY_H */ +namespace cln { // Templates for univariate polynomials of complex/real/rational/integers. @@ -526,9 +522,9 @@ public: // Evaluation. const T operator() (const T& y) const; public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_UP_specialized* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } }; template @@ -622,11 +618,11 @@ private: // Lookup of polynomial rings. template -inline const cl_univpoly_specialized_ring cl_find_univpoly_ring (const cl_specialized_number_ring& r) -{ return The(cl_univpoly_specialized_ring) (cl_find_univpoly_ring((const cl_ring&)r)); } +inline const cl_univpoly_specialized_ring find_univpoly_ring (const cl_specialized_number_ring& r) +{ return The(cl_univpoly_specialized_ring) (find_univpoly_ring((const cl_ring&)r)); } template -inline const cl_univpoly_specialized_ring cl_find_univpoly_ring (const cl_specialized_number_ring& r, const cl_symbol& varname) -{ return The(cl_univpoly_specialized_ring) (cl_find_univpoly_ring((const cl_ring&)r,varname)); } +inline const cl_univpoly_specialized_ring find_univpoly_ring (const cl_specialized_number_ring& r, const cl_symbol& varname) +{ return The(cl_univpoly_specialized_ring) (find_univpoly_ring((const cl_ring&)r,varname)); } // Operations on polynomials. @@ -710,4 +706,6 @@ inline const cl_UP_specialized deriv (const cl_UP_specialized& x) #endif /* _CL_UNIVPOLY_AUX_H */ #endif -#endif +#endif /* notyet */ + +} // namespace cln diff --git a/include/cl_univpoly_complex.h b/include/cln/univpoly_complex.h similarity index 90% rename from include/cl_univpoly_complex.h rename to include/cln/univpoly_complex.h index c87243e..6c16b34 100644 --- a/include/cl_univpoly_complex.h +++ b/include/cln/univpoly_complex.h @@ -3,12 +3,14 @@ #ifndef _CL_UNIVPOLY_COMPLEX_H #define _CL_UNIVPOLY_COMPLEX_H -#include "cl_ring.h" -#include "cl_univpoly.h" -#include "cl_number.h" -#include "cl_complex_class.h" -#include "cl_integer_class.h" -#include "cl_complex_ring.h" +#include "cln/ring.h" +#include "cln/univpoly.h" +#include "cln/number.h" +#include "cln/complex_class.h" +#include "cln/integer_class.h" +#include "cln/complex_ring.h" + +namespace cln { // Normal univariate polynomials with stricter static typing: // `cl_N' instead of `cl_ring_element'. @@ -50,9 +52,9 @@ public: // Evaluation. const cl_N operator() (const cl_N& y) const; public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_UP_N* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } }; class cl_heap_univpoly_complex_ring : public cl_heap_univpoly_ring { @@ -144,10 +146,10 @@ private: }; // Lookup of polynomial rings. -inline const cl_univpoly_complex_ring cl_find_univpoly_ring (const cl_complex_ring& r) -{ return The(cl_univpoly_complex_ring) (cl_find_univpoly_ring((const cl_ring&)r)); } -inline const cl_univpoly_complex_ring cl_find_univpoly_ring (const cl_complex_ring& r, const cl_symbol& varname) -{ return The(cl_univpoly_complex_ring) (cl_find_univpoly_ring((const cl_ring&)r,varname)); } +inline const cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& r) +{ return The(cl_univpoly_complex_ring) (find_univpoly_ring((const cl_ring&)r)); } +inline const cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& r, const cl_symbol& varname) +{ return The(cl_univpoly_complex_ring) (find_univpoly_ring((const cl_ring&)r,varname)); } // Operations on polynomials. @@ -219,4 +221,6 @@ inline const cl_UP_N deriv (const cl_UP_N& x) CL_REQUIRE(cl_C_ring) +} // namespace cln + #endif /* _CL_UNIVPOLY_COMPLEX_H */ diff --git a/include/cl_univpoly_integer.h b/include/cln/univpoly_integer.h similarity index 88% rename from include/cl_univpoly_integer.h rename to include/cln/univpoly_integer.h index 96cea07..9d998f8 100644 --- a/include/cl_univpoly_integer.h +++ b/include/cln/univpoly_integer.h @@ -3,11 +3,13 @@ #ifndef _CL_UNIVPOLY_INTEGER_H #define _CL_UNIVPOLY_INTEGER_H -#include "cl_ring.h" -#include "cl_univpoly.h" -#include "cl_number.h" -#include "cl_integer_class.h" -#include "cl_integer_ring.h" +#include "cln/ring.h" +#include "cln/univpoly.h" +#include "cln/number.h" +#include "cln/integer_class.h" +#include "cln/integer_ring.h" + +namespace cln { // Normal univariate polynomials with stricter static typing: // `cl_I' instead of `cl_ring_element'. @@ -49,9 +51,9 @@ public: // Evaluation. const cl_I operator() (const cl_I& y) const; public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_UP_I* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } }; class cl_heap_univpoly_integer_ring : public cl_heap_univpoly_ring { @@ -143,10 +145,10 @@ private: }; // Lookup of polynomial rings. -inline const cl_univpoly_integer_ring cl_find_univpoly_ring (const cl_integer_ring& r) -{ return The(cl_univpoly_integer_ring) (cl_find_univpoly_ring((const cl_ring&)r)); } -inline const cl_univpoly_integer_ring cl_find_univpoly_ring (const cl_integer_ring& r, const cl_symbol& varname) -{ return The(cl_univpoly_integer_ring) (cl_find_univpoly_ring((const cl_ring&)r,varname)); } +inline const cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& r) +{ return The(cl_univpoly_integer_ring) (find_univpoly_ring((const cl_ring&)r)); } +inline const cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& r, const cl_symbol& varname) +{ return The(cl_univpoly_integer_ring) (find_univpoly_ring((const cl_ring&)r,varname)); } // Operations on polynomials. @@ -216,12 +218,14 @@ CL_REQUIRE(cl_I_ring) // Returns the n-th Tchebychev polynomial (n >= 0). -extern const cl_UP_I cl_tschebychev (sintL n); +extern const cl_UP_I tschebychev (sintL n); // Returns the n-th Hermite polynomial (n >= 0). -extern const cl_UP_I cl_hermite (sintL n); +extern const cl_UP_I hermite (sintL n); // Returns the n-th Laguerre polynomial (n >= 0). -extern const cl_UP_I cl_laguerre (sintL n); +extern const cl_UP_I laguerre (sintL n); + +} // namespace cln #endif /* _CL_UNIVPOLY_INTEGER_H */ diff --git a/include/cl_univpoly_modint.h b/include/cln/univpoly_modint.h similarity index 90% rename from include/cl_univpoly_modint.h rename to include/cln/univpoly_modint.h index 83d6aa9..28f800a 100644 --- a/include/cl_univpoly_modint.h +++ b/include/cln/univpoly_modint.h @@ -3,10 +3,12 @@ #ifndef _CL_UNIVPOLY_MODINT_H #define _CL_UNIVPOLY_MODINT_H -#include "cl_ring.h" -#include "cl_univpoly.h" -#include "cl_modinteger.h" -#include "cl_integer_class.h" +#include "cln/ring.h" +#include "cln/univpoly.h" +#include "cln/modinteger.h" +#include "cln/integer_class.h" + +namespace cln { // Normal univariate polynomials with stricter static typing: // `cl_MI' instead of `cl_ring_element'. @@ -40,9 +42,9 @@ public: // Evaluation. const cl_MI operator() (const cl_MI& y) const; public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_UP_MI* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } }; class cl_heap_univpoly_modint_ring : public cl_heap_univpoly_ring { @@ -135,10 +137,10 @@ private: }; // Lookup of polynomial rings. -inline const cl_univpoly_modint_ring cl_find_univpoly_ring (const cl_modint_ring& r) -{ return The(cl_univpoly_modint_ring) (cl_find_univpoly_ring((const cl_ring&)r)); } -inline const cl_univpoly_modint_ring cl_find_univpoly_ring (const cl_modint_ring& r, const cl_symbol& varname) -{ return The(cl_univpoly_modint_ring) (cl_find_univpoly_ring((const cl_ring&)r,varname)); } +inline const cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& r) +{ return The(cl_univpoly_modint_ring) (find_univpoly_ring((const cl_ring&)r)); } +inline const cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& r, const cl_symbol& varname) +{ return The(cl_univpoly_modint_ring) (find_univpoly_ring((const cl_ring&)r,varname)); } // Operations on polynomials. @@ -206,4 +208,6 @@ inline const cl_MI cl_UP_MI::operator() (const cl_MI& y) const inline const cl_UP_MI deriv (const cl_UP_MI& x) { return The2(cl_UP_MI)(deriv((const cl_UP&)x)); } +} // namespace cln + #endif /* _CL_UNIVPOLY_MODINT_H */ diff --git a/include/cl_univpoly_rational.h b/include/cln/univpoly_rational.h similarity index 89% rename from include/cl_univpoly_rational.h rename to include/cln/univpoly_rational.h index 9a87e04..f9ff026 100644 --- a/include/cl_univpoly_rational.h +++ b/include/cln/univpoly_rational.h @@ -3,12 +3,14 @@ #ifndef _CL_UNIVPOLY_RATIONAL_H #define _CL_UNIVPOLY_RATIONAL_H -#include "cl_ring.h" -#include "cl_univpoly.h" -#include "cl_number.h" -#include "cl_rational_class.h" -#include "cl_integer_class.h" -#include "cl_rational_ring.h" +#include "cln/ring.h" +#include "cln/univpoly.h" +#include "cln/number.h" +#include "cln/rational_class.h" +#include "cln/integer_class.h" +#include "cln/rational_ring.h" + +namespace cln { // Normal univariate polynomials with stricter static typing: // `cl_RA' instead of `cl_ring_element'. @@ -50,9 +52,9 @@ public: // Evaluation. const cl_RA operator() (const cl_RA& y) const; public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_UP_RA* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } }; class cl_heap_univpoly_rational_ring : public cl_heap_univpoly_ring { @@ -144,10 +146,10 @@ private: }; // Lookup of polynomial rings. -inline const cl_univpoly_rational_ring cl_find_univpoly_ring (const cl_rational_ring& r) -{ return The(cl_univpoly_rational_ring) (cl_find_univpoly_ring((const cl_ring&)r)); } -inline const cl_univpoly_rational_ring cl_find_univpoly_ring (const cl_rational_ring& r, const cl_symbol& varname) -{ return The(cl_univpoly_rational_ring) (cl_find_univpoly_ring((const cl_ring&)r,varname)); } +inline const cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& r) +{ return The(cl_univpoly_rational_ring) (find_univpoly_ring((const cl_ring&)r)); } +inline const cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& r, const cl_symbol& varname) +{ return The(cl_univpoly_rational_ring) (find_univpoly_ring((const cl_ring&)r,varname)); } // Operations on polynomials. @@ -221,6 +223,8 @@ CL_REQUIRE(cl_RA_ring) // Returns the n-th Legendre polynomial (n >= 0). -extern const cl_UP_RA cl_legendre (sintL n); +extern const cl_UP_RA legendre (sintL n); + +} // namespace cln #endif /* _CL_UNIVPOLY_RATIONAL_H */ diff --git a/include/cl_univpoly_real.h b/include/cln/univpoly_real.h similarity index 90% rename from include/cl_univpoly_real.h rename to include/cln/univpoly_real.h index c04736b..064e73d 100644 --- a/include/cl_univpoly_real.h +++ b/include/cln/univpoly_real.h @@ -3,12 +3,14 @@ #ifndef _CL_UNIVPOLY_REAL_H #define _CL_UNIVPOLY_REAL_H -#include "cl_ring.h" -#include "cl_univpoly.h" -#include "cl_number.h" -#include "cl_real_class.h" -#include "cl_integer_class.h" -#include "cl_real_ring.h" +#include "cln/ring.h" +#include "cln/univpoly.h" +#include "cln/number.h" +#include "cln/real_class.h" +#include "cln/integer_class.h" +#include "cln/real_ring.h" + +namespace cln { // Normal univariate polynomials with stricter static typing: // `cl_R' instead of `cl_ring_element'. @@ -50,9 +52,9 @@ public: // Evaluation. const cl_R operator() (const cl_R& y) const; public: // Ability to place an object at a given address. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } void* operator new (size_t size, cl_UP_R* ptr) { (void)size; return ptr; } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } }; class cl_heap_univpoly_real_ring : public cl_heap_univpoly_ring { @@ -144,10 +146,10 @@ private: }; // Lookup of polynomial rings. -inline const cl_univpoly_real_ring cl_find_univpoly_ring (const cl_real_ring& r) -{ return The(cl_univpoly_real_ring) (cl_find_univpoly_ring((const cl_ring&)r)); } -inline const cl_univpoly_real_ring cl_find_univpoly_ring (const cl_real_ring& r, const cl_symbol& varname) -{ return The(cl_univpoly_real_ring) (cl_find_univpoly_ring((const cl_ring&)r,varname)); } +inline const cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& r) +{ return The(cl_univpoly_real_ring) (find_univpoly_ring((const cl_ring&)r)); } +inline const cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& r, const cl_symbol& varname) +{ return The(cl_univpoly_real_ring) (find_univpoly_ring((const cl_ring&)r,varname)); } // Operations on polynomials. @@ -219,4 +221,6 @@ inline const cl_UP_R deriv (const cl_UP_R& x) CL_REQUIRE(cl_R_ring) +} // namespace cln + #endif /* _CL_UNIVPOLY_REAL_H */ diff --git a/lidia-interface/src/interfaces/integers/cln/bigint_def.h b/lidia-interface/src/interfaces/integers/cln/bigint_def.h index 7d8df91..a799e63 100644 --- a/lidia-interface/src/interfaces/integers/cln/bigint_def.h +++ b/lidia-interface/src/interfaces/integers/cln/bigint_def.h @@ -31,8 +31,8 @@ ** **/ -#include -#include +#include +#include #define integer_type_name cl_I #define base_digit uintD diff --git a/src/Makefile.in b/src/Makefile.in index 7f36763..9784773 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -202,8 +202,9 @@ install : all force if [ ! -d $(libdir) ] ; then mkdir $(libdir) ; fi $(LIBTOOL_INSTALL) $(INSTALL_DATA) libcln.la $(libdir)/libcln.la if [ ! -d $(includedir) ] ; then mkdir $(includedir) ; fi - $(INSTALL_DATA) $(top_srcdir)/include/*.h $(includedir) - $(INSTALL_DATA) ../include/*.h $(includedir) + if [ ! -d $(includedir)/cln ] ; then mkdir $(includedir)/cln ; fi + $(INSTALL_DATA) $(top_srcdir)/include/cln/*.h $(includedir)/cln + $(INSTALL_DATA) ../include/cln/*.h $(includedir)/cln # if [ ! -d $(mandir) ] ; then mkdir $(mandir) ; fi # if [ ! -d $(mandir)/man3 ] ; then mkdir $(mandir)/man3 ; fi # if [ ! -d $(datadir) ] ; then mkdir $(datadir) ; fi @@ -212,6 +213,7 @@ install : all force installdirs : force if [ ! -d $(libdir) ] ; then mkdir $(libdir) ; fi if [ ! -d $(includedir) ] ; then mkdir $(includedir) ; fi + if [ ! -d $(includedir)/cln ] ; then mkdir $(includedir)/cln ; fi # if [ ! -d $(mandir) ] ; then mkdir $(mandir) ; fi # if [ ! -d $(mandir)/man3 ] ; then mkdir $(mandir)/man3 ; fi # if [ ! -d $(datadir) ] ; then mkdir $(datadir) ; fi @@ -219,8 +221,7 @@ installdirs : force uninstall : force $(LIBTOOL_UNINSTALL) $(RM) $(libdir)/libcln.la - $(RM) $(addprefix $(includedir)/, $(notdir $(wildcard $(top_srcdir)/include/*.h))) - $(RM) $(addprefix $(includedir)/, $(notdir $(wildcard ../include/*.h))) + $(RM) -r $(includedir)/cln check : all diff --git a/src/base/cl_N.h b/src/base/cl_N.h index 7969961..6acdaba 100644 --- a/src/base/cl_N.h +++ b/src/base/cl_N.h @@ -3,9 +3,11 @@ #ifndef _CL_N_H #define _CL_N_H -#include "cl_number.h" +#include "cln/number.h" #include "cl_macros.h" +namespace cln { + nonreturning_function(extern, cl_error_division_by_0, (void)); nonreturning_function(extern, cl_as_error, (const cl_number& obj, const char * typestring, const char * filename, int line)); @@ -18,4 +20,6 @@ nonreturning_function(extern, cl_as_error, (const cl_number& obj, const char * t (((((uint32)(msd) << 7) | ((uint32)(msd) >> 25)) ^ ((sint32)(sign) << 30)) + (uintL)(exp)) #define equal_hashcode_one equal_hashcode_low(bit(31),1,0) +} // namespace cln + #endif /* _CL_N_H */ diff --git a/src/base/cl_N_err_d0.cc b/src/base/cl_N_err_d0.cc index 7da2194..6d09e8c 100644 --- a/src/base/cl_N_err_d0.cc +++ b/src/base/cl_N_err_d0.cc @@ -9,11 +9,15 @@ // Implementation. -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/abort.h" + +namespace cln { void cl_error_division_by_0 (void) { - fprint(cl_stderr, "Division by zero.\n"); + fprint(stderr, "Division by zero.\n"); cl_abort(); } + +} // namespace cln diff --git a/src/base/cl_abort.cc b/src/base/cl_abort.cc index d2c6129..dee0be3 100644 --- a/src/base/cl_abort.cc +++ b/src/base/cl_abort.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_abort.h" +#include "cln/abort.h" // Implementation. #include +namespace cln { + void cl_abort (void) { exit(1); } + +} // namespace cln diff --git a/src/base/cl_alloca.cc b/src/base/cl_alloca.cc index 2166f9f..9553347 100644 --- a/src/base/cl_alloca.cc +++ b/src/base/cl_alloca.cc @@ -9,13 +9,15 @@ // Implementation. -#include "cl_malloc.h" +#include "cln/malloc.h" #include "cl_offsetof.h" +namespace cln { + cl_alloca_header* cl_alloc_alloca_header (size_t size) { var cl_alloca_header* pointer = - (cl_alloca_header*)cl_malloc_hook(size+offsetofa(cl_alloca_header,usable_memory)); + (cl_alloca_header*)malloc_hook(size+offsetofa(cl_alloca_header,usable_memory)); pointer->next = NULL; return pointer; } @@ -24,7 +26,10 @@ void cl_free_alloca_header (cl_alloca_header* pointer) { do { cl_alloca_header* next = pointer->next; - cl_free_hook(pointer); + free_hook(pointer); pointer = next; } while (pointer != NULL); } + +} // namespace cln + diff --git a/src/base/cl_alloca.h b/src/base/cl_alloca.h index 6ed5a45..bff2c56 100644 --- a/src/base/cl_alloca.h +++ b/src/base/cl_alloca.h @@ -6,6 +6,8 @@ #include "cl_macros.h" #include +namespace cln { + // Allocating temporary data of arbitrary size. // We prefer to allocate it on the stack instead of via malloc(), because // that's fully inlinable and causes less cache misses. But the global stack @@ -81,4 +83,6 @@ public: #define cl_small_alloc_array(arrayeltype,arraysize) \ (arrayeltype*)cl_small_alloca((arraysize)*sizeof(arrayeltype)) +} // namespace cln + #endif /* _CL_ALLOCA_H */ diff --git a/src/base/cl_as_err.cc b/src/base/cl_as_err.cc index a06b684..565753a 100644 --- a/src/base/cl_as_err.cc +++ b/src/base/cl_as_err.cc @@ -9,26 +9,30 @@ // Implementation. -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/abort.h" + +namespace cln { void cl_as_error (const cl_number& obj, const char * typestring, const char * filename, int line) { - fprint(cl_stderr, "Type assertion failed: in file "); - fprint(cl_stderr, filename); - fprint(cl_stderr, ", line "); - fprintdecimal(cl_stderr, line); - fprint(cl_stderr, ", not "); - fprint(cl_stderr, typestring); - fprint(cl_stderr, ": "); + fprint(stderr, "Type assertion failed: in file "); + fprint(stderr, filename); + fprint(stderr, ", line "); + fprintdecimal(stderr, line); + fprint(stderr, ", not "); + fprint(stderr, typestring); + fprint(stderr, ": "); #if 0 // This brings in a dependency from the complex and float printer and all the float stuff. - fprint(cl_stderr, obj); + fprint(stderr, obj); #else - fprint(cl_stderr, "@0x"); - fprinthexadecimal(cl_stderr, (unsigned long)(void*)&obj); - fprint(cl_stderr, ": 0x"); - fprinthexadecimal(cl_stderr, (unsigned long)obj.word); + fprint(stderr, "@0x"); + fprinthexadecimal(stderr, (unsigned long)(void*)&obj); + fprint(stderr, ": 0x"); + fprinthexadecimal(stderr, (unsigned long)obj.word); #endif - fprint(cl_stderr, "\n"); + fprint(stderr, "\n"); cl_abort(); } + +} // namespace cln diff --git a/src/base/cl_condition.cc b/src/base/cl_condition.cc index ac6e3bf..37bd311 100644 --- a/src/base/cl_condition.cc +++ b/src/base/cl_condition.cc @@ -4,15 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_condition.h" - +#include "cln/condition.h" // Implementation. +namespace cln { + // This tells the compiler to put the `cl_condition' vtable into this file. void cl_condition::dummy () {} // The destructor must be defined although it is virtual and abstract. -#if !(defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ < 8)) cl_condition::~cl_condition () {} -#endif + +} // namespace cln diff --git a/src/base/cl_debug.cc b/src/base/cl_debug.cc index 373c494..e5b0f6c 100644 --- a/src/base/cl_debug.cc +++ b/src/base/cl_debug.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_object.h" +#include "cln/object.h" // Implementation. -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/abort.h" + +namespace cln { // The default printer function. void cl_dprint_unknown (cl_heap* pointer) @@ -49,11 +51,7 @@ void* cl_print (cl_uint word) else cl_dprint_unknown_immediate(pointer); } - #ifdef CL_IO_IOSTREAM - cl_debugout << endl; // newline and flush output - #else - fprint(cl_debugout, "\n"); - #endif + cl_debugout << std::endl; // newline and flush output return pointer; } @@ -76,3 +74,5 @@ void cl_rcpointer::debug_print () const { cl_print(word); } + +} // namespace cln diff --git a/src/base/cl_debugout.cc b/src/base/cl_debugout.cc index ad5a5c2..ddfd015 100644 --- a/src/base/cl_debugout.cc +++ b/src/base/cl_debugout.cc @@ -4,24 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_io.h" +#include "cln/io.h" // Implementation. // Just assume that the debugger runs on /dev/tty, independently of -// cl_stdin, cl_stdout, cl_stderr. +// stdin, stdout, stderr. -#if defined(CL_IO_STDIO) +#include -FILE* cl_debugout = fopen("/dev/tty","a"); +namespace cln { -#endif +std::ostream * cl_debugout_stream = new std::ofstream ("/dev/tty"); -#if defined(CL_IO_IOSTREAM) - -#include - -ostream* cl_debugout_stream = new ofstream ("/dev/tty"); - -#endif +} // namespace cln diff --git a/src/base/cl_free.cc b/src/base/cl_free.cc index a7d49c4..c335765 100644 --- a/src/base/cl_free.cc +++ b/src/base/cl_free.cc @@ -4,12 +4,14 @@ #include "cl_sysdep.h" // Specification. -#include "cl_object.h" +#include "cln/object.h" // Implementation. -#include "cl_malloc.h" +#include "cln/malloc.h" + +namespace cln { void cl_free_heap_object (cl_heap* pointer) { @@ -17,7 +19,7 @@ void cl_free_heap_object (cl_heap* pointer) var const cl_class* type = pointer->type; if (type->destruct) type->destruct(pointer); - cl_free_hook(pointer); + free_hook(pointer); } @@ -31,7 +33,7 @@ void cl_free_heap_object (cl_heap* pointer) static const char * copyright_notice[] = { " \n" - "Copyright (c) Bruno Haible 1988-1999 \n" + "Copyright (c) Bruno Haible 1988-2000 \n" " \n" "This program is free software; you can redistribute it and/or modify\n" "it under the terms of the GNU General Public License as published by\n" @@ -49,3 +51,5 @@ static const char * copyright_notice[] = { " ", (const char *) ©right_notice }; + +} // namespace cln diff --git a/src/base/cl_immclasses.cc b/src/base/cl_immclasses.cc index 091b649..b7d0513 100644 --- a/src/base/cl_immclasses.cc +++ b/src/base/cl_immclasses.cc @@ -4,10 +4,14 @@ #include "cl_sysdep.h" // Specification. -#include "cl_object.h" +#include "cln/object.h" // Implementation. +namespace cln { + const struct cl_class * cl_immediate_classes [1<=0, b>0 returns floor(a/b). // b should be a constant expression. #define floor(a_from_floor,b_from_floor) ((a_from_floor) / (b_from_floor)) -// Save the macro in case we need to include . +// Save the macro in case we need to include . #define cln_floor(a_from_floor,b_from_floor) ((a_from_floor) / (b_from_floor)) // ceiling(a,b) for a>=0, b>0 returns ceiling(a/b) = floor((a+b-1)/b). @@ -224,17 +226,17 @@ #define ALLOCATE_ANYWHERE(classname) \ /* Ability to place an object at a given address. */ \ public: \ - void* operator new (size_t size) { return cl_malloc_hook(size); } \ + void* operator new (size_t size) { return malloc_hook(size); } \ void* operator new (size_t size, classname* ptr) { unused size; return ptr; } \ - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } #else // For some compilers, work around template problem with "classname". #define ALLOCATE_ANYWHERE(classname) \ /* Ability to place an object at a given address. */ \ public: \ - void* operator new (size_t size) { return cl_malloc_hook(size); } \ + void* operator new (size_t size) { return malloc_hook(size); } \ void* operator new (size_t size, void* ptr) { unused size; return ptr; } \ - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } #endif // init1(type, object) (value); diff --git a/src/base/cl_malloc.cc b/src/base/cl_malloc.cc index aa7b821..8765cf1 100644 --- a/src/base/cl_malloc.cc +++ b/src/base/cl_malloc.cc @@ -1,17 +1,17 @@ -// cl_malloc_hook, cl_free_hook. +// malloc_hook, free_hook. // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_malloc.h" +#include "cln/malloc.h" // Implementation. #include -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/abort.h" #ifndef malloc extern "C" void* malloc (size_t size); @@ -20,16 +20,19 @@ extern "C" void free (void* ptr); #endif +namespace cln { + // Just like malloc() but never return NULL pointers. static void* xmalloc (size_t size) { void* ptr = malloc(size); if (ptr) return ptr; - fprint(cl_stderr, "Out of virtual memory.\n"); + fprint(stderr, "Out of virtual memory.\n"); cl_abort(); } -void* (*cl_malloc_hook) (size_t size) = xmalloc; -void (*cl_free_hook) (void* ptr) = free; +void* (*malloc_hook) (size_t size) = xmalloc; +void (*free_hook) (void* ptr) = free; +} // namespace cln diff --git a/src/base/cl_notreached.cc b/src/base/cl_notreached.cc index d6ec6bc..94455f3 100644 --- a/src/base/cl_notreached.cc +++ b/src/base/cl_notreached.cc @@ -9,16 +9,20 @@ // Implementation. -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/abort.h" + +namespace cln { void cl_notreached_abort (const char* filename, int lineno) { - fprint(cl_stderr, "Internal error: statement in file "); - fprint(cl_stderr, filename); - fprint(cl_stderr, ", line "); - fprintdecimal(cl_stderr, lineno); - fprint(cl_stderr, " has been reached!!\n"); - fprint(cl_stderr, "Please send the authors of the program a description how you produced this error!\n"); + fprint(stderr, "Internal error: statement in file "); + fprint(stderr, filename); + fprint(stderr, ", line "); + fprintdecimal(stderr, lineno); + fprint(stderr, " has been reached!!\n"); + fprint(stderr, "Please send the authors of the program a description how you produced this error!\n"); cl_abort(); } + +} // namespace cln diff --git a/src/base/cl_sysdep.h b/src/base/cl_sysdep.h index ca11aaa..8a59f5a 100644 --- a/src/base/cl_sysdep.h +++ b/src/base/cl_sysdep.h @@ -4,10 +4,10 @@ #define _CL_SYSDEP_H // CPU and other -#include "cl_config.h" +#include "cln/config.h" // char_bitsize, short_bitsize, long_bitsize, long_long_bitsize -#include "cl_intparam.h" +#include "cln/intparam.h" // The CPU's endianness #if defined(short_little_endian) || defined(int_little_endian) || defined(long_little_endian) @@ -56,9 +56,9 @@ #include "cl_macros.h" // Elementary types. -#include "cl_types.h" +#include "cln/types.h" // Dependencies among modules. -#include "cl_modules.h" +#include "cln/modules.h" #endif /* _CL_SYSDEP_H */ diff --git a/src/base/digit/cl_2D.h b/src/base/digit/cl_2D.h index 87db39e..273f966 100644 --- a/src/base/digit/cl_2D.h +++ b/src/base/digit/cl_2D.h @@ -3,9 +3,11 @@ #ifndef _CL_2D_H #define _CL_2D_H -#include "cl_types.h" +#include "cln/types.h" #include "cl_D.h" +namespace cln { + // Multipliziert zwei Zahlen mod 2^intDsize. // mul2adic(a,b) // > uintD a,b: Zahlen mod 2^intDsize @@ -37,4 +39,6 @@ // < ergebnis: Zahl c mod 2^intDsize mit b*c == a mod 2^intDsize extern uintD div2adic (uintD a, uintD b); +} // namespace cln + #endif /* _CL_2D_H */ diff --git a/src/base/digit/cl_2D_div.cc b/src/base/digit/cl_2D_div.cc index 36c22e5..d99c8e1 100644 --- a/src/base/digit/cl_2D_div.cc +++ b/src/base/digit/cl_2D_div.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + uintD div2adic (uintD a, uintD b) { // Methode: @@ -42,3 +44,5 @@ uintD div2adic (uintD a, uintD b) } #endif } + +} // namespace cln diff --git a/src/base/digit/cl_2D_exptpos.cc b/src/base/digit/cl_2D_exptpos.cc index 1cf16af..8e14f66 100644 --- a/src/base/digit/cl_2D_exptpos.cc +++ b/src/base/digit/cl_2D_exptpos.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + uintD expt_pos (uintD a, uintL b) { // Methode: @@ -34,3 +36,5 @@ uintD expt_pos (uintD a, uintL b) } return c; } + +} // namespace cln diff --git a/src/base/digit/cl_D.h b/src/base/digit/cl_D.h index dc01288..50643e9 100644 --- a/src/base/digit/cl_D.h +++ b/src/base/digit/cl_D.h @@ -3,10 +3,10 @@ #ifndef _CL_D_H #define _CL_D_H -#include "cl_types.h" +#include "cln/types.h" #include "cl_low.h" -// Aus cl_types.h importiere: +// Aus cln/types.h importiere: // intDsize Anzahl Bits in einem Digit // uintD, sintD Integer-Typen für ein Digit // log2_intDsize log2(intDsize) @@ -24,6 +24,7 @@ #endif #endif +namespace cln { // Vorzeichen eines Digit bestimmen // sign_of_sintD(wert) @@ -220,4 +221,6 @@ inline sint32 sign_of_sintD (sintD wert) inline uint64 logcountD (uint64 x64) { logcount_64(); return x64; } #endif +} // namespace cln + #endif /* _CL_D_H */ diff --git a/src/base/digitseq/cl_2DS.h b/src/base/digitseq/cl_2DS.h index 2ea4c76..ba301eb 100644 --- a/src/base/digitseq/cl_2DS.h +++ b/src/base/digitseq/cl_2DS.h @@ -3,6 +3,8 @@ #ifndef _CL_2DS_H #define _CL_2DS_H +namespace cln { + // div2adic(a_len,a_LSDptr,b_len,b_LSDptr,dest_LSDptr); // dividiert die UDS a_LSDptr[-a_len..-1] mod 2^(intDsize*b_len) // durch die ungerade UDS b_LSDptr[-b_len..-1] mod 2^(intDsize*b_len) @@ -24,4 +26,6 @@ // (len>0) und liefert sie als UDS dest_LSDptr[-len..-1] mod 2^(intDsize*len). extern void recip2adic (uintC len, const uintD* a_LSDptr, uintD* dest_LSDptr); +} // namespace cln + #endif /* _CL_2DS_H */ diff --git a/src/base/digitseq/cl_2DS_div.cc b/src/base/digitseq/cl_2DS_div.cc index 9b53438..8730623 100644 --- a/src/base/digitseq/cl_2DS_div.cc +++ b/src/base/digitseq/cl_2DS_div.cc @@ -11,7 +11,9 @@ #include "cl_2D.h" #include "cl_DS.h" -#include "cl_abort.h" +#include "cln/abort.h" + +namespace cln { // Time for dividing a n word number by a n word number, this is the common // case and therefore the important one: @@ -162,3 +164,4 @@ void div2adic (uintC a_len, const uintD* a_LSDptr, uintC b_len, const uintD* b_L } // Bit complexity (N = max(a_len,b_len)): O(M(N)). +} // namespace cln diff --git a/src/base/digitseq/cl_2DS_recip.cc b/src/base/digitseq/cl_2DS_recip.cc index a776da2..8ae8621 100644 --- a/src/base/digitseq/cl_2DS_recip.cc +++ b/src/base/digitseq/cl_2DS_recip.cc @@ -20,6 +20,8 @@ const unsigned int recip2adic_threshold = 620; const unsigned int recip2adic_threshold = 380; #endif +namespace cln { + void recip2adic (uintC len, const uintD* a_LSDptr, uintD* dest_LSDptr) { // Method: @@ -64,3 +66,4 @@ void recip2adic (uintC len, const uintD* a_LSDptr, uintD* dest_LSDptr) } // Bit complexity (N := len): O(M(N)). +} // namespace cln diff --git a/src/base/digitseq/cl_DS.h b/src/base/digitseq/cl_DS.h index 0b651f7..61dd161 100644 --- a/src/base/digitseq/cl_DS.h +++ b/src/base/digitseq/cl_DS.h @@ -3,12 +3,14 @@ #ifndef _CL_DS_H #define _CL_DS_H -#include "cl_types.h" +#include "cln/types.h" #include "cl_gmpconfig.h" #include "cl_D.h" #include "cl_DS_endian.h" #include "cl_alloca.h" +namespace cln { + // Digit Sequence (DS) // a memory range with n digits (n an uintC), // between two pointers MSDptr and LSDptr. @@ -349,7 +351,9 @@ extern void shiftxor_loop_up (uintD* xptr, const uintD* yptr, uintC count, uintC // Supersede the functions by wrappers around calls to gmp mpn, // for those functions where gmp is believed to be faster. +extern "C" { #include +} #if 0 // not worth it, since gmp's mpn_cmp is not optimized inline cl_signean compare_loop_down (const uintD* xptr, const uintD* yptr, uintC count) @@ -2671,5 +2675,6 @@ extern void cl_UDS_mul_square (const uintD* sourceptr, uintC len, extern void cl_UDS_recipsqrt (const uintD* a_MSDptr, uintC a_len, uintD* b_MSDptr, uintC b_len); +} // namespace cln #endif /* _CL_DS_H */ diff --git a/src/base/digitseq/cl_DS_div.cc b/src/base/digitseq/cl_DS_div.cc index d9e8d5d..1f850e9 100644 --- a/src/base/digitseq/cl_DS_div.cc +++ b/src/base/digitseq/cl_DS_div.cc @@ -10,7 +10,9 @@ // Implementation. #include "cl_N.h" -#include "cl_abort.h" +#include "cln/abort.h" + +namespace cln { // We observe the following timings in seconds: // Time for dividing a 2*n word number by a n word number: @@ -416,3 +418,4 @@ } // Bit complexity (N = a_len): O(M(N)). +} // namespace cln diff --git a/src/base/digitseq/cl_DS_mul.cc b/src/base/digitseq/cl_DS_mul.cc index be332ef..e1f94a4 100644 --- a/src/base/digitseq/cl_DS_mul.cc +++ b/src/base/digitseq/cl_DS_mul.cc @@ -10,8 +10,10 @@ // Implementation. #include "cl_low.h" -#include "cl_malloc.h" -#include "cl_abort.h" +#include "cln/malloc.h" +#include "cln/abort.h" + +namespace cln { // Multiplikations-Doppelschleife: // Multipliziert zwei UDS und legt das Ergebnis in einer dritten UDS ab. @@ -120,9 +122,6 @@ } // Karatsuba-multiplication: O(n^(log 3 / log 2)) - static void mulu_karatsuba (const uintD* sourceptr1, uintC len1, - const uintD* sourceptr2, uintC len2, - uintD* destptr); static void mulu_karatsuba_square (const uintD* sourceptr, uintC len, uintD* destptr); #include "cl_DS_mul_kara.h" @@ -525,3 +524,5 @@ mulu_fft_modm(sourceptr,len,sourceptr,len,destptr); } } + +} // namespace cln diff --git a/src/base/digitseq/cl_DS_mul_fftc.h b/src/base/digitseq/cl_DS_mul_fftc.h index f3528a6..7384194 100644 --- a/src/base/digitseq/cl_DS_mul_fftc.h +++ b/src/base/digitseq/cl_DS_mul_fftc.h @@ -156,9 +156,9 @@ #endif -#include "cl_floatparam.h" -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/floatparam.h" +#include "cln/io.h" +#include "cln/abort.h" #if defined(HAVE_LONGDOUBLE) && (long_double_mant_bits > double_mant_bits) && (defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && 0)) // Only these CPUs have fast "long double"s in hardware. @@ -663,7 +663,7 @@ static void fill_factor (uintL N, fftc_complex* x, uintL l, if (max_l(2) > intDsize && l > intDsize) { // l > intDsize if (max_l(2) > 64 && l > 64) { - fprint(cl_stderr, "FFT problem: l > 64 not supported by pow2_table\n"); + fprint(stderr, "FFT problem: l > 64 not supported by pow2_table\n"); cl_abort(); } var fftc_real carry = 0; @@ -944,7 +944,7 @@ static inline void mulu_fftcomplex_nocheck (const uintD* sourceptr1, uintC len1, for ( ; ; k++) { if (k >= sizeof(max_l_table)/sizeof(max_l_table[0]) || max_l_table[k] <= 0) { - fprint(cl_stderr, "FFT problem: numbers too big, floating point precision not sufficient\n"); + fprint(stderr, "FFT problem: numbers too big, floating point precision not sufficient\n"); cl_abort(); } if (2*ceiling((uintL)len1*intDsize,max_l_table[k])-1 <= ((uintL)1 << k)) @@ -1100,7 +1100,7 @@ static void mulu_fftcomplex (const uintD* sourceptr1, uintC len1, var uintD checksum = multiply_checksum(checksum1,checksum2); mulu_fftcomplex_nocheck(sourceptr1,len1,sourceptr2,len2,destptr); if (!(checksum == compute_checksum(destptr,len1+len2))) { - fprint(cl_stderr, "FFT problem: checksum error\n"); + fprint(stderr, "FFT problem: checksum error\n"); cl_abort(); } } diff --git a/src/base/digitseq/cl_DS_mul_fftcs.h b/src/base/digitseq/cl_DS_mul_fftcs.h index 3b49b94..4fc42b2 100644 --- a/src/base/digitseq/cl_DS_mul_fftcs.h +++ b/src/base/digitseq/cl_DS_mul_fftcs.h @@ -269,9 +269,10 @@ #endif -#include "cl_floatparam.h" -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/floatparam.h" +#include "cln/io.h" +#include "cln/abort.h" + #if defined(HAVE_LONGDOUBLE) && (long_double_mant_bits > double_mant_bits) && (defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && 0)) // Only these CPUs have fast "long double"s in hardware. @@ -726,7 +727,7 @@ static void fill_factor (uintL N, fftcs_real* x, uintL l, if (max_l(2) > intDsize && l > intDsize) { // l > intDsize if (max_l(2) > 64 && l > 64) { - fprint(cl_stderr, "FFT problem: l > 64 not supported by pow2_table\n"); + fprint(stderr, "FFT problem: l > 64 not supported by pow2_table\n"); cl_abort(); } var fftcs_real carry = 0; @@ -999,7 +1000,7 @@ static inline void mulu_fftcs_nocheck (const uintD* sourceptr1, uintC len1, for ( ; ; k++) { if (k >= sizeof(max_l_table)/sizeof(max_l_table[0]) || max_l_table[k] <= 0) { - fprint(cl_stderr, "FFT problem: numbers too big, floating point precision not sufficient\n"); + fprint(stderr, "FFT problem: numbers too big, floating point precision not sufficient\n"); cl_abort(); } if (2*ceiling((uintL)len1*intDsize,max_l_table[k])-1 <= ((uintL)1 << k)) @@ -1149,7 +1150,7 @@ static void mulu_fftcs (const uintD* sourceptr1, uintC len1, var uintD checksum = multiply_checksum(checksum1,checksum2); mulu_fftcs_nocheck(sourceptr1,len1,sourceptr2,len2,destptr); if (!(checksum == compute_checksum(destptr,len1+len2))) { - fprint(cl_stderr, "FFT problem: checksum error\n"); + fprint(stderr, "FFT problem: checksum error\n"); cl_abort(); } } diff --git a/src/base/digitseq/cl_DS_mul_fftr.h b/src/base/digitseq/cl_DS_mul_fftr.h index cc1f865..c5781dd 100644 --- a/src/base/digitseq/cl_DS_mul_fftr.h +++ b/src/base/digitseq/cl_DS_mul_fftr.h @@ -196,9 +196,10 @@ #endif -#include "cl_floatparam.h" -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/floatparam.h" +#include "cln/io.h" +#include "cln/abort.h" + #if defined(HAVE_LONGDOUBLE) && (long_double_mant_bits > double_mant_bits) && (defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && 0)) // Only these CPUs have fast "long double"s in hardware. @@ -713,7 +714,7 @@ static void fill_factor (uintL N, fftr_real* x, uintL l, if (max_l(2) > intDsize && l > intDsize) { // l > intDsize if (max_l(2) > 64 && l > 64) { - fprint(cl_stderr, "FFT problem: l > 64 not supported by pow2_table\n"); + fprint(stderr, "FFT problem: l > 64 not supported by pow2_table\n"); cl_abort(); } var fftr_real carry = 0; @@ -986,7 +987,7 @@ static inline void mulu_fftr_nocheck (const uintD* sourceptr1, uintC len1, for ( ; ; k++) { if (k >= sizeof(max_l_table)/sizeof(max_l_table[0]) || max_l_table[k] <= 0) { - fprint(cl_stderr, "FFT problem: numbers too big, floating point precision not sufficient\n"); + fprint(stderr, "FFT problem: numbers too big, floating point precision not sufficient\n"); cl_abort(); } if (2*ceiling((uintL)len1*intDsize,max_l_table[k])-1 <= ((uintL)1 << k)) @@ -1136,7 +1137,7 @@ static void mulu_fftr (const uintD* sourceptr1, uintC len1, var uintD checksum = multiply_checksum(checksum1,checksum2); mulu_fftr_nocheck(sourceptr1,len1,sourceptr2,len2,destptr); if (!(checksum == compute_checksum(destptr,len1+len2))) { - fprint(cl_stderr, "FFT problem: checksum error\n"); + fprint(stderr, "FFT problem: checksum error\n"); cl_abort(); } } diff --git a/src/base/digitseq/cl_DS_mul_kara.h b/src/base/digitseq/cl_DS_mul_kara.h index fba0a1b..b838fc2 100644 --- a/src/base/digitseq/cl_DS_mul_kara.h +++ b/src/base/digitseq/cl_DS_mul_kara.h @@ -1,4 +1,3 @@ - static void mulu_karatsuba (const uintD* sourceptr1, uintC len1, const uintD* sourceptr2, uintC len2, uintD* destptr) diff --git a/src/base/digitseq/cl_DS_mul_kara_sqr.h b/src/base/digitseq/cl_DS_mul_kara_sqr.h index 1e834f5..e91b434 100644 --- a/src/base/digitseq/cl_DS_mul_kara_sqr.h +++ b/src/base/digitseq/cl_DS_mul_kara_sqr.h @@ -1,4 +1,3 @@ - // Eine vereinfachte Version von mulu_karatsuba für den Fall // sourceptr1 == sourceptr2 && len1 == len2. // Weniger Variablen, eine Additionsschleife weniger, eine Kopierschleife diff --git a/src/base/digitseq/cl_DS_random.cc b/src/base/digitseq/cl_DS_random.cc index 33c7260..a1d40f2 100644 --- a/src/base/digitseq/cl_DS_random.cc +++ b/src/base/digitseq/cl_DS_random.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_random.h" +#include "cln/random.h" #include "cl_DS.h" #include "cl_low.h" -void random_UDS (cl_random_state& randomstate, uintD* ptr, uintC len) +namespace cln { + +void random_UDS (random_state& randomstate, uintD* ptr, uintC len) { var uintC count; #if (intDsize==64) @@ -31,3 +33,5 @@ void random_UDS (cl_random_state& randomstate, uintD* ptr, uintC len) } #endif } + +} // namespace cln diff --git a/src/base/digitseq/cl_DS_recip.cc b/src/base/digitseq/cl_DS_recip.cc index c82e4d9..6bcb8a2 100644 --- a/src/base/digitseq/cl_DS_recip.cc +++ b/src/base/digitseq/cl_DS_recip.cc @@ -9,7 +9,9 @@ // Implementation. -#include "cl_abort.h" +#include "cln/abort.h" + +namespace cln { // Compute the reciprocal value of a digit sequence. // Input: UDS a_MSDptr/a_len/.. of length a_len, @@ -158,3 +160,5 @@ shiftrightcopy_loop_msp(y_MSDptr,b_MSDptr,b_len+1,1,0); } // Bit complexity (N := b_len): O(M(N)). + +} // namespace cln diff --git a/src/base/digitseq/cl_DS_recipsqrt.cc b/src/base/digitseq/cl_DS_recipsqrt.cc index ba5d4ca..3554cc3 100644 --- a/src/base/digitseq/cl_DS_recipsqrt.cc +++ b/src/base/digitseq/cl_DS_recipsqrt.cc @@ -10,7 +10,9 @@ // Implementation. #include "cl_low.h" -#include "cl_abort.h" +#include "cln/abort.h" + +namespace cln { // Compute the reciprocal square root of a digit sequence. // Input: UDS a_MSDptr/a_len/.. of length a_len, @@ -162,3 +164,4 @@ } // Bit complexity (N := b_len): O(M(N)). +} // namespace cln diff --git a/src/base/digitseq/cl_DS_sqrt.cc b/src/base/digitseq/cl_DS_sqrt.cc index 3b3f540..385118d 100644 --- a/src/base/digitseq/cl_DS_sqrt.cc +++ b/src/base/digitseq/cl_DS_sqrt.cc @@ -10,7 +10,9 @@ // Implementation. #include "cl_low.h" -#include "cl_abort.h" +#include "cln/abort.h" + +namespace cln { // We observe the following timings: // Time for square root of a_len = 2*N by b_len = N digits, @@ -49,18 +51,6 @@ { return (cl_boolean)(n >= 2100); } #endif -// Workaround gcc-2.7.0 bug on i386. -#if defined(__GNUC__) - #if (__GNUC__ == 2) - #if (__GNUC_MINOR__ == 7) - #define workaround_gcc_bug() *&b_stern = *&b_stern; - #endif - #endif -#endif -#ifndef workaround_gcc_bug - #define workaround_gcc_bug() -#endif - // Bildet zu einer Unsigned Digit sequence a die Wurzel // (genauer: Gaußklammer aus Wurzel aus a). // squarep = cl_UDS_sqrt(a_MSDptr,a_len,a_LSDptr, &b); @@ -337,7 +327,6 @@ cl_boolean cl_UDS_sqrt (const uintD* a_MSDptr, uintC a_len, const uintD* a_LSDpt if ( dec_loop_lsp(a_lptr lspop 2,j+1) ==0) goto b_stern_ok; // Subtraktion von b*^2 lieferte negativen Carry b_stern = b_stern-1; // b* := b* - 1 - workaround_gcc_bug(); // erhöhe [a[2n-j-1],...,a[2n-2j-2]] um [b[n],...,b[n-j],0] + 2 * b* + 1 if ((sintD)b_stern < 0) { mspref(b_ptr,-1) |= bit(0); } // höchstes Bit von b* in b[n-j] ablegen mspref(b_ptr,0) = (uintD)(b_stern<<1)+1; // niedrige Bits von b* und eine 1 als b[n-j-1] ablegen @@ -372,3 +361,4 @@ cl_boolean cl_UDS_sqrt (const uintD* a_MSDptr, uintC a_len, const uintD* a_LSDpt } // Bit complexity (N := a_len): O(M(N)). +} // namespace cln diff --git a/src/base/digitseq/cl_DS_trandom.cc b/src/base/digitseq/cl_DS_trandom.cc index 706db37..aebdfca 100644 --- a/src/base/digitseq/cl_DS_trandom.cc +++ b/src/base/digitseq/cl_DS_trandom.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_random.h" +#include "cln/random.h" #include "cl_DS.h" #include "cl_low.h" -void testrandom_UDS (cl_random_state& randomstate, uintD* MSDptr, uintC len) +namespace cln { + +void testrandom_UDS (random_state& randomstate, uintD* MSDptr, uintC len) { // Idea from Torbjörn Granlund, see his "random2.c" file in gmp 2.0. var uintD* ptr = MSDptr mspop len; @@ -43,3 +45,5 @@ void testrandom_UDS (cl_random_state& randomstate, uintD* MSDptr, uintC len) ran = ran >> (log2_intDsize+1); ran_bits -= log2_intDsize+1; } } + +} // namespace cln diff --git a/src/base/digitseq/cl_asm.h b/src/base/digitseq/cl_asm.h index 8079878..6aac6c4 100644 --- a/src/base/digitseq/cl_asm.h +++ b/src/base/digitseq/cl_asm.h @@ -1,6 +1,6 @@ // Includes the CPU specific cl_asm_*.h file. -#include "cl_config.h" +#include "cln/config.h" #include "cl_DS_endian.h" #ifdef __m68k__ diff --git a/src/base/digitseq/cl_asm_.cc b/src/base/digitseq/cl_asm_.cc index 6a5e631..60b9ff1 100644 --- a/src/base/digitseq/cl_asm_.cc +++ b/src/base/digitseq/cl_asm_.cc @@ -1,6 +1,6 @@ // Includes the CPU specific cl_asm_*.cc file. -#include "cl_config.h" +#include "cln/config.h" #include "cl_DS_endian.h" #ifdef __m68k__ diff --git a/src/base/hash/cl_hash.h b/src/base/hash/cl_hash.h index 2e92ffd..6a9f14e 100644 --- a/src/base/hash/cl_hash.h +++ b/src/base/hash/cl_hash.h @@ -3,11 +3,13 @@ #ifndef _CL_HASH_H #define _CL_HASH_H -#include "cl_object.h" -#include "cl_malloc.h" -#include "cl_abort.h" +#include "cln/object.h" +#include "cln/malloc.h" +#include "cln/abort.h" #include "cl_iterator.h" +namespace cln { + const long htentry_last = 0; // means that there is no next entry // These forward declarations are needed for Sun CC 3.0.1 and 4.0.1. @@ -35,15 +37,15 @@ protected: // a normal hash table into a "weak" hash table. public: // Allocation. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } // Deallocation. - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } // Constructor: build a new, empty table. cl_heap_hashtable (long initial_size = 5) : cl_heap (), _size (initial_size), _count (0), _garcol_fun (no_garcol) { _modulus = compute_modulus(_size); - _total_vector = cl_malloc_hook(_modulus*sizeof(long) + _size*sizeof(htxentry)); + _total_vector = malloc_hook(_modulus*sizeof(long) + _size*sizeof(htxentry)); _slots = (long*) ((char*)_total_vector + 0); _entries = (htxentry *) ((char*)_total_vector + _modulus*sizeof(long)); for (var long hi = _modulus-1; hi >= 0; hi--) @@ -61,7 +63,7 @@ public: for (long i = 0; i < _size; i++) if (_entries[i].next >= 0) _entries[i].~htxentry(); - cl_free_hook(_total_vector); + free_hook(_total_vector); } // Count number of entries. long num_entries () @@ -186,5 +188,6 @@ inline _cl_hashtable_iterator cl_heap_hashtable::iterator () #endif } +} // namespace cln #endif /* _CL_HASH_H */ diff --git a/src/base/hash/cl_hash1.h b/src/base/hash/cl_hash1.h index 5494b00..2bd3e7b 100644 --- a/src/base/hash/cl_hash1.h +++ b/src/base/hash/cl_hash1.h @@ -6,6 +6,8 @@ #include "cl_hash.h" #include "cl_iterator.h" +namespace cln { + // Requirements: // - function bool equal (key1_type,key1_type); // - function unsigned long hashcode (key1_type); @@ -30,9 +32,9 @@ struct cl_htentry1 { template struct cl_heap_hashtable_1 : public cl_heap_hashtable > { // Allocation. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } // Deallocation. - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } public: // Lookup (htref alias gethash). // Returns a pointer which you should immediately dereference @@ -127,7 +129,7 @@ private: { var long new_size = _size + (_size >> 1) + 1; // _size*1.5 var long new_modulus = compute_modulus(new_size); - var void* new_total_vector = cl_malloc_hook(new_modulus*sizeof(long) + new_size*sizeof(htxentry)); + var void* new_total_vector = malloc_hook(new_modulus*sizeof(long) + new_size*sizeof(htxentry)); var long* new_slots = (long*) ((char*)new_total_vector + 0); var htxentry* new_entries = (htxentry *) ((char*)new_total_vector + new_modulus*sizeof(long)); for (var long hi = new_modulus-1; hi >= 0; hi--) @@ -150,7 +152,7 @@ private: new_slots[hindex] = 1+index; old_entries[old_index].~htxentry(); } - cl_free_hook(_total_vector); + free_hook(_total_vector); _modulus = new_modulus; _size = new_size; _freelist = free_list_head; @@ -160,4 +162,6 @@ private: } }; +} // namespace cln + #endif /* _CL_HASH1_H */ diff --git a/src/base/hash/cl_hash1weak.h b/src/base/hash/cl_hash1weak.h index 0719ec4..a356819 100644 --- a/src/base/hash/cl_hash1weak.h +++ b/src/base/hash/cl_hash1weak.h @@ -5,6 +5,8 @@ #include "cl_hash1.h" +namespace cln { + // This is a hash table in which an entry can be removed when a user-defined // condition is fulfilled (e.g. the value is not referenced any more). // We don't remove unused entries immediately, only when the hash table @@ -20,9 +22,9 @@ template struct cl_heap_weak_hashtable_1 : public cl_heap_hashtable_1 { // Allocation. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } // Deallocation. - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } public: // Function which tells when an unused entry may be garbage collected. cl_boolean (* const _maygc_htentry) (const cl_htentry1&); @@ -90,4 +92,6 @@ private: } }; +} // namespace cln + #endif /* _CL_HASH1WEAK_H */ diff --git a/src/base/hash/cl_hash2.h b/src/base/hash/cl_hash2.h index 10985b5..6c1ad36 100644 --- a/src/base/hash/cl_hash2.h +++ b/src/base/hash/cl_hash2.h @@ -6,6 +6,8 @@ #include "cl_hash.h" #include "cl_iterator.h" +namespace cln { + // Requirements: // - function bool equal (key1_type,key1_type); // - function bool equal (key2_type,key2_type); @@ -28,9 +30,9 @@ struct cl_htentry2 { template struct cl_heap_hashtable_2 : public cl_heap_hashtable > { // Allocation. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } // Deallocation. - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } public: // Lookup (htref alias gethash). // Returns a pointer which you should immediately dereference @@ -128,7 +130,7 @@ private: { var long new_size = _size + (_size >> 1) + 1; // _size*1.5 var long new_modulus = compute_modulus(new_size); - var void* new_total_vector = cl_malloc_hook(new_modulus*sizeof(long) + new_size*sizeof(htxentry)); + var void* new_total_vector = malloc_hook(new_modulus*sizeof(long) + new_size*sizeof(htxentry)); var long* new_slots = (long*) ((char*)new_total_vector + 0); var htxentry* new_entries = (htxentry *) ((char*)new_total_vector + new_modulus*sizeof(long)); for (var long hi = new_modulus-1; hi >= 0; hi--) @@ -152,7 +154,7 @@ private: new_slots[hindex] = 1+index; old_entries[old_index].~htxentry(); } - cl_free_hook(_total_vector); + free_hook(_total_vector); _modulus = new_modulus; _size = new_size; _freelist = free_list_head; @@ -162,4 +164,6 @@ private: } }; +} // namespace cln + #endif /* _CL_HASH2_H */ diff --git a/src/base/hash/cl_hash2weak.h b/src/base/hash/cl_hash2weak.h index e8ec0fe..6103690 100644 --- a/src/base/hash/cl_hash2weak.h +++ b/src/base/hash/cl_hash2weak.h @@ -5,6 +5,8 @@ #include "cl_hash2.h" +namespace cln { + // This is a hash table in which an entry can be removed when a user-defined // condition is fulfilled (e.g. the value is not referenced any more). // We don't remove unused entries immediately, only when the hash table @@ -20,9 +22,9 @@ template struct cl_heap_weak_hashtable_2 : public cl_heap_hashtable_2 { // Allocation. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } // Deallocation. - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } public: // Function which tells when an unused entry may be garbage collected. cl_boolean (* const _maygc_htentry) (const cl_htentry2&); @@ -90,4 +92,6 @@ private: } }; +} // namespace cln + #endif /* _CL_HASH2WEAK_H */ diff --git a/src/base/hash/cl_hashset.h b/src/base/hash/cl_hashset.h index b5d28f3..a89c126 100644 --- a/src/base/hash/cl_hashset.h +++ b/src/base/hash/cl_hashset.h @@ -6,6 +6,8 @@ #include "cl_hash.h" #include "cl_iterator.h" +namespace cln { + // Requirements: // - function bool equal (key1_type,key1_type); // - function unsigned long hashcode (key1_type); @@ -21,9 +23,9 @@ struct cl_htsetentry { template struct cl_heap_hashtable_set : public cl_heap_hashtable > { // Allocation. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } // Deallocation. - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } public: // Lookup (htref alias gethash). bool get (const key1_type& key) @@ -114,7 +116,7 @@ private: { var long new_size = _size + (_size >> 1) + 1; // _size*1.5 var long new_modulus = compute_modulus(new_size); - var void* new_total_vector = cl_malloc_hook(new_modulus*sizeof(long) + new_size*sizeof(htxentry)); + var void* new_total_vector = malloc_hook(new_modulus*sizeof(long) + new_size*sizeof(htxentry)); var long* new_slots = (long*) ((char*)new_total_vector + 0); var htxentry* new_entries = (htxentry *) ((char*)new_total_vector + new_modulus*sizeof(long)); for (var long hi = new_modulus-1; hi >= 0; hi--) @@ -136,7 +138,7 @@ private: new_slots[hindex] = 1+index; old_entries[old_index].~htxentry(); } - cl_free_hook(_total_vector); + free_hook(_total_vector); _modulus = new_modulus; _size = new_size; _freelist = free_list_head; @@ -146,4 +148,6 @@ private: } }; +} // namespace cln + #endif /* _CL_HASHSET_H */ diff --git a/src/base/hash/cl_hashuniq.h b/src/base/hash/cl_hashuniq.h index 3ca6754..52d676f 100644 --- a/src/base/hash/cl_hashuniq.h +++ b/src/base/hash/cl_hashuniq.h @@ -6,6 +6,8 @@ #include "cl_hash.h" #include "cl_iterator.h" +namespace cln { + // In such a hash table an entry's key is determined by its value // and not stored explicitly. @@ -30,9 +32,9 @@ struct cl_htuniqentry { template struct cl_heap_hashtable_uniq : public cl_heap_hashtable > { // Allocation. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } // Deallocation. - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } public: // Lookup (htref alias gethash). // Returns a pointer which you should immediately dereference @@ -125,7 +127,7 @@ private: { var long new_size = _size + (_size >> 1) + 1; // _size*1.5 var long new_modulus = compute_modulus(new_size); - var void* new_total_vector = cl_malloc_hook(new_modulus*sizeof(long) + new_size*sizeof(htxentry)); + var void* new_total_vector = malloc_hook(new_modulus*sizeof(long) + new_size*sizeof(htxentry)); var long* new_slots = (long*) ((char*)new_total_vector + 0); var htxentry* new_entries = (htxentry *) ((char*)new_total_vector + new_modulus*sizeof(long)); for (var long hi = new_modulus-1; hi >= 0; hi--) @@ -147,7 +149,7 @@ private: new_slots[hindex] = 1+index; old_entries[old_index].~htxentry(); } - cl_free_hook(_total_vector); + free_hook(_total_vector); _modulus = new_modulus; _size = new_size; _freelist = free_list_head; @@ -157,4 +159,6 @@ private: } }; +} // namespace cln + #endif /* _CL_HASHUNIQ_H */ diff --git a/src/base/hash/cl_hashuniqweak.h b/src/base/hash/cl_hashuniqweak.h index 932574c..a022e4b 100644 --- a/src/base/hash/cl_hashuniqweak.h +++ b/src/base/hash/cl_hashuniqweak.h @@ -5,6 +5,8 @@ #include "cl_hashuniq.h" +namespace cln { + // This is a hashuniq table in which an entry can be removed when the // value is not referenced any more. // Best example: string -> symbol uniquification. When a symbol is not @@ -22,9 +24,9 @@ template struct cl_heap_weak_hashtable_uniq : public cl_heap_hashtable_uniq { // Allocation. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } // Deallocation. - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } public: // Constructor. cl_heap_weak_hashtable_uniq () @@ -90,4 +92,6 @@ private: } }; +} // namespace cln + #endif /* _CL_HASHUNIQWEAK_H */ diff --git a/src/base/hash/cl_rcpointer2_hashweak_rcpointer.cc b/src/base/hash/cl_rcpointer2_hashweak_rcpointer.cc index 660cbd1..cd3ef24 100644 --- a/src/base/hash/cl_rcpointer2_hashweak_rcpointer.cc +++ b/src/base/hash/cl_rcpointer2_hashweak_rcpointer.cc @@ -11,6 +11,8 @@ #include "cl_hash2weak.h" +namespace cln { + static void cl_weak_hashtable_from_rcpointer2_to_rcpointer_destructor (cl_heap* pointer) { #if (defined(__mips__) || defined(__mips64__)) && !defined(__GNUC__) // workaround SGI CC bug @@ -45,3 +47,4 @@ void cl_wht_from_rcpointer2_to_rcpointer::put (const cl_rcpointer& x, const cl_r ((cl_heap_weak_hashtable_from_rcpointer2_to_rcpointer*)pointer)->put(x,y,z); } +} // namespace cln diff --git a/src/base/hash/cl_rcpointer2_hashweak_rcpointer.h b/src/base/hash/cl_rcpointer2_hashweak_rcpointer.h index 5514efa..434dae5 100644 --- a/src/base/hash/cl_rcpointer2_hashweak_rcpointer.h +++ b/src/base/hash/cl_rcpointer2_hashweak_rcpointer.h @@ -3,10 +3,12 @@ #ifndef _CL_RCPOINTER2_HASHWEAK_RCPOINTER_H #define _CL_RCPOINTER2_HASHWEAK_RCPOINTER_H -#include "cl_object.h" +#include "cln/object.h" #include "cl_hash2weak.h" +namespace cln { + // Equality. static inline bool equal (const cl_rcpointer& x, const cl_rcpointer& y) { return (x.pointer == y.pointer); } @@ -41,4 +43,6 @@ struct cl_wht_from_rcpointer2_to_rcpointer : public cl_rcpointer { void put (const cl_rcpointer& x, const cl_rcpointer& y, const cl_rcpointer& z) const; }; +} // namespace cln + #endif /* _CL_RCPOINTER2_HASHWEAK_RCPOINTER_H */ diff --git a/src/base/hash/cl_rcpointer_hashweak_rcpointer.cc b/src/base/hash/cl_rcpointer_hashweak_rcpointer.cc index 8967994..6d134a5 100644 --- a/src/base/hash/cl_rcpointer_hashweak_rcpointer.cc +++ b/src/base/hash/cl_rcpointer_hashweak_rcpointer.cc @@ -11,6 +11,8 @@ #include "cl_hash1weak.h" +namespace cln { + static void cl_weak_hashtable_from_rcpointer_to_rcpointer_destructor (cl_heap* pointer) { #if (defined(__mips__) || defined(__mips64__)) && !defined(__GNUC__) // workaround SGI CC bug @@ -45,3 +47,4 @@ void cl_wht_from_rcpointer_to_rcpointer::put (const cl_rcpointer& x, const cl_rc ((cl_heap_weak_hashtable_from_rcpointer_to_rcpointer*)pointer)->put(x,y); } +} // namespace cln diff --git a/src/base/hash/cl_rcpointer_hashweak_rcpointer.h b/src/base/hash/cl_rcpointer_hashweak_rcpointer.h index 96e5413..cda04e8 100644 --- a/src/base/hash/cl_rcpointer_hashweak_rcpointer.h +++ b/src/base/hash/cl_rcpointer_hashweak_rcpointer.h @@ -3,10 +3,12 @@ #ifndef _CL_RCPOINTER_HASHWEAK_RCPOINTER_H #define _CL_RCPOINTER_HASHWEAK_RCPOINTER_H -#include "cl_object.h" +#include "cln/object.h" #include "cl_hash1weak.h" +namespace cln { + // Equality. static inline bool equal (const cl_rcpointer& x, const cl_rcpointer& y) { return (x.pointer == y.pointer); } @@ -36,4 +38,6 @@ struct cl_wht_from_rcpointer_to_rcpointer : public cl_rcpointer { void put (const cl_rcpointer& x, const cl_rcpointer& y) const; }; +} // namespace cln + #endif /* _CL_RCPOINTER_HASHWEAK_RCPOINTER_H */ diff --git a/src/base/input/cl_read_err_bad.cc b/src/base/input/cl_read_err_bad.cc index 1880a35..1fdc227 100644 --- a/src/base/input/cl_read_err_bad.cc +++ b/src/base/input/cl_read_err_bad.cc @@ -4,19 +4,23 @@ #include "cl_sysdep.h" // Specification. -#include "cl_number_io.h" +#include "cln/number_io.h" // Implementation. -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/abort.h" + +namespace cln { void read_number_bad_syntax (const char * string, const char * string_limit) { - fprint(cl_stderr, "Illegal number syntax: \""); + fprint(stderr, "Illegal number syntax: \""); for (const char * ptr = string; ptr != string_limit; ptr++) - fprintchar(cl_stderr, *ptr); - fprint(cl_stderr, "\"\n"); + fprintchar(stderr, *ptr); + fprint(stderr, "\"\n"); cl_abort(); } + +} // namespace cln diff --git a/src/base/input/cl_read_err_eof.cc b/src/base/input/cl_read_err_eof.cc index f6bd100..ac27d37 100644 --- a/src/base/input/cl_read_err_eof.cc +++ b/src/base/input/cl_read_err_eof.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_number_io.h" +#include "cln/number_io.h" // Implementation. -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/abort.h" + +namespace cln { void read_number_eof (void) { - fprint(cl_stderr, "read_number: end of stream encountered\n"); + fprint(stderr, "read_number: end of stream encountered\n"); cl_abort(); } + +} // namespace cln diff --git a/src/base/input/cl_read_err_junk.cc b/src/base/input/cl_read_err_junk.cc index 3cc5fc9..8874109 100644 --- a/src/base/input/cl_read_err_junk.cc +++ b/src/base/input/cl_read_err_junk.cc @@ -4,24 +4,28 @@ #include "cl_sysdep.h" // Specification. -#include "cl_number_io.h" +#include "cln/number_io.h" // Implementation. -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/abort.h" + +namespace cln { void read_number_junk (const char * string_rest, const char * string, const char * string_limit) { - fprint(cl_stderr, "Junk after number: "); + fprint(stderr, "Junk after number: "); { for (const char * ptr = string; ptr != string_rest; ptr++) - fprintchar(cl_stderr, *ptr); + fprintchar(stderr, *ptr); } - fprint(cl_stderr, "\""); + fprint(stderr, "\""); { for (const char * ptr = string_rest; ptr != string_limit; ptr++) - fprintchar(cl_stderr, *ptr); + fprintchar(stderr, *ptr); } - fprint(cl_stderr, "\"\n"); + fprint(stderr, "\"\n"); cl_abort(); } + +} // namespace cln diff --git a/src/base/input/cl_read_globals.cc b/src/base/input/cl_read_globals.cc new file mode 100644 index 0000000..4064e96 --- /dev/null +++ b/src/base/input/cl_read_globals.cc @@ -0,0 +1,12 @@ +// Global variables in CLN + +// Specification. +#include "cln/io.h" + +// Implementation. + +namespace cln { + +extern cl_istream stdin = std::cin; + +} // namespace cln diff --git a/src/base/low/cl_low_div.cc b/src/base/low/cl_low_div.cc index 13641f9..c8e3366 100644 --- a/src/base/low/cl_low_div.cc +++ b/src/base/low/cl_low_div.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + #ifdef NEED_VAR_divu_16_rest uint16 divu_16_rest; #endif @@ -304,3 +306,4 @@ uint64 divu_12864_6464_(uint64 xhi, uint64 xlo, uint64 y) } } } #endif +} // namespace cln diff --git a/src/base/low/cl_low_isqrt.cc b/src/base/low/cl_low_isqrt.cc index a5714e5..b4cf1cc 100644 --- a/src/base/low/cl_low_isqrt.cc +++ b/src/base/low/cl_low_isqrt.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + // Zieht die Ganzzahl-Wurzel aus einer 32-Bit-Zahl und // liefert eine 16-Bit-Wurzel. // isqrt(x) @@ -58,3 +60,5 @@ uintL isqrt (uintL x) } }} } + +} // namespace cln diff --git a/src/base/low/cl_low_isqrt2.cc b/src/base/low/cl_low_isqrt2.cc index 396cfac..eb68d48 100644 --- a/src/base/low/cl_low_isqrt2.cc +++ b/src/base/low/cl_low_isqrt2.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + // Zieht die Ganzzahl-Wurzel aus einer 64-Bit-Zahl und // liefert eine 32-Bit-Wurzel. // isqrt(x1,x0) @@ -57,3 +59,5 @@ uintL isqrt (uintL x1, uintL x0) } }} } + +} // namespace cln diff --git a/src/base/low/cl_low_mul.cc b/src/base/low/cl_low_mul.cc index eacd99f..719a396 100644 --- a/src/base/low/cl_low_mul.cc +++ b/src/base/low/cl_low_mul.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + #ifdef NEED_VAR_mulu32_high uint32 mulu32_high; #endif @@ -69,3 +71,5 @@ uint64 mulu64_ (uint64 x, uint64 y) mulu64_high = hi; return lo; } #endif + +} // namespace cln diff --git a/src/base/output/cl_output_dec.cc b/src/base/output/cl_output_dec.cc index 3465bf1..27facca 100644 --- a/src/base/output/cl_output_dec.cc +++ b/src/base/output/cl_output_dec.cc @@ -4,26 +4,12 @@ #include "cl_sysdep.h" // Specification. -#include "cl_io.h" +#include "cln/io.h" // Implementation. -#if defined(CL_IO_STDIO) - -void fprintdecimal (cl_ostream stream, unsigned long x) -{ - fprintf(stream,"%lu",x); -} - -void fprintdecimal (cl_ostream stream, long x) -{ - fprintf(stream,"%ld",x); -} - -#endif - -#if defined(CL_IO_IOSTREAM) +namespace cln { // We don't use `stream << x' or `stream << dec << x', because an ostream // carries so many attributes, and we don't want to modifies these attributes. @@ -54,4 +40,4 @@ void fprintdecimal (cl_ostream stream, long x) } } -#endif +} // namespace cln diff --git a/src/base/output/cl_output_hex.cc b/src/base/output/cl_output_hex.cc index 7098b31..552612e 100644 --- a/src/base/output/cl_output_hex.cc +++ b/src/base/output/cl_output_hex.cc @@ -4,21 +4,12 @@ #include "cl_sysdep.h" // Specification. -#include "cl_io.h" +#include "cln/io.h" // Implementation. -#if defined(CL_IO_STDIO) - -void fprinthexadecimal (cl_ostream stream, unsigned long x) -{ - fprintf(stream,"%lX",x); -} - -#endif - -#if defined(CL_IO_IOSTREAM) +namespace cln { void fprinthexadecimal (cl_ostream stream, unsigned long x) { @@ -36,8 +27,6 @@ void fprinthexadecimal (cl_ostream stream, unsigned long x) #undef bufsize } -#endif - void fprinthexadecimal (cl_ostream stream, long x) { if (x >= 0) @@ -47,3 +36,5 @@ void fprinthexadecimal (cl_ostream stream, long x) fprintdecimal(stream,(unsigned long)(-1-x)+1); } } + +} // namespace cln diff --git a/src/base/output/cl_prin_globals.cc b/src/base/output/cl_prin_globals.cc index 8a25148..98ce102 100644 --- a/src/base/output/cl_prin_globals.cc +++ b/src/base/output/cl_prin_globals.cc @@ -6,23 +6,30 @@ CL_PROVIDE(cl_prin_globals) // Specification. -#include "cl_output.h" +#include "cln/output.h" // Implementation. -cl_print_flags cl_default_print_flags; +namespace cln { + +cl_ostream stdout = std::cout; +cl_ostream stderr = std::cerr; + +cl_print_flags default_print_flags; #if 0 // The default constructors already do this. -AT_INITIALIZATION(cl_default_print_flags) +AT_INITIALIZATION(default_print_flags) { - cl_default_print_flags.rational_base = 10; - cl_default_print_flags.rational_readably = cl_false; - cl_default_print_flags.float_readably = cl_false; - cl_default_print_flags.default_float_format = cl_float_format_ffloat; - cl_default_print_flags.complex_readably = cl_false; - cl_default_print_flags.vector_syntax = vsyntax_pretty; - cl_default_print_flags.univpoly_varname = "x"; + default_print_flags.rational_base = 10; + default_print_flags.rational_readably = cl_false; + default_print_flags.float_readably = cl_false; + default_print_flags.default_float_format = float_format_ffloat; + default_print_flags.complex_readably = cl_false; + default_print_flags.vector_syntax = vsyntax_pretty; + default_print_flags.univpoly_varname = "x"; } #endif +} // namespace cln + CL_PROVIDE_END(cl_prin_globals) diff --git a/src/base/proplist/cl_pl_add.cc b/src/base/proplist/cl_pl_add.cc index 3240b98..3de5272 100644 --- a/src/base/proplist/cl_pl_add.cc +++ b/src/base/proplist/cl_pl_add.cc @@ -4,12 +4,14 @@ #include "cl_sysdep.h" // Specification. -#include "cl_proplist.h" +#include "cln/proplist.h" // Implementation. -#include "cl_abort.h" +#include "cln/abort.h" + +namespace cln { // This tells the compiler to put the `cl_property' vtable into this file. void cl_property::dummy () {} @@ -21,3 +23,5 @@ void cl_property_list::add_property (cl_property* new_property) new_property->next = list; list = new_property; } + +} // namespace cln diff --git a/src/base/proplist/cl_pl_d.cc b/src/base/proplist/cl_pl_d.cc index 10cd5d9..b60c841 100644 --- a/src/base/proplist/cl_pl_d.cc +++ b/src/base/proplist/cl_pl_d.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_proplist.h" +#include "cln/proplist.h" // Implementation. +namespace cln { + cl_property_list::~cl_property_list () { while (list) { @@ -17,3 +19,5 @@ cl_property_list::~cl_property_list () delete l; } } + +} // namespace cln diff --git a/src/base/proplist/cl_pl_get.cc b/src/base/proplist/cl_pl_get.cc index 673d2b9..c1f2e12 100644 --- a/src/base/proplist/cl_pl_get.cc +++ b/src/base/proplist/cl_pl_get.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_proplist.h" +#include "cln/proplist.h" // Implementation. +namespace cln { + cl_property* cl_property_list::get_property (const cl_symbol& key) { var cl_property* l; @@ -17,3 +19,5 @@ cl_property* cl_property_list::get_property (const cl_symbol& key) break; return l; } + +} // namespace cln diff --git a/src/base/random/cl_UL_random.cc b/src/base/random/cl_UL_random.cc index fbb34be..782ab48 100644 --- a/src/base/random/cl_UL_random.cc +++ b/src/base/random/cl_UL_random.cc @@ -4,19 +4,21 @@ #include "cl_sysdep.h" // Specification. -#include "cl_random.h" +#include "cln/random.h" // Implementation. #include "cl_low.h" +namespace cln { + // Zufallszahlengenerator nach [Knuth: The Art of Computer Programming, Vol. II, // Seminumerical Algorithms, 3.3.4., Table 1, Line 30], nach C. Haynes: // X eine 64-Bit-Zahl. Iteration X := (a*X+c) mod m // mit m=2^64, a=6364136223846793005, c=1. -uint32 random32 (cl_random_state& randomstate) +uint32 random32 (random_state& randomstate) { #ifdef HAVE_FAST_LONGLONG // Multiplikator a=6364136223846793005 = 0x5851F42D4C957F2D : @@ -54,3 +56,5 @@ uint32 random32 (cl_random_state& randomstate) return highlow32(low16(newseed_hi),high16(newseed_lo)); #endif } + +} // namespace cln diff --git a/src/base/random/cl_random_def.cc b/src/base/random/cl_random_def.cc index a1e3357..59373a6 100644 --- a/src/base/random/cl_random_def.cc +++ b/src/base/random/cl_random_def.cc @@ -1,4 +1,4 @@ -// cl_default_random_state. +// default_random_state. // General includes. #include "cl_sysdep.h" @@ -6,11 +6,15 @@ CL_PROVIDE(cl_random_def) // Specification. -#include "cl_random.h" +#include "cln/random.h" // Implementation. -cl_random_state cl_default_random_state; +namespace cln { + +random_state default_random_state; + +} // namespace cln CL_PROVIDE_END(cl_random_def) diff --git a/src/base/random/cl_random_from.cc b/src/base/random/cl_random_from.cc index 8ed6392..f796c25 100644 --- a/src/base/random/cl_random_from.cc +++ b/src/base/random/cl_random_from.cc @@ -1,10 +1,10 @@ -// cl_random_state constructor. +// random_state constructor. // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_random.h" +#include "cln/random.h" // Implementation. @@ -31,7 +31,7 @@ inline uint32 get_seed (void) { var struct timeval tv; gettimeofday(&tv,0); - return highlow32(tv.tv_sec,tv.tv_usec); // 16+16 zufällige Bits + return cln::highlow32(tv.tv_sec,tv.tv_usec); // 16+16 zufällige Bits } #elif defined(HAVE_FTIME) @@ -70,16 +70,18 @@ inline uint32 get_seed (void) #endif +namespace cln { + // Counter, to avoid that two random-states created immediately one after // the other contain the same seed. static uint32 counter = 0; -cl_random_state::cl_random_state () +random_state::random_state () { var uint32 seed_hi; var uint32 seed_lo; #if defined(unix) || defined(__unix) || defined(_AIX) || defined(sinix) || (defined(_WIN32) && defined(__GNUC__)) - seed_lo = get_seed(); + seed_lo = ::get_seed(); seed_hi = (rand() // zufällige 31 Bit (bei UNIX_BSD) bzw. 16 Bit (bei UNIX_SYSV) << 8) ^ (uintL)(getpid()); // ca. 8 Bit von der Process ID #elif defined(__atarist) @@ -93,9 +95,11 @@ cl_random_state::cl_random_state () seed_lo = get_real_time(); // Uhrzeit, 100 Hz seed_hi = time(NULL); #else -#error "Must implement cl_random_state constructor!" +#error "Must implement random_state constructor!" #endif seed_hi ^= counter++ << 5; seed.hi = seed_hi; seed.lo = seed_lo; } + +} // namespace cln diff --git a/src/base/random/cl_random_impl.h b/src/base/random/cl_random_impl.h index 92e8ff0..f4dc0d4 100644 --- a/src/base/random/cl_random_impl.h +++ b/src/base/random/cl_random_impl.h @@ -3,20 +3,24 @@ #ifndef _CL_RANDOM_IMPL_H #define _CL_RANDOM_IMPL_H -#include "cl_random.h" +#include "cln/random.h" + +namespace cln { // random_UDS(randomstate,MSDptr,len) füllt die UDS MSDptr/len/.. // mit len Zufallsdigits. // > randomstate: ein Random-State, wird verändert // > MSDptr/len/..: wo die Zufallsdigits abgelegt werden sollen // > len: gewünschte Anzahl von Zufallsdigits -extern void random_UDS (cl_random_state& randomstate, uintD* MSDptr, uintC len); +extern void random_UDS (random_state& randomstate, uintD* MSDptr, uintC len); // testrandom_UDS(randomstate,MSDptr,len) füllt die UDS MSDptr/len/.. // mit len Zufallsdigits, mit relativ langen Blöcken von Nullen und Einsen. // > randomstate: ein Random-State, wird verändert // > MSDptr/len/..: wo die Zufallsdigits abgelegt werden sollen // > len: gewünschte Anzahl von Zufallsdigits -extern void testrandom_UDS (cl_random_state& randomstate, uintD* MSDptr, uintC len); +extern void testrandom_UDS (random_state& randomstate, uintD* MSDptr, uintC len); + +} // namespace cln #endif /* _CL_RANDOM_IMPL_H */ diff --git a/src/base/ring/cl_no_ring.cc b/src/base/ring/cl_no_ring.cc index d0fe485..1331da0 100644 --- a/src/base/ring/cl_no_ring.cc +++ b/src/base/ring/cl_no_ring.cc @@ -6,29 +6,31 @@ CL_PROVIDE(cl_no_ring) // Specification. -#include "cl_ring.h" +#include "cln/ring.h" // Implementation. -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/abort.h" + +namespace cln { nonreturning_function(static, uninitialized_ring, (void)); static void uninitialized_ring () { - fprint(cl_stderr, "Uninitialized ring operation called\n"); + fprint(stderr, "Uninitialized ring operation called\n"); cl_abort(); } nonreturning_function(static, uninitialized_error, (const _cl_ring_element&)); static void uninitialized_error (const _cl_ring_element& obj) { - fprint(cl_stderr, "Uninitialized ring element @0x"); - fprinthexadecimal(cl_stderr, (unsigned long)(void*)&obj); - fprint(cl_stderr, ": 0x"); - fprinthexadecimal(cl_stderr, (unsigned long)obj.rep.word); - fprint(cl_stderr, "\n"); + fprint(stderr, "Uninitialized ring element @0x"); + fprinthexadecimal(stderr, (unsigned long)(void*)&obj); + fprint(stderr, ": 0x"); + fprinthexadecimal(stderr, (unsigned long)obj.rep.word); + fprint(stderr, "\n"); cl_abort(); } @@ -144,4 +146,6 @@ cl_class cl_class_no_ring = { const cl_ring cl_no_ring = cl_ring (new cl_heap_no_ring()); +} // namespace cln + CL_PROVIDE_END(cl_no_ring) diff --git a/src/base/ring/cl_ring_debug.cc b/src/base/ring/cl_ring_debug.cc index cab9b4c..35fe61e 100644 --- a/src/base/ring/cl_ring_debug.cc +++ b/src/base/ring/cl_ring_debug.cc @@ -4,22 +4,22 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ring.h" +#include "cln/ring.h" // Implementation. -#include "cl_io.h" +#include "cln/io.h" + +namespace cln { void cl_ring_element::debug_print () const { fprint(cl_debugout, *this); - #ifdef CL_IO_IOSTREAM - cl_debugout << endl; // newline and flush output - #else - fprint(cl_debugout, "\n"); - #endif + cl_debugout << std::endl; // newline and flush output } -// This dummy links in this module when requires it. +// This dummy links in this module when requires it. int cl_ring_debug_module; + +} // namespace cln diff --git a/src/base/string/cl_spushstring.h b/src/base/string/cl_spushstring.h index 5f2787b..0abfa51 100644 --- a/src/base/string/cl_spushstring.h +++ b/src/base/string/cl_spushstring.h @@ -3,10 +3,12 @@ #ifndef _CL_SPUSHSTRING_H #define _CL_SPUSHSTRING_H -#include "cl_object.h" -#include "cl_malloc.h" +#include "cln/object.h" +#include "cln/malloc.h" #include "cl_sstring.h" -#include "cl_abort.h" +#include "cln/abort.h" + +namespace cln { class cl_spushstring { protected: @@ -24,7 +26,7 @@ public: void push (char); // Adds several characters at the end at once. void append (const char * ptr, uintL len); -// Get the contents as a string. Free it using cl_free_hook() when done. +// Get the contents as a string. Free it using free_hook() when done. char* contents (); // Look at the contents. uintL length () const; @@ -33,12 +35,12 @@ public: inline cl_spushstring::cl_spushstring () { alloc = 20; // Must be > 0. - buffer = (char *) cl_malloc_hook(alloc); + buffer = (char *) malloc_hook(alloc); index = 0; } inline cl_spushstring::~cl_spushstring () { - cl_free_hook(buffer); + free_hook(buffer); } inline void cl_spushstring::reset () { @@ -58,4 +60,6 @@ inline char cl_spushstring::operator[] (uintL i) const return buffer[i]; } +} // namespace cln + #endif /* _CL_SPUSHSTRING_H */ diff --git a/src/base/string/cl_spushstring_append.cc b/src/base/string/cl_spushstring_append.cc index 245d7a2..56a69bf 100644 --- a/src/base/string/cl_spushstring_append.cc +++ b/src/base/string/cl_spushstring_append.cc @@ -11,14 +11,16 @@ #include // declares memcpy() +namespace cln { + void cl_spushstring::append (const char * ptr, uintL len) { if (index + len > alloc) { var uintL newalloc = index+2*len; if (newalloc < 2*alloc) { newalloc = 2*alloc; } - var char* newbuffer = (char *) cl_malloc_hook(newalloc); + var char* newbuffer = (char *) malloc_hook(newalloc); memcpy(newbuffer,buffer,alloc); - cl_free_hook(buffer); + free_hook(buffer); buffer = newbuffer; alloc = newalloc; } @@ -26,3 +28,5 @@ void cl_spushstring::append (const char * ptr, uintL len) for (uintL count = len; count > 0; count--) buffer[index++] = *ptr++; } + +} // namespace cln diff --git a/src/base/string/cl_spushstring_push.cc b/src/base/string/cl_spushstring_push.cc index 29cb91f..c45197c 100644 --- a/src/base/string/cl_spushstring_push.cc +++ b/src/base/string/cl_spushstring_push.cc @@ -11,16 +11,20 @@ #include // declares memcpy() +namespace cln { + void cl_spushstring::push (char c) { if (index >= alloc) { var uintL newalloc = 2*alloc; - var char* newbuffer = (char *) cl_malloc_hook(newalloc); + var char* newbuffer = (char *) malloc_hook(newalloc); memcpy(newbuffer,buffer,alloc); - cl_free_hook(buffer); + free_hook(buffer); buffer = newbuffer; alloc = newalloc; } // Now index < alloc. buffer[index++] = c; } + +} // namespace cln diff --git a/src/base/string/cl_sstring.cc b/src/base/string/cl_sstring.cc index 3e67af0..0c8a774 100644 --- a/src/base/string/cl_sstring.cc +++ b/src/base/string/cl_sstring.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_malloc.h" +#include "cln/malloc.h" + +namespace cln { char * cl_sstring (const char * ptr, uintL len) { - var char * string = (char *) cl_malloc_hook(len+1); + var char * string = (char *) malloc_hook(len+1); { var const char* ptr1 = ptr; var char* ptr2 = string; @@ -24,3 +26,5 @@ char * cl_sstring (const char * ptr, uintL len) } return string; } + +} // namespace cln diff --git a/src/base/string/cl_sstring.h b/src/base/string/cl_sstring.h index 433bb9e..a512140 100644 --- a/src/base/string/cl_sstring.h +++ b/src/base/string/cl_sstring.h @@ -3,8 +3,12 @@ #ifndef _CL_SSTRING_H #define _CL_SSTRING_H +namespace cln { + // Liefert einen String. -// Mit cl_malloc_hook() alloziert, mit cl_free_hook() freizugeben. +// Mit malloc_hook() alloziert, mit free_hook() freizugeben. extern char * cl_sstring (const char * ptr, uintL len); +} // namespace cln + #endif /* _CL_SSTRING_H */ diff --git a/src/base/string/cl_st_c2.cc b/src/base/string/cl_st_c2.cc index 163e66b..0adc918 100644 --- a/src/base/string/cl_st_c2.cc +++ b/src/base/string/cl_st_c2.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_string.h" +#include "cln/string.h" // Implementation. +namespace cln { + extern cl_heap_string* cl_make_heap_string (const char * ptr, unsigned long len); cl_string::cl_string (const char * ptr, unsigned long len) { pointer = cl_make_heap_string(ptr,len); } + +} // namespace cln diff --git a/src/base/string/cl_st_concat1.cc b/src/base/string/cl_st_concat1.cc index 56ea069..44d0e6d 100644 --- a/src/base/string/cl_st_concat1.cc +++ b/src/base/string/cl_st_concat1.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_string.h" +#include "cln/string.h" // Implementation. @@ -13,6 +13,8 @@ #define MAYBE_INLINE inline #include "cl_st_make0.cc" +namespace cln { + const cl_string operator+ (const cl_string& str1, const cl_string& str2) { unsigned long len1 = strlen(str1); @@ -32,3 +34,5 @@ const cl_string operator+ (const cl_string& str1, const cl_string& str2) *ptr++ = '\0'; return str; } + +} // namespace cln diff --git a/src/base/string/cl_st_concat2.cc b/src/base/string/cl_st_concat2.cc index 3a16604..e14fdbe 100644 --- a/src/base/string/cl_st_concat2.cc +++ b/src/base/string/cl_st_concat2.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_string.h" +#include "cln/string.h" // Implementation. @@ -13,9 +13,11 @@ #define MAYBE_INLINE inline #include "cl_st_make0.cc" +namespace cln { + const cl_string operator+ (const char* str1, const cl_string& str2) { - unsigned long len1 = strlen(str1); + unsigned long len1 = ::strlen(str1); unsigned long len2 = strlen(str2); var cl_heap_string* str = cl_make_heap_string(len1+len2); var char * ptr = &str->data[0]; @@ -32,3 +34,5 @@ const cl_string operator+ (const char* str1, const cl_string& str2) *ptr++ = '\0'; return str; } + +} // namespace cln diff --git a/src/base/string/cl_st_concat3.cc b/src/base/string/cl_st_concat3.cc index c2ce3b4..a27a753 100644 --- a/src/base/string/cl_st_concat3.cc +++ b/src/base/string/cl_st_concat3.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_string.h" +#include "cln/string.h" // Implementation. @@ -13,10 +13,12 @@ #define MAYBE_INLINE inline #include "cl_st_make0.cc" +namespace cln { + const cl_string operator+ (const cl_string& str1, const char* str2) { unsigned long len1 = strlen(str1); - unsigned long len2 = strlen(str2); + unsigned long len2 = ::strlen(str2); var cl_heap_string* str = cl_make_heap_string(len1+len2); var char * ptr = &str->data[0]; { @@ -32,3 +34,5 @@ const cl_string operator+ (const cl_string& str1, const char* str2) *ptr++ = '\0'; return str; } + +} // namespace cln diff --git a/src/base/string/cl_st_debug.cc b/src/base/string/cl_st_debug.cc index 5d37a60..948c5ec 100644 --- a/src/base/string/cl_st_debug.cc +++ b/src/base/string/cl_st_debug.cc @@ -8,10 +8,12 @@ // Implementation. -#include "cl_string.h" -#include "cl_io.h" +#include "cln/string.h" +#include "cln/io.h" #include +namespace cln { + static void dprint (cl_heap* pointer) { var const cl_string& obj = *(const cl_string*)&pointer; @@ -45,5 +47,7 @@ static void dprint (cl_heap* pointer) AT_INITIALIZATION(dprint_string) { cl_register_type_printer(cl_class_string,dprint); } -// This dummy links in this module when requires it. +// This dummy links in this module when requires it. int cl_string_debug_module; + +} // namespace cln diff --git a/src/base/string/cl_st_hashcode.cc b/src/base/string/cl_st_hashcode.cc index 61b23e1..f2da3b4 100644 --- a/src/base/string/cl_st_hashcode.cc +++ b/src/base/string/cl_st_hashcode.cc @@ -1,14 +1,16 @@ -// cl_string hashcode(). +// cln/string.hashcode(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_string.h" +#include "cln/string.h" // Implementation. +namespace cln { + unsigned long hashcode (const cl_string& str) { var unsigned long code = 0x61284AF3; @@ -25,3 +27,5 @@ unsigned long hashcode (const cl_string& str) } return code; } + +} // namespace cln diff --git a/src/base/string/cl_st_make0.cc b/src/base/string/cl_st_make0.cc index e0cd132..1628d42 100644 --- a/src/base/string/cl_st_make0.cc +++ b/src/base/string/cl_st_make0.cc @@ -4,20 +4,24 @@ #include "cl_sysdep.h" // Specification. -#include "cl_string.h" +#include "cln/string.h" // Implementation. -#include "cl_malloc.h" +#include "cln/malloc.h" #include "cl_offsetof.h" +namespace cln { + MAYBE_INLINE cl_heap_string* cl_make_heap_string (unsigned long len) { - var cl_heap_string* str = (cl_heap_string*) cl_malloc_hook(offsetofa(cl_heap_string,data)+sizeof(char)*(len+1)); + var cl_heap_string* str = (cl_heap_string*) malloc_hook(offsetofa(cl_heap_string,data)+sizeof(char)*(len+1)); str->refcount = 1; str->type = &cl_class_string; str->length = len; return str; /* Have to fill data[0..len] yourself. */ } + +} // namespace cln diff --git a/src/base/string/cl_st_make1.cc b/src/base/string/cl_st_make1.cc index 919aba3..be96128 100644 --- a/src/base/string/cl_st_make1.cc +++ b/src/base/string/cl_st_make1.cc @@ -4,18 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_string.h" +#include "cln/string.h" // Implementation. -#include "cl_malloc.h" +#include "cln/malloc.h" #include "cl_offsetof.h" +namespace cln { + cl_heap_string* cl_make_heap_string (const char * s) { - var unsigned long len = strlen(s); - var cl_heap_string* str = (cl_heap_string*) cl_malloc_hook(offsetofa(cl_heap_string,data)+sizeof(char)*(len+1)); + var unsigned long len = ::strlen(s); + var cl_heap_string* str = (cl_heap_string*) malloc_hook(offsetofa(cl_heap_string,data)+sizeof(char)*(len+1)); str->refcount = 1; str->type = &cl_class_string; str->length = len; @@ -29,3 +31,5 @@ cl_heap_string* cl_make_heap_string (const char * s) } return str; } + +} // namespace cln diff --git a/src/base/string/cl_st_make2.cc b/src/base/string/cl_st_make2.cc index dfcdea0..1599e2b 100644 --- a/src/base/string/cl_st_make2.cc +++ b/src/base/string/cl_st_make2.cc @@ -4,17 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_string.h" +#include "cln/string.h" // Implementation. -#include "cl_malloc.h" +#include "cln/malloc.h" #include "cl_offsetof.h" +namespace cln { + cl_heap_string* cl_make_heap_string (const char * ptr, unsigned long len) { - var cl_heap_string* str = (cl_heap_string*) cl_malloc_hook(offsetofa(cl_heap_string,data)+sizeof(char)*(len+1)); + var cl_heap_string* str = (cl_heap_string*) malloc_hook(offsetofa(cl_heap_string,data)+sizeof(char)*(len+1)); str->refcount = 1; str->type = &cl_class_string; str->length = len; @@ -28,3 +30,5 @@ cl_heap_string* cl_make_heap_string (const char * ptr, unsigned long len) } return str; } + +} // namespace cln diff --git a/src/base/string/cl_st_null.cc b/src/base/string/cl_st_null.cc index 852ed64..e62b0a1 100644 --- a/src/base/string/cl_st_null.cc +++ b/src/base/string/cl_st_null.cc @@ -6,12 +6,20 @@ CL_PROVIDE(cl_st_null) // Specification. -#include "cl_string.h" +#include "cln/string.h" + +namespace cln { + extern const cl_string cl_null_string; +} // namespace cln // Implementation. +namespace cln { + const cl_string cl_null_string = cl_string(NULL,0); +} // namespace cln + CL_PROVIDE_END(cl_st_null) diff --git a/src/base/string/input/cl_st_get1.cc b/src/base/string/input/cl_st_get1.cc index 697a72f..4f2f560 100644 --- a/src/base/string/input/cl_st_get1.cc +++ b/src/base/string/input/cl_st_get1.cc @@ -4,20 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_string.h" +#include "cln/string.h" // Implementation. -#ifdef CL_IO_IOSTREAM - -#include "cl_io.h" +#include "cln/io.h" #include "cl_spushstring.h" -#if ((defined(__sparc__) || defined(__rs6000__) || defined(__mips__)) && !defined(__GNUC__)) -// Sun C++ doesn't have istream::unget(). - #define unget() putback(c) -#endif +namespace cln { const cl_string cl_fget (cl_istream stream, char delim) { @@ -26,7 +21,7 @@ const cl_string cl_fget (cl_istream stream, char delim) while (stream.good()) { var int c = stream.get(); if (c==EOF) - break; // ios::eofbit already set + break; // std::ios::eofbit already set if (c==delim) { stream.unget(); break; @@ -36,4 +31,4 @@ const cl_string cl_fget (cl_istream stream, char delim) return buffer.contents(); } -#endif +} // namespace cln diff --git a/src/base/string/input/cl_st_get2.cc b/src/base/string/input/cl_st_get2.cc index 79d92c0..f20daaa 100644 --- a/src/base/string/input/cl_st_get2.cc +++ b/src/base/string/input/cl_st_get2.cc @@ -4,21 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_string.h" +#include "cln/string.h" // Implementation. -#ifdef CL_IO_IOSTREAM - -#include "cl_io.h" +#include "cln/io.h" #include "cl_spushstring.h" -#if ((defined(__sparc__) || defined(__rs6000__) || defined(__mips__)) && !defined(__GNUC__)) -// Sun C++ doesn't have istream::unget() and istream::set(). - #define unget() putback(c) - #define set(x) setf(x) -#endif +namespace cln { const cl_string cl_fget (cl_istream stream, int n, char delim) { @@ -34,11 +28,7 @@ const cl_string cl_fget (cl_istream stream, int n, char delim) } if (--n <= 0) { stream.unget(); - #if defined(__GNUG__) && (__GNUC_MINOR__ < 8) - stream.set(ios::failbit); - #else // new ANSI C++ - stream.setstate(ios::failbit); - #endif + stream.setstate(std::ios::failbit); break; } buffer.push(c); @@ -46,4 +36,4 @@ const cl_string cl_fget (cl_istream stream, int n, char delim) return buffer.contents(); } -#endif +} // namespace cln diff --git a/src/base/string/input/cl_st_getline1.cc b/src/base/string/input/cl_st_getline1.cc index e3435c6..5421ae0 100644 --- a/src/base/string/input/cl_st_getline1.cc +++ b/src/base/string/input/cl_st_getline1.cc @@ -4,16 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_string.h" +#include "cln/string.h" // Implementation. -#ifdef CL_IO_IOSTREAM - -#include "cl_io.h" +#include "cln/io.h" #include "cl_spushstring.h" +namespace cln { + const cl_string cl_fgetline (cl_istream stream, char delim) { var cl_spushstring buffer; @@ -21,7 +21,7 @@ const cl_string cl_fgetline (cl_istream stream, char delim) while (stream.good()) { var int c = stream.get(); if (c==EOF) - break; // ios::eofbit already set + break; // std::ios::eofbit already set if (c==delim) break; buffer.push(c); @@ -29,4 +29,4 @@ const cl_string cl_fgetline (cl_istream stream, char delim) return buffer.contents(); } -#endif +} // namespace cln diff --git a/src/base/string/input/cl_st_getline2.cc b/src/base/string/input/cl_st_getline2.cc index 53397ae..fa015cb 100644 --- a/src/base/string/input/cl_st_getline2.cc +++ b/src/base/string/input/cl_st_getline2.cc @@ -4,21 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_string.h" +#include "cln/string.h" // Implementation. -#ifdef CL_IO_IOSTREAM - -#include "cl_io.h" +#include "cln/io.h" #include "cl_spushstring.h" -#if ((defined(__sparc__) || defined(__rs6000__) || defined(__mips__)) && !defined(__GNUC__)) -// Sun C++ doesn't have istream::unget() and istream::set(). - #define unget() putback(c) - #define set(x) setf(x) -#endif +namespace cln { const cl_string cl_fgetline (cl_istream stream, int n, char delim) { @@ -27,16 +21,12 @@ const cl_string cl_fgetline (cl_istream stream, int n, char delim) while (stream.good()) { var int c = stream.get(); if (c==EOF) - break; // ios::eofbit already set + break; // std::ios::eofbit already set if (c==delim) break; if (--n <= 0) { stream.unget(); - #if defined(__GNUG__) && (__GNUC_MINOR__ < 8) - stream.set(ios::failbit); - #else // new ANSI C++ - stream.setstate(ios::failbit); - #endif + stream.setstate(std::ios::failbit); break; } buffer.push(c); @@ -44,4 +34,4 @@ const cl_string cl_fgetline (cl_istream stream, int n, char delim) return buffer.contents(); } -#endif +} // namespace cln diff --git a/src/base/string/input/cl_st_gettoken.cc b/src/base/string/input/cl_st_gettoken.cc index 5213991..0f27fa7 100644 --- a/src/base/string/input/cl_st_gettoken.cc +++ b/src/base/string/input/cl_st_gettoken.cc @@ -4,21 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_string.h" +#include "cln/string.h" // Implementation. -#ifdef CL_IO_IOSTREAM - -#include "cl_io.h" +#include "cln/io.h" #include "cl_spushstring.h" #include -#if ((defined(__sparc__) || defined(__rs6000__) || defined(__mips__)) && !defined(__GNUC__)) -// Sun C++ doesn't have istream::unget(). - #define unget() putback(c) -#endif +namespace cln { cl_istream operator>> (cl_istream stream, cl_string& str) { @@ -62,4 +57,4 @@ cl_istream operator>> (cl_istream stream, cl_string& str) return stream; } -#endif +} // namespace cln diff --git a/src/base/string/misc/cl_st_class.cc b/src/base/string/misc/cl_st_class.cc index b3bd01e..0cf9a1a 100644 --- a/src/base/string/misc/cl_st_class.cc +++ b/src/base/string/misc/cl_st_class.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_string.h" +#include "cln/string.h" // Implementation. +namespace cln { + cl_class cl_class_string = { NULL, // empty destructor 0 }; + +} // namespace cln diff --git a/src/base/string/output/cl_st_print.cc b/src/base/string/output/cl_st_print.cc index 8bbbf66..be39578 100644 --- a/src/base/string/output/cl_st_print.cc +++ b/src/base/string/output/cl_st_print.cc @@ -4,24 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_string.h" +#include "cln/string.h" // Implementation. -#include "cl_io.h" +#include "cln/io.h" + +namespace cln { void fprint (cl_ostream stream, const cl_string& str) { -#if defined(CL_IO_STDIO) - var const char * ptr = str.asciz(); - var unsigned long i = str.length(); - while (i > 0) { - fprintchar(stream,*ptr); - ptr++; i--; - } -#endif -#if defined(CL_IO_IOSTREAM) stream.write(str.asciz(),str.length()); -#endif } + +} // namespace cln diff --git a/src/base/symbol/cl_sy_hashcode.cc b/src/base/symbol/cl_sy_hashcode.cc index 82579ec..a318221 100644 --- a/src/base/symbol/cl_sy_hashcode.cc +++ b/src/base/symbol/cl_sy_hashcode.cc @@ -1,16 +1,18 @@ -// cl_symbol hashcode(). +// cln/symbol.hashcode(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_symbol.h" +#include "cln/symbol.h" // Implementation. #include "cl_offsetof.h" +namespace cln { + #define declare_alignof(where,type) \ struct CONCAT(aligndummy,__LINE__) { char slot1; type slot2; }; \ const unsigned long where = offsetof(CONCAT(aligndummy,__LINE__), slot2); @@ -22,3 +24,5 @@ unsigned long hashcode (const cl_symbol& s) return (unsigned long)(s.pointer) / (string_alignment & -string_alignment); // divide by power of 2 } + +} // namespace cln diff --git a/src/base/symbol/cl_symbol.cc b/src/base/symbol/cl_symbol.cc index dd007cd..0193027 100644 --- a/src/base/symbol/cl_symbol.cc +++ b/src/base/symbol/cl_symbol.cc @@ -6,13 +6,15 @@ CL_PROVIDE(cl_symbol) // Specification. -#include "cl_symbol.h" +#include "cln/symbol.h" // Implementation. #include "cl_hashuniqweak.h" +namespace cln { + inline const cl_string hashkey (const cl_symbol& sym) { return (cl_string)sym; @@ -97,4 +99,6 @@ cl_symbol::cl_symbol (const cl_string& s) pointer = p; } +} // namespace cln + CL_PROVIDE_END(cl_symbol) diff --git a/src/complex/algebraic/cl_C_abs.cc b/src/complex/algebraic/cl_C_abs.cc index 03d2786..c7c57f5 100644 --- a/src/complex/algebraic/cl_C_abs.cc +++ b/src/complex/algebraic/cl_C_abs.cc @@ -4,18 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" #undef MAYBE_INLINE #define MAYBE_INLINE inline #include "cl_C_abs_aux.cc" +namespace cln { + const cl_R abs (const cl_N& x) { // Methode: @@ -29,3 +31,5 @@ const cl_R abs (const cl_N& x) return abs(x); } } + +} // namespace cln diff --git a/src/complex/algebraic/cl_C_abs_aux.cc b/src/complex/algebraic/cl_C_abs_aux.cc index 98ba466..adb83ad 100644 --- a/src/complex/algebraic/cl_C_abs_aux.cc +++ b/src/complex/algebraic/cl_C_abs_aux.cc @@ -9,7 +9,9 @@ // Implementation. -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { MAYBE_INLINE const cl_R abs (const cl_C& x) @@ -18,3 +20,5 @@ const cl_R abs (const cl_C& x) var const cl_R& b = imagpart(x); return cl_hypot(a,b); } + +} // namespace cln diff --git a/src/complex/algebraic/cl_C_signum.cc b/src/complex/algebraic/cl_C_signum.cc index 0dcbed0..d059f32 100644 --- a/src/complex/algebraic/cl_C_signum.cc +++ b/src/complex/algebraic/cl_C_signum.cc @@ -4,18 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" #undef MAYBE_INLINE #define MAYBE_INLINE inline #include "cl_C_abs_aux.cc" +namespace cln { + const cl_N signum (const cl_N& x) { // Methode: @@ -32,3 +34,5 @@ const cl_N signum (const cl_N& x) return x / abs(x); } } + +} // namespace cln diff --git a/src/complex/algebraic/cl_C_sqrt.cc b/src/complex/algebraic/cl_C_sqrt.cc index 4617382..a79b7f6 100644 --- a/src/complex/algebraic/cl_C_sqrt.cc +++ b/src/complex/algebraic/cl_C_sqrt.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N sqrt (const cl_N& x) { @@ -47,3 +49,5 @@ const cl_N sqrt (const cl_N& x) } } } + +} // namespace cln diff --git a/src/complex/algebraic/cl_DF_hypot.cc b/src/complex/algebraic/cl_DF_hypot.cc index 364aa34..fb6dba2 100644 --- a/src/complex/algebraic/cl_DF_hypot.cc +++ b/src/complex/algebraic/cl_DF_hypot.cc @@ -9,13 +9,15 @@ // Implementation. -#include "cl_dfloat.h" +#include "cln/dfloat.h" #include "cl_DF.h" #undef MAYBE_INLINE #define MAYBE_INLINE inline #include "cl_DF_minusp.cc" +namespace cln { + const cl_DF cl_hypot (const cl_DF& a, const cl_DF& b) { // a=0.0 -> liefere abs(b). @@ -55,3 +57,5 @@ const cl_DF cl_hypot (const cl_DF& a, const cl_DF& b) var cl_DF nc = square(na) + square(nb); return scale_float(sqrt(nc),e); // c' := sqrt(c'), 2^e*c' } + +} // namespace cln diff --git a/src/complex/algebraic/cl_FF_hypot.cc b/src/complex/algebraic/cl_FF_hypot.cc index 5f3f9bf..f52ba0d 100644 --- a/src/complex/algebraic/cl_FF_hypot.cc +++ b/src/complex/algebraic/cl_FF_hypot.cc @@ -9,13 +9,15 @@ // Implementation. -#include "cl_ffloat.h" +#include "cln/ffloat.h" #include "cl_FF.h" #undef MAYBE_INLINE #define MAYBE_INLINE inline #include "cl_FF_minusp.cc" +namespace cln { + const cl_FF cl_hypot (const cl_FF& a, const cl_FF& b) { // a=0.0 -> liefere abs(b). @@ -55,3 +57,5 @@ const cl_FF cl_hypot (const cl_FF& a, const cl_FF& b) var cl_FF nc = square(na) + square(nb); return scale_float(sqrt(nc),e); // c' := sqrt(c'), 2^e*c' } + +} // namespace cln diff --git a/src/complex/algebraic/cl_LF_hypot.cc b/src/complex/algebraic/cl_LF_hypot.cc index 5455b3e..70f51a0 100644 --- a/src/complex/algebraic/cl_LF_hypot.cc +++ b/src/complex/algebraic/cl_LF_hypot.cc @@ -9,7 +9,7 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" #include "cl_LF_impl.h" @@ -17,6 +17,8 @@ #define MAYBE_INLINE inline #include "cl_LF_minusp.cc" +namespace cln { + ALL_cl_LF_OPERATIONS_SAME_PRECISION() const cl_LF cl_hypot (const cl_LF& a, const cl_LF& b) @@ -71,3 +73,5 @@ const cl_LF cl_hypot (const cl_LF& a, const cl_LF& b) var cl_LF nc = square(na) + square(nb); return scale_float(sqrt(nc),e); // c' := sqrt(c'), 2^e*c' }} + +} // namespace cln diff --git a/src/complex/algebraic/cl_R_hypot.cc b/src/complex/algebraic/cl_R_hypot.cc index aeea356..431705c 100644 --- a/src/complex/algebraic/cl_R_hypot.cc +++ b/src/complex/algebraic/cl_R_hypot.cc @@ -9,9 +9,9 @@ // Implementation. -#include "cl_real.h" +#include "cln/real.h" #include "cl_R.h" -#include "cl_rational.h" +#include "cln/rational.h" #include "cl_RA.h" #include "cl_F.h" #include "cl_SF.h" @@ -19,6 +19,8 @@ #include "cl_DF.h" #include "cl_LF.h" +namespace cln { + const cl_R cl_hypot (const cl_R& a, const cl_R& b) { // Methode: @@ -86,3 +88,5 @@ const cl_R cl_hypot (const cl_R& a, const cl_R& b) } } } + +} // namespace cln diff --git a/src/complex/algebraic/cl_SF_hypot.cc b/src/complex/algebraic/cl_SF_hypot.cc index b74ab4b..d410bea 100644 --- a/src/complex/algebraic/cl_SF_hypot.cc +++ b/src/complex/algebraic/cl_SF_hypot.cc @@ -9,13 +9,15 @@ // Implementation. -#include "cl_sfloat.h" +#include "cln/sfloat.h" #include "cl_SF.h" #undef MAYBE_INLINE #define MAYBE_INLINE inline #include "cl_SF_minusp.cc" +namespace cln { + const cl_SF cl_hypot (const cl_SF& a, const cl_SF& b) { // a=0.0 -> liefere abs(b). @@ -55,3 +57,5 @@ const cl_SF cl_hypot (const cl_SF& a, const cl_SF& b) var cl_SF nc = square(na) + square(nb); return scale_float(sqrt(nc),e); // c' := sqrt(c'), 2^e*c' } + +} // namespace cln diff --git a/src/complex/cl_C.h b/src/complex/cl_C.h index f3c22be..8e96f14 100644 --- a/src/complex/cl_C.h +++ b/src/complex/cl_C.h @@ -3,14 +3,16 @@ #ifndef _CL_C_H #define _CL_C_H -#include "cl_number.h" -#include "cl_complex.h" -#include "cl_sfloat_class.h" -#include "cl_ffloat_class.h" -#include "cl_dfloat_class.h" -#include "cl_lfloat_class.h" +#include "cln/number.h" +#include "cln/complex.h" +#include "cln/sfloat_class.h" +#include "cln/ffloat_class.h" +#include "cln/dfloat_class.h" +#include "cln/lfloat_class.h" #include "cl_macros.h" -#include "cl_malloc.h" +#include "cln/malloc.h" + +namespace cln { struct cl_heap_complex : cl_heap { cl_R realpart; @@ -24,7 +26,7 @@ inline cl_heap_complex* TheComplex (const cl_number& obj) inline cl_heap_complex* allocate_complex (const cl_R& real, const cl_R& imag) { - cl_heap_complex* p = (cl_heap_complex*) cl_malloc_hook(sizeof(cl_heap_complex)); + cl_heap_complex* p = (cl_heap_complex*) malloc_hook(sizeof(cl_heap_complex)); p->refcount = 1; p->type = &cl_class_complex; p->realpart.pointer = real.pointer; cl_inc_refcount(real); @@ -186,5 +188,6 @@ extern const cl_C_R atanh (const cl_R& x, const cl_R& y); // Hilfsfunktion für asinh und asin: u+iv := arsinh(x+iy). Liefert cl_C_R(u,v). extern const cl_C_R asinh (const cl_R& x, const cl_R& y); +} // namespace cln #endif /* _CL_C_H */ diff --git a/src/complex/elem/cl_C_equal.cc b/src/complex/elem/cl_C_equal.cc index e3315e9..b028106 100644 --- a/src/complex/elem/cl_C_equal.cc +++ b/src/complex/elem/cl_C_equal.cc @@ -1,18 +1,20 @@ -// cl_equal(). +// equal(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" -cl_boolean cl_equal (const cl_N& x, const cl_N& y) +namespace cln { + +cl_boolean equal (const cl_N& x, const cl_N& y) { // Methode: // Falls beide reell, klar. @@ -24,13 +26,13 @@ cl_boolean cl_equal (const cl_N& x, const cl_N& y) if (realp(y)) { DeclareType(cl_R,y); // x,y beide reell - return cl_equal(x,y); + return equal(x,y); } else { DeclareType(cl_C,y); // x reell, y komplex if (!zerop(imagpart(y))) return cl_false; - return cl_equal(x,realpart(y)); + return equal(x,realpart(y)); } } else { DeclareType(cl_C,x); @@ -39,15 +41,17 @@ cl_boolean cl_equal (const cl_N& x, const cl_N& y) // x komplex, y reell if (!zerop(imagpart(x))) return cl_false; - return cl_equal(realpart(x),y); + return equal(realpart(x),y); } else { DeclareType(cl_C,y); // x,y beide komplex - if (!cl_equal(realpart(x),realpart(y))) + if (!equal(realpart(x),realpart(y))) return cl_false; - if (!cl_equal(imagpart(x),imagpart(y))) + if (!equal(imagpart(x),imagpart(y))) return cl_false; return cl_true; } } } + +} // namespace cln diff --git a/src/complex/elem/cl_C_from_R_R_complex.cc b/src/complex/elem/cl_C_from_R_R_complex.cc index 57ed3a6..eefeabb 100644 --- a/src/complex/elem/cl_C_from_R_R_complex.cc +++ b/src/complex/elem/cl_C_from_R_R_complex.cc @@ -9,7 +9,11 @@ // Implementation. +namespace cln { + const cl_N complex_C (const cl_R& a, const cl_R& b) { return allocate_complex(a,b); } + +} // namespace cln diff --git a/src/complex/elem/cl_C_from_R_R_complex1.cc b/src/complex/elem/cl_C_from_R_R_complex1.cc index a365f18..9056e3c 100644 --- a/src/complex/elem/cl_C_from_R_R_complex1.cc +++ b/src/complex/elem/cl_C_from_R_R_complex1.cc @@ -11,6 +11,8 @@ #include "cl_R.h" +namespace cln { + const cl_N complex (const cl_R& a, const cl_R& b) { // Methode: @@ -20,3 +22,5 @@ const cl_N complex (const cl_R& a, const cl_R& b) else return allocate_complex(a,b); } + +} // namespace cln diff --git a/src/complex/elem/cl_C_imagpart.cc b/src/complex/elem/cl_C_imagpart.cc index 37eb61f..14215f8 100644 --- a/src/complex/elem/cl_C_imagpart.cc +++ b/src/complex/elem/cl_C_imagpart.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" +namespace cln { + const cl_R imagpart (const cl_N& x) { if (realp(x)) @@ -20,3 +22,5 @@ const cl_R imagpart (const cl_N& x) return imagpart(x); } } + +} // namespace cln diff --git a/src/complex/elem/cl_C_minus.cc b/src/complex/elem/cl_C_minus.cc index 79514de..adf043b 100644 --- a/src/complex/elem/cl_C_minus.cc +++ b/src/complex/elem/cl_C_minus.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N operator- (const cl_N& x, const cl_N& y) { @@ -52,3 +54,5 @@ const cl_N operator- (const cl_N& x, const cl_N& y) } } } + +} // namespace cln diff --git a/src/complex/elem/cl_C_minus1.cc b/src/complex/elem/cl_C_minus1.cc index 7469dbd..e6e335b 100644 --- a/src/complex/elem/cl_C_minus1.cc +++ b/src/complex/elem/cl_C_minus1.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N minus1 (const cl_N& x) { @@ -27,3 +29,5 @@ const cl_N minus1 (const cl_N& x) return complex_C(minus1(a),b); } } + +} // namespace cln diff --git a/src/complex/elem/cl_C_mul.cc b/src/complex/elem/cl_C_mul.cc index d75d158..ef62a30 100644 --- a/src/complex/elem/cl_C_mul.cc +++ b/src/complex/elem/cl_C_mul.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N operator* (const cl_N& x, const cl_N& y) { @@ -52,3 +54,5 @@ const cl_N operator* (const cl_N& x, const cl_N& y) } } } + +} // namespace cln diff --git a/src/complex/elem/cl_C_plus.cc b/src/complex/elem/cl_C_plus.cc index 2a042bb..c60638d 100644 --- a/src/complex/elem/cl_C_plus.cc +++ b/src/complex/elem/cl_C_plus.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N operator+ (const cl_N& x, const cl_N& y) { @@ -52,3 +54,5 @@ const cl_N operator+ (const cl_N& x, const cl_N& y) } } } + +} // namespace cln diff --git a/src/complex/elem/cl_C_plus1.cc b/src/complex/elem/cl_C_plus1.cc index 6e1515e..3b28b9d 100644 --- a/src/complex/elem/cl_C_plus1.cc +++ b/src/complex/elem/cl_C_plus1.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N plus1 (const cl_N& x) { @@ -27,3 +29,5 @@ const cl_N plus1 (const cl_N& x) return complex_C(plus1(a),b); } } + +} // namespace cln diff --git a/src/complex/elem/cl_C_realpart.cc b/src/complex/elem/cl_C_realpart.cc index da59cc4..5a5c209 100644 --- a/src/complex/elem/cl_C_realpart.cc +++ b/src/complex/elem/cl_C_realpart.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" +namespace cln { + const cl_R realpart (const cl_N& x) { if (realp(x)) { @@ -21,3 +23,5 @@ const cl_R realpart (const cl_N& x) return realpart(x); } } + +} // namespace cln diff --git a/src/complex/elem/cl_C_square.cc b/src/complex/elem/cl_C_square.cc index b9fac76..ebae275 100644 --- a/src/complex/elem/cl_C_square.cc +++ b/src/complex/elem/cl_C_square.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N square (const cl_N& x) { @@ -27,3 +29,5 @@ const cl_N square (const cl_N& x) return complex_C(square(a)-square(b),2*a*b); } } + +} // namespace cln diff --git a/src/complex/elem/cl_C_uminus.cc b/src/complex/elem/cl_C_uminus.cc index 417b171..d177b15 100644 --- a/src/complex/elem/cl_C_uminus.cc +++ b/src/complex/elem/cl_C_uminus.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N operator- (const cl_N& x) { @@ -27,3 +29,5 @@ const cl_N operator- (const cl_N& x) return complex_C(-a,-b); } } + +} // namespace cln diff --git a/src/complex/elem/cl_C_zerop.cc b/src/complex/elem/cl_C_zerop.cc index cbb916a..50450d1 100644 --- a/src/complex/elem/cl_C_zerop.cc +++ b/src/complex/elem/cl_C_zerop.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { cl_boolean zerop (const cl_N& x) { @@ -28,3 +30,5 @@ cl_boolean zerop (const cl_N& x) return cl_false; } } + +} // namespace cln diff --git a/src/complex/elem/division/cl_C_DF_recip.cc b/src/complex/elem/division/cl_C_DF_recip.cc index c214fef..8fd42dd 100644 --- a/src/complex/elem/division/cl_C_DF_recip.cc +++ b/src/complex/elem/division/cl_C_DF_recip.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_dfloat.h" +#include "cln/dfloat.h" #include "cl_DF.h" +namespace cln { + const cl_C_DF cl_C_recip (const cl_DF& a, const cl_DF& b) { // a=0.0 -> liefere die Komponenten a=0.0 und -1/b. @@ -53,3 +55,5 @@ const cl_C_DF cl_C_recip (const cl_DF& a, const cl_DF& b) // 2^(-e)*a'/c' + i * -2^(-e)*b'/c' return cl_C_DF(scale_float(na/nc,-e), scale_float(-(nb/nc),-e)); } + +} // namespace cln diff --git a/src/complex/elem/division/cl_C_FF_recip.cc b/src/complex/elem/division/cl_C_FF_recip.cc index 0fe21cc..ea9e448 100644 --- a/src/complex/elem/division/cl_C_FF_recip.cc +++ b/src/complex/elem/division/cl_C_FF_recip.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_ffloat.h" +#include "cln/ffloat.h" #include "cl_FF.h" +namespace cln { + const cl_C_FF cl_C_recip (const cl_FF& a, const cl_FF& b) { // a=0.0 -> liefere die Komponenten a=0.0 und -1/b. @@ -53,3 +55,5 @@ const cl_C_FF cl_C_recip (const cl_FF& a, const cl_FF& b) // 2^(-e)*a'/c' + i * -2^(-e)*b'/c' return cl_C_FF(scale_float(na/nc,-e), scale_float(-(nb/nc),-e)); } + +} // namespace cln diff --git a/src/complex/elem/division/cl_C_LF_recip.cc b/src/complex/elem/division/cl_C_LF_recip.cc index ed81c64..c62ef08 100644 --- a/src/complex/elem/division/cl_C_LF_recip.cc +++ b/src/complex/elem/division/cl_C_LF_recip.cc @@ -9,10 +9,12 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" #include "cl_LF_impl.h" +namespace cln { + ALL_cl_LF_OPERATIONS_SAME_PRECISION() const cl_C_LF cl_C_recip (const cl_LF& a, const cl_LF& b) @@ -69,3 +71,5 @@ const cl_C_LF cl_C_recip (const cl_LF& a, const cl_LF& b) // 2^(-e)*a'/c' + i * -2^(-e)*b'/c' return cl_C_LF(scale_float(na/nc,-e), scale_float(-(nb/nc),-e)); }} + +} // namespace cln diff --git a/src/complex/elem/division/cl_C_SF_recip.cc b/src/complex/elem/division/cl_C_SF_recip.cc index b1fed61..609b91d 100644 --- a/src/complex/elem/division/cl_C_SF_recip.cc +++ b/src/complex/elem/division/cl_C_SF_recip.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_sfloat.h" +#include "cln/sfloat.h" #include "cl_SF.h" +namespace cln { + const cl_C_SF cl_C_recip (const cl_SF& a, const cl_SF& b) { // a=0.0 -> liefere die Komponenten a=0.0 und -1/b. @@ -53,3 +55,5 @@ const cl_C_SF cl_C_recip (const cl_SF& a, const cl_SF& b) // 2^(-e)*a'/c' + i * -2^(-e)*b'/c' return cl_C_SF(scale_float(na/nc,-e), scale_float(-(nb/nc),-e)); } + +} // namespace cln diff --git a/src/complex/elem/division/cl_C_div.cc b/src/complex/elem/division/cl_C_div.cc index 9976ca6..94eadbf 100644 --- a/src/complex/elem/division/cl_C_div.cc +++ b/src/complex/elem/division/cl_C_div.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N operator/ (const cl_N& x, const cl_N& y) { @@ -38,3 +40,5 @@ const cl_N operator/ (const cl_N& x, const cl_N& y) return x * recip(y); } } + +} // namespace cln diff --git a/src/complex/elem/division/cl_C_recip.cc b/src/complex/elem/division/cl_C_recip.cc index 128714c..50eb025 100644 --- a/src/complex/elem/division/cl_C_recip.cc +++ b/src/complex/elem/division/cl_C_recip.cc @@ -4,15 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" #include "cl_R.h" -#include "cl_rational.h" +#include "cln/rational.h" #include "cl_RA.h" #include "cl_F.h" #include "cl_SF.h" @@ -20,6 +20,8 @@ #include "cl_DF.h" #include "cl_LF.h" +namespace cln { + ALL_cl_LF_OPERATIONS_SAME_PRECISION() // for GEN_F_OP2: @@ -109,3 +111,5 @@ const cl_N recip (const cl_N& x) } } } + +} // namespace cln diff --git a/src/complex/input/cl_N_from_string.cc b/src/complex/input/cl_N_from_string.cc index 5e406ea..8b9de6f 100644 --- a/src/complex/input/cl_N_from_string.cc +++ b/src/complex/input/cl_N_from_string.cc @@ -4,19 +4,21 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex_class.h" +#include "cln/complex_class.h" // Implementation. -#include "cl_input.h" -#include "cl_complex_io.h" +#include "cln/input.h" +#include "cln/complex_io.h" + +namespace cln { cl_read_flags cl_N_read_flags = { syntax_number, lsyntax_all, 10, - { cl_float_format_ffloat, cl_float_format_lfloat_min, cl_true } + { float_format_ffloat, float_format_lfloat_min, cl_true } }; cl_N::cl_N (const char * string) @@ -24,3 +26,5 @@ cl_N::cl_N (const char * string) pointer = as_cl_private_thing( read_complex(cl_N_read_flags,string,NULL,NULL)); } + +} // namespace cln diff --git a/src/complex/input/cl_N_read.cc b/src/complex/input/cl_N_read.cc index 21c8396..b2314cd 100644 --- a/src/complex/input/cl_N_read.cc +++ b/src/complex/input/cl_N_read.cc @@ -4,27 +4,29 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex_io.h" +#include "cln/complex_io.h" // Implementation. #include -#include "cl_input.h" -#include "cl_real_io.h" -#include "cl_float_io.h" -#include "cl_rational_io.h" -#include "cl_integer_io.h" -#include "cl_integer.h" +#include "cln/input.h" +#include "cln/real_io.h" +#include "cln/float_io.h" +#include "cln/rational_io.h" +#include "cln/integer_io.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_F.h" #include "cl_C.h" -#include "cl_abort.h" +#include "cln/abort.h" #undef floor -#include +#include #define floor cln_floor +namespace cln { + // Step forward over all digits, to the end of string or to the next non-digit. static const char * skip_digits (const char * ptr, const char * string_limit, unsigned int base) { @@ -62,7 +64,7 @@ const cl_N read_complex (const cl_read_flags& flags, const char * string, const { // If no string_limit is given, it defaults to the end of the string. if (!string_limit) - string_limit = string + strlen(string); + string_limit = string + ::strlen(string); if (flags.syntax & syntax_rational) { // Check for rational number syntax. var unsigned int rational_base = flags.rational_base; @@ -89,9 +91,9 @@ const cl_N read_complex (const cl_read_flags& flags, const char * string, const goto not_rational_syntax; var cl_I base = read_integer(10,0,ptr,0,base_end_ptr-ptr); if (!((base >= 2) && (base <= 36))) { - fprint(cl_stderr, "Base must be an integer in the range from 2 to 36, not "); - fprint(cl_stderr, base); - fprint(cl_stderr, "\n"); + fprint(stderr, "Base must be an integer in the range from 2 to 36, not "); + fprint(stderr, base); + fprint(stderr, "\n"); cl_abort(); } rational_base = FN_to_UL(base); ptr = base_end_ptr; @@ -210,21 +212,21 @@ not_rational_syntax: } ptr = ptr_after_exponent; var const char * ptr_after_prec = ptr; - var cl_float_format_t prec; + var float_format_t prec; if ((ptr != string_limit) && (*ptr == '_')) { ptr++; ptr_after_prec = skip_digits(ptr,string_limit,10); if (ptr_after_prec == ptr) goto not_float_syntax; var cl_I prec1 = digits_to_I(ptr,ptr_after_prec-ptr,10); var uintL prec2 = cl_I_to_UL(prec1); - prec = (float_base==10 ? cl_float_format(prec2) - : (cl_float_format_t)((uintL)((1+prec2)*log((double)float_base)*1.442695041)+1) + prec = (float_base==10 ? float_format(prec2) + : (float_format_t)((uintL)((1+prec2)*::log((double)float_base)*1.442695041)+1) ); } else { switch (exponent_marker) { - case 'S': prec = cl_float_format_sfloat; break; - case 'F': prec = cl_float_format_ffloat; break; - case 'D': prec = cl_float_format_dfloat; break; + case 'S': prec = float_format_sfloat; break; + case 'F': prec = float_format_ffloat; break; + case 'D': prec = float_format_dfloat; break; case 'L': prec = flags.float_flags.default_lfloat_format; break; case 'E': prec = flags.float_flags.default_float_format; break; default: NOTREACHED @@ -236,9 +238,9 @@ not_rational_syntax: var uintL num_significant_digits = (ptr_after_fracpart - ptr) - (ptr_before_fracpart > ptr ? 1 : 0); var uintL prec2 = (num_significant_digits>=2 ? num_significant_digits-2 : 0); - var cl_float_format_t precx = - (float_base==10 ? cl_float_format(prec2) - : (cl_float_format_t)((uintL)((1+prec2)*log((double)float_base)*1.442695041)+1) + var float_format_t precx = + (float_base==10 ? float_format(prec2) + : (float_format_t)((uintL)((1+prec2)*::log((double)float_base)*1.442695041)+1) ); if ((uintL)precx > (uintL)prec) prec = precx; @@ -337,3 +339,5 @@ not_complex_syntax: at_end_of_parse(string_rest); return x; } + +} // namespace cln diff --git a/src/complex/input/cl_N_read_stream.cc b/src/complex/input/cl_N_read_stream.cc index 9d5e1b9..f22f3ed 100644 --- a/src/complex/input/cl_N_read_stream.cc +++ b/src/complex/input/cl_N_read_stream.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex_io.h" +#include "cln/complex_io.h" // Implementation. -#include "cl_io.h" +#include "cln/io.h" #include "cl_spushstring.h" -#include "cl_input.h" +#include "cln/input.h" + +namespace cln { // We read an entire token (or even more, if it begins with #C) into a // buffer and then call read_complex() on the buffer. @@ -112,3 +114,5 @@ syntax: read_number_bad_syntax(buffer.start_pointer(),buffer.end_pointer()); // Handle premature EOF. eof: read_number_eof(); } + +} // namespace cln diff --git a/src/complex/misc/cl_C_class.cc b/src/complex/misc/cl_C_class.cc index db4290c..ef5dfb6 100644 --- a/src/complex/misc/cl_C_class.cc +++ b/src/complex/misc/cl_C_class.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" +namespace cln { + static void complex_destructor (cl_heap* pointer) { (*(cl_heap_complex*)pointer).~cl_heap_complex(); @@ -20,3 +22,5 @@ cl_class cl_class_complex = { complex_destructor, cl_class_flags_subclass_complex }; + +} // namespace cln diff --git a/src/complex/misc/cl_C_conjugate.cc b/src/complex/misc/cl_C_conjugate.cc index 1a6e8e1..4c33e04 100644 --- a/src/complex/misc/cl_C_conjugate.cc +++ b/src/complex/misc/cl_C_conjugate.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N conjugate (const cl_N& x) { @@ -24,3 +26,5 @@ const cl_N conjugate (const cl_N& x) return complex_C(a,-b); } } + +} // namespace cln diff --git a/src/complex/misc/cl_C_debug.cc b/src/complex/misc/cl_C_debug.cc index 80aca20..f4f1cbb 100644 --- a/src/complex/misc/cl_C_debug.cc +++ b/src/complex/misc/cl_C_debug.cc @@ -8,9 +8,11 @@ // Implementation. -#include "cl_complex.h" -#include "cl_io.h" -#include "cl_complex_io.h" +#include "cln/complex.h" +#include "cln/io.h" +#include "cln/complex_io.h" + +namespace cln { static void dprint (cl_heap* pointer) { @@ -21,10 +23,12 @@ static void dprint (cl_heap* pointer) AT_INITIALIZATION(dprint_N) { cl_register_type_printer(cl_class_complex,dprint); } -// This dummy links in this module when requires it. +// This dummy links in this module when requires it. int cl_C_debug_module; extern int cl_R_debug_module; static void* dummy[] = { &dummy, &cl_R_debug_module }; + +} // namespace cln diff --git a/src/complex/misc/cl_C_eqhashcode.cc b/src/complex/misc/cl_C_eqhashcode.cc index 9e29510..6b60d87 100644 --- a/src/complex/misc/cl_C_eqhashcode.cc +++ b/src/complex/misc/cl_C_eqhashcode.cc @@ -4,28 +4,32 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_N.h" #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" -uint32 cl_equal_hashcode (const cl_N& x) +namespace cln { + +uint32 equal_hashcode (const cl_N& x) { if (realp(x)) { DeclareType(cl_R,x); - return cl_equal_hashcode(x); + return equal_hashcode(x); } else { DeclareType(cl_C,x); var const cl_R& a = realpart(x); var const cl_R& b = imagpart(x); - var uint32 code1 = cl_equal_hashcode(a); - var uint32 code2 = cl_equal_hashcode(b); + var uint32 code1 = equal_hashcode(a); + var uint32 code2 = equal_hashcode(b); // Wichtig beim Kombinieren, wegen "complex canonicalization": - // Ist imagpart=0.0, so ist der Hashcode = cl_equal_hashcode(a). + // Ist imagpart=0.0, so ist der Hashcode = equal_hashcode(a). return code1 ^ ((code2 << 5) | (code2 >> 27)); } } + +} // namespace cln diff --git a/src/complex/misc/cl_C_expt.cc b/src/complex/misc/cl_C_expt.cc index 609e6be..f6badde 100644 --- a/src/complex/misc/cl_C_expt.cc +++ b/src/complex/misc/cl_C_expt.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { // Methode: // Für y>0: @@ -50,3 +52,5 @@ const cl_N expt (const cl_N& x, sintL y) var cl_N z = expt_pos(x,abs_y); // (expt x (abs y)) return (y<0 ? recip(z) : z); // evtl. noch Kehrwert nehmen } + +} // namespace cln diff --git a/src/complex/misc/cl_C_expt_I.cc b/src/complex/misc/cl_C_expt_I.cc index 35b35f8..64e1da0 100644 --- a/src/complex/misc/cl_C_expt_I.cc +++ b/src/complex/misc/cl_C_expt_I.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" #include "cl_I.h" +namespace cln { + // Methode: // Für y>0: // a:=x, b:=y. @@ -52,3 +54,5 @@ const cl_N expt (const cl_N& x, const cl_I& y) var cl_N z = expt_pos(x,abs_y); // (expt x (abs y)) return (y_negative ? recip(z) : z); // evtl. noch Kehrwert nehmen } + +} // namespace cln diff --git a/src/complex/misc/cl_N_as.cc b/src/complex/misc/cl_N_as.cc index 85cb6e6..8740088 100644 --- a/src/complex/misc/cl_N_as.cc +++ b/src/complex/misc/cl_N_as.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_N.h" +namespace cln { + // Cf. cl_N_p in cl_C_ring.cc. // But here, for better inlining in g++, it is preferrable to finish every // alternative with either "return cl_true;" or "return cl_false;". @@ -40,3 +42,5 @@ const cl_N& as_cl_N (const cl_number& x, const char * filename, int line) } else cl_as_error(x,"a number",filename,line); } + +} // namespace cln diff --git a/src/complex/output/cl_N_aprint.cc b/src/complex/output/cl_N_aprint.cc index a138561..969ba13 100644 --- a/src/complex/output/cl_N_aprint.cc +++ b/src/complex/output/cl_N_aprint.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex_io.h" +#include "cln/complex_io.h" // Implementation. -#include "cl_output.h" +#include "cln/output.h" + +namespace cln { void print_complex (cl_ostream stream, const cl_print_flags& flags, const cl_N& z) { print_complex(stream,(const cl_print_number_flags&)flags,z); } + +} // namespace cln diff --git a/src/complex/output/cl_N_bprint.cc b/src/complex/output/cl_N_bprint.cc index 695cc17..3a42f85 100644 --- a/src/complex/output/cl_N_bprint.cc +++ b/src/complex/output/cl_N_bprint.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex_io.h" +#include "cln/complex_io.h" // Implementation. -#include "cl_output.h" -#include "cl_complex.h" +#include "cln/output.h" +#include "cln/complex.h" #include "cl_C.h" -#include "cl_real_io.h" +#include "cln/real_io.h" + +namespace cln { void print_complex (cl_ostream stream, const cl_print_number_flags& flags, const cl_N& z) { @@ -58,3 +60,5 @@ void print_complex (cl_ostream stream, const cl_print_number_flags& flags, const } } } + +} // namespace cln diff --git a/src/complex/ring/cl_C_ring.cc b/src/complex/ring/cl_C_ring.cc index 49cfcc3..6e6cb74 100644 --- a/src/complex/ring/cl_C_ring.cc +++ b/src/complex/ring/cl_C_ring.cc @@ -6,15 +6,17 @@ CL_PROVIDE(cl_C_ring) // Specification. -#include "cl_complex_ring.h" +#include "cln/complex_ring.h" // Implementation. -#include "cl_complex.h" -#include "cl_complex_io.h" +#include "cln/complex.h" +#include "cln/complex_io.h" #include "cl_C.h" +namespace cln { + static void N_fprint (cl_heap_ring* R, cl_ostream stream, const _cl_ring_element& x) { unused R; @@ -24,7 +26,7 @@ static void N_fprint (cl_heap_ring* R, cl_ostream stream, const _cl_ring_element static cl_boolean N_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y) { unused R; - return cl_equal(The(cl_N)(x),The(cl_N)(y)); + return equal(The(cl_N)(x),The(cl_N)(y)); } static const _cl_ring_element N_zero (cl_heap_ring* R) @@ -111,7 +113,7 @@ static cl_ring_mulops N_mulops = { static cl_number_ring_ops N_ops = { cl_N_p, - cl_equal, + equal, exact_zerop, operator+, operator-, @@ -156,4 +158,6 @@ inline cl_complex_ring::cl_specialized_number_ring () const cl_complex_ring cl_C_ring; +} // namespace cln + CL_PROVIDE_END(cl_C_ring) diff --git a/src/complex/transcendental/cl_C_acos.cc b/src/complex/transcendental/cl_C_acos.cc index ee82b57..1004206 100644 --- a/src/complex/transcendental/cl_C_acos.cc +++ b/src/complex/transcendental/cl_C_acos.cc @@ -4,25 +4,27 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" #include "cl_R.h" -#include "cl_rational.h" +#include "cln/rational.h" #include "cl_RA.h" -#include "cl_float.h" +#include "cln/float.h" -inline const cl_F cl_pi (const cl_R& v) +namespace cln { + +inline const cl_F pi (const cl_R& v) { if (rationalp(v)) - return cl_pi(); + return pi(); else { DeclareType(cl_F,v); - return cl_pi(v); + return pi(v); } } @@ -56,20 +58,20 @@ const cl_N acos (const cl_N& z) DeclareType(cl_I,x); // x Integer if (eq(x,0)) // x=0 -> Ergebnis pi/2 - return scale_float(cl_pi(),-1); + return scale_float(pi(),-1); if (eq(x,1)) // x=1 -> Ergebnis 0 return 0; if (eq(x,-1)) // x=-1 -> Ergebnis pi - return cl_pi(); + return pi(); xf = cl_float(x); } else { DeclareType(cl_RT,x); // x Ratio if (eq(denominator(x),2)) { // Nenner = 2 ? if (eq(numerator(x),1)) // x=1/2 -> Ergebnis pi/3 - return cl_pi()/3; + return pi()/3; if (eq(numerator(x),-1)) // x=-1/2 -> Ergebnis 2pi/3 - return scale_float(cl_pi(),1)/3; + return scale_float(pi(),1)/3; } xf = cl_float(x); } @@ -89,6 +91,8 @@ const cl_N acos (const cl_N& z) } var cl_R& u = u_v.realpart; var cl_R& v = u_v.imagpart; - var cl_F pi = cl_pi(v); // pi im Float-Format von v - return complex(scale_float(pi,-1)-v,u); // (pi/2-v)+iu + var cl_F archimedes = pi(v); // pi im Float-Format von v + return complex(scale_float(archimedes,-1)-v,u); // (pi/2-v)+iu } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_acosh.cc b/src/complex/transcendental/cl_C_acosh.cc index 7b613bc..8c30669 100644 --- a/src/complex/transcendental/cl_C_acosh.cc +++ b/src/complex/transcendental/cl_C_acosh.cc @@ -4,22 +4,24 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" #include "cl_R.h" -#include "cl_rational.h" +#include "cln/rational.h" #include "cl_RA.h" -#include "cl_float.h" +#include "cln/float.h" #undef MAYBE_INLINE #define MAYBE_INLINE inline #include "cl_F_from_R_def.cc" +namespace cln { + const cl_N acosh (const cl_N& z) { // Methode: @@ -58,19 +60,19 @@ const cl_N acosh (const cl_N& z) DeclareType(cl_I,x); // x Integer if (eq(x,0)) // x=0 -> Ergebnis pi/2 i - return complex_C(0,scale_float(cl_pi(),-1)); + return complex_C(0,scale_float(pi(),-1)); if (eq(x,1)) // x=1 -> Ergebnis 0 return 0; if (eq(x,-1)) // x=-1 -> Ergebnis pi i - return complex_C(0,cl_pi()); + return complex_C(0,pi()); } else { DeclareType(cl_RT,x); // x Ratio if (eq(denominator(x),2)) { // Nenner = 2 ? if (eq(numerator(x),1)) // x=1/2 -> Ergebnis pi/3 i - return complex_C(0,cl_pi()/3); + return complex_C(0,pi()/3); if (eq(numerator(x),-1)) // x=-1/2 -> Ergebnis 2pi/3 i - return complex_C(0,scale_float(cl_pi(),1)/3); + return complex_C(0,scale_float(pi(),1)/3); } } } @@ -80,8 +82,10 @@ const cl_N acosh (const cl_N& z) var cl_F& x = xf; // x Float <= -1 // log(sqrt(x^2-1)-x), ein Float >=0, Imaginärteil pi - return complex_C(ln(sqrt(square(x)-1)-x),cl_pi()); + return complex_C(ln(sqrt(square(x)-1)-x),pi()); } } return 4 * atanh( sqrt(minus1(z)/2) / plus1(sqrt(plus1(z)/2)) ); } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_asin.cc b/src/complex/transcendental/cl_C_asin.cc index 8a4894f..f121c7f 100644 --- a/src/complex/transcendental/cl_C_asin.cc +++ b/src/complex/transcendental/cl_C_asin.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { // Methode: // Wert und Branch Cuts nach der Formel CLTL2, S. 311: @@ -37,3 +39,5 @@ const cl_N asin (const cl_N& z) var cl_R& v = u_v.imagpart; return complex(v,-u); // v-iu } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_asinh.cc b/src/complex/transcendental/cl_C_asinh.cc index 816391c..d028f31 100644 --- a/src/complex/transcendental/cl_C_asinh.cc +++ b/src/complex/transcendental/cl_C_asinh.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { // Methode: // Wert und Branch Cuts nach der Formel CLTL2, S. 313: @@ -78,3 +80,5 @@ const cl_N asinh (const cl_N& z) var cl_R& v = u_v.imagpart; return complex(u,v); } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_asinh_aux.cc b/src/complex/transcendental/cl_C_asinh_aux.cc index f68147d..572c722 100644 --- a/src/complex/transcendental/cl_C_asinh_aux.cc +++ b/src/complex/transcendental/cl_C_asinh_aux.cc @@ -9,17 +9,19 @@ // Implementation. -#include "cl_real.h" +#include "cln/real.h" #include "cl_F_tran.h" #include "cl_R.h" -#include "cl_rational.h" +#include "cln/rational.h" #include "cl_RA.h" -#include "cl_float.h" +#include "cln/float.h" #undef MAYBE_INLINE #define MAYBE_INLINE inline #include "cl_F_from_R_def.cc" +namespace cln { + // Hilfsfunktion für asinh und asin: u+iv := arsinh(x+iy). Liefert cl_C_R(u,v). const cl_C_R asinh (const cl_R& x, const cl_R& y) @@ -84,18 +86,18 @@ const cl_C_R asinh (const cl_R& x, const cl_R& y) DeclareType(cl_I,y); // y Integer if (eq(y,1)) // x=0, y=1 -> v = pi/2 - return cl_C_R(0,scale_float(cl_pi(),-1)); + return cl_C_R(0,scale_float(pi(),-1)); if (eq(y,-1)) // x=0, y=-1 -> v = -pi/2 - return cl_C_R(0,-scale_float(cl_pi(),-1)); + return cl_C_R(0,-scale_float(pi(),-1)); yf = cl_float(y); // y in Float umwandeln } else { DeclareType(cl_RT,y); // y Ratio if (eq(denominator(y),2)) { // Nenner = 2 ? if (eq(numerator(y),1)) // x=0, y=1/2 -> v = pi/6 - return cl_C_R(0,cl_pi()/6); + return cl_C_R(0,pi()/6); if (eq(numerator(y),-1)) // x=0, y=-1/2 -> v = -pi/6 - return cl_C_R(0,-(cl_pi()/6)); + return cl_C_R(0,-(pi()/6)); } yf = cl_float(y); // y in Float umwandeln } @@ -124,7 +126,7 @@ const cl_C_R asinh (const cl_R& x, const cl_R& y) temp = temp + y; // temp = sqrt(y^2-1)+|y|, ein Float >1 var cl_F u = ln(temp); // ln(|y|+sqrt(y^2-1)), ein Float >0 - var cl_F v = scale_float(cl_pi(),-1); // (scale-float pi -1) = pi/2 + var cl_F v = scale_float(pi(),-1); // (scale-float pi -1) = pi/2 if (!minusp(y)) return cl_C_R(u,v); // y>1 -> v = pi/2 else @@ -170,3 +172,5 @@ const cl_C_R asinh (const cl_R& x, const cl_R& y) DeclareType(cl_F,v); return cl_C_R(scale_float(u,1),scale_float(v,1)); // u:=2*u, v:=2*v }}} + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_atan.cc b/src/complex/transcendental/cl_C_atan.cc index 98b9a21..eeffdf6 100644 --- a/src/complex/transcendental/cl_C_atan.cc +++ b/src/complex/transcendental/cl_C_atan.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { // Methode: // Wert und Branch Cuts nach der Formel CLTL2, S. 307/312/313: @@ -37,3 +39,5 @@ const cl_N atan (const cl_N& z) var cl_R& v = u_v.imagpart; return complex(v,-u); // v-iu } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_atanh.cc b/src/complex/transcendental/cl_C_atanh.cc index 299445b..7bddef7 100644 --- a/src/complex/transcendental/cl_C_atanh.cc +++ b/src/complex/transcendental/cl_C_atanh.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { // Methode: // Wert und Branch Cuts nach der Formel CLTL2, S. 315: @@ -58,3 +60,5 @@ const cl_N atanh (const cl_N& z) var cl_R& v = u_v.imagpart; return complex(u,v); } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_atanh_aux.cc b/src/complex/transcendental/cl_C_atanh_aux.cc index c3dc545..42cae75 100644 --- a/src/complex/transcendental/cl_C_atanh_aux.cc +++ b/src/complex/transcendental/cl_C_atanh_aux.cc @@ -10,7 +10,7 @@ // Implementation. #include "cl_N.h" -#include "cl_real.h" +#include "cln/real.h" #include "cl_F_tran.h" #include "cl_R.h" @@ -18,6 +18,8 @@ #define MAYBE_INLINE inline #include "cl_F_from_R_def.cc" +namespace cln { + // Hilfsfunktion für atanh und atan: u+iv := artanh(x+iy). Liefert cl_C_R(u,v). const cl_C_R atanh (const cl_R& x, const cl_R& y) @@ -74,7 +76,7 @@ const cl_C_R atanh (const cl_R& x, const cl_R& y) } else { // (1+x)/(1-x) < 0 -> Betrag nehmen, Imaginärteil berechnen: xx = - xx; - v = scale_float(cl_pi(),-1); // (scale-float pi -1) = pi/2 + v = scale_float(pi(),-1); // (scale-float pi -1) = pi/2 if (minusp(xx_den)) // 1-x<0 -> dann -pi/2 v = -v; @@ -125,3 +127,5 @@ const cl_C_R atanh (const cl_R& x, const cl_R& y) } return cl_C_R(u,v); } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_cis.cc b/src/complex/transcendental/cl_C_cis.cc index 0753a27..fc29e43 100644 --- a/src/complex/transcendental/cl_C_cis.cc +++ b/src/complex/transcendental/cl_C_cis.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N cis (const cl_N& x) { @@ -19,16 +21,18 @@ const cl_N cis (const cl_N& x) // x = a+bi -> (complex (* (exp (- b)) (cos a)) (* (exp (- b)) (sin a))) if (realp(x)) { DeclareType(cl_R,x); - var cl_cos_sin_t trig = cl_cos_sin(x); + var cos_sin_t trig = cos_sin(x); return complex(trig.cos, trig.sin); } else { DeclareType(cl_C,x); // x=a+bi var const cl_R& a = realpart(x); var const cl_R& b = imagpart(x); - var cl_cos_sin_t trig_a = cl_cos_sin(a); // cos(a), sin(a) errechnen + var cos_sin_t trig_a = cos_sin(a); // cos(a), sin(a) errechnen var cl_R exp_minusb = exp(-b); // (exp (- b)) return complex(exp_minusb*trig_a.cos, // (* (exp (- b)) (cos a)) exp_minusb*trig_a.sin); // (* (exp (- b)) (sin a)) } } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_cos.cc b/src/complex/transcendental/cl_C_cos.cc index af0842f..3ef3ac9 100644 --- a/src/complex/transcendental/cl_C_cos.cc +++ b/src/complex/transcendental/cl_C_cos.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N cos (const cl_N& x) { @@ -25,10 +27,12 @@ const cl_N cos (const cl_N& x) // x=a+bi var const cl_R& a = realpart(x); var const cl_R& b = imagpart(x); - var cl_cosh_sinh_t hyp_b = cl_cosh_sinh(b); // cosh(b), sinh(b) errechnen - var cl_cos_sin_t trig_a = cl_cos_sin(a); // cos(a), sin(a) errechnen + var cosh_sinh_t hyp_b = cosh_sinh(b); // cosh(b), sinh(b) errechnen + var cos_sin_t trig_a = cos_sin(a); // cos(a), sin(a) errechnen return complex(trig_a.cos * hyp_b.cosh, // cos(a)*cosh(b) - (trig_a.sin * hyp_b.sinh) // -sin(a)*sinh(b) ); } } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_cosh.cc b/src/complex/transcendental/cl_C_cosh.cc index f8a1ec2..f3e44a1 100644 --- a/src/complex/transcendental/cl_C_cosh.cc +++ b/src/complex/transcendental/cl_C_cosh.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N cosh (const cl_N& x) { @@ -25,10 +27,12 @@ const cl_N cosh (const cl_N& x) // x=a+bi var const cl_R& a = realpart(x); var const cl_R& b = imagpart(x); - var cl_cos_sin_t trig_b = cl_cos_sin(b); // cos(b), sin(b) errechnen - var cl_cosh_sinh_t hyp_a = cl_cosh_sinh(a); // cosh(a), sinh(a) errechnen + var cos_sin_t trig_b = cos_sin(b); // cos(b), sin(b) errechnen + var cosh_sinh_t hyp_a = cosh_sinh(a); // cosh(a), sinh(a) errechnen return complex(hyp_a.cosh * trig_b.cos, // cosh(a)*cos(b) hyp_a.sinh * trig_b.sin // sinh(a)*sin(b) ); } } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_exp.cc b/src/complex/transcendental/cl_C_exp.cc index 4b3b96d..3a339de 100644 --- a/src/complex/transcendental/cl_C_exp.cc +++ b/src/complex/transcendental/cl_C_exp.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N exp (const cl_N& x) { @@ -26,9 +28,11 @@ const cl_N exp (const cl_N& x) // x=a+bi var const cl_R& a = realpart(x); var const cl_R& b = imagpart(x); - var cl_cos_sin_t unitvec = cl_cos_sin(b); // (cos b), (sin b) + var cos_sin_t unitvec = cos_sin(b); // (cos b), (sin b) // Da b nicht = Fixnum 0 ist, ist auch sin(b) nicht = Fixnum 0. var cl_R exp_a = exp(a); // (exp a) return complex_C(exp_a * unitvec.cos, exp_a * unitvec.sin); } } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_expt_C.cc b/src/complex/transcendental/cl_C_expt_C.cc index 7709e88..b1bf2ea 100644 --- a/src/complex/transcendental/cl_C_expt_C.cc +++ b/src/complex/transcendental/cl_C_expt_C.cc @@ -4,19 +4,21 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" #include "cl_R.h" -#include "cl_rational.h" +#include "cln/rational.h" #include "cl_RA.h" #include "cl_I.h" #include "cl_N.h" +namespace cln { + // Methode: // Falls y rational: // Falls y Integer: @@ -216,3 +218,5 @@ const cl_N expt (const cl_N& x, const cl_N& y) } return exp(log(x)*y); } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_log.cc b/src/complex/transcendental/cl_C_log.cc index 9863f63..6e3c680 100644 --- a/src/complex/transcendental/cl_C_log.cc +++ b/src/complex/transcendental/cl_C_log.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" #include "cl_N.h" +namespace cln { + const cl_N log (const cl_N& x) { // Methode: @@ -22,3 +24,5 @@ const cl_N log (const cl_N& x) { cl_error_division_by_0(); } return complex(ln(r),phase(x)); } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_log2.cc b/src/complex/transcendental/cl_C_log2.cc index 75efeda..86e22fa 100644 --- a/src/complex/transcendental/cl_C_log2.cc +++ b/src/complex/transcendental/cl_C_log2.cc @@ -4,16 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" #include "cl_R.h" #include "cl_N.h" +namespace cln { + const cl_N log (const cl_N& a, const cl_N& b) { // Methode: @@ -94,3 +96,5 @@ const cl_N log (const cl_N& a, const cl_N& b) // normaler komplexer Fall return log(a) / log(b); } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_phase.cc b/src/complex/transcendental/cl_C_phase.cc index b403b3e..fe7b242 100644 --- a/src/complex/transcendental/cl_C_phase.cc +++ b/src/complex/transcendental/cl_C_phase.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_R phase (const cl_N& x) { @@ -28,3 +30,5 @@ const cl_R phase (const cl_N& x) return atan(realpart(x),imagpart(x)); } } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_sin.cc b/src/complex/transcendental/cl_C_sin.cc index 2d5935c..ed08354 100644 --- a/src/complex/transcendental/cl_C_sin.cc +++ b/src/complex/transcendental/cl_C_sin.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N sin (const cl_N& x) { @@ -25,8 +27,8 @@ const cl_N sin (const cl_N& x) // x=a+bi var const cl_R& a = realpart(x); var const cl_R& b = imagpart(x); - var cl_cosh_sinh_t hyp_b = cl_cosh_sinh(b); // cosh(b), sinh(b) errechnen - var cl_cos_sin_t trig_a = cl_cos_sin(a); // cos(a), sin(a) errechnen + var cosh_sinh_t hyp_b = cosh_sinh(b); // cosh(b), sinh(b) errechnen + var cos_sin_t trig_a = cos_sin(a); // cos(a), sin(a) errechnen // Da b nicht = Fixnum 0 ist, ist auch sinh(b) nicht = Fixnum 0. // cos(a) /= Fixnum 0. return complex_C(trig_a.sin * hyp_b.cosh, // sin(a)*cosh(b) @@ -34,3 +36,5 @@ const cl_N sin (const cl_N& x) ); } } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_sinh.cc b/src/complex/transcendental/cl_C_sinh.cc index b7ba4b9..7b426c4 100644 --- a/src/complex/transcendental/cl_C_sinh.cc +++ b/src/complex/transcendental/cl_C_sinh.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N sinh (const cl_N& x) { @@ -25,8 +27,8 @@ const cl_N sinh (const cl_N& x) // x=a+bi var const cl_R& a = realpart(x); var const cl_R& b = imagpart(x); - var cl_cosh_sinh_t hyp_a = cl_cosh_sinh(a); // cosh(a), sinh(a) errechnen - var cl_cos_sin_t trig_b = cl_cos_sin(b); // cos(b), sin(b) errechnen + var cosh_sinh_t hyp_a = cosh_sinh(a); // cosh(a), sinh(a) errechnen + var cos_sin_t trig_b = cos_sin(b); // cos(b), sin(b) errechnen // Da b nicht = Fixnum 0 ist, ist auch sin(b) nicht = Fixnum 0. // cosh(a) /= Fixnum 0. return complex_C(hyp_a.sinh * trig_b.cos, // sinh(a)*cos(b) @@ -34,3 +36,5 @@ const cl_N sinh (const cl_N& x) ); } } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_tan.cc b/src/complex/transcendental/cl_C_tan.cc index 412f3b4..52aff85 100644 --- a/src/complex/transcendental/cl_C_tan.cc +++ b/src/complex/transcendental/cl_C_tan.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N tan (const cl_N& x) { @@ -20,15 +22,15 @@ const cl_N tan (const cl_N& x) // (complex (* (cos a) (cosh b)) (- (* (sin a) (sinh b)))) ) if (realp(x)) { DeclareType(cl_R,x); - var cl_cos_sin_t trig = cl_cos_sin(x); + var cos_sin_t trig = cos_sin(x); return trig.sin / trig.cos; } else { DeclareType(cl_C,x); // x=a+bi var const cl_R& a = realpart(x); var const cl_R& b = imagpart(x); - var cl_cosh_sinh_t hyp_b = cl_cosh_sinh(b); // cosh(b), sinh(b) errechnen - var cl_cos_sin_t trig_a = cl_cos_sin(a); // cos(a), sin(a) errechnen + var cosh_sinh_t hyp_b = cosh_sinh(b); // cosh(b), sinh(b) errechnen + var cos_sin_t trig_a = cos_sin(a); // cos(a), sin(a) errechnen return complex_C(trig_a.sin * hyp_b.cosh, // sin(a)*cosh(b) trig_a.cos * hyp_b.sinh // cos(a)*sinh(b), nicht Fixnum 0 @@ -38,3 +40,5 @@ const cl_N tan (const cl_N& x) ); } } + +} // namespace cln diff --git a/src/complex/transcendental/cl_C_tanh.cc b/src/complex/transcendental/cl_C_tanh.cc index 96e8699..331a066 100644 --- a/src/complex/transcendental/cl_C_tanh.cc +++ b/src/complex/transcendental/cl_C_tanh.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N tanh (const cl_N& x) { @@ -20,15 +22,15 @@ const cl_N tanh (const cl_N& x) // (complex (* (cosh a) (cos b)) (* (sinh a) (sin b))) ) if (realp(x)) { DeclareType(cl_R,x); - var cl_cosh_sinh_t hyp = cl_cosh_sinh(x); + var cosh_sinh_t hyp = cosh_sinh(x); return hyp.sinh / hyp.cosh; } else { DeclareType(cl_C,x); // x=a+bi var const cl_R& a = realpart(x); var const cl_R& b = imagpart(x); - var cl_cos_sin_t trig_b = cl_cos_sin(b); // cos(b), sin(b) errechnen - var cl_cosh_sinh_t hyp_a = cl_cosh_sinh(a); // cosh(a), sinh(a) errechnen + var cos_sin_t trig_b = cos_sin(b); // cos(b), sin(b) errechnen + var cosh_sinh_t hyp_a = cosh_sinh(a); // cosh(a), sinh(a) errechnen return complex_C(hyp_a.sinh * trig_b.cos, // sinh(a)*cos(b) hyp_a.cosh * trig_b.sin // cosh(a)*sin(b), nicht Fixnum 0 @@ -38,3 +40,5 @@ const cl_N tanh (const cl_N& x) ); } } + +} // namespace cln diff --git a/src/complex/transcendental/cl_R_cis.cc b/src/complex/transcendental/cl_R_cis.cc index b0b0ea3..63c62e6 100644 --- a/src/complex/transcendental/cl_R_cis.cc +++ b/src/complex/transcendental/cl_R_cis.cc @@ -4,18 +4,22 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_N cis (const cl_R& x) { // Methode: // (complex (cos x) (sin x)) - var cl_cos_sin_t trig = cl_cos_sin(x); + var cos_sin_t trig = cos_sin(x); return complex(trig.cos, trig.sin); } + +} // namespace cln diff --git a/src/float/algebraic/cl_F_sqrt.cc b/src/float/algebraic/cl_F_sqrt.cc index 902fded..6267c8d 100644 --- a/src/float/algebraic/cl_F_sqrt.cc +++ b/src/float/algebraic/cl_F_sqrt.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" + +namespace cln { const cl_F sqrt (const cl_F& x) GEN_F_OP1(x, sqrt, return) + +} // namespace cln diff --git a/src/float/base/cl_F_err_nan.cc b/src/float/base/cl_F_err_nan.cc index 04ed6b2..0b6824c 100644 --- a/src/float/base/cl_F_err_nan.cc +++ b/src/float/base/cl_F_err_nan.cc @@ -9,11 +9,15 @@ // Implementation. -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/abort.h" + +namespace cln { void cl_error_floating_point_nan (void) { - fprint(cl_stderr, "floating point NaN occurred.\n"); + fprint(stderr, "floating point NaN occurred.\n"); cl_abort(); } + +} // namespace cln diff --git a/src/float/base/cl_F_err_ov.cc b/src/float/base/cl_F_err_ov.cc index b0527d3..aaf0637 100644 --- a/src/float/base/cl_F_err_ov.cc +++ b/src/float/base/cl_F_err_ov.cc @@ -9,11 +9,15 @@ // Implementation. -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/abort.h" + +namespace cln { void cl_error_floating_point_overflow (void) { - fprint(cl_stderr, "Floating point overflow.\n"); + fprint(stderr, "Floating point overflow.\n"); cl_abort(); } + +} // namespace cln diff --git a/src/float/base/cl_F_err_un.cc b/src/float/base/cl_F_err_un.cc index 5bf72b3..cf1c9f4 100644 --- a/src/float/base/cl_F_err_un.cc +++ b/src/float/base/cl_F_err_un.cc @@ -9,11 +9,15 @@ // Implementation. -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/abort.h" + +namespace cln { void cl_error_floating_point_underflow (void) { - fprint(cl_stderr, "Floating point underflow.\n"); + fprint(stderr, "Floating point underflow.\n"); cl_abort(); } + +} // namespace cln diff --git a/src/float/base/cl_F_globals.cc b/src/float/base/cl_F_globals.cc index 1de4db7..573d525 100644 --- a/src/float/base/cl_F_globals.cc +++ b/src/float/base/cl_F_globals.cc @@ -4,12 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. +namespace cln { + cl_boolean cl_inhibit_floating_point_underflow = cl_false; -cl_float_format_t cl_default_float_format = cl_float_format_ffloat; +float_format_t default_float_format = float_format_ffloat; +} // namespace cln diff --git a/src/float/base/cl_ieee.cc b/src/float/base/cl_ieee.cc index fb4ca49..5c77350 100644 --- a/src/float/base/cl_ieee.cc +++ b/src/float/base/cl_ieee.cc @@ -46,7 +46,11 @@ AT_INITIALIZATION(ieee) #endif +namespace cln { + // This dummy links in this module whenever some module needs IEEE floats. int cl_ieee_module; +} // namespace cln + CL_PROVIDE_END(cl_ieee) diff --git a/src/float/base/cl_ieee.h b/src/float/base/cl_ieee.h index 11b5b36..355e667 100644 --- a/src/float/base/cl_ieee.h +++ b/src/float/base/cl_ieee.h @@ -3,6 +3,8 @@ #ifndef _CL_IEEE_H #define _CL_IEEE_H +namespace cln { + // To make sure that cl_ieee.cc is linked in. // NEED_IEEE_FLOATS() #if (defined(linux) || defined(__linux)) // only needed on Linux @@ -14,4 +16,6 @@ #endif extern int cl_ieee_module; +} // namespace cln + #endif /* _CL_IEEE_H */ diff --git a/src/float/cl_F.h b/src/float/cl_F.h index f11107d..1a48faa 100644 --- a/src/float/cl_F.h +++ b/src/float/cl_F.h @@ -3,10 +3,11 @@ #ifndef _CL_F_H #define _CL_F_H -#include "cl_number.h" +#include "cln/number.h" #include "cl_macros.h" -#include "cl_float.h" +#include "cln/float.h" +namespace cln { nonreturning_function(extern, cl_error_floating_point_overflow, (void)); nonreturning_function(extern, cl_error_floating_point_underflow, (void)); @@ -266,16 +267,17 @@ extern const cl_F cl_F_extendsqrtx (const cl_F& x); extern const cl_F cl_F_shortenrelative (const cl_F& x, const cl_F& y); -// Macro: dispatches according to a cl_float_format_t value. +// Macro: dispatches according to a float_format_t value. // floatformatcase(value, SF_statement,FF_statement,DF_statement,LF_statement) // LF_statement darf auf `len' zugreifen, die zu `value' korrespondierende // Mantissenlänge (gemessen in Digits). #define floatformatcase(value, SF_statement,FF_statement,DF_statement,LF_statement) \ - { if ((value) <= cl_float_format_sfloat) { SF_statement } \ - elif ((value) <= cl_float_format_ffloat) { FF_statement } \ - elif ((value) <= cl_float_format_dfloat) { DF_statement } \ + { if ((value) <= float_format_sfloat) { SF_statement } \ + elif ((value) <= float_format_ffloat) { FF_statement } \ + elif ((value) <= float_format_dfloat) { DF_statement } \ else { var uintL len = ceiling((uintL)(value),intDsize); LF_statement } \ } +} // namespace cln #endif /* _CL_F_H */ diff --git a/src/float/conv/cl_DF_to_FF.cc b/src/float/conv/cl_DF_to_FF.cc index 36c1aea..5f6768f 100644 --- a/src/float/conv/cl_DF_to_FF.cc +++ b/src/float/conv/cl_DF_to_FF.cc @@ -12,6 +12,8 @@ #include "cl_DF.h" #include "cl_FF.h" +namespace cln { + const cl_FF cl_DF_to_FF (const cl_DF& x) { // x entpacken: @@ -62,3 +64,5 @@ const cl_FF cl_DF_to_FF (const cl_DF& x) return encode_FF(sign,exp,manthi); #endif } + +} // namespace cln diff --git a/src/float/conv/cl_DF_to_LF.cc b/src/float/conv/cl_DF_to_LF.cc index 1a268f1..cb1ae3a 100644 --- a/src/float/conv/cl_DF_to_LF.cc +++ b/src/float/conv/cl_DF_to_LF.cc @@ -14,6 +14,8 @@ #include "cl_LF_impl.h" #include "cl_DS.h" +namespace cln { + const cl_LF cl_DF_to_LF (const cl_DF& x, uintC len) { // x entpacken: @@ -45,3 +47,5 @@ const cl_LF cl_DF_to_LF (const cl_DF& x, uintC len) clear_loop_msp(ptr mspop ceiling(DF_mant_len+1,intDsize),len-ceiling(DF_mant_len+1,intDsize)); return y; } + +} // namespace cln diff --git a/src/float/conv/cl_DF_to_SF.cc b/src/float/conv/cl_DF_to_SF.cc index 50a07b1..fc41a0f 100644 --- a/src/float/conv/cl_DF_to_SF.cc +++ b/src/float/conv/cl_DF_to_SF.cc @@ -12,6 +12,8 @@ #include "cl_DF.h" #include "cl_SF.h" +namespace cln { + const cl_SF cl_DF_to_SF (const cl_DF& x) { // x entpacken: @@ -63,3 +65,5 @@ const cl_SF cl_DF_to_SF (const cl_DF& x) return encode_SF(sign,exp,manthi); #endif } + +} // namespace cln diff --git a/src/float/conv/cl_DF_to_double.cc b/src/float/conv/cl_DF_to_double.cc index 98dd214..044de05 100644 --- a/src/float/conv/cl_DF_to_double.cc +++ b/src/float/conv/cl_DF_to_double.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. #include "cl_DF.h" -double cl_double_approx (const cl_DF& obj) +namespace cln { + +double double_approx (const cl_DF& obj) { union { dfloat eksplicit; double machine_double; } u; #define val u.eksplicit @@ -51,3 +53,5 @@ double cl_double_approx (const cl_DF& obj) #undef val return u.machine_double; } + +} // namespace cln diff --git a/src/float/conv/cl_DF_to_float.cc b/src/float/conv/cl_DF_to_float.cc index fb2e48b..bad7982 100644 --- a/src/float/conv/cl_DF_to_float.cc +++ b/src/float/conv/cl_DF_to_float.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. @@ -12,7 +12,9 @@ #include "cl_DF.h" #include "cl_FF.h" -float cl_float_approx (const cl_DF& x) +namespace cln { + +float float_approx (const cl_DF& x) { union { ffloat eksplicit; float machine_float; } u; // x entpacken: @@ -70,3 +72,5 @@ float cl_float_approx (const cl_DF& x) { u.eksplicit = make_FF_word(sign,exp+FF_exp_mid,mant); } return u.machine_float; } + +} // namespace cln diff --git a/src/float/conv/cl_FF_to_DF.cc b/src/float/conv/cl_FF_to_DF.cc index 7c717b9..71aa586 100644 --- a/src/float/conv/cl_FF_to_DF.cc +++ b/src/float/conv/cl_FF_to_DF.cc @@ -12,6 +12,8 @@ #include "cl_FF.h" #include "cl_DF.h" +namespace cln { + const cl_DF cl_FF_to_DF (const cl_FF& x) { // x entpacken: @@ -26,3 +28,5 @@ const cl_DF cl_FF_to_DF (const cl_FF& x) return encode_DF(sign,exp,mant>>(32-(DF_mant_len-FF_mant_len)),mant<<(DF_mant_len-FF_mant_len)); #endif } + +} // namespace cln diff --git a/src/float/conv/cl_FF_to_LF.cc b/src/float/conv/cl_FF_to_LF.cc index 19a981f..be24790 100644 --- a/src/float/conv/cl_FF_to_LF.cc +++ b/src/float/conv/cl_FF_to_LF.cc @@ -14,6 +14,8 @@ #include "cl_LF_impl.h" #include "cl_DS.h" +namespace cln { + const cl_LF cl_FF_to_LF (const cl_FF& x, uintC len) { // x entpacken: @@ -39,3 +41,5 @@ const cl_LF cl_FF_to_LF (const cl_FF& x, uintC len) clear_loop_msp(ptr mspop ceiling(FF_mant_len+1,intDsize),len-ceiling(FF_mant_len+1,intDsize)); return y; } + +} // namespace cln diff --git a/src/float/conv/cl_FF_to_SF.cc b/src/float/conv/cl_FF_to_SF.cc index 7e84623..eaad04e 100644 --- a/src/float/conv/cl_FF_to_SF.cc +++ b/src/float/conv/cl_FF_to_SF.cc @@ -12,6 +12,8 @@ #include "cl_FF.h" #include "cl_SF.h" +namespace cln { + const cl_SF cl_FF_to_SF (const cl_FF& x) { // x entpacken: @@ -38,3 +40,5 @@ const cl_SF cl_FF_to_SF (const cl_FF& x) } return encode_SF(sign,exp,mant); } + +} // namespace cln diff --git a/src/float/conv/cl_FF_to_double.cc b/src/float/conv/cl_FF_to_double.cc index 34f50c2..14476b6 100644 --- a/src/float/conv/cl_FF_to_double.cc +++ b/src/float/conv/cl_FF_to_double.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. @@ -12,7 +12,9 @@ #include "cl_FF.h" #include "cl_DF.h" -double cl_double_approx (const cl_FF& x) +namespace cln { + +double double_approx (const cl_FF& x) { // x entpacken: var cl_signean sign; @@ -62,3 +64,5 @@ double cl_double_approx (const cl_FF& x) #endif return u.machine_double; } + +} // namespace cln diff --git a/src/float/conv/cl_FF_to_float.cc b/src/float/conv/cl_FF_to_float.cc index d7204bc..d5fd5b9 100644 --- a/src/float/conv/cl_FF_to_float.cc +++ b/src/float/conv/cl_FF_to_float.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. #include "cl_FF.h" -float cl_float_approx (const cl_FF& obj) +namespace cln { + +float float_approx (const cl_FF& obj) { union { ffloat eksplicit; float machine_float; } u; #define val u.eksplicit @@ -33,3 +35,5 @@ float cl_float_approx (const cl_FF& obj) #undef val return u.machine_float; } + +} // namespace cln diff --git a/src/float/conv/cl_F_from_F.cc b/src/float/conv/cl_F_from_F.cc index d96fb90..1a76902 100644 --- a/src/float/conv/cl_F_from_F.cc +++ b/src/float/conv/cl_F_from_F.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_F.h" #include "cl_LF.h" +namespace cln { + const cl_F cl_float (const cl_F& x, const cl_F& y) { floattypecase(y @@ -21,3 +23,5 @@ const cl_F cl_float (const cl_F& x, const cl_F& y) , return cl_F_to_LF(x,TheLfloat(y)->len); ); } + +} // namespace cln diff --git a/src/float/conv/cl_F_from_F_f.cc b/src/float/conv/cl_F_from_F_f.cc index e8509e0..cf94877 100644 --- a/src/float/conv/cl_F_from_F_f.cc +++ b/src/float/conv/cl_F_from_F_f.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -const cl_F cl_float (const cl_F& x, cl_float_format_t f) +namespace cln { + +const cl_F cl_float (const cl_F& x, float_format_t f) { floatformatcase((uintL)f , return cl_F_to_SF(x); @@ -20,3 +22,5 @@ const cl_F cl_float (const cl_F& x, cl_float_format_t f) , return cl_F_to_LF(x,len); ); } + +} // namespace cln diff --git a/src/float/conv/cl_F_from_I.cc b/src/float/conv/cl_F_from_I.cc index 2e2ffcf..7eee526 100644 --- a/src/float/conv/cl_F_from_I.cc +++ b/src/float/conv/cl_F_from_I.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -15,6 +15,8 @@ #include "cl_DF.h" #include "cl_LF.h" +namespace cln { + const cl_F cl_float (const cl_I& x, const cl_F& y) { floattypecase(y @@ -24,3 +26,5 @@ const cl_F cl_float (const cl_I& x, const cl_F& y) , return cl_I_to_LF(x,TheLfloat(y)->len); ); } + +} // namespace cln diff --git a/src/float/conv/cl_F_from_I_def.cc b/src/float/conv/cl_F_from_I_def.cc index 18bd9f2..8b8e00d 100644 --- a/src/float/conv/cl_F_from_I_def.cc +++ b/src/float/conv/cl_F_from_I_def.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -15,12 +15,16 @@ #include "cl_DF.h" #include "cl_LF.h" +namespace cln { + const cl_F cl_float (const cl_I& x) { - floatformatcase(cl_default_float_format + floatformatcase(default_float_format , return cl_I_to_SF(x); , return cl_I_to_FF(x); , return cl_I_to_DF(x); , return cl_I_to_LF(x,len); ); } + +} // namespace cln diff --git a/src/float/conv/cl_F_from_I_f.cc b/src/float/conv/cl_F_from_I_f.cc index 3c4fc50..4aab33d 100644 --- a/src/float/conv/cl_F_from_I_f.cc +++ b/src/float/conv/cl_F_from_I_f.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -15,7 +15,9 @@ #include "cl_DF.h" #include "cl_LF.h" -const cl_F cl_float (const cl_I& x, cl_float_format_t f) +namespace cln { + +const cl_F cl_float (const cl_I& x, float_format_t f) { floatformatcase((uintL)f , return cl_I_to_SF(x); @@ -24,3 +26,5 @@ const cl_F cl_float (const cl_I& x, cl_float_format_t f) , return cl_I_to_LF(x,len); ); } + +} // namespace cln diff --git a/src/float/conv/cl_F_from_RA.cc b/src/float/conv/cl_F_from_RA.cc index 08bc77f..075ffc8 100644 --- a/src/float/conv/cl_F_from_RA.cc +++ b/src/float/conv/cl_F_from_RA.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -15,6 +15,8 @@ #include "cl_DF.h" #include "cl_LF.h" +namespace cln { + const cl_F cl_float (const cl_RA& x, const cl_F& y) { floattypecase(y @@ -24,3 +26,5 @@ const cl_F cl_float (const cl_RA& x, const cl_F& y) , return cl_RA_to_LF(x,TheLfloat(y)->len); ); } + +} // namespace cln diff --git a/src/float/conv/cl_F_from_RA_def.cc b/src/float/conv/cl_F_from_RA_def.cc index 8db48dc..690ec5d 100644 --- a/src/float/conv/cl_F_from_RA_def.cc +++ b/src/float/conv/cl_F_from_RA_def.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -15,12 +15,16 @@ #include "cl_DF.h" #include "cl_LF.h" +namespace cln { + const cl_F cl_float (const cl_RA& x) { - floatformatcase(cl_default_float_format + floatformatcase(default_float_format , return cl_RA_to_SF(x); , return cl_RA_to_FF(x); , return cl_RA_to_DF(x); , return cl_RA_to_LF(x,len); ); } + +} // namespace cln diff --git a/src/float/conv/cl_F_from_RA_f.cc b/src/float/conv/cl_F_from_RA_f.cc index 7dcd6dc..f83ba3c 100644 --- a/src/float/conv/cl_F_from_RA_f.cc +++ b/src/float/conv/cl_F_from_RA_f.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -15,7 +15,9 @@ #include "cl_DF.h" #include "cl_LF.h" -const cl_F cl_float (const cl_RA& x, cl_float_format_t f) +namespace cln { + +const cl_F cl_float (const cl_RA& x, float_format_t f) { floatformatcase((uintL)f , return cl_RA_to_SF(x); @@ -24,3 +26,5 @@ const cl_F cl_float (const cl_RA& x, cl_float_format_t f) , return cl_RA_to_LF(x,len); ); } + +} // namespace cln diff --git a/src/float/conv/cl_F_to_DF.cc b/src/float/conv/cl_F_to_DF.cc index 64f6143..cbdc8f8 100644 --- a/src/float/conv/cl_F_to_DF.cc +++ b/src/float/conv/cl_F_to_DF.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" +namespace cln { + const cl_DF cl_F_to_DF (const cl_F& x) { floatcase(x @@ -20,3 +22,5 @@ const cl_DF cl_F_to_DF (const cl_F& x) , return cl_LF_to_DF(x); ); } + +} // namespace cln diff --git a/src/float/conv/cl_F_to_FF.cc b/src/float/conv/cl_F_to_FF.cc index 004e4c1..0b0c710 100644 --- a/src/float/conv/cl_F_to_FF.cc +++ b/src/float/conv/cl_F_to_FF.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" +namespace cln { + const cl_FF cl_F_to_FF (const cl_F& x) { floatcase(x @@ -20,3 +22,5 @@ const cl_FF cl_F_to_FF (const cl_F& x) , return cl_LF_to_FF(x); ); } + +} // namespace cln diff --git a/src/float/conv/cl_F_to_LF.cc b/src/float/conv/cl_F_to_LF.cc index 1aa8eb6..47ce39d 100644 --- a/src/float/conv/cl_F_to_LF.cc +++ b/src/float/conv/cl_F_to_LF.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_F.h" #include "cl_LF.h" +namespace cln { + const cl_LF cl_F_to_LF (const cl_F& x, uintC len) { floatcase(x @@ -21,3 +23,5 @@ const cl_LF cl_F_to_LF (const cl_F& x, uintC len) , return LF_to_LF(x,len); ); } + +} // namespace cln diff --git a/src/float/conv/cl_F_to_SF.cc b/src/float/conv/cl_F_to_SF.cc index 5a7a274..54ae87c 100644 --- a/src/float/conv/cl_F_to_SF.cc +++ b/src/float/conv/cl_F_to_SF.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" +namespace cln { + const cl_SF cl_F_to_SF (const cl_F& x) { floatcase(x @@ -20,3 +22,5 @@ const cl_SF cl_F_to_SF (const cl_F& x) , return cl_LF_to_SF(x); ); } + +} // namespace cln diff --git a/src/float/conv/cl_F_to_double.cc b/src/float/conv/cl_F_to_double.cc index 3852fbf..54e6f74 100644 --- a/src/float/conv/cl_F_to_double.cc +++ b/src/float/conv/cl_F_to_double.cc @@ -4,23 +4,27 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" -double cl_double_approx (const cl_F& x) +namespace cln { + +double double_approx (const cl_F& x) { floatcase(x - , return cl_double_approx(x); - , return cl_double_approx(x); - , return cl_double_approx(x); - , return cl_double_approx(x); + , return double_approx(x); + , return double_approx(x); + , return double_approx(x); + , return double_approx(x); ); } + +} // namespace cln diff --git a/src/float/conv/cl_F_to_float.cc b/src/float/conv/cl_F_to_float.cc index ed6359c..51ee764 100644 --- a/src/float/conv/cl_F_to_float.cc +++ b/src/float/conv/cl_F_to_float.cc @@ -4,23 +4,27 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" -float cl_float_approx (const cl_F& x) +namespace cln { + +float float_approx (const cl_F& x) { floatcase(x - , return cl_float_approx(x); - , return cl_float_approx(x); - , return cl_float_approx(x); - , return cl_float_approx(x); + , return float_approx(x); + , return float_approx(x); + , return float_approx(x); + , return float_approx(x); ); } + +} // namespace cln diff --git a/src/float/conv/cl_LF_to_DF.cc b/src/float/conv/cl_LF_to_DF.cc index 8535f73..91fa51b 100644 --- a/src/float/conv/cl_LF_to_DF.cc +++ b/src/float/conv/cl_LF_to_DF.cc @@ -14,6 +14,8 @@ #include "cl_DF.h" #include "cl_DS.h" +namespace cln { + const cl_DF cl_LF_to_DF (const cl_LF& x) { // x entpacken: @@ -73,3 +75,5 @@ const cl_DF cl_LF_to_DF (const cl_LF& x) return encode_DF(sign,exp,manthi,mantlo); #endif } + +} // namespace cln diff --git a/src/float/conv/cl_LF_to_FF.cc b/src/float/conv/cl_LF_to_FF.cc index 5c30d5e..28d1567 100644 --- a/src/float/conv/cl_LF_to_FF.cc +++ b/src/float/conv/cl_LF_to_FF.cc @@ -14,6 +14,8 @@ #include "cl_FF.h" #include "cl_DS.h" +namespace cln { + const cl_FF cl_LF_to_FF (const cl_LF& x) { // x entpacken: @@ -49,3 +51,5 @@ const cl_FF cl_LF_to_FF (const cl_LF& x) } return encode_FF(sign,exp,mant); } + +} // namespace cln diff --git a/src/float/conv/cl_LF_to_SF.cc b/src/float/conv/cl_LF_to_SF.cc index c5de4c5..ff880ab 100644 --- a/src/float/conv/cl_LF_to_SF.cc +++ b/src/float/conv/cl_LF_to_SF.cc @@ -14,6 +14,8 @@ #include "cl_SF.h" #include "cl_DS.h" +namespace cln { + const cl_SF cl_LF_to_SF (const cl_LF& x) { // x entpacken: @@ -49,3 +51,5 @@ const cl_SF cl_LF_to_SF (const cl_LF& x) } return encode_SF(sign,exp,mant); } + +} // namespace cln diff --git a/src/float/conv/cl_LF_to_double.cc b/src/float/conv/cl_LF_to_double.cc index 5228c9b..8458760 100644 --- a/src/float/conv/cl_LF_to_double.cc +++ b/src/float/conv/cl_LF_to_double.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -14,7 +14,9 @@ #include "cl_DF.h" #include "cl_DS.h" -double cl_double_approx (const cl_LF& x) +namespace cln { + +double double_approx (const cl_LF& x) { // x entpacken: var cl_signean sign; @@ -105,3 +107,5 @@ double cl_double_approx (const cl_LF& x) #endif return u.machine_double; } + +} // namespace cln diff --git a/src/float/conv/cl_LF_to_float.cc b/src/float/conv/cl_LF_to_float.cc index 53d4263..6f1f826 100644 --- a/src/float/conv/cl_LF_to_float.cc +++ b/src/float/conv/cl_LF_to_float.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -14,7 +14,9 @@ #include "cl_FF.h" #include "cl_DS.h" -float cl_float_approx (const cl_LF& x) +namespace cln { + +float float_approx (const cl_LF& x) { // x entpacken: var cl_signean sign; @@ -57,3 +59,5 @@ float cl_float_approx (const cl_LF& x) { u.eksplicit = make_FF_word(sign,exp+FF_exp_mid,mant); } return u.machine_float; } + +} // namespace cln diff --git a/src/float/conv/cl_SF_to_DF.cc b/src/float/conv/cl_SF_to_DF.cc index 34211a5..a91c202 100644 --- a/src/float/conv/cl_SF_to_DF.cc +++ b/src/float/conv/cl_SF_to_DF.cc @@ -12,6 +12,8 @@ #include "cl_SF.h" #include "cl_DF.h" +namespace cln { + const cl_DF cl_SF_to_DF (const cl_SF& x) { // x entpacken: @@ -26,3 +28,5 @@ const cl_DF cl_SF_to_DF (const cl_SF& x) return encode_DF(sign,exp,mant<<(DF_mant_len-SF_mant_len-32),0); #endif } + +} // namespace cln diff --git a/src/float/conv/cl_SF_to_FF.cc b/src/float/conv/cl_SF_to_FF.cc index de034f5..a1771e4 100644 --- a/src/float/conv/cl_SF_to_FF.cc +++ b/src/float/conv/cl_SF_to_FF.cc @@ -12,6 +12,8 @@ #include "cl_SF.h" #include "cl_FF.h" +namespace cln { + const cl_FF cl_SF_to_FF (const cl_SF& x) { // x entpacken: @@ -22,3 +24,5 @@ const cl_FF cl_SF_to_FF (const cl_SF& x) // Mantisse um 23-16=7 Bits nach links schieben: return encode_FF(sign,exp,mant<<(FF_mant_len-SF_mant_len)); } + +} // namespace cln diff --git a/src/float/conv/cl_SF_to_LF.cc b/src/float/conv/cl_SF_to_LF.cc index f339705..540aaf4 100644 --- a/src/float/conv/cl_SF_to_LF.cc +++ b/src/float/conv/cl_SF_to_LF.cc @@ -14,6 +14,8 @@ #include "cl_LF_impl.h" #include "cl_DS.h" +namespace cln { + const cl_LF cl_SF_to_LF (const cl_SF& x, uintC len) { // x entpacken: @@ -39,3 +41,5 @@ const cl_LF cl_SF_to_LF (const cl_SF& x, uintC len) clear_loop_msp(ptr mspop ceiling(SF_mant_len+1,intDsize),len-ceiling(SF_mant_len+1,intDsize)); return y; } + +} // namespace cln diff --git a/src/float/conv/cl_SF_to_double.cc b/src/float/conv/cl_SF_to_double.cc index c27d798..7c0f98c 100644 --- a/src/float/conv/cl_SF_to_double.cc +++ b/src/float/conv/cl_SF_to_double.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -12,7 +12,9 @@ #include "cl_SF.h" #include "cl_DF.h" -double cl_double_approx (const cl_SF& x) +namespace cln { + +double double_approx (const cl_SF& x) { // x entpacken: var cl_signean sign; @@ -62,3 +64,5 @@ double cl_double_approx (const cl_SF& x) #endif return u.machine_double; } + +} // namespace cln diff --git a/src/float/conv/cl_SF_to_float.cc b/src/float/conv/cl_SF_to_float.cc index 7bb07dd..8d592b9 100644 --- a/src/float/conv/cl_SF_to_float.cc +++ b/src/float/conv/cl_SF_to_float.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -12,7 +12,9 @@ #include "cl_SF.h" #include "cl_FF.h" -float cl_float_approx (const cl_SF& x) +namespace cln { + +float float_approx (const cl_SF& x) { // x entpacken: var cl_signean sign; @@ -32,3 +34,5 @@ float cl_float_approx (const cl_SF& x) { u.eksplicit = make_FF_word(sign,exp+FF_exp_mid,mant<<(FF_mant_len-SF_mant_len)); } return u.machine_float; } + +} // namespace cln diff --git a/src/float/dfloat/algebraic/cl_DF_sqrt.cc b/src/float/dfloat/algebraic/cl_DF_sqrt.cc index a8c1b74..201e2e3 100644 --- a/src/float/dfloat/algebraic/cl_DF_sqrt.cc +++ b/src/float/dfloat/algebraic/cl_DF_sqrt.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. @@ -14,6 +14,8 @@ #include "cl_low.h" #include "cl_DS.h" +namespace cln { + const cl_DF sqrt (const cl_DF& x) { // Methode: @@ -146,3 +148,5 @@ const cl_DF sqrt (const cl_DF& x) return encode_DF(0,exp,manthi,mantlo); #endif } + +} // namespace cln diff --git a/src/float/dfloat/cl_DF.h b/src/float/dfloat/cl_DF.h index 1cb7870..2acace7 100644 --- a/src/float/dfloat/cl_DF.h +++ b/src/float/dfloat/cl_DF.h @@ -3,11 +3,18 @@ #ifndef _CL_DF_H #define _CL_DF_H -#include "cl_number.h" -#include "cl_malloc.h" +#include "cln/number.h" +#include "cln/malloc.h" #include "cl_low.h" #include "cl_F.h" +#ifdef FAST_DOUBLE +#include "cl_N.h" +#include "cl_F.h" +#endif + +namespace cln { + typedef // 64-bit float in IEEE format #if (cl_word_size==64) // Sign/Exponent/Mantissa @@ -61,7 +68,7 @@ extern cl_class cl_class_dfloat; #if (cl_word_size==64) inline cl_heap_dfloat* allocate_dfloat (dfloat eksplicit) { - cl_heap_dfloat* p = (cl_heap_dfloat*) cl_malloc_hook(sizeof(cl_heap_dfloat)); + cl_heap_dfloat* p = (cl_heap_dfloat*) malloc_hook(sizeof(cl_heap_dfloat)); p->refcount = 1; p->type = &cl_class_dfloat; p->representation.eksplicit = eksplicit; @@ -70,7 +77,7 @@ inline cl_heap_dfloat* allocate_dfloat (dfloat eksplicit) #else inline cl_heap_dfloat* allocate_dfloat (uint32 semhi, uint32 mlo) { - cl_heap_dfloat* p = (cl_heap_dfloat*) cl_malloc_hook(sizeof(cl_heap_dfloat)); + cl_heap_dfloat* p = (cl_heap_dfloat*) malloc_hook(sizeof(cl_heap_dfloat)); p->refcount = 1; p->type = &cl_class_dfloat; p->representation.eksplicit.semhi = semhi; @@ -210,8 +217,6 @@ inline double DF_to_double (const cl_DF& obj) // maybe_underflow: Ergebnis sehr klein und /=0, liefert IEEE-Null // maybe_divide_0: Ergebnis unbestimmt, liefert IEEE-Infinity // maybe_nan: Ergebnis unbestimmt, liefert IEEE-NaN - #include "cl_N.h" - #include "cl_F.h" #if (cl_word_size==64) #define double_to_DF(expr,ergebnis_zuweisung,maybe_overflow,maybe_subnormal,maybe_underflow,maybe_divide_0,maybe_nan) \ { var dfloatjanus _erg; _erg.machine_double = (expr); \ @@ -305,4 +310,6 @@ inline const cl_DF cl_double_to_DF (const dfloatjanus& val) // wandelt ein Double-Float obj in ein IEEE-Double-Float val um. extern void cl_DF_to_double (const cl_DF& obj, dfloatjanus* val_); +} // namespace cln + #endif /* _CL_DF_H */ diff --git a/src/float/dfloat/conv/cl_DF_from_double.cc b/src/float/dfloat/conv/cl_DF_from_double.cc index 1a6e7f5..f6c4605 100644 --- a/src/float/dfloat/conv/cl_DF_from_double.cc +++ b/src/float/dfloat/conv/cl_DF_from_double.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + cl_heap_dfloat* cl_double_to_DF_pointer (const dfloatjanus& val_) { var dfloat val = val_.eksplicit; @@ -58,3 +60,5 @@ cl_heap_dfloat* cl_double_to_DF_pointer (const dfloatjanus& val_) } #endif } + +} // namespace cln diff --git a/src/float/dfloat/conv/cl_DF_to_doublej.cc b/src/float/dfloat/conv/cl_DF_to_doublej.cc index 352a16f..e82d45a 100644 --- a/src/float/dfloat/conv/cl_DF_to_doublej.cc +++ b/src/float/dfloat/conv/cl_DF_to_doublej.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + void cl_DF_to_double (const cl_DF& obj, dfloatjanus* val_) { var dfloat val = TheDfloat(obj)->dfloat_value; @@ -46,3 +48,5 @@ void cl_DF_to_double (const cl_DF& obj, dfloatjanus* val_) #endif val_->eksplicit = val; } + +} // namespace cln diff --git a/src/float/dfloat/conv/cl_I_to_double.cc b/src/float/dfloat/conv/cl_I_to_double.cc index 31e7038..6223450 100644 --- a/src/float/dfloat/conv/cl_I_to_double.cc +++ b/src/float/dfloat/conv/cl_I_to_double.cc @@ -1,10 +1,10 @@ -// cl_double_approx(). +// double_approx(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -14,7 +14,9 @@ #include "cl_DS.h" #include "cl_F.h" -double cl_double_approx (const cl_I& x) +namespace cln { + +double double_approx (const cl_I& x) { // Method: same as cl_I_to_DF(). if (eq(x,0)) { return 0.0; } @@ -147,3 +149,5 @@ double cl_double_approx (const cl_I& x) return u.machine_double; #endif } + +} // namespace cln diff --git a/src/float/dfloat/conv/cl_RA_to_double.cc b/src/float/dfloat/conv/cl_RA_to_double.cc index 904b819..bde025f 100644 --- a/src/float/dfloat/conv/cl_RA_to_double.cc +++ b/src/float/dfloat/conv/cl_RA_to_double.cc @@ -1,26 +1,28 @@ -// cl_double_approx(). +// double_approx(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_DF.h" #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_F.h" -double cl_double_approx (const cl_RA& x) +namespace cln { + +double double_approx (const cl_RA& x) { // Method: same as cl_RA_to_DF(). if (integerp(x)) { DeclareType(cl_I,x); - return cl_double_approx(x); + return double_approx(x); } { // x Ratio DeclareType(cl_RT,x); @@ -184,3 +186,5 @@ double cl_double_approx (const cl_RA& x) return u.machine_double; #endif }} + +} // namespace cln diff --git a/src/float/dfloat/division/cl_DF_ceil22.cc b/src/float/dfloat/division/cl_DF_ceil22.cc index ceca811..4165c7a 100644 --- a/src/float/dfloat/division/cl_DF_ceil22.cc +++ b/src/float/dfloat/division/cl_DF_ceil22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. #include "cl_DF.h" +namespace cln { + const cl_DF_div_t ceiling2 (const cl_DF& x, const cl_DF& y) { // Methode: @@ -20,3 +22,5 @@ const cl_DF_div_t ceiling2 (const cl_DF& x, const cl_DF& y) var cl_DF& r = q_r.remainder; return cl_DF_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/dfloat/division/cl_DF_fceil.cc b/src/float/dfloat/division/cl_DF_fceil.cc index fb17c81..dfd577b 100644 --- a/src/float/dfloat/division/cl_DF_fceil.cc +++ b/src/float/dfloat/division/cl_DF_fceil.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. @@ -15,6 +15,8 @@ #define MAYBE_INLINE inline #include "cl_DF_minusp.cc" +namespace cln { + const cl_DF fceiling (const cl_DF& x) { if (minusp(x)) @@ -22,3 +24,5 @@ const cl_DF fceiling (const cl_DF& x) else return futruncate(x); } + +} // namespace cln diff --git a/src/float/dfloat/division/cl_DF_floor22.cc b/src/float/dfloat/division/cl_DF_floor22.cc index 90fb35a..98022ee 100644 --- a/src/float/dfloat/division/cl_DF_floor22.cc +++ b/src/float/dfloat/division/cl_DF_floor22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. #include "cl_DF.h" +namespace cln { + const cl_DF_div_t floor2 (const cl_DF& x, const cl_DF& y) { // Methode: @@ -20,3 +22,5 @@ const cl_DF_div_t floor2 (const cl_DF& x, const cl_DF& y) var cl_DF& r = q_r.remainder; return cl_DF_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/dfloat/division/cl_DF_recip.cc b/src/float/dfloat/division/cl_DF_recip.cc index cda34ee..2bf62e8 100644 --- a/src/float/dfloat/division/cl_DF_recip.cc +++ b/src/float/dfloat/division/cl_DF_recip.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. #include "cl_DF.h" +namespace cln { + const cl_DF recip (const cl_DF& x) { return cl_DF_1 / x; } + +} // namespace cln diff --git a/src/float/dfloat/division/cl_DF_round22.cc b/src/float/dfloat/division/cl_DF_round22.cc index 0f31fd2..5c34713 100644 --- a/src/float/dfloat/division/cl_DF_round22.cc +++ b/src/float/dfloat/division/cl_DF_round22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. #include "cl_DF.h" +namespace cln { + const cl_DF_div_t round2 (const cl_DF& x, const cl_DF& y) { // Methode: @@ -20,3 +22,5 @@ const cl_DF_div_t round2 (const cl_DF& x, const cl_DF& y) var cl_DF& r = q_r.remainder; return cl_DF_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/dfloat/division/cl_DF_trunc22.cc b/src/float/dfloat/division/cl_DF_trunc22.cc index 5a7daac..e6d1f80 100644 --- a/src/float/dfloat/division/cl_DF_trunc22.cc +++ b/src/float/dfloat/division/cl_DF_trunc22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. #include "cl_DF.h" +namespace cln { + const cl_DF_div_t truncate2 (const cl_DF& x, const cl_DF& y) { // Methode: @@ -20,3 +22,5 @@ const cl_DF_div_t truncate2 (const cl_DF& x, const cl_DF& y) var cl_DF& r = q_r.remainder; return cl_DF_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_compare.cc b/src/float/dfloat/elem/cl_DF_compare.cc index 970a8f5..9dc784a 100644 --- a/src/float/dfloat/elem/cl_DF_compare.cc +++ b/src/float/dfloat/elem/cl_DF_compare.cc @@ -1,17 +1,19 @@ -// cl_compare(). +// compare(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. #include "cl_DF.h" -cl_signean cl_compare (const cl_DF& x, const cl_DF& y) +namespace cln { + +cl_signean compare (const cl_DF& x, const cl_DF& y) { // Methode: // x und y haben verschiedenes Vorzeichen -> @@ -80,3 +82,5 @@ cl_signean cl_compare (const cl_DF& x, const cl_DF& y) } #endif } + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_div.cc b/src/float/dfloat/elem/cl_DF_div.cc index 3c18e5a..fa5ca78 100644 --- a/src/float/dfloat/elem/cl_DF_div.cc +++ b/src/float/dfloat/elem/cl_DF_div.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. @@ -15,12 +15,15 @@ #include "cl_low.h" #include "cl_DS.h" #include "cl_ieee.h" -NEED_IEEE_FLOATS() #undef MAYBE_INLINE #define MAYBE_INLINE inline #include "cl_DF_zerop.cc" +namespace cln { + +NEED_IEEE_FLOATS() + const cl_DF operator/ (const cl_DF& x1, const cl_DF& x2) { // Methode: @@ -220,3 +223,5 @@ const cl_DF operator/ (const cl_DF& x1, const cl_DF& x2) #endif #endif } + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_ffloor.cc b/src/float/dfloat/elem/cl_DF_ffloor.cc index 744ef79..18a508c 100644 --- a/src/float/dfloat/elem/cl_DF_ffloor.cc +++ b/src/float/dfloat/elem/cl_DF_ffloor.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. @@ -15,6 +15,8 @@ #define MAYBE_INLINE inline #include "cl_DF_minusp.cc" +namespace cln { + const cl_DF ffloor (const cl_DF& x) { if (minusp(x)) @@ -22,3 +24,5 @@ const cl_DF ffloor (const cl_DF& x) else return ftruncate(x); } + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_from_I.cc b/src/float/dfloat/elem/cl_DF_from_I.cc index a6c3957..a4efd9d 100644 --- a/src/float/dfloat/elem/cl_DF_from_I.cc +++ b/src/float/dfloat/elem/cl_DF_from_I.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_DS.h" #include "cl_F.h" +namespace cln { + const cl_DF cl_I_to_DF (const cl_I& x) { // Methode: @@ -133,3 +135,5 @@ const cl_DF cl_I_to_DF (const cl_I& x) return encode_DF(sign,(sintL)exp,manthi,mantlo); #endif } + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_from_RA.cc b/src/float/dfloat/elem/cl_DF_from_RA.cc index 13169d0..43f3022 100644 --- a/src/float/dfloat/elem/cl_DF_from_RA.cc +++ b/src/float/dfloat/elem/cl_DF_from_RA.cc @@ -10,10 +10,12 @@ // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_F.h" +namespace cln { + const cl_DF cl_RA_to_DF (const cl_RA& x) { // Methode: @@ -148,3 +150,5 @@ const cl_DF cl_RA_to_DF (const cl_RA& x) return encode_DF(sign,lendiff,manthi,mantlo); #endif }} + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_fround.cc b/src/float/dfloat/elem/cl_DF_fround.cc index 64fd2a7..ac0add5 100644 --- a/src/float/dfloat/elem/cl_DF_fround.cc +++ b/src/float/dfloat/elem/cl_DF_fround.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. #include "cl_DF.h" +namespace cln { + const cl_DF fround (const cl_DF& x) { // Methode: @@ -166,3 +168,5 @@ const cl_DF fround (const cl_DF& x) } #endif } + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_ftrunc.cc b/src/float/dfloat/elem/cl_DF_ftrunc.cc index d00a630..23d5f4d 100644 --- a/src/float/dfloat/elem/cl_DF_ftrunc.cc +++ b/src/float/dfloat/elem/cl_DF_ftrunc.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. #include "cl_DF.h" +namespace cln { + const cl_DF ftruncate (const cl_DF& x) { // Methode: @@ -60,3 +62,5 @@ const cl_DF ftruncate (const cl_DF& x) } } #endif } + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_futrunc.cc b/src/float/dfloat/elem/cl_DF_futrunc.cc index 1277ea0..35c2576 100644 --- a/src/float/dfloat/elem/cl_DF_futrunc.cc +++ b/src/float/dfloat/elem/cl_DF_futrunc.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + const cl_DF futruncate (const cl_DF& x) { // Methode: @@ -80,3 +82,5 @@ const cl_DF futruncate (const cl_DF& x) } } #endif } + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_globals.cc b/src/float/dfloat/elem/cl_DF_globals.cc index f64c98e..985299c 100644 --- a/src/float/dfloat/elem/cl_DF_globals.cc +++ b/src/float/dfloat/elem/cl_DF_globals.cc @@ -11,6 +11,8 @@ CL_PROVIDE(cl_DF_globals) // Implementation. +namespace cln { + #if (cl_word_size==64) const cl_DF cl_DF_0 = allocate_dfloat(0); // 0.0d0 @@ -29,4 +31,6 @@ const cl_DF cl_DF_minus1 = encode_DF(-1,1,bit(DF_mant_len-32),0); // -1.0d0 #endif +} // namespace cln + CL_PROVIDE_END(cl_DF_globals) diff --git a/src/float/dfloat/elem/cl_DF_minus.cc b/src/float/dfloat/elem/cl_DF_minus.cc index ce24ac3..ba4bd55 100644 --- a/src/float/dfloat/elem/cl_DF_minus.cc +++ b/src/float/dfloat/elem/cl_DF_minus.cc @@ -4,13 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. #include "cl_DF.h" #include "cl_ieee.h" + +namespace cln { + NEED_IEEE_FLOATS() const cl_DF operator- (const cl_DF& x1, const cl_DF& x2) @@ -41,3 +44,5 @@ const cl_DF operator- (const cl_DF& x1, const cl_DF& x2) #endif #endif } + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_minusp.cc b/src/float/dfloat/elem/cl_DF_minusp.cc index a5605bf..e708a8e 100644 --- a/src/float/dfloat/elem/cl_DF_minusp.cc +++ b/src/float/dfloat/elem/cl_DF_minusp.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. #include "cl_DF.h" +namespace cln { + MAYBE_INLINE cl_boolean minusp (const cl_DF& x) { @@ -20,3 +22,5 @@ cl_boolean minusp (const cl_DF& x) return (cl_boolean) ((sint32)TheDfloat(x)->dfloat_value_semhi < 0); #endif } + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_mul.cc b/src/float/dfloat/elem/cl_DF_mul.cc index 783a503..de8cb7b 100644 --- a/src/float/dfloat/elem/cl_DF_mul.cc +++ b/src/float/dfloat/elem/cl_DF_mul.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. @@ -14,12 +14,15 @@ #include "cl_low.h" #include "cl_DS.h" #include "cl_ieee.h" -NEED_IEEE_FLOATS() #undef MAYBE_INLINE #define MAYBE_INLINE inline #include "cl_DF_zerop.cc" +namespace cln { + +NEED_IEEE_FLOATS() + const cl_DF operator* (const cl_DF& x1, const cl_DF& x2) { // Methode: @@ -207,3 +210,5 @@ const cl_DF operator* (const cl_DF& x1, const cl_DF& x2) } #endif } + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_plus.cc b/src/float/dfloat/elem/cl_DF_plus.cc index 781cb3c..bae86a1 100644 --- a/src/float/dfloat/elem/cl_DF_plus.cc +++ b/src/float/dfloat/elem/cl_DF_plus.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. @@ -12,9 +12,12 @@ #include "cl_DF.h" #include "cl_F.h" #include "cl_ieee.h" -NEED_IEEE_FLOATS() #include "cl_xmacros.h" +namespace cln { + +NEED_IEEE_FLOATS() + const cl_DF operator+ (const cl_DF& x1, const cl_DF& x2) { // Methode (nach [Knuth, II, Seminumerical Algorithms, Abschnitt 4.2.1., S.200]): @@ -258,3 +261,5 @@ const cl_DF operator+ (const cl_DF& x1, const cl_DF& x2) #endif #endif } + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_plusp.cc b/src/float/dfloat/elem/cl_DF_plusp.cc index 0de29f1..e67b497 100644 --- a/src/float/dfloat/elem/cl_DF_plusp.cc +++ b/src/float/dfloat/elem/cl_DF_plusp.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. @@ -16,6 +16,8 @@ #include "cl_DF_minusp.cc" #include "cl_DF_zerop.cc" +namespace cln { + MAYBE_INLINE2 cl_boolean plusp (const cl_DF& x) { @@ -26,3 +28,5 @@ cl_boolean plusp (const cl_DF& x) else return cl_true; // sonst ist x>0. } + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_scale.cc b/src/float/dfloat/elem/cl_DF_scale.cc index 77c2ef6..ac19bcb 100644 --- a/src/float/dfloat/elem/cl_DF_scale.cc +++ b/src/float/dfloat/elem/cl_DF_scale.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_DF.h" #include "cl_F.h" +namespace cln { + const cl_DF scale_float (const cl_DF& x, sintL delta) { // Methode: @@ -61,3 +63,5 @@ const cl_DF scale_float (const cl_DF& x, sintL delta) { return cl_DF_0; } } } + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_scale_I.cc b/src/float/dfloat/elem/cl_DF_scale_I.cc index 2397882..e189b6e 100644 --- a/src/float/dfloat/elem/cl_DF_scale_I.cc +++ b/src/float/dfloat/elem/cl_DF_scale_I.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_F.h" #include "cl_I.h" +namespace cln { + const cl_DF scale_float (const cl_DF& x, const cl_I& delta) { // Methode: @@ -67,3 +69,5 @@ const cl_DF scale_float (const cl_DF& x, const cl_I& delta) { return cl_DF_0; } } } + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_to_I.cc b/src/float/dfloat/elem/cl_DF_to_I.cc index 08bd1e0..94ba5b6 100644 --- a/src/float/dfloat/elem/cl_DF_to_I.cc +++ b/src/float/dfloat/elem/cl_DF_to_I.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" +namespace cln { + const cl_I cl_DF_to_I (const cl_DF& x) { // Methode: @@ -43,3 +45,5 @@ const cl_I cl_DF_to_I (const cl_DF& x) return ash( L2_to_I(manthi,mantlo), exp ); #endif } + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_uminus.cc b/src/float/dfloat/elem/cl_DF_uminus.cc index 699ef95..d2e970a 100644 --- a/src/float/dfloat/elem/cl_DF_uminus.cc +++ b/src/float/dfloat/elem/cl_DF_uminus.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. #include "cl_DF.h" +namespace cln { + const cl_DF operator- (const cl_DF& x) { // Methode: @@ -30,3 +32,5 @@ const cl_DF operator- (const cl_DF& x) return allocate_dfloat( semhi ^ bit(31), mlo ); #endif } + +} // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_zerop.cc b/src/float/dfloat/elem/cl_DF_zerop.cc index 3803b1e..7f72d81 100644 --- a/src/float/dfloat/elem/cl_DF_zerop.cc +++ b/src/float/dfloat/elem/cl_DF_zerop.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. #include "cl_DF.h" +namespace cln { + MAYBE_INLINE cl_boolean zerop (const cl_DF& x) { @@ -20,3 +22,5 @@ cl_boolean zerop (const cl_DF& x) return (cl_boolean) (TheDfloat(x)->dfloat_value_semhi == 0); #endif } + +} // namespace cln diff --git a/src/float/dfloat/input/cl_DF_from_string.cc b/src/float/dfloat/input/cl_DF_from_string.cc index 071a421..973a8c3 100644 --- a/src/float/dfloat/input/cl_DF_from_string.cc +++ b/src/float/dfloat/input/cl_DF_from_string.cc @@ -4,20 +4,22 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat_class.h" +#include "cln/dfloat_class.h" // Implementation. -#include "cl_dfloat.h" -#include "cl_input.h" -#include "cl_float_io.h" +#include "cln/dfloat.h" +#include "cln/input.h" +#include "cln/float_io.h" + +namespace cln { cl_read_flags cl_DF_read_flags = { syntax_dfloat, lsyntax_all, 10, - { cl_float_format_dfloat, cl_float_format_lfloat_min, cl_false } + { float_format_dfloat, float_format_lfloat_min, cl_false } }; cl_DF::cl_DF (const char * string) @@ -25,3 +27,5 @@ cl_DF::cl_DF (const char * string) pointer = as_cl_private_thing( As(cl_DF)(read_float(cl_DF_read_flags,string,NULL,NULL))); } + +} // namespace cln diff --git a/src/float/dfloat/misc/cl_DF_abs.cc b/src/float/dfloat/misc/cl_DF_abs.cc index ebadb9a..f29d596 100644 --- a/src/float/dfloat/misc/cl_DF_abs.cc +++ b/src/float/dfloat/misc/cl_DF_abs.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. @@ -13,8 +13,12 @@ #define MAYBE_INLINE inline #include "cl_DF_minusp.cc" +namespace cln { + const cl_DF abs (const cl_DF& x) { // x<0 -> (- x), x>=0 -> x if (minusp(x)) return -x; else return x; } + +} // namespace cln diff --git a/src/float/dfloat/misc/cl_DF_as.cc b/src/float/dfloat/misc/cl_DF_as.cc index e60dc9f..6590a5f 100644 --- a/src/float/dfloat/misc/cl_DF_as.cc +++ b/src/float/dfloat/misc/cl_DF_as.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. #include "cl_N.h" +namespace cln { + inline cl_boolean cl_DF_p (const cl_number& x) { if (x.pointer_p()) @@ -27,3 +29,5 @@ const cl_DF& as_cl_DF (const cl_number& x, const char * filename, int line) } else cl_as_error(x,"a double-float number",filename,line); } + +} // namespace cln diff --git a/src/float/dfloat/misc/cl_DF_class.cc b/src/float/dfloat/misc/cl_DF_class.cc index 06fcfba..ec0f66e 100644 --- a/src/float/dfloat/misc/cl_DF_class.cc +++ b/src/float/dfloat/misc/cl_DF_class.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. +namespace cln { + cl_class cl_class_dfloat = { NULL, // empty destructor cl_class_flags_subclass_complex | cl_class_flags_subclass_real | cl_class_flags_subclass_float }; + +} // namespace cln diff --git a/src/float/dfloat/misc/cl_DF_debug.cc b/src/float/dfloat/misc/cl_DF_debug.cc index 6fa7d7c..0232915 100644 --- a/src/float/dfloat/misc/cl_DF_debug.cc +++ b/src/float/dfloat/misc/cl_DF_debug.cc @@ -8,9 +8,11 @@ // Implementation. -#include "cl_dfloat.h" -#include "cl_io.h" -#include "cl_float_io.h" +#include "cln/dfloat.h" +#include "cln/io.h" +#include "cln/float_io.h" + +namespace cln { static void dprint (cl_heap* pointer) { @@ -21,5 +23,7 @@ static void dprint (cl_heap* pointer) AT_INITIALIZATION(dprint_DF) { cl_register_type_printer(cl_class_dfloat,dprint); } -// This dummy links in this module when requires it. +// This dummy links in this module when requires it. int cl_DF_debug_module; + +} // namespace cln diff --git a/src/float/dfloat/misc/cl_DF_decode.cc b/src/float/dfloat/misc/cl_DF_decode.cc index 641104b..e082f77 100644 --- a/src/float/dfloat/misc/cl_DF_decode.cc +++ b/src/float/dfloat/misc/cl_DF_decode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. @@ -12,17 +12,19 @@ #include "cl_DF.h" #include "cl_I.h" -const cl_decoded_dfloat decode_float (const cl_DF& x) +namespace cln { + +const decoded_dfloat decode_float (const cl_DF& x) { // x entpacken: var cl_signean sign; var sintL exp; #if (cl_word_size==64) var uint64 mant; - DF_decode(x, { return cl_decoded_dfloat(cl_DF_0, 0, cl_DF_1); }, + DF_decode(x, { return decoded_dfloat(cl_DF_0, 0, cl_DF_1); }, sign=,exp=,mant= ); - return cl_decoded_dfloat( + return decoded_dfloat( encode_DF(0,0,mant), // (-1)^0 * 2^0 * m erzeugen L_to_FN(exp), // e als Fixnum encode_DF(sign,1,bit(DF_mant_len)) // (-1)^s erzeugen @@ -30,13 +32,15 @@ const cl_decoded_dfloat decode_float (const cl_DF& x) #else var uint32 manthi; var uint32 mantlo; - DF_decode2(x, { return cl_decoded_dfloat(cl_DF_0, 0, cl_DF_1); }, + DF_decode2(x, { return decoded_dfloat(cl_DF_0, 0, cl_DF_1); }, sign=,exp=,manthi=,mantlo= ); - return cl_decoded_dfloat( + return decoded_dfloat( encode_DF(0,0,manthi,mantlo), // (-1)^0 * 2^0 * m erzeugen L_to_FN(exp), // e als Fixnum encode_DF(sign,1,bit(DF_mant_len-32),0) // (-1)^s erzeugen ); #endif } + +} // namespace cln diff --git a/src/float/dfloat/misc/cl_DF_digits.cc b/src/float/dfloat/misc/cl_DF_digits.cc index 5ea00a6..53670bf 100644 --- a/src/float/dfloat/misc/cl_DF_digits.cc +++ b/src/float/dfloat/misc/cl_DF_digits.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. #include "cl_DF.h" +namespace cln { + MAYBE_INLINE uintL float_digits (const cl_DF& x) { unused x; return DF_mant_len+1; // 53 } + +} // namespace cln diff --git a/src/float/dfloat/misc/cl_DF_eqhashcode.cc b/src/float/dfloat/misc/cl_DF_eqhashcode.cc index 269fecc..c3907be 100644 --- a/src/float/dfloat/misc/cl_DF_eqhashcode.cc +++ b/src/float/dfloat/misc/cl_DF_eqhashcode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. @@ -12,8 +12,10 @@ #include "cl_N.h" #include "cl_DF.h" +namespace cln { + MAYBE_INLINE -uint32 cl_equal_hashcode (const cl_DF& x) +uint32 equal_hashcode (const cl_DF& x) { var cl_signean sign; var sintL exp; @@ -30,3 +32,5 @@ uint32 cl_equal_hashcode (const cl_DF& x) #endif return equal_hashcode_low(msd,exp,sign); } + +} // namespace cln diff --git a/src/float/dfloat/misc/cl_DF_exponent.cc b/src/float/dfloat/misc/cl_DF_exponent.cc index 3bb84c3..db94aaa 100644 --- a/src/float/dfloat/misc/cl_DF_exponent.cc +++ b/src/float/dfloat/misc/cl_DF_exponent.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. #include "cl_DF.h" +namespace cln { + MAYBE_INLINE sintL float_exponent (const cl_DF& x) { @@ -18,3 +20,5 @@ sintL float_exponent (const cl_DF& x) if (uexp==0) { return 0; } return (sintL)(uexp - DF_exp_mid); } + +} // namespace cln diff --git a/src/float/dfloat/misc/cl_DF_idecode.cc b/src/float/dfloat/misc/cl_DF_idecode.cc index 6140afd..b69fc03 100644 --- a/src/float/dfloat/misc/cl_DF_idecode.cc +++ b/src/float/dfloat/misc/cl_DF_idecode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_DF.h" #include "cl_I.h" +namespace cln { + MAYBE_INLINE const cl_idecoded_float integer_decode_float (const cl_DF& x) { @@ -41,3 +43,5 @@ const cl_idecoded_float integer_decode_float (const cl_DF& x) ); #endif } + +} // namespace cln diff --git a/src/float/dfloat/misc/cl_DF_max.cc b/src/float/dfloat/misc/cl_DF_max.cc index 7dfe3ca..4bebf26 100644 --- a/src/float/dfloat/misc/cl_DF_max.cc +++ b/src/float/dfloat/misc/cl_DF_max.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. +namespace cln { + const cl_DF max (const cl_DF& x, const cl_DF& y) { return (x >= y ? x : y); } + +} // namespace cln diff --git a/src/float/dfloat/misc/cl_DF_min.cc b/src/float/dfloat/misc/cl_DF_min.cc index 7768cf8..c1a903c 100644 --- a/src/float/dfloat/misc/cl_DF_min.cc +++ b/src/float/dfloat/misc/cl_DF_min.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. +namespace cln { + const cl_DF min (const cl_DF& x, const cl_DF& y) { return (x <= y ? x : y); } + +} // namespace cln diff --git a/src/float/dfloat/misc/cl_DF_precision.cc b/src/float/dfloat/misc/cl_DF_precision.cc index 3092f94..5bafced 100644 --- a/src/float/dfloat/misc/cl_DF_precision.cc +++ b/src/float/dfloat/misc/cl_DF_precision.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. @@ -15,9 +15,13 @@ #define MAYBE_INLINE inline #include "cl_DF_zerop.cc" +namespace cln { + MAYBE_INLINE2 uintL float_precision (const cl_DF& x) { if (zerop(x)) return 0; return DF_mant_len+1; // 53 } + +} // namespace cln diff --git a/src/float/dfloat/misc/cl_DF_sign.cc b/src/float/dfloat/misc/cl_DF_sign.cc index 643100b..42847c4 100644 --- a/src/float/dfloat/misc/cl_DF_sign.cc +++ b/src/float/dfloat/misc/cl_DF_sign.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. @@ -15,9 +15,13 @@ #define MAYBE_INLINE inline #include "cl_DF_minusp.cc" +namespace cln { + MAYBE_INLINE2 const cl_DF float_sign (const cl_DF& x) { // Methode: x>=0 -> Ergebnis 1.0; x<0 -> Ergebnis -1.0 return (!minusp(x) ? cl_DF_1 : cl_DF_minus1); } + +} // namespace cln diff --git a/src/float/dfloat/misc/cl_DF_signum.cc b/src/float/dfloat/misc/cl_DF_signum.cc index 5ab1b8a..3101a93 100644 --- a/src/float/dfloat/misc/cl_DF_signum.cc +++ b/src/float/dfloat/misc/cl_DF_signum.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_dfloat.h" +#include "cln/dfloat.h" // Implementation. @@ -16,6 +16,8 @@ #include "cl_DF_minusp.cc" #include "cl_DF_zerop.cc" +namespace cln { + MAYBE_INLINE2 const cl_DF signum (const cl_DF& x) { @@ -23,3 +25,5 @@ const cl_DF signum (const cl_DF& x) elif (zerop(x)) { return cl_DF_0; } // x=0 -> 0.0 else { return cl_DF_1; } // x>0 -> +1.0 } + +} // namespace cln diff --git a/src/float/division/cl_F_ceil1.cc b/src/float/division/cl_F_ceil1.cc index 55d98ab..b9f5dee 100644 --- a/src/float/division/cl_F_ceil1.cc +++ b/src/float/division/cl_F_ceil1.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" + +namespace cln { const cl_I ceiling1 (const cl_F& x) GEN_F_OP1(x, ceiling1, return) + +} // namespace cln diff --git a/src/float/division/cl_F_ceil2.cc b/src/float/division/cl_F_ceil2.cc index 638b04d..283c2af 100644 --- a/src/float/division/cl_F_ceil2.cc +++ b/src/float/division/cl_F_ceil2.cc @@ -4,21 +4,23 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_SF.h" #include "cl_FF.h" #include "cl_DF.h" #include "cl_LF.h" +namespace cln { + const cl_F_div_t ceiling2 (const cl_F& x) { floatcase(x @@ -28,3 +30,5 @@ const cl_F_div_t ceiling2 (const cl_F& x) , var cl_LF q = fceiling(x); return cl_F_div_t(cl_LF_to_I(q),LF_LF_minus_LF(x,q)); ); } + +} // namespace cln diff --git a/src/float/division/cl_F_ceil22.cc b/src/float/division/cl_F_ceil22.cc index abbb324..e0e5850 100644 --- a/src/float/division/cl_F_ceil22.cc +++ b/src/float/division/cl_F_ceil22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" +namespace cln { + const cl_F_div_t ceiling2 (const cl_F& x, const cl_F& y) { // Methode: @@ -20,3 +22,5 @@ const cl_F_div_t ceiling2 (const cl_F& x, const cl_F& y) var cl_F& r = q_r.remainder; return cl_F_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/division/cl_F_fceil1.cc b/src/float/division/cl_F_fceil1.cc index 0fa9fb1..a4a1bbd 100644 --- a/src/float/division/cl_F_fceil1.cc +++ b/src/float/division/cl_F_fceil1.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" + +namespace cln { const cl_F fceiling (const cl_F& x) GEN_F_OP1(x, fceiling, return) + +} // namespace cln diff --git a/src/float/division/cl_F_fceil2.cc b/src/float/division/cl_F_fceil2.cc index 00c0eeb..0d9ca9b 100644 --- a/src/float/division/cl_F_fceil2.cc +++ b/src/float/division/cl_F_fceil2.cc @@ -4,18 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + const cl_F_fdiv_t fceiling2 (const cl_F& x) { #if 0 // 3 type dispatches @@ -30,3 +32,5 @@ const cl_F_fdiv_t fceiling2 (const cl_F& x) ); #endif } + +} // namespace cln diff --git a/src/float/division/cl_F_ffloor1.cc b/src/float/division/cl_F_ffloor1.cc index 6a3ab4e..8b8da27 100644 --- a/src/float/division/cl_F_ffloor1.cc +++ b/src/float/division/cl_F_ffloor1.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" + +namespace cln { const cl_F ffloor (const cl_F& x) GEN_F_OP1(x, ffloor, return) + +} // namespace cln diff --git a/src/float/division/cl_F_ffloor2.cc b/src/float/division/cl_F_ffloor2.cc index 84b9b5f..a2a5174 100644 --- a/src/float/division/cl_F_ffloor2.cc +++ b/src/float/division/cl_F_ffloor2.cc @@ -4,18 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + const cl_F_fdiv_t ffloor2 (const cl_F& x) { #if 0 // 3 type dispatches @@ -30,3 +32,5 @@ const cl_F_fdiv_t ffloor2 (const cl_F& x) ); #endif } + +} // namespace cln diff --git a/src/float/division/cl_F_floor1.cc b/src/float/division/cl_F_floor1.cc index 1d86918..4c9a64c 100644 --- a/src/float/division/cl_F_floor1.cc +++ b/src/float/division/cl_F_floor1.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" + +namespace cln { const cl_I floor1 (const cl_F& x) GEN_F_OP1(x, floor1, return) + +} // namespace cln diff --git a/src/float/division/cl_F_floor2.cc b/src/float/division/cl_F_floor2.cc index 6b96906..1363ff9 100644 --- a/src/float/division/cl_F_floor2.cc +++ b/src/float/division/cl_F_floor2.cc @@ -4,21 +4,23 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_SF.h" #include "cl_FF.h" #include "cl_DF.h" #include "cl_LF.h" +namespace cln { + const cl_F_div_t floor2 (const cl_F& x) { floatcase(x @@ -28,3 +30,5 @@ const cl_F_div_t floor2 (const cl_F& x) , var cl_LF q = ffloor(x); return cl_F_div_t(cl_LF_to_I(q),LF_LF_minus_LF(x,q)); ); } + +} // namespace cln diff --git a/src/float/division/cl_F_floor22.cc b/src/float/division/cl_F_floor22.cc index c19980e..7d498ac 100644 --- a/src/float/division/cl_F_floor22.cc +++ b/src/float/division/cl_F_floor22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" +namespace cln { + const cl_F_div_t floor2 (const cl_F& x, const cl_F& y) { // Methode: @@ -20,3 +22,5 @@ const cl_F_div_t floor2 (const cl_F& x, const cl_F& y) var cl_F& r = q_r.remainder; return cl_F_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/division/cl_F_fround1.cc b/src/float/division/cl_F_fround1.cc index 83542a2..553c2a1 100644 --- a/src/float/division/cl_F_fround1.cc +++ b/src/float/division/cl_F_fround1.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" + +namespace cln { const cl_F fround (const cl_F& x) GEN_F_OP1(x, fround, return) + +} // namespace cln diff --git a/src/float/division/cl_F_fround2.cc b/src/float/division/cl_F_fround2.cc index 520f50a..0d57c3e 100644 --- a/src/float/division/cl_F_fround2.cc +++ b/src/float/division/cl_F_fround2.cc @@ -4,18 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + const cl_F_fdiv_t fround2 (const cl_F& x) { #if 0 // 3 type dispatches @@ -30,3 +32,5 @@ const cl_F_fdiv_t fround2 (const cl_F& x) ); #endif } + +} // namespace cln diff --git a/src/float/division/cl_F_ftrunc1.cc b/src/float/division/cl_F_ftrunc1.cc index ceb6666..7f1e232 100644 --- a/src/float/division/cl_F_ftrunc1.cc +++ b/src/float/division/cl_F_ftrunc1.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" + +namespace cln { const cl_F ftruncate (const cl_F& x) GEN_F_OP1(x, ftruncate, return) + +} // namespace cln diff --git a/src/float/division/cl_F_ftrunc2.cc b/src/float/division/cl_F_ftrunc2.cc index 7b3a1eb..553ac48 100644 --- a/src/float/division/cl_F_ftrunc2.cc +++ b/src/float/division/cl_F_ftrunc2.cc @@ -4,18 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + const cl_F_fdiv_t ftruncate2 (const cl_F& x) { #if 0 // 3 type dispatches @@ -30,3 +32,5 @@ const cl_F_fdiv_t ftruncate2 (const cl_F& x) ); #endif } + +} // namespace cln diff --git a/src/float/division/cl_F_round1.cc b/src/float/division/cl_F_round1.cc index c32dba1..5f5b478 100644 --- a/src/float/division/cl_F_round1.cc +++ b/src/float/division/cl_F_round1.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" + +namespace cln { const cl_I round1 (const cl_F& x) GEN_F_OP1(x, round1, return) + +} // namespace cln diff --git a/src/float/division/cl_F_round2.cc b/src/float/division/cl_F_round2.cc index 3a52851..2569f25 100644 --- a/src/float/division/cl_F_round2.cc +++ b/src/float/division/cl_F_round2.cc @@ -4,21 +4,23 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_SF.h" #include "cl_FF.h" #include "cl_DF.h" #include "cl_LF.h" +namespace cln { + const cl_F_div_t round2 (const cl_F& x) { floatcase(x @@ -28,3 +30,5 @@ const cl_F_div_t round2 (const cl_F& x) , var cl_LF q = fround(x); return cl_F_div_t(cl_LF_to_I(q),LF_LF_minus_LF(x,q)); ); } + +} // namespace cln diff --git a/src/float/division/cl_F_round22.cc b/src/float/division/cl_F_round22.cc index 5ed1887..3dd774e 100644 --- a/src/float/division/cl_F_round22.cc +++ b/src/float/division/cl_F_round22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" +namespace cln { + const cl_F_div_t round2 (const cl_F& x, const cl_F& y) { // Methode: @@ -20,3 +22,5 @@ const cl_F_div_t round2 (const cl_F& x, const cl_F& y) var cl_F& r = q_r.remainder; return cl_F_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/division/cl_F_trunc1.cc b/src/float/division/cl_F_trunc1.cc index a23bcab..986349a 100644 --- a/src/float/division/cl_F_trunc1.cc +++ b/src/float/division/cl_F_trunc1.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" + +namespace cln { const cl_I truncate1 (const cl_F& x) GEN_F_OP1(x, truncate1, return) + +} // namespace cln diff --git a/src/float/division/cl_F_trunc2.cc b/src/float/division/cl_F_trunc2.cc index e1dd711..9c4c3cd 100644 --- a/src/float/division/cl_F_trunc2.cc +++ b/src/float/division/cl_F_trunc2.cc @@ -4,21 +4,23 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_SF.h" #include "cl_FF.h" #include "cl_DF.h" #include "cl_LF.h" +namespace cln { + const cl_F_div_t truncate2 (const cl_F& x) { floatcase(x @@ -28,3 +30,5 @@ const cl_F_div_t truncate2 (const cl_F& x) , var cl_LF q = ftruncate(x); return cl_F_div_t(cl_LF_to_I(q),LF_LF_minus_LF(x,q)); ); } + +} // namespace cln diff --git a/src/float/division/cl_F_trunc22.cc b/src/float/division/cl_F_trunc22.cc index b5faa9f..221fd41 100644 --- a/src/float/division/cl_F_trunc22.cc +++ b/src/float/division/cl_F_trunc22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" +namespace cln { + const cl_F_div_t truncate2 (const cl_F& x, const cl_F& y) { // Methode: @@ -20,3 +22,5 @@ const cl_F_div_t truncate2 (const cl_F& x, const cl_F& y) var cl_F& r = q_r.remainder; return cl_F_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/elem/cl_F_I_div.cc b/src/float/elem/cl_F_I_div.cc index 30dfb90..126b79d 100644 --- a/src/float/elem/cl_F_I_div.cc +++ b/src/float/elem/cl_F_I_div.cc @@ -4,22 +4,24 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_RA.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_F.h" #include "cl_SF.h" #include "cl_FF.h" #include "cl_DF.h" #include "cl_LF.h" +namespace cln { + const cl_F operator/ (const cl_F& x, const cl_I& y) { floatcase(x @@ -29,3 +31,5 @@ const cl_F operator/ (const cl_F& x, const cl_I& y) , /* LF */ return cl_LF_I_div(x,y); ); } + +} // namespace cln diff --git a/src/float/elem/cl_F_I_mul.cc b/src/float/elem/cl_F_I_mul.cc index 92f8e48..dbd9cba 100644 --- a/src/float/elem/cl_F_I_mul.cc +++ b/src/float/elem/cl_F_I_mul.cc @@ -4,22 +4,24 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_I.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_F.h" #include "cl_SF.h" #include "cl_FF.h" #include "cl_DF.h" #include "cl_LF.h" +namespace cln { + const cl_R cl_F_I_mul (const cl_F& x, const cl_I& y) { if (eq(y,0)) { return 0; } // x * 0 = exakte 0 @@ -30,3 +32,5 @@ const cl_R cl_F_I_mul (const cl_F& x, const cl_I& y) , /* LF */ return cl_LF_I_mul(x,y); ); } + +} // namespace cln diff --git a/src/float/elem/cl_F_RA_div.cc b/src/float/elem/cl_F_RA_div.cc index 8ffa4e9..aa881ca 100644 --- a/src/float/elem/cl_F_RA_div.cc +++ b/src/float/elem/cl_F_RA_div.cc @@ -4,22 +4,24 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_RA.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_F.h" #include "cl_SF.h" #include "cl_FF.h" #include "cl_DF.h" #include "cl_LF.h" +namespace cln { + const cl_F operator/ (const cl_F& x, const cl_RA& y) { floatcase(x @@ -45,3 +47,5 @@ const cl_F operator/ (const cl_F& x, const cl_RA& y) return cl_LF_RA_div(x,y); ); } + +} // namespace cln diff --git a/src/float/elem/cl_F_RA_mul.cc b/src/float/elem/cl_F_RA_mul.cc index 5f2905d..9eeb6be 100644 --- a/src/float/elem/cl_F_RA_mul.cc +++ b/src/float/elem/cl_F_RA_mul.cc @@ -4,22 +4,24 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_RA.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_F.h" #include "cl_SF.h" #include "cl_FF.h" #include "cl_DF.h" #include "cl_LF.h" +namespace cln { + const cl_R cl_F_RA_mul (const cl_F& x, const cl_RA& y) { if (eq(y,0)) { return 0; } // x * 0 = exakte 0 @@ -30,3 +32,5 @@ const cl_R cl_F_RA_mul (const cl_F& x, const cl_RA& y) , /* LF */ return cl_LF_RA_mul(x,y); ); } + +} // namespace cln diff --git a/src/float/elem/cl_F_compare.cc b/src/float/elem/cl_F_compare.cc index 9304856..ff23cc8 100644 --- a/src/float/elem/cl_F_compare.cc +++ b/src/float/elem/cl_F_compare.cc @@ -1,20 +1,24 @@ -// cl_compare(). +// compare(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" -cl_signean cl_compare (const cl_F& x, const cl_F& y) -GEN_F_OP2(x,y, cl_compare, 0, 1, return) +namespace cln { + +cl_signean compare (const cl_F& x, const cl_F& y) +GEN_F_OP2(x,y, compare, 0, 1, return) + +} // namespace cln diff --git a/src/float/elem/cl_F_div.cc b/src/float/elem/cl_F_div.cc index 74d0313..9364774 100644 --- a/src/float/elem/cl_F_div.cc +++ b/src/float/elem/cl_F_div.cc @@ -4,20 +4,24 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + ALL_cl_LF_OPERATIONS_SAME_PRECISION() const cl_F operator/ (const cl_F& x, const cl_F& y) #define div(a,b) a/b GEN_F_OP2(x,y, div, 1, 1, return) + +} // namespace cln diff --git a/src/float/elem/cl_F_minus.cc b/src/float/elem/cl_F_minus.cc index f149806..c9882bc 100644 --- a/src/float/elem/cl_F_minus.cc +++ b/src/float/elem/cl_F_minus.cc @@ -4,20 +4,24 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + ALL_cl_LF_OPERATIONS_SAME_PRECISION() const cl_F operator- (const cl_F& x, const cl_F& y) #define minus(a,b) a-b GEN_F_OP2(x,y, minus, 1, 0, return) + +} // namespace cln diff --git a/src/float/elem/cl_F_minusp.cc b/src/float/elem/cl_F_minusp.cc index fd429f3..e2bba66 100644 --- a/src/float/elem/cl_F_minusp.cc +++ b/src/float/elem/cl_F_minusp.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -18,6 +18,8 @@ #include "cl_DF_minusp.cc" #include "cl_LF_minusp.cc" +namespace cln { + cl_boolean minusp (const cl_F& x) { floatcase(x @@ -27,3 +29,5 @@ cl_boolean minusp (const cl_F& x) , return minusp(x); ); } + +} // namespace cln diff --git a/src/float/elem/cl_F_mul.cc b/src/float/elem/cl_F_mul.cc index c3bbfd7..bd578cb 100644 --- a/src/float/elem/cl_F_mul.cc +++ b/src/float/elem/cl_F_mul.cc @@ -4,20 +4,24 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + ALL_cl_LF_OPERATIONS_SAME_PRECISION() const cl_F operator* (const cl_F& x, const cl_F& y) #define mul(a,b) a*b GEN_F_OP2(x,y, mul, 1, 1, return) + +} // namespace cln diff --git a/src/float/elem/cl_F_plus.cc b/src/float/elem/cl_F_plus.cc index 149b344..37923ec 100644 --- a/src/float/elem/cl_F_plus.cc +++ b/src/float/elem/cl_F_plus.cc @@ -4,20 +4,24 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + ALL_cl_LF_OPERATIONS_SAME_PRECISION() const cl_F operator+ (const cl_F& x, const cl_F& y) #define plus(a,b) a+b GEN_F_OP2(x,y, plus, 1, 0, return) + +} // namespace cln diff --git a/src/float/elem/cl_F_plusp.cc b/src/float/elem/cl_F_plusp.cc index e091a0b..229164f 100644 --- a/src/float/elem/cl_F_plusp.cc +++ b/src/float/elem/cl_F_plusp.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -18,6 +18,8 @@ #include "cl_DF_plusp.cc" #include "cl_LF_plusp.cc" +namespace cln { + cl_boolean plusp (const cl_F& x) { floatcase(x @@ -27,3 +29,5 @@ cl_boolean plusp (const cl_F& x) , return plusp(x); ); } + +} // namespace cln diff --git a/src/float/elem/cl_F_recip.cc b/src/float/elem/cl_F_recip.cc index 7469cbb..54363a5 100644 --- a/src/float/elem/cl_F_recip.cc +++ b/src/float/elem/cl_F_recip.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" + +namespace cln { const cl_F recip (const cl_F& x) GEN_F_OP1(x, recip, return) + +} // namespace cln diff --git a/src/float/elem/cl_F_scale.cc b/src/float/elem/cl_F_scale.cc index f1d1126..ae3ff38 100644 --- a/src/float/elem/cl_F_scale.cc +++ b/src/float/elem/cl_F_scale.cc @@ -4,17 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_F.h" +namespace cln { + const cl_F scale_float (const cl_F& x, sintL delta) { floatcase(x @@ -24,3 +26,5 @@ const cl_F scale_float (const cl_F& x, sintL delta) , return scale_float(x,delta); ); } + +} // namespace cln diff --git a/src/float/elem/cl_F_scale_I.cc b/src/float/elem/cl_F_scale_I.cc index 4fac10c..d72184f 100644 --- a/src/float/elem/cl_F_scale_I.cc +++ b/src/float/elem/cl_F_scale_I.cc @@ -4,17 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_F.h" +namespace cln { + const cl_F scale_float (const cl_F& x, const cl_I& delta) { floatcase(x @@ -24,3 +26,5 @@ const cl_F scale_float (const cl_F& x, const cl_I& delta) , return scale_float(x,delta); ); } + +} // namespace cln diff --git a/src/float/elem/cl_F_square.cc b/src/float/elem/cl_F_square.cc index cece02f..b230a7b 100644 --- a/src/float/elem/cl_F_square.cc +++ b/src/float/elem/cl_F_square.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" + +namespace cln { const cl_F square (const cl_F& x) GEN_F_OP1(x, square, return) + +} // namespace cln diff --git a/src/float/elem/cl_F_uminus.cc b/src/float/elem/cl_F_uminus.cc index 60c2bc9..225e0ff 100644 --- a/src/float/elem/cl_F_uminus.cc +++ b/src/float/elem/cl_F_uminus.cc @@ -4,17 +4,21 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" + +namespace cln { const cl_F operator- (const cl_F& x) #define minus(a) -a GEN_F_OP1(x, minus, return) + +} // namespace cln diff --git a/src/float/elem/cl_F_zerop.cc b/src/float/elem/cl_F_zerop.cc index 6eba0b0..3126d46 100644 --- a/src/float/elem/cl_F_zerop.cc +++ b/src/float/elem/cl_F_zerop.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -18,6 +18,8 @@ #include "cl_DF_zerop.cc" #include "cl_LF_zerop.cc" +namespace cln { + cl_boolean zerop (const cl_F& x) { floatcase(x @@ -27,3 +29,5 @@ cl_boolean zerop (const cl_F& x) , return zerop(x); ); } + +} // namespace cln diff --git a/src/float/elem/cl_I_F_div.cc b/src/float/elem/cl_I_F_div.cc index 34a49c3..f1bc594 100644 --- a/src/float/elem/cl_I_F_div.cc +++ b/src/float/elem/cl_I_F_div.cc @@ -4,22 +4,24 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_RA.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_F.h" #include "cl_SF.h" #include "cl_FF.h" #include "cl_DF.h" #include "cl_LF.h" +namespace cln { + const cl_R operator/ (const cl_I& x, const cl_F& y) { if (eq(x,0)) { return 0; } @@ -30,3 +32,5 @@ const cl_R operator/ (const cl_I& x, const cl_F& y) , /* LF */ return cl_I_to_LF(x,LFlen0(y)) / y; // cf. cl_I_LF_div ); } + +} // namespace cln diff --git a/src/float/elem/cl_RA_F_div.cc b/src/float/elem/cl_RA_F_div.cc index e34d2cf..48d7888 100644 --- a/src/float/elem/cl_RA_F_div.cc +++ b/src/float/elem/cl_RA_F_div.cc @@ -4,22 +4,24 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_RA.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_F.h" #include "cl_SF.h" #include "cl_FF.h" #include "cl_DF.h" #include "cl_LF.h" +namespace cln { + const cl_R operator/ (const cl_RA& x, const cl_F& y) { if (eq(x,0)) { return 0; } @@ -46,3 +48,5 @@ const cl_R operator/ (const cl_RA& x, const cl_F& y) return cl_RA_LF_div(x,y); ); } + +} // namespace cln diff --git a/src/float/ffloat/algebraic/cl_FF_sqrt.cc b/src/float/ffloat/algebraic/cl_FF_sqrt.cc index f6a9665..611f946 100644 --- a/src/float/ffloat/algebraic/cl_FF_sqrt.cc +++ b/src/float/ffloat/algebraic/cl_FF_sqrt.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_F.h" #include "cl_low.h" +namespace cln { + const cl_FF sqrt (const cl_FF& x) { // Methode: @@ -63,3 +65,5 @@ const cl_FF sqrt (const cl_FF& x) } return encode_FF(0,exp,mant); } + +} // namespace cln diff --git a/src/float/ffloat/cl_FF.h b/src/float/ffloat/cl_FF.h index 50463c4..a7c5f3b 100644 --- a/src/float/ffloat/cl_FF.h +++ b/src/float/ffloat/cl_FF.h @@ -3,11 +3,18 @@ #ifndef _CL_FF_H #define _CL_FF_H -#include "cl_number.h" -#include "cl_malloc.h" +#include "cln/number.h" +#include "cln/malloc.h" #include "cl_low.h" #include "cl_F.h" +#ifdef FAST_FLOAT +#include "cl_N.h" +#include "cl_F.h" +#endif + +namespace cln { + typedef uint32 ffloat; // 32-bit float in IEEE format union ffloatjanus { @@ -67,7 +74,7 @@ inline const cl_FF allocate_ffloat (ffloat eksplicit) #else inline cl_heap_ffloat* allocate_ffloat (ffloat eksplicit) { - cl_heap_ffloat* p = (cl_heap_ffloat*) cl_malloc_hook(sizeof(cl_heap_ffloat)); + cl_heap_ffloat* p = (cl_heap_ffloat*) malloc_hook(sizeof(cl_heap_ffloat)); p->refcount = 1; p->type = &cl_class_ffloat; p->representation.eksplicit = eksplicit; @@ -176,8 +183,6 @@ inline float FF_to_float (const cl_FF& obj) // maybe_underflow: Ergebnis sehr klein und /=0, liefert IEEE-Null // maybe_divide_0: Ergebnis unbestimmt, liefert IEEE-Infinity // maybe_nan: Ergebnis unbestimmt, liefert IEEE-NaN - #include "cl_N.h" - #include "cl_F.h" #define float_to_FF(expr,ergebnis_zuweisung,maybe_overflow,maybe_subnormal,maybe_underflow,maybe_divide_0,maybe_nan) \ { var ffloatjanus _erg; _erg.machine_float = (expr); \ if ((_erg.eksplicit & ((uint32)bit(FF_exp_len+FF_mant_len)-bit(FF_mant_len))) == 0) /* e=0 ? */\ @@ -241,4 +246,6 @@ inline const cl_FF cl_float_to_FF (const ffloatjanus& val) // wandelt ein Single-Float obj in ein IEEE-Single-Float val um. extern void cl_FF_to_float (const cl_FF& obj, ffloatjanus* val_); +} // namespace cln + #endif /* _CL_FF_H */ diff --git a/src/float/ffloat/conv/cl_FF_from_float.cc b/src/float/ffloat/conv/cl_FF_from_float.cc index 54d7166..64eda10 100644 --- a/src/float/ffloat/conv/cl_FF_from_float.cc +++ b/src/float/ffloat/conv/cl_FF_from_float.cc @@ -6,6 +6,7 @@ // Specification. #include "cl_FF.h" +namespace cln { // Implementation. @@ -38,3 +39,5 @@ cl_private_thing cl_float_to_FF_pointer (const ffloatjanus& val_) #endif } } + +} // namespace cln diff --git a/src/float/ffloat/conv/cl_FF_to_floatj.cc b/src/float/ffloat/conv/cl_FF_to_floatj.cc index 52caf0b..a1898fd 100644 --- a/src/float/ffloat/conv/cl_FF_to_floatj.cc +++ b/src/float/ffloat/conv/cl_FF_to_floatj.cc @@ -6,6 +6,7 @@ // Specification. #include "cl_FF.h" +namespace cln { // Implementation. @@ -28,3 +29,5 @@ void cl_FF_to_float (const cl_FF& obj, ffloatjanus* val_) } val_->eksplicit = val; } + +} // namespace cln diff --git a/src/float/ffloat/conv/cl_I_to_float.cc b/src/float/ffloat/conv/cl_I_to_float.cc index bfe8bb0..53d80ec 100644 --- a/src/float/ffloat/conv/cl_I_to_float.cc +++ b/src/float/ffloat/conv/cl_I_to_float.cc @@ -1,10 +1,10 @@ -// cl_float_approx(). +// float_approx(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -14,7 +14,9 @@ #include "cl_DS.h" #include "cl_F.h" -float cl_float_approx (const cl_I& x) +namespace cln { + +float float_approx (const cl_I& x) { // Method: same as cl_I_to_FF(). if (eq(x,0)) { return 0.0; } @@ -106,3 +108,5 @@ float cl_float_approx (const cl_I& x) { u.eksplicit = make_FF_word(sign,(sintL)exp+FF_exp_mid,mant); } return u.machine_float; } + +} // namespace cln diff --git a/src/float/ffloat/conv/cl_RA_to_float.cc b/src/float/ffloat/conv/cl_RA_to_float.cc index 877f824..a7716dd 100644 --- a/src/float/ffloat/conv/cl_RA_to_float.cc +++ b/src/float/ffloat/conv/cl_RA_to_float.cc @@ -1,26 +1,28 @@ -// cl_float_approx(). +// float_approx(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_FF.h" #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_F.h" -float cl_float_approx (const cl_RA& x) +namespace cln { + +float float_approx (const cl_RA& x) { // Method: same as cl_RA_to_FF(). if (integerp(x)) { DeclareType(cl_I,x); - return cl_float_approx(x); + return float_approx(x); } { // x Ratio DeclareType(cl_RT,x); @@ -102,3 +104,5 @@ float cl_float_approx (const cl_RA& x) { u.eksplicit = make_FF_word(sign,lendiff+FF_exp_mid,mant); } return u.machine_float; }} + +} // namespace cln diff --git a/src/float/ffloat/division/cl_FF_ceil22.cc b/src/float/ffloat/division/cl_FF_ceil22.cc index 90d7b06..a4c2742 100644 --- a/src/float/ffloat/division/cl_FF_ceil22.cc +++ b/src/float/ffloat/division/cl_FF_ceil22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. #include "cl_FF.h" +namespace cln { + const cl_FF_div_t ceiling2 (const cl_FF& x, const cl_FF& y) { // Methode: @@ -20,3 +22,5 @@ const cl_FF_div_t ceiling2 (const cl_FF& x, const cl_FF& y) var cl_FF& r = q_r.remainder; return cl_FF_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/ffloat/division/cl_FF_fceil.cc b/src/float/ffloat/division/cl_FF_fceil.cc index 423dc21..c6a6667 100644 --- a/src/float/ffloat/division/cl_FF_fceil.cc +++ b/src/float/ffloat/division/cl_FF_fceil.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. @@ -15,6 +15,8 @@ #define MAYBE_INLINE inline #include "cl_FF_minusp.cc" +namespace cln { + const cl_FF fceiling (const cl_FF& x) { if (minusp(x)) @@ -22,3 +24,5 @@ const cl_FF fceiling (const cl_FF& x) else return futruncate(x); } + +} // namespace cln diff --git a/src/float/ffloat/division/cl_FF_floor22.cc b/src/float/ffloat/division/cl_FF_floor22.cc index 8a37040..9c165ef 100644 --- a/src/float/ffloat/division/cl_FF_floor22.cc +++ b/src/float/ffloat/division/cl_FF_floor22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. #include "cl_FF.h" +namespace cln { + const cl_FF_div_t floor2 (const cl_FF& x, const cl_FF& y) { // Methode: @@ -20,3 +22,5 @@ const cl_FF_div_t floor2 (const cl_FF& x, const cl_FF& y) var cl_FF& r = q_r.remainder; return cl_FF_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/ffloat/division/cl_FF_recip.cc b/src/float/ffloat/division/cl_FF_recip.cc index d94aceb..66c7aef 100644 --- a/src/float/ffloat/division/cl_FF_recip.cc +++ b/src/float/ffloat/division/cl_FF_recip.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. #include "cl_FF.h" +namespace cln { + const cl_FF recip (const cl_FF& x) { return cl_FF_1 / x; } + +} // namespace cln diff --git a/src/float/ffloat/division/cl_FF_round22.cc b/src/float/ffloat/division/cl_FF_round22.cc index 9973910..20973ff 100644 --- a/src/float/ffloat/division/cl_FF_round22.cc +++ b/src/float/ffloat/division/cl_FF_round22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. #include "cl_FF.h" +namespace cln { + const cl_FF_div_t round2 (const cl_FF& x, const cl_FF& y) { // Methode: @@ -20,3 +22,5 @@ const cl_FF_div_t round2 (const cl_FF& x, const cl_FF& y) var cl_FF& r = q_r.remainder; return cl_FF_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/ffloat/division/cl_FF_trunc22.cc b/src/float/ffloat/division/cl_FF_trunc22.cc index 7f05de9..b959983 100644 --- a/src/float/ffloat/division/cl_FF_trunc22.cc +++ b/src/float/ffloat/division/cl_FF_trunc22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. #include "cl_FF.h" +namespace cln { + const cl_FF_div_t truncate2 (const cl_FF& x, const cl_FF& y) { // Methode: @@ -20,3 +22,5 @@ const cl_FF_div_t truncate2 (const cl_FF& x, const cl_FF& y) var cl_FF& r = q_r.remainder; return cl_FF_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_compare.cc b/src/float/ffloat/elem/cl_FF_compare.cc index 0e6fce8..6633c49 100644 --- a/src/float/ffloat/elem/cl_FF_compare.cc +++ b/src/float/ffloat/elem/cl_FF_compare.cc @@ -1,17 +1,19 @@ -// cl_compare(). +// compare(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. #include "cl_FF.h" -cl_signean cl_compare (const cl_FF& x, const cl_FF& y) +namespace cln { + +cl_signean compare (const cl_FF& x, const cl_FF& y) { // Methode: // x und y haben verschiedenes Vorzeichen -> @@ -46,3 +48,5 @@ cl_signean cl_compare (const cl_FF& x, const cl_FF& y) } } } + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_div.cc b/src/float/ffloat/elem/cl_FF_div.cc index 89dc717..b3492b4 100644 --- a/src/float/ffloat/elem/cl_FF_div.cc +++ b/src/float/ffloat/elem/cl_FF_div.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. @@ -14,12 +14,15 @@ #include "cl_F.h" #include "cl_low.h" #include "cl_ieee.h" -NEED_IEEE_FLOATS() #undef MAYBE_INLINE #define MAYBE_INLINE inline #include "cl_FF_zerop.cc" +namespace cln { + +NEED_IEEE_FLOATS() + const cl_FF operator/ (const cl_FF& x1, const cl_FF& x2) { // Methode: @@ -101,3 +104,5 @@ const cl_FF operator/ (const cl_FF& x1, const cl_FF& x2) return encode_FF(sign1,exp1,mant); #endif } + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_ffloor.cc b/src/float/ffloat/elem/cl_FF_ffloor.cc index 7f9bbd7..a6ac0ba 100644 --- a/src/float/ffloat/elem/cl_FF_ffloor.cc +++ b/src/float/ffloat/elem/cl_FF_ffloor.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. @@ -15,6 +15,8 @@ #define MAYBE_INLINE inline #include "cl_FF_minusp.cc" +namespace cln { + const cl_FF ffloor (const cl_FF& x) { if (minusp(x)) @@ -22,3 +24,5 @@ const cl_FF ffloor (const cl_FF& x) else return ftruncate(x); } + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_from_I.cc b/src/float/ffloat/elem/cl_FF_from_I.cc index 913cdd6..a459c46 100644 --- a/src/float/ffloat/elem/cl_FF_from_I.cc +++ b/src/float/ffloat/elem/cl_FF_from_I.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_DS.h" #include "cl_F.h" +namespace cln { + const cl_FF cl_I_to_FF (const cl_I& x) { // Methode: @@ -113,3 +115,5 @@ const cl_FF cl_I_to_FF (const cl_I& x) #endif return encode_FF(sign,(sintL)exp,mant); } + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_from_RA.cc b/src/float/ffloat/elem/cl_FF_from_RA.cc index 548d588..5444549 100644 --- a/src/float/ffloat/elem/cl_FF_from_RA.cc +++ b/src/float/ffloat/elem/cl_FF_from_RA.cc @@ -10,10 +10,12 @@ // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_F.h" +namespace cln { + const cl_FF cl_RA_to_FF (const cl_RA& x) { // Methode: @@ -106,3 +108,5 @@ const cl_FF cl_RA_to_FF (const cl_RA& x) // Fertig. return encode_FF(sign,lendiff,mant); }} + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_fround.cc b/src/float/ffloat/elem/cl_FF_fround.cc index 3af0574..d4dc255 100644 --- a/src/float/ffloat/elem/cl_FF_fround.cc +++ b/src/float/ffloat/elem/cl_FF_fround.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. #include "cl_FF.h" +namespace cln { + const cl_FF fround (const cl_FF& x) { // Methode: @@ -76,3 +78,5 @@ const cl_FF fround (const cl_FF& x) } } } } + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_ftrunc.cc b/src/float/ffloat/elem/cl_FF_ftrunc.cc index 85056ac..a3171b8 100644 --- a/src/float/ffloat/elem/cl_FF_ftrunc.cc +++ b/src/float/ffloat/elem/cl_FF_ftrunc.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. #include "cl_FF.h" +namespace cln { + const cl_FF ftruncate (const cl_FF& x) { // Methode: @@ -32,3 +34,5 @@ const cl_FF ftruncate (const cl_FF& x) ); } } } + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_futrunc.cc b/src/float/ffloat/elem/cl_FF_futrunc.cc index f14f09d..a8538ea 100644 --- a/src/float/ffloat/elem/cl_FF_futrunc.cc +++ b/src/float/ffloat/elem/cl_FF_futrunc.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + const cl_FF futruncate (const cl_FF& x) { // Methode: @@ -43,3 +45,5 @@ const cl_FF futruncate (const cl_FF& x) ); } } } + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_globals.cc b/src/float/ffloat/elem/cl_FF_globals.cc index 7fb6e2c..68c7eeb 100644 --- a/src/float/ffloat/elem/cl_FF_globals.cc +++ b/src/float/ffloat/elem/cl_FF_globals.cc @@ -11,6 +11,8 @@ CL_PROVIDE(cl_FF_globals) // Implementation. +namespace cln { + #if !defined(CL_WIDE_POINTERS) const cl_FF cl_FF_0 = allocate_ffloat(0); // 0.0f0 @@ -21,4 +23,6 @@ const cl_FF cl_FF_minus1 = encode_FF(-1,1,bit(FF_mant_len)); // -1.0f0 #endif +} // namespace cln + CL_PROVIDE_END(cl_FF_globals) diff --git a/src/float/ffloat/elem/cl_FF_minus.cc b/src/float/ffloat/elem/cl_FF_minus.cc index f2a8996..73df3a8 100644 --- a/src/float/ffloat/elem/cl_FF_minus.cc +++ b/src/float/ffloat/elem/cl_FF_minus.cc @@ -4,13 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. #include "cl_FF.h" #include "cl_ieee.h" + +namespace cln { + NEED_IEEE_FLOATS() const cl_FF operator- (const cl_FF& x1, const cl_FF& x2) @@ -30,3 +33,5 @@ const cl_FF operator- (const cl_FF& x1, const cl_FF& x2) { return x1 + allocate_ffloat(x2_ ^ bit(31)); } #endif } + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_minusp.cc b/src/float/ffloat/elem/cl_FF_minusp.cc index b979890..666b97f 100644 --- a/src/float/ffloat/elem/cl_FF_minusp.cc +++ b/src/float/ffloat/elem/cl_FF_minusp.cc @@ -4,15 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. #include "cl_FF.h" +namespace cln { + MAYBE_INLINE cl_boolean minusp (const cl_FF& x) { return (cl_boolean) ((sint32)cl_ffloat_value(x) < 0); } + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_mul.cc b/src/float/ffloat/elem/cl_FF_mul.cc index 67fdf7d..08cafac 100644 --- a/src/float/ffloat/elem/cl_FF_mul.cc +++ b/src/float/ffloat/elem/cl_FF_mul.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. @@ -13,12 +13,15 @@ #include "cl_F.h" #include "cl_low.h" #include "cl_ieee.h" -NEED_IEEE_FLOATS() #undef MAYBE_INLINE #define MAYBE_INLINE inline #include "cl_FF_zerop.cc" +namespace cln { + +NEED_IEEE_FLOATS() + const cl_FF operator* (const cl_FF& x1, const cl_FF& x2) { // Methode: @@ -99,3 +102,5 @@ const cl_FF operator* (const cl_FF& x1, const cl_FF& x2) return encode_FF(sign1,exp1,manthi); #endif } + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_plus.cc b/src/float/ffloat/elem/cl_FF_plus.cc index 061739b..b42e80d 100644 --- a/src/float/ffloat/elem/cl_FF_plus.cc +++ b/src/float/ffloat/elem/cl_FF_plus.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. @@ -12,9 +12,12 @@ #include "cl_FF.h" #include "cl_F.h" #include "cl_ieee.h" -NEED_IEEE_FLOATS() #include "cl_xmacros.h" +namespace cln { + +NEED_IEEE_FLOATS() + const cl_FF operator+ (const cl_FF& x1, const cl_FF& x2) { // Methode (nach [Knuth, II, Seminumerical Algorithms, Abschnitt 4.2.1., S.200]): @@ -134,3 +137,5 @@ const cl_FF operator+ (const cl_FF& x1, const cl_FF& x2) return encode_FF(sign1,exp1,mant1); #endif } + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_plusp.cc b/src/float/ffloat/elem/cl_FF_plusp.cc index e53e631..93aa87b 100644 --- a/src/float/ffloat/elem/cl_FF_plusp.cc +++ b/src/float/ffloat/elem/cl_FF_plusp.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. @@ -16,6 +16,8 @@ #include "cl_FF_minusp.cc" #include "cl_FF_zerop.cc" +namespace cln { + MAYBE_INLINE2 cl_boolean plusp (const cl_FF& x) { @@ -26,3 +28,5 @@ cl_boolean plusp (const cl_FF& x) else return cl_true; // sonst ist x>0. } + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_scale.cc b/src/float/ffloat/elem/cl_FF_scale.cc index 0dae6ae..b6dc24d 100644 --- a/src/float/ffloat/elem/cl_FF_scale.cc +++ b/src/float/ffloat/elem/cl_FF_scale.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_FF.h" #include "cl_F.h" +namespace cln { + const cl_FF scale_float (const cl_FF& x, sintL delta) { // Methode: @@ -47,3 +49,5 @@ const cl_FF scale_float (const cl_FF& x, sintL delta) { return cl_FF_0; } } } + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_scale_I.cc b/src/float/ffloat/elem/cl_FF_scale_I.cc index f83749d..9d68cdc 100644 --- a/src/float/ffloat/elem/cl_FF_scale_I.cc +++ b/src/float/ffloat/elem/cl_FF_scale_I.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_F.h" #include "cl_I.h" +namespace cln { + const cl_FF scale_float (const cl_FF& x, const cl_I& delta) { // Methode: @@ -53,3 +55,5 @@ const cl_FF scale_float (const cl_FF& x, const cl_I& delta) { return cl_FF_0; } } } + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_to_I.cc b/src/float/ffloat/elem/cl_FF_to_I.cc index 35a14a6..dccf633 100644 --- a/src/float/ffloat/elem/cl_FF_to_I.cc +++ b/src/float/ffloat/elem/cl_FF_to_I.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" +namespace cln { + const cl_I cl_FF_to_I (const cl_FF& x) { // Methode: @@ -33,3 +35,5 @@ const cl_I cl_FF_to_I (const cl_FF& x) ,exp ); } + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_uminus.cc b/src/float/ffloat/elem/cl_FF_uminus.cc index 2d59df0..a125239 100644 --- a/src/float/ffloat/elem/cl_FF_uminus.cc +++ b/src/float/ffloat/elem/cl_FF_uminus.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. #include "cl_FF.h" +namespace cln { + const cl_FF operator- (const cl_FF& x) { // Methode: @@ -21,3 +23,5 @@ const cl_FF operator- (const cl_FF& x) else return allocate_ffloat( x_ ^ bit(31) ); } + +} // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_zerop.cc b/src/float/ffloat/elem/cl_FF_zerop.cc index 69d8574..bec6869 100644 --- a/src/float/ffloat/elem/cl_FF_zerop.cc +++ b/src/float/ffloat/elem/cl_FF_zerop.cc @@ -4,15 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. #include "cl_FF.h" +namespace cln { + MAYBE_INLINE cl_boolean zerop (const cl_FF& x) { return (cl_boolean) (cl_ffloat_value(x) == 0); } + +} // namespace cln diff --git a/src/float/ffloat/input/cl_FF_from_string.cc b/src/float/ffloat/input/cl_FF_from_string.cc index 9736b62..e842af8 100644 --- a/src/float/ffloat/input/cl_FF_from_string.cc +++ b/src/float/ffloat/input/cl_FF_from_string.cc @@ -4,20 +4,22 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat_class.h" +#include "cln/ffloat_class.h" // Implementation. -#include "cl_ffloat.h" -#include "cl_input.h" -#include "cl_float_io.h" +#include "cln/ffloat.h" +#include "cln/input.h" +#include "cln/float_io.h" + +namespace cln { cl_read_flags cl_FF_read_flags = { syntax_ffloat, lsyntax_all, 10, - { cl_float_format_ffloat, cl_float_format_lfloat_min, cl_false } + { float_format_ffloat, float_format_lfloat_min, cl_false } }; cl_FF::cl_FF (const char * string) @@ -25,3 +27,5 @@ cl_FF::cl_FF (const char * string) pointer = as_cl_private_thing( As(cl_FF)(read_float(cl_FF_read_flags,string,NULL,NULL))); } + +} // namespace cln diff --git a/src/float/ffloat/misc/cl_FF_abs.cc b/src/float/ffloat/misc/cl_FF_abs.cc index 1b65e0a..cb774c0 100644 --- a/src/float/ffloat/misc/cl_FF_abs.cc +++ b/src/float/ffloat/misc/cl_FF_abs.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. @@ -13,8 +13,12 @@ #define MAYBE_INLINE inline #include "cl_FF_minusp.cc" +namespace cln { + const cl_FF abs (const cl_FF& x) { // x<0 -> (- x), x>=0 -> x if (minusp(x)) return -x; else return x; } + +} // namespace cln diff --git a/src/float/ffloat/misc/cl_FF_as.cc b/src/float/ffloat/misc/cl_FF_as.cc index 8581d82..5ac42dd 100644 --- a/src/float/ffloat/misc/cl_FF_as.cc +++ b/src/float/ffloat/misc/cl_FF_as.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. #include "cl_N.h" +namespace cln { + inline cl_boolean cl_FF_p (const cl_number& x) { #if defined(CL_WIDE_POINTERS) @@ -33,3 +35,5 @@ const cl_FF& as_cl_FF (const cl_number& x, const char * filename, int line) } else cl_as_error(x,"a single-float number",filename,line); } + +} // namespace cln diff --git a/src/float/ffloat/misc/cl_FF_class.cc b/src/float/ffloat/misc/cl_FF_class.cc index 11cf4a0..b300fb8 100644 --- a/src/float/ffloat/misc/cl_FF_class.cc +++ b/src/float/ffloat/misc/cl_FF_class.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. +namespace cln { + cl_class cl_class_ffloat = { #ifdef CL_WIDE_POINTERS NULL, // destructor not used, since not heap objects @@ -24,3 +26,5 @@ AT_INITIALIZATION(ini_class_ffloat) cl_immediate_classes[cl_FF_tag] = &cl_class_ffloat; } #endif + +} // namespace cln diff --git a/src/float/ffloat/misc/cl_FF_debug.cc b/src/float/ffloat/misc/cl_FF_debug.cc index 60998ac..67122b8 100644 --- a/src/float/ffloat/misc/cl_FF_debug.cc +++ b/src/float/ffloat/misc/cl_FF_debug.cc @@ -8,9 +8,11 @@ // Implementation. -#include "cl_ffloat.h" -#include "cl_io.h" -#include "cl_float_io.h" +#include "cln/ffloat.h" +#include "cln/io.h" +#include "cln/float_io.h" + +namespace cln { static void dprint (cl_heap* pointer) { @@ -21,5 +23,7 @@ static void dprint (cl_heap* pointer) AT_INITIALIZATION(dprint_FF) { cl_register_type_printer(cl_class_ffloat,dprint); } -// This dummy links in this module when requires it. +// This dummy links in this module when requires it. int cl_FF_debug_module; + +} // namespace cln diff --git a/src/float/ffloat/misc/cl_FF_decode.cc b/src/float/ffloat/misc/cl_FF_decode.cc index 31c1ccf..ac23b1a 100644 --- a/src/float/ffloat/misc/cl_FF_decode.cc +++ b/src/float/ffloat/misc/cl_FF_decode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. @@ -12,18 +12,22 @@ #include "cl_FF.h" #include "cl_I.h" -const cl_decoded_ffloat decode_float (const cl_FF& x) +namespace cln { + +const decoded_ffloat decode_float (const cl_FF& x) { // x entpacken: var cl_signean sign; var sintL exp; var uint32 mant; - FF_decode(x, { return cl_decoded_ffloat(cl_FF_0, 0, cl_FF_1); }, + FF_decode(x, { return decoded_ffloat(cl_FF_0, 0, cl_FF_1); }, sign=,exp=,mant= ); - return cl_decoded_ffloat( + return decoded_ffloat( encode_FF(0,0,mant), // (-1)^0 * 2^0 * m erzeugen L_to_FN(exp), // e als Fixnum encode_FF(sign,1,bit(FF_mant_len)) // (-1)^s erzeugen ); } + +} // namespace cln diff --git a/src/float/ffloat/misc/cl_FF_digits.cc b/src/float/ffloat/misc/cl_FF_digits.cc index 3b48413..cff0855 100644 --- a/src/float/ffloat/misc/cl_FF_digits.cc +++ b/src/float/ffloat/misc/cl_FF_digits.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. #include "cl_FF.h" +namespace cln { + MAYBE_INLINE uintL float_digits (const cl_FF& x) { unused x; return FF_mant_len+1; // 24 } + +} // namespace cln diff --git a/src/float/ffloat/misc/cl_FF_eqhashcode.cc b/src/float/ffloat/misc/cl_FF_eqhashcode.cc index 2f0492e..3abbd99 100644 --- a/src/float/ffloat/misc/cl_FF_eqhashcode.cc +++ b/src/float/ffloat/misc/cl_FF_eqhashcode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. @@ -12,8 +12,10 @@ #include "cl_N.h" #include "cl_FF.h" +namespace cln { + MAYBE_INLINE -uint32 cl_equal_hashcode (const cl_FF& x) +uint32 equal_hashcode (const cl_FF& x) { var cl_signean sign; var sintL exp; @@ -22,3 +24,5 @@ uint32 cl_equal_hashcode (const cl_FF& x) var uint32 msd = mant << (32-(FF_mant_len+1)); return equal_hashcode_low(msd,exp,sign); } + +} // namespace cln diff --git a/src/float/ffloat/misc/cl_FF_exponent.cc b/src/float/ffloat/misc/cl_FF_exponent.cc index 4b11e8d..72f3cee 100644 --- a/src/float/ffloat/misc/cl_FF_exponent.cc +++ b/src/float/ffloat/misc/cl_FF_exponent.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. #include "cl_FF.h" +namespace cln { + MAYBE_INLINE sintL float_exponent (const cl_FF& x) { @@ -18,3 +20,5 @@ sintL float_exponent (const cl_FF& x) if (uexp==0) { return 0; } return (sintL)(uexp - FF_exp_mid); } + +} // namespace cln diff --git a/src/float/ffloat/misc/cl_FF_idecode.cc b/src/float/ffloat/misc/cl_FF_idecode.cc index 7d52bd9..f4f7307 100644 --- a/src/float/ffloat/misc/cl_FF_idecode.cc +++ b/src/float/ffloat/misc/cl_FF_idecode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. @@ -19,6 +19,8 @@ #include "cl_F.h" #include "dfloat/cl_DF.h" +namespace cln { + MAYBE_INLINE const cl_idecoded_float integer_decode_float (const cl_FF& x) { @@ -29,8 +31,12 @@ const cl_idecoded_float integer_decode_float (const cl_FF& x) ); } +} // namespace cln + #else +namespace cln { + MAYBE_INLINE const cl_idecoded_float integer_decode_float (const cl_FF& x) { @@ -51,4 +57,6 @@ const cl_idecoded_float integer_decode_float (const cl_FF& x) ); } +} // namespace cln + #endif diff --git a/src/float/ffloat/misc/cl_FF_max.cc b/src/float/ffloat/misc/cl_FF_max.cc index 00230d1..e9ee704 100644 --- a/src/float/ffloat/misc/cl_FF_max.cc +++ b/src/float/ffloat/misc/cl_FF_max.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. +namespace cln { + const cl_FF max (const cl_FF& x, const cl_FF& y) { return (x >= y ? x : y); } + +} // namespace cln diff --git a/src/float/ffloat/misc/cl_FF_min.cc b/src/float/ffloat/misc/cl_FF_min.cc index a9e1513..0fd4288 100644 --- a/src/float/ffloat/misc/cl_FF_min.cc +++ b/src/float/ffloat/misc/cl_FF_min.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. +namespace cln { + const cl_FF min (const cl_FF& x, const cl_FF& y) { return (x <= y ? x : y); } + +} // namespace cln diff --git a/src/float/ffloat/misc/cl_FF_precision.cc b/src/float/ffloat/misc/cl_FF_precision.cc index 0d2a3b1..9133505 100644 --- a/src/float/ffloat/misc/cl_FF_precision.cc +++ b/src/float/ffloat/misc/cl_FF_precision.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. @@ -15,9 +15,13 @@ #define MAYBE_INLINE inline #include "cl_FF_zerop.cc" +namespace cln { + MAYBE_INLINE2 uintL float_precision (const cl_FF& x) { if (zerop(x)) return 0; return FF_mant_len+1; // 24 } + +} // namespace cln diff --git a/src/float/ffloat/misc/cl_FF_sign.cc b/src/float/ffloat/misc/cl_FF_sign.cc index 1e8e9bb..583b7fd 100644 --- a/src/float/ffloat/misc/cl_FF_sign.cc +++ b/src/float/ffloat/misc/cl_FF_sign.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. @@ -15,9 +15,13 @@ #define MAYBE_INLINE inline #include "cl_FF_minusp.cc" +namespace cln { + MAYBE_INLINE2 const cl_FF float_sign (const cl_FF& x) { // Methode: x>=0 -> Ergebnis 1.0; x<0 -> Ergebnis -1.0 return (!minusp(x) ? cl_FF_1 : cl_FF_minus1); } + +} // namespace cln diff --git a/src/float/ffloat/misc/cl_FF_signum.cc b/src/float/ffloat/misc/cl_FF_signum.cc index 6c8bc56..69cb60e 100644 --- a/src/float/ffloat/misc/cl_FF_signum.cc +++ b/src/float/ffloat/misc/cl_FF_signum.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_ffloat.h" +#include "cln/ffloat.h" // Implementation. @@ -16,6 +16,8 @@ #include "cl_FF_minusp.cc" #include "cl_FF_zerop.cc" +namespace cln { + MAYBE_INLINE2 const cl_FF signum (const cl_FF& x) { @@ -23,3 +25,5 @@ const cl_FF signum (const cl_FF& x) elif (zerop(x)) { return cl_FF_0; } // x=0 -> 0.0 else { return cl_FF_1; } // x>0 -> +1.0 } + +} // namespace cln diff --git a/src/float/input/cl_F_from_string.cc b/src/float/input/cl_F_from_string.cc index c734175..ad07636 100644 --- a/src/float/input/cl_F_from_string.cc +++ b/src/float/input/cl_F_from_string.cc @@ -4,20 +4,22 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float_class.h" +#include "cln/float_class.h" // Implementation. -#include "cl_float.h" -#include "cl_input.h" -#include "cl_float_io.h" +#include "cln/float.h" +#include "cln/input.h" +#include "cln/float_io.h" + +namespace cln { cl_read_flags cl_F_read_flags = { syntax_float, lsyntax_all, 10, - { cl_float_format_ffloat, cl_float_format_lfloat_min, cl_true } + { float_format_ffloat, float_format_lfloat_min, cl_true } }; cl_F::cl_F (const char * string) @@ -25,3 +27,5 @@ cl_F::cl_F (const char * string) pointer = as_cl_private_thing( read_float(cl_F_read_flags,string,NULL,NULL)); } + +} // namespace cln diff --git a/src/float/input/cl_F_read.cc b/src/float/input/cl_F_read.cc index e46e51f..43ae773 100644 --- a/src/float/input/cl_F_read.cc +++ b/src/float/input/cl_F_read.cc @@ -6,21 +6,23 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float_io.h" +#include "cln/float_io.h" // Implementation. #include -#include "cl_input.h" -#include "cl_integer.h" +#include "cln/input.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_F.h" #undef floor -#include +#include #define floor cln_floor +namespace cln { + // Step forward over all digits, to the end of string or to the next non-digit. static const char * skip_digits (const char * ptr, const char * string_limit, unsigned int base) { @@ -56,7 +58,7 @@ const cl_F read_float (const cl_read_flags& flags, const char * string, const ch ASSERT((flags.syntax & ~(syntax_float|syntax_maybe_bad)) == 0); // If no string_limit is given, it defaults to the end of the string. if (!string_limit) - string_limit = string + strlen(string); + string_limit = string + ::strlen(string); if (flags.syntax & syntax_float) { // Check for floating-point number syntax: // {'+'|'-'|} {digit}+ {'.' {digit}* | } expo {'+'|'-'|} {digit}+ @@ -123,21 +125,21 @@ const cl_F read_float (const cl_read_flags& flags, const char * string, const ch } ptr = ptr_after_exponent; var const char * ptr_after_prec = ptr; - var cl_float_format_t prec; + var float_format_t prec; if ((ptr != string_limit) && (*ptr == '_')) { ptr++; ptr_after_prec = skip_digits(ptr,string_limit,10); if (ptr_after_prec == ptr) goto not_float_syntax; var cl_I prec1 = digits_to_I(ptr,ptr_after_prec-ptr,10); var uintL prec2 = cl_I_to_UL(prec1); - prec = (float_base==10 ? cl_float_format(prec2) - : (cl_float_format_t)((uintL)((1+prec2)*log((double)float_base)*1.442695041)+1) + prec = (float_base==10 ? float_format(prec2) + : (float_format_t)((uintL)((1+prec2)*::log((double)float_base)*1.442695041)+1) ); } else { switch (exponent_marker) { - case 'S': prec = cl_float_format_sfloat; break; - case 'F': prec = cl_float_format_ffloat; break; - case 'D': prec = cl_float_format_dfloat; break; + case 'S': prec = float_format_sfloat; break; + case 'F': prec = float_format_ffloat; break; + case 'D': prec = float_format_dfloat; break; case 'L': prec = flags.float_flags.default_lfloat_format; break; case 'E': prec = flags.float_flags.default_float_format; break; default: NOTREACHED @@ -149,9 +151,9 @@ const cl_F read_float (const cl_read_flags& flags, const char * string, const ch var uintL num_significant_digits = (ptr_after_fracpart - ptr) - (ptr_before_fracpart > ptr ? 1 : 0); var uintL prec2 = (num_significant_digits>=2 ? num_significant_digits-2 : 0); - var cl_float_format_t precx = - (float_base==10 ? cl_float_format(prec2) - : (cl_float_format_t)((uintL)((1+prec2)*log((double)float_base)*1.442695041)+1) + var float_format_t precx = + (float_base==10 ? float_format(prec2) + : (float_format_t)((uintL)((1+prec2)*::log((double)float_base)*1.442695041)+1) ); if ((uintL)precx > (uintL)prec) prec = precx; @@ -176,3 +178,5 @@ bad_syntax: } read_number_bad_syntax(string,string_limit); } + +} // namespace cln diff --git a/src/float/input/cl_F_read_stream.cc b/src/float/input/cl_F_read_stream.cc index 889c6ae..dfa30aa 100644 --- a/src/float/input/cl_F_read_stream.cc +++ b/src/float/input/cl_F_read_stream.cc @@ -6,15 +6,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float_io.h" +#include "cln/float_io.h" // Implementation. -#include "cl_input.h" -#include "cl_io.h" +#include "cln/input.h" +#include "cln/io.h" #include "cl_spushstring.h" +namespace cln { + // We read an entire token (or even more, if it begins with #C) into a // buffer and then call read_float() on the buffer. @@ -102,3 +104,5 @@ syntax1: buffer.push(c); // Handle premature EOF. eof: read_number_eof(); } + +} // namespace cln diff --git a/src/float/input/cl_F_readparsed.cc b/src/float/input/cl_F_readparsed.cc index a33e968..4610724 100644 --- a/src/float/input/cl_F_readparsed.cc +++ b/src/float/input/cl_F_readparsed.cc @@ -4,27 +4,29 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float_io.h" +#include "cln/float_io.h" // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" -#include "cl_rational.h" +#include "cln/rational.h" #include "cl_RA.h" -#include "cl_float.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/float.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_F.h" #include "cl_SF.h" #include "cl_FF.h" #include "cl_DF.h" #include "cl_LF.h" -const cl_F read_float (unsigned int base, cl_float_format_t prec, cl_signean sign, const char * string, uintL index1, uintL index4, uintL index2, uintL index3) +namespace cln { + +const cl_F read_float (unsigned int base, float_format_t prec, cl_signean sign, const char * string, uintL index1, uintL index4, uintL index2, uintL index3) { var cl_I exponent; { @@ -91,3 +93,5 @@ const cl_F read_float (unsigned int base, cl_float_format_t prec, cl_signean sig } ); } + +} // namespace cln diff --git a/src/float/lfloat/algebraic/cl_LF_sqrt.cc b/src/float/lfloat/algebraic/cl_LF_sqrt.cc index 7ca0850..c551ca4 100644 --- a/src/float/lfloat/algebraic/cl_LF_sqrt.cc +++ b/src/float/lfloat/algebraic/cl_LF_sqrt.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -13,7 +13,9 @@ #include "cl_LF_impl.h" #include "cl_F.h" #include "cl_DS.h" -#include "cl_abort.h" +#include "cln/abort.h" + +namespace cln { const cl_LF sqrt (const cl_LF& x) { @@ -128,3 +130,4 @@ const cl_LF sqrt (const cl_LF& x) } // Bit complexity (N := length(x)): O(M(N)). +} // namespace cln diff --git a/src/float/lfloat/cl_LF.h b/src/float/lfloat/cl_LF.h index a682857..3a3fc96 100644 --- a/src/float/lfloat/cl_LF.h +++ b/src/float/lfloat/cl_LF.h @@ -3,9 +3,11 @@ #ifndef _CL_LF_H #define _CL_LF_H -#include "cl_number.h" -#include "cl_lfloat_class.h" -#include "cl_integer_class.h" +#include "cln/number.h" +#include "cln/lfloat_class.h" +#include "cln/integer_class.h" + +namespace cln { struct cl_heap_lfloat : cl_heap { unsigned int len; // length of mantissa (in digits) @@ -137,4 +139,6 @@ extern const cl_LF cl_LF_shortenrelative (const cl_LF& x, const cl_LF& y); // 1 ulp(x) < y. y must be >0. extern const cl_LF cl_LF_shortenwith (const cl_LF& x, const cl_LF& y); +} // namespace cln + #endif /* _CL_LF_H */ diff --git a/src/float/lfloat/cl_LF_impl.h b/src/float/lfloat/cl_LF_impl.h index 592da5a..7194fc9 100644 --- a/src/float/lfloat/cl_LF_impl.h +++ b/src/float/lfloat/cl_LF_impl.h @@ -3,12 +3,14 @@ #ifndef _CL_LF_IMPL_H #define _CL_LF_IMPL_H -#include "cl_number.h" +#include "cln/number.h" #include "cl_LF.h" -#include "cl_malloc.h" +#include "cln/malloc.h" #include "cl_offsetof.h" #include "cl_DS.h" +namespace cln { + extern cl_class cl_class_lfloat; // Builds a long-float, without filling the mantissa. @@ -19,7 +21,7 @@ extern cl_class cl_class_lfloat; // The long-float is only complete when the mantissa has been filled in! inline cl_heap_lfloat* allocate_lfloat (uintC len, uint32 expo, cl_signean sign) { - cl_heap_lfloat* p = (cl_heap_lfloat*) cl_malloc_hook(offsetofa(cl_heap_lfloat,data)+sizeof(uintD)*len); + cl_heap_lfloat* p = (cl_heap_lfloat*) malloc_hook(offsetofa(cl_heap_lfloat,data)+sizeof(uintD)*len); p->refcount = 1; p->type = &cl_class_lfloat; p->len = len; @@ -146,4 +148,6 @@ inline const cl_LF encode_LF (cl_signean sign, sintL exp, const uintD* mantMSDpt #define encode_LF_array(sign,exp,mantarr,mantlen) \ encode_LF(sign,exp,arrayMSDptr(mantarr,mantlen),mantlen) +} // namespace cln + #endif /* _CL_LF_IMPL_H */ diff --git a/src/float/lfloat/division/cl_LF_ceil22.cc b/src/float/lfloat/division/cl_LF_ceil22.cc index d7b7f28..0de3eb2 100644 --- a/src/float/lfloat/division/cl_LF_ceil22.cc +++ b/src/float/lfloat/division/cl_LF_ceil22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. #include "cl_LF.h" +namespace cln { + const cl_LF_div_t ceiling2 (const cl_LF& x, const cl_LF& y) { // Methode: @@ -20,3 +22,5 @@ const cl_LF_div_t ceiling2 (const cl_LF& x, const cl_LF& y) var cl_LF& r = q_r.remainder; return cl_LF_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/lfloat/division/cl_LF_fceil.cc b/src/float/lfloat/division/cl_LF_fceil.cc index 9ce0f22..7e869f1 100644 --- a/src/float/lfloat/division/cl_LF_fceil.cc +++ b/src/float/lfloat/division/cl_LF_fceil.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -15,6 +15,8 @@ #define MAYBE_INLINE inline #include "cl_LF_minusp.cc" +namespace cln { + const cl_LF fceiling (const cl_LF& x) { if (minusp(x)) @@ -22,3 +24,5 @@ const cl_LF fceiling (const cl_LF& x) else return futruncate(x); } + +} // namespace cln diff --git a/src/float/lfloat/division/cl_LF_floor22.cc b/src/float/lfloat/division/cl_LF_floor22.cc index 10f77d2..6e493e9 100644 --- a/src/float/lfloat/division/cl_LF_floor22.cc +++ b/src/float/lfloat/division/cl_LF_floor22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. #include "cl_LF.h" +namespace cln { + const cl_LF_div_t floor2 (const cl_LF& x, const cl_LF& y) { // Methode: @@ -20,3 +22,5 @@ const cl_LF_div_t floor2 (const cl_LF& x, const cl_LF& y) var cl_LF& r = q_r.remainder; return cl_LF_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/lfloat/division/cl_LF_recip.cc b/src/float/lfloat/division/cl_LF_recip.cc index b0162e4..382e416 100644 --- a/src/float/lfloat/division/cl_LF_recip.cc +++ b/src/float/lfloat/division/cl_LF_recip.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -12,9 +12,13 @@ #include "cl_LF.h" #include "cl_LF_impl.h" +namespace cln { + ALL_cl_LF_OPERATIONS_SAME_PRECISION() const cl_LF recip (const cl_LF& x) { return encode_LF1(TheLfloat(x)->len) / x; } + +} // namespace cln diff --git a/src/float/lfloat/division/cl_LF_round22.cc b/src/float/lfloat/division/cl_LF_round22.cc index 8514601..962e8ec 100644 --- a/src/float/lfloat/division/cl_LF_round22.cc +++ b/src/float/lfloat/division/cl_LF_round22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. #include "cl_LF.h" +namespace cln { + const cl_LF_div_t round2 (const cl_LF& x, const cl_LF& y) { // Methode: @@ -20,3 +22,5 @@ const cl_LF_div_t round2 (const cl_LF& x, const cl_LF& y) var cl_LF& r = q_r.remainder; return cl_LF_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/lfloat/division/cl_LF_trunc22.cc b/src/float/lfloat/division/cl_LF_trunc22.cc index d1e5d4a..34458b5 100644 --- a/src/float/lfloat/division/cl_LF_trunc22.cc +++ b/src/float/lfloat/division/cl_LF_trunc22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. #include "cl_LF.h" +namespace cln { + const cl_LF_div_t truncate2 (const cl_LF& x, const cl_LF& y) { // Methode: @@ -20,3 +22,5 @@ const cl_LF_div_t truncate2 (const cl_LF& x, const cl_LF& y) var cl_LF& r = q_r.remainder; return cl_LF_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_I_LF_div.cc b/src/float/lfloat/elem/cl_I_LF_div.cc index 0d72f52..ecff491 100644 --- a/src/float/lfloat/elem/cl_I_LF_div.cc +++ b/src/float/lfloat/elem/cl_I_LF_div.cc @@ -9,14 +9,16 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF_impl.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_DS.h" #include "cl_F.h" #include "cl_N.h" +namespace cln { + const cl_R cl_I_LF_div (const cl_I& x, const cl_LF& y) { // Method: @@ -31,3 +33,5 @@ const cl_R cl_I_LF_div (const cl_I& x, const cl_LF& y) return cl_I_to_LF(x,len) / y; } // Bit complexity (N = max(length(x),length(y))): O(M(N)). + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_1minus.cc b/src/float/lfloat/elem/cl_LF_1minus.cc index c484aa1..72d751b 100644 --- a/src/float/lfloat/elem/cl_LF_1minus.cc +++ b/src/float/lfloat/elem/cl_LF_1minus.cc @@ -12,6 +12,8 @@ #include "cl_LF_impl.h" #include "cl_DS.h" +namespace cln { + const cl_LF LF_LF_minus_LF (const cl_LF& x1, const cl_LF& x2) { // Methode: @@ -25,3 +27,5 @@ const cl_LF LF_LF_minus_LF (const cl_LF& x1, const cl_LF& x2) return LF_LF_plus_LF(x1,mx2); } } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_1plus.cc b/src/float/lfloat/elem/cl_LF_1plus.cc index 877fb2d..4c90e50 100644 --- a/src/float/lfloat/elem/cl_LF_1plus.cc +++ b/src/float/lfloat/elem/cl_LF_1plus.cc @@ -14,6 +14,8 @@ #include "cl_F.h" #include "cl_xmacros.h" +namespace cln { + const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2) { // Methode (nach [Knuth, II, Seminumerical Algorithms, Abschnitt 4.2.1., S.200]): @@ -238,3 +240,5 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2) // y fertig. return y; } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_2minus.cc b/src/float/lfloat/elem/cl_LF_2minus.cc index 71c4408..925d198 100644 --- a/src/float/lfloat/elem/cl_LF_2minus.cc +++ b/src/float/lfloat/elem/cl_LF_2minus.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. #include "cl_LF.h" +namespace cln { + const cl_LF operator- (const cl_LF& x1, const cl_LF& x2) { GEN_LF_OP2(x1,x2,LF_LF_minus_LF,return) } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_2plus.cc b/src/float/lfloat/elem/cl_LF_2plus.cc index 8bfd6a1..29d5f36 100644 --- a/src/float/lfloat/elem/cl_LF_2plus.cc +++ b/src/float/lfloat/elem/cl_LF_2plus.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. #include "cl_LF.h" +namespace cln { + const cl_LF operator+ (const cl_LF& x1, const cl_LF& x2) { GEN_LF_OP2(x1,x2,LF_LF_plus_LF,return) } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_I_div.cc b/src/float/lfloat/elem/cl_LF_I_div.cc index 8a61f4b..bce4a5a 100644 --- a/src/float/lfloat/elem/cl_LF_I_div.cc +++ b/src/float/lfloat/elem/cl_LF_I_div.cc @@ -9,14 +9,16 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF_impl.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_DS.h" #include "cl_F.h" #include "cl_N.h" +namespace cln { + const cl_LF cl_LF_I_div (const cl_LF& x, const cl_I& y) { // Method: @@ -111,3 +113,4 @@ const cl_LF cl_LF_I_div (const cl_LF& x, const cl_I& y) } // Bit complexity (N := max(length(x),length(y))): O(M(N)). +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_I_mul.cc b/src/float/lfloat/elem/cl_LF_I_mul.cc index 5d9dbab..4fcafe1 100644 --- a/src/float/lfloat/elem/cl_LF_I_mul.cc +++ b/src/float/lfloat/elem/cl_LF_I_mul.cc @@ -10,11 +10,13 @@ // Implementation. #include "cl_LF_impl.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_DS.h" #include "cl_F.h" +namespace cln { + const cl_R cl_LF_I_mul (const cl_LF& x, const cl_I& y) { // Method: @@ -86,3 +88,4 @@ const cl_R cl_LF_I_mul (const cl_LF& x, const cl_I& y) } // Bit complexity (N = max(length(x),length(y))): O(M(N)). +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_RA_div.cc b/src/float/lfloat/elem/cl_LF_RA_div.cc index 0a51629..091eae3 100644 --- a/src/float/lfloat/elem/cl_LF_RA_div.cc +++ b/src/float/lfloat/elem/cl_LF_RA_div.cc @@ -9,10 +9,12 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_rational.h" +#include "cln/lfloat.h" +#include "cln/rational.h" #include "cl_RA.h" +namespace cln { + const cl_LF cl_LF_RA_div (const cl_LF& x, const cl_RA& y) { // Method: @@ -27,3 +29,5 @@ const cl_LF cl_LF_RA_div (const cl_LF& x, const cl_RA& y) return cl_LF_I_div(The(cl_LF)(cl_LF_I_mul(x,v)),u); } } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_RA_mul.cc b/src/float/lfloat/elem/cl_LF_RA_mul.cc index db3299e..905bc06 100644 --- a/src/float/lfloat/elem/cl_LF_RA_mul.cc +++ b/src/float/lfloat/elem/cl_LF_RA_mul.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_RA.h" +namespace cln { + const cl_R cl_LF_RA_mul (const cl_LF& x, const cl_RA& y) { // Method: @@ -47,3 +49,5 @@ const cl_R cl_LF_RA_mul (const cl_LF& x, const cl_RA& y) // We see that the first approach is always better than the second, except if // den_length = x_length && x_length <= num_length <= 2*x_length // when both are equally fast. + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_compare.cc b/src/float/lfloat/elem/cl_LF_compare.cc index 1a2e97c..797f403 100644 --- a/src/float/lfloat/elem/cl_LF_compare.cc +++ b/src/float/lfloat/elem/cl_LF_compare.cc @@ -1,10 +1,10 @@ -// cl_compare(). +// compare(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -16,7 +16,9 @@ #define MAYBE_INLINE inline #include "cl_LF_minusp.cc" -cl_signean cl_compare (const cl_LF& x, const cl_LF& y) +namespace cln { + +cl_signean compare (const cl_LF& x, const cl_LF& y) { // Methode: // x und y haben verschiedenes Vorzeichen -> @@ -101,3 +103,5 @@ cl_signean cl_compare (const cl_LF& x, const cl_LF& y) } } } } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_div.cc b/src/float/lfloat/elem/cl_LF_div.cc index 8958023..3d4aa2a 100644 --- a/src/float/lfloat/elem/cl_LF_div.cc +++ b/src/float/lfloat/elem/cl_LF_div.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -15,17 +15,7 @@ #include "cl_F.h" #include "cl_N.h" -// Workaround gcc-2.7.0 bug on i386. -#if defined(__GNUC__) - #if (__GNUC__ == 2) - #if (__GNUC_MINOR__ == 7) - #define workaround_gcc_bug() *&uexp1 = *&uexp1; - #endif - #endif -#endif -#ifndef workaround_gcc_bug - #define workaround_gcc_bug() -#endif +namespace cln { const cl_LF operator/ (const cl_LF& x1, const cl_LF& x2) { @@ -60,13 +50,11 @@ const cl_LF operator/ (const cl_LF& x1, const cl_LF& x2) // (uexp1-LF_exp_mid) - (uexp2-LF_exp_mid) = (uexp1-uexp2+LF_exp_mid)-LF_exp_mid if (uexp1 >= uexp2) { uexp1 = uexp1 - uexp2; // kein Carry - workaround_gcc_bug(); if (uexp1 > LF_exp_high-LF_exp_mid) { cl_error_floating_point_overflow(); } uexp1 = uexp1 + LF_exp_mid; } else { uexp1 = uexp1 - uexp2; // Carry - workaround_gcc_bug(); if (uexp1 < (uintL)(LF_exp_low-1-LF_exp_mid)) { if (underflow_allowed()) { cl_error_floating_point_underflow(); } @@ -165,3 +153,4 @@ const cl_LF operator/ (const cl_LF& x1, const cl_LF& x2) } // Bit complexity (N := max(length(x1),length(x2))): O(M(N)). +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_ffloor.cc b/src/float/lfloat/elem/cl_LF_ffloor.cc index 7a1d57c..ffc4cbf 100644 --- a/src/float/lfloat/elem/cl_LF_ffloor.cc +++ b/src/float/lfloat/elem/cl_LF_ffloor.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -15,6 +15,8 @@ #define MAYBE_INLINE inline #include "cl_LF_minusp.cc" +namespace cln { + const cl_LF ffloor (const cl_LF& x) { if (minusp(x)) @@ -22,3 +24,5 @@ const cl_LF ffloor (const cl_LF& x) else return ftruncate(x); } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_from_I.cc b/src/float/lfloat/elem/cl_LF_from_I.cc index 378c9fc..7b9ba79 100644 --- a/src/float/lfloat/elem/cl_LF_from_I.cc +++ b/src/float/lfloat/elem/cl_LF_from_I.cc @@ -10,11 +10,13 @@ // Implementation. #include "cl_LF_impl.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_DS.h" #include "cl_F.h" +namespace cln { + const cl_LF cl_I_to_LF (const cl_I& x, uintC len) { // Methode: @@ -114,3 +116,5 @@ const cl_LF cl_I_to_LF (const cl_I& x, uintC len) } return y; } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_from_RA.cc b/src/float/lfloat/elem/cl_LF_from_RA.cc index e1a2c25..58f9db1 100644 --- a/src/float/lfloat/elem/cl_LF_from_RA.cc +++ b/src/float/lfloat/elem/cl_LF_from_RA.cc @@ -11,10 +11,12 @@ #include "cl_LF_impl.h" #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_F.h" +namespace cln { + const cl_LF cl_RA_to_LF (const cl_RA& x, uintC len) { // Methode: @@ -140,3 +142,5 @@ const cl_LF cl_RA_to_LF (const cl_RA& x, uintC len) // num_length < 2*len && den_length < len // whereas cl_I_to_LF(numerator,len)/cl_I_to_LF(denominator,len) is faster if // num_length > 2*len || den_length > len + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_fround.cc b/src/float/lfloat/elem/cl_LF_fround.cc index fd8fbcc..18bc495 100644 --- a/src/float/lfloat/elem/cl_LF_fround.cc +++ b/src/float/lfloat/elem/cl_LF_fround.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_LF_impl.h" #include "cl_DS.h" +namespace cln { + const cl_LF fround (const cl_LF& x) { // Methode: @@ -132,3 +134,5 @@ const cl_LF fround (const cl_LF& x) } #endif } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_ftrunc.cc b/src/float/lfloat/elem/cl_LF_ftrunc.cc index 4f45f01..a9a2616 100644 --- a/src/float/lfloat/elem/cl_LF_ftrunc.cc +++ b/src/float/lfloat/elem/cl_LF_ftrunc.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_LF_impl.h" #include "cl_DS.h" +namespace cln { + const cl_LF ftruncate (const cl_LF& x) { // Methode: @@ -68,3 +70,5 @@ const cl_LF ftruncate (const cl_LF& x) return y; #endif } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_futrunc.cc b/src/float/lfloat/elem/cl_LF_futrunc.cc index 01eb27e..c044194 100644 --- a/src/float/lfloat/elem/cl_LF_futrunc.cc +++ b/src/float/lfloat/elem/cl_LF_futrunc.cc @@ -12,6 +12,8 @@ #include "cl_LF_impl.h" #include "cl_DS.h" +namespace cln { + const cl_LF futruncate (const cl_LF& x) { // Methode: @@ -97,3 +99,5 @@ const cl_LF futruncate (const cl_LF& x) return y; #endif } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_globals.cc b/src/float/lfloat/elem/cl_LF_globals.cc index 61ef41e..9284a18 100644 --- a/src/float/lfloat/elem/cl_LF_globals.cc +++ b/src/float/lfloat/elem/cl_LF_globals.cc @@ -6,7 +6,7 @@ CL_PROVIDE(cl_LF_globals) // Specification. -#include "cl_number.h" +#include "cln/number.h" // Implementation. @@ -14,7 +14,11 @@ CL_PROVIDE(cl_LF_globals) #include "cl_LF.h" #include "cl_LF_impl.h" +namespace cln { + // Only needed for the default constructor of cl_LF. const cl_LF cl_LF_0 = encode_LF0(LF_minlen); // 0.0L0 +} // namespace cln + CL_PROVIDE_END(cl_LF_globals) diff --git a/src/float/lfloat/elem/cl_LF_minus1.cc b/src/float/lfloat/elem/cl_LF_minus1.cc index 8083eda..652c4f3 100644 --- a/src/float/lfloat/elem/cl_LF_minus1.cc +++ b/src/float/lfloat/elem/cl_LF_minus1.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. #include "cl_LF.h" +namespace cln { + ALL_cl_LF_OPERATIONS_SAME_PRECISION() const cl_LF minus1 (const cl_LF& x) { return x + cl_I_to_LF(cl_I(-1),TheLfloat(x)->len); } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_minusp.cc b/src/float/lfloat/elem/cl_LF_minusp.cc index cb82588..882bd77 100644 --- a/src/float/lfloat/elem/cl_LF_minusp.cc +++ b/src/float/lfloat/elem/cl_LF_minusp.cc @@ -4,15 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. #include "cl_LF.h" +namespace cln { + MAYBE_INLINE cl_boolean minusp (const cl_LF& x) { return (cl_boolean) (- TheLfloat(x)->sign); } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_mul.cc b/src/float/lfloat/elem/cl_LF_mul.cc index 2699dfa..7b53f45 100644 --- a/src/float/lfloat/elem/cl_LF_mul.cc +++ b/src/float/lfloat/elem/cl_LF_mul.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -14,6 +14,8 @@ #include "cl_DS.h" #include "cl_F.h" +namespace cln { + const cl_LF operator* (const cl_LF& x1, const cl_LF& x2) { // Methode: @@ -107,3 +109,4 @@ const cl_LF operator* (const cl_LF& x1, const cl_LF& x2) } // Bit complexity (N = max(length(x1),length(x2))): O(M(N)). +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_plus1.cc b/src/float/lfloat/elem/cl_LF_plus1.cc index b431f7d..e539f6b 100644 --- a/src/float/lfloat/elem/cl_LF_plus1.cc +++ b/src/float/lfloat/elem/cl_LF_plus1.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. #include "cl_LF.h" +namespace cln { + ALL_cl_LF_OPERATIONS_SAME_PRECISION() const cl_LF plus1 (const cl_LF& x) { return x + cl_I_to_LF(cl_I(1),TheLfloat(x)->len); } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_plusp.cc b/src/float/lfloat/elem/cl_LF_plusp.cc index 6602978..24df977 100644 --- a/src/float/lfloat/elem/cl_LF_plusp.cc +++ b/src/float/lfloat/elem/cl_LF_plusp.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -17,6 +17,8 @@ #include "cl_LF_minusp.cc" #include "cl_LF_zerop.cc" +namespace cln { + MAYBE_INLINE2 cl_boolean plusp (const cl_LF& x) { @@ -27,3 +29,5 @@ cl_boolean plusp (const cl_LF& x) else return cl_true; // sonst ist x>0. } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_scale.cc b/src/float/lfloat/elem/cl_LF_scale.cc index 7bb826b..bcbb519 100644 --- a/src/float/lfloat/elem/cl_LF_scale.cc +++ b/src/float/lfloat/elem/cl_LF_scale.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_LF_impl.h" #include "cl_F.h" +namespace cln { + const cl_LF scale_float (const cl_LF& x, sintL delta) { // Methode: @@ -40,3 +42,5 @@ const cl_LF scale_float (const cl_LF& x, sintL delta) var uintC len = TheLfloat(x)->len; return encode_LFu(TheLfloat(x)->sign,uexp,arrayMSDptr(TheLfloat(x)->data,len),len); } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_scale_I.cc b/src/float/lfloat/elem/cl_LF_scale_I.cc index df6ec8d..9158c7b 100644 --- a/src/float/lfloat/elem/cl_LF_scale_I.cc +++ b/src/float/lfloat/elem/cl_LF_scale_I.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -14,6 +14,8 @@ #include "cl_F.h" #include "cl_I.h" +namespace cln { + const cl_LF scale_float (const cl_LF& x, const cl_I& delta) { // Methode: @@ -105,3 +107,5 @@ const cl_LF scale_float (const cl_LF& x, const cl_I& delta) var uintC len = TheLfloat(x)->len; return encode_LFu(TheLfloat(x)->sign,uexp,arrayMSDptr(TheLfloat(x)->data,len),len); } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_square.cc b/src/float/lfloat/elem/cl_LF_square.cc index 59c3891..53fb6f8 100644 --- a/src/float/lfloat/elem/cl_LF_square.cc +++ b/src/float/lfloat/elem/cl_LF_square.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -14,6 +14,8 @@ #include "cl_DS.h" #include "cl_F.h" +namespace cln { + const cl_LF square (const cl_LF& x) { // Methode: wie operator*(x,x). @@ -87,3 +89,4 @@ const cl_LF square (const cl_LF& x) } // Bit complexity (N = length(x)): O(M(N)). +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_to_I.cc b/src/float/lfloat/elem/cl_LF_to_I.cc index a90cb28..c0f32ba 100644 --- a/src/float/lfloat/elem/cl_LF_to_I.cc +++ b/src/float/lfloat/elem/cl_LF_to_I.cc @@ -9,7 +9,7 @@ // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_DS.h" @@ -17,6 +17,8 @@ #define MAYBE_INLINE inline #include "cl_LF_minusp.cc" +namespace cln { + const cl_I cl_LF_to_I (const cl_LF& x) { // Methode: @@ -43,3 +45,5 @@ const cl_I cl_LF_to_I (const cl_LF& x) minus(uexp, LF_exp_mid + intDsize*(uintL)len) ); } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_uminus.cc b/src/float/lfloat/elem/cl_LF_uminus.cc index 697ffc8..4e31ddf 100644 --- a/src/float/lfloat/elem/cl_LF_uminus.cc +++ b/src/float/lfloat/elem/cl_LF_uminus.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_LF_impl.h" #include "cl_DS.h" +namespace cln { + const cl_LF operator- (const cl_LF& x) { // Methode: @@ -26,3 +28,5 @@ const cl_LF operator- (const cl_LF& x) return mx; } } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_zerop.cc b/src/float/lfloat/elem/cl_LF_zerop.cc index fd6f9f9..bbfbb0e 100644 --- a/src/float/lfloat/elem/cl_LF_zerop.cc +++ b/src/float/lfloat/elem/cl_LF_zerop.cc @@ -4,15 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. #include "cl_LF.h" +namespace cln { + MAYBE_INLINE cl_boolean zerop (const cl_LF& x) { return (cl_boolean) (TheLfloat(x)->expo == 0); } + +} // namespace cln diff --git a/src/float/lfloat/elem/cl_RA_LF_div.cc b/src/float/lfloat/elem/cl_RA_LF_div.cc index 99a9a2d..78ad0d0 100644 --- a/src/float/lfloat/elem/cl_RA_LF_div.cc +++ b/src/float/lfloat/elem/cl_RA_LF_div.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_RA.h" +namespace cln { + const cl_R cl_RA_LF_div (const cl_RA& x, const cl_LF& y) { // Method: @@ -59,3 +61,5 @@ const cl_R cl_RA_LF_div (const cl_RA& x, const cl_LF& y) // 5000 0.55 1.94 0.98 2.30 1.70 3.33 4.90 7.74 11.94 19.29 // // We see that the first approach is always better than the second. + +} // namespace cln diff --git a/src/float/lfloat/input/cl_LF_from_string.cc b/src/float/lfloat/input/cl_LF_from_string.cc index 1991a4d..591119e 100644 --- a/src/float/lfloat/input/cl_LF_from_string.cc +++ b/src/float/lfloat/input/cl_LF_from_string.cc @@ -4,20 +4,22 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat_class.h" +#include "cln/lfloat_class.h" // Implementation. -#include "cl_lfloat.h" -#include "cl_input.h" -#include "cl_float_io.h" +#include "cln/lfloat.h" +#include "cln/input.h" +#include "cln/float_io.h" + +namespace cln { cl_read_flags cl_LF_read_flags = { syntax_lfloat, lsyntax_all, 10, - { cl_float_format_lfloat_min, cl_float_format_lfloat_min, cl_false } + { float_format_lfloat_min, float_format_lfloat_min, cl_false } }; cl_LF::cl_LF (const char * string) @@ -25,3 +27,5 @@ cl_LF::cl_LF (const char * string) pointer = as_cl_private_thing( As(cl_LF)(read_float(cl_LF_read_flags,string,NULL,NULL))); } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_abs.cc b/src/float/lfloat/misc/cl_LF_abs.cc index 11cab15..be8cb56 100644 --- a/src/float/lfloat/misc/cl_LF_abs.cc +++ b/src/float/lfloat/misc/cl_LF_abs.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -13,8 +13,12 @@ #define MAYBE_INLINE inline #include "cl_LF_minusp.cc" +namespace cln { + const cl_LF abs (const cl_LF& x) { // x<0 -> (- x), x>=0 -> x if (minusp(x)) return -x; else return x; } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_as.cc b/src/float/lfloat/misc/cl_LF_as.cc index 9a38f99..0ce126b 100644 --- a/src/float/lfloat/misc/cl_LF_as.cc +++ b/src/float/lfloat/misc/cl_LF_as.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. #include "cl_N.h" +namespace cln { + inline cl_boolean cl_LF_p (const cl_number& x) { if (x.pointer_p()) @@ -27,3 +29,5 @@ const cl_LF& as_cl_LF (const cl_number& x, const char * filename, int line) } else cl_as_error(x,"a long-float number",filename,line); } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_class.cc b/src/float/lfloat/misc/cl_LF_class.cc index 7333f69..c44546b 100644 --- a/src/float/lfloat/misc/cl_LF_class.cc +++ b/src/float/lfloat/misc/cl_LF_class.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. +namespace cln { + cl_class cl_class_lfloat = { NULL, // empty destructor cl_class_flags_subclass_complex | cl_class_flags_subclass_real | cl_class_flags_subclass_float }; + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_debug.cc b/src/float/lfloat/misc/cl_LF_debug.cc index 7d65e82..51e1676 100644 --- a/src/float/lfloat/misc/cl_LF_debug.cc +++ b/src/float/lfloat/misc/cl_LF_debug.cc @@ -8,9 +8,11 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_io.h" -#include "cl_float_io.h" +#include "cln/lfloat.h" +#include "cln/io.h" +#include "cln/float_io.h" + +namespace cln { static void dprint (cl_heap* pointer) { @@ -21,5 +23,7 @@ static void dprint (cl_heap* pointer) AT_INITIALIZATION(dprint_LF) { cl_register_type_printer(cl_class_lfloat,dprint); } -// This dummy links in this module when requires it. +// This dummy links in this module when requires it. int cl_LF_debug_module; + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_decode.cc b/src/float/lfloat/misc/cl_LF_decode.cc index d3889e9..f35f058 100644 --- a/src/float/lfloat/misc/cl_LF_decode.cc +++ b/src/float/lfloat/misc/cl_LF_decode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -13,18 +13,22 @@ #include "cl_LF_impl.h" #include "cl_I.h" -const cl_decoded_lfloat decode_float (const cl_LF& x) +namespace cln { + +const decoded_lfloat decode_float (const cl_LF& x) { // x entpacken: var cl_signean sign; var sintL exp; var uintC mantlen; var const uintD* mantMSDptr; - LF_decode(x, { return cl_decoded_lfloat(x, 0, encode_LF1(mantlen)); }, + LF_decode(x, { return decoded_lfloat(x, 0, encode_LF1(mantlen)); }, sign=,exp=,mantMSDptr=,mantlen=,); - return cl_decoded_lfloat( + return decoded_lfloat( encode_LFu(0,0+LF_exp_mid,mantMSDptr,mantlen), // (-1)^0 * 2^0 * m erzeugen L_to_I(exp), // e als Fixnum encode_LF1s(sign,mantlen) // (-1)^s erzeugen ); } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_digits.cc b/src/float/lfloat/misc/cl_LF_digits.cc index a7c2c55..76a8139 100644 --- a/src/float/lfloat/misc/cl_LF_digits.cc +++ b/src/float/lfloat/misc/cl_LF_digits.cc @@ -4,15 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. #include "cl_LF.h" +namespace cln { + MAYBE_INLINE uintL float_digits (const cl_LF& x) { return intDsize*(uintL)(TheLfloat(x)->len); } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_eqhashcode.cc b/src/float/lfloat/misc/cl_LF_eqhashcode.cc index ec70512..0181c96 100644 --- a/src/float/lfloat/misc/cl_LF_eqhashcode.cc +++ b/src/float/lfloat/misc/cl_LF_eqhashcode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -13,8 +13,10 @@ #include "cl_LF_impl.h" #include "cl_DS.h" +namespace cln { + MAYBE_INLINE -uint32 cl_equal_hashcode (const cl_LF& x) +uint32 equal_hashcode (const cl_LF& x) { var cl_signean sign; var sintL exp; @@ -27,3 +29,5 @@ uint32 cl_equal_hashcode (const cl_LF& x) #endif return equal_hashcode_low(msd,exp,sign); } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_exponent.cc b/src/float/lfloat/misc/cl_LF_exponent.cc index 44d0291..7fd12b1 100644 --- a/src/float/lfloat/misc/cl_LF_exponent.cc +++ b/src/float/lfloat/misc/cl_LF_exponent.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. #include "cl_LF.h" +namespace cln { + MAYBE_INLINE sintL float_exponent (const cl_LF& x) { @@ -18,3 +20,5 @@ sintL float_exponent (const cl_LF& x) if (uexp==0) { return 0; } return (sintL)(uexp - LF_exp_mid); } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_extend.cc b/src/float/lfloat/misc/cl_LF_extend.cc index 3c1ee60..4ca4ce2 100644 --- a/src/float/lfloat/misc/cl_LF_extend.cc +++ b/src/float/lfloat/misc/cl_LF_extend.cc @@ -12,6 +12,8 @@ #include "cl_LF_impl.h" #include "cl_DS.h" +namespace cln { + const cl_LF extend (const cl_LF& x, uintC len) { var Lfloat y = allocate_lfloat(len,TheLfloat(x)->expo,TheLfloat(x)->sign); // neues LF @@ -23,3 +25,5 @@ const cl_LF extend (const cl_LF& x, uintC len) } return y; } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_idecode.cc b/src/float/lfloat/misc/cl_LF_idecode.cc index 959aa3d..06c8d09 100644 --- a/src/float/lfloat/misc/cl_LF_idecode.cc +++ b/src/float/lfloat/misc/cl_LF_idecode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_I.h" #include "cl_DS.h" +namespace cln { + MAYBE_INLINE const cl_idecoded_float integer_decode_float (const cl_LF& x) { @@ -36,3 +38,5 @@ const cl_idecoded_float integer_decode_float (const cl_LF& x) (sign>=0 ? cl_I(1) : cl_I(-1)) // (-1)^s erzeugen ); } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_leninc.cc b/src/float/lfloat/misc/cl_LF_leninc.cc index 34c3579..b05c875 100644 --- a/src/float/lfloat/misc/cl_LF_leninc.cc +++ b/src/float/lfloat/misc/cl_LF_leninc.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + uintC cl_LF_len_incsqrt (uintC n) { // Methode bei intDsize=16: @@ -51,3 +53,5 @@ uintC cl_LF_len_incsqrt (uintC n) // No TEST(14), because NMAX(1UL<<14) is already out of range. n_max; } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_lenincx.cc b/src/float/lfloat/misc/cl_LF_lenincx.cc index e949a96..76620d6 100644 --- a/src/float/lfloat/misc/cl_LF_lenincx.cc +++ b/src/float/lfloat/misc/cl_LF_lenincx.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + uintC cl_LF_len_incsqrtx (uintC n) { // Methode bei intDsize=16: @@ -44,3 +46,5 @@ uintC cl_LF_len_incsqrtx (uintC n) // No TEST(14), because NMAX(1UL<<14) is already out of range. n_max; } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_max.cc b/src/float/lfloat/misc/cl_LF_max.cc index e45000e..3b8729e 100644 --- a/src/float/lfloat/misc/cl_LF_max.cc +++ b/src/float/lfloat/misc/cl_LF_max.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. +namespace cln { + const cl_LF max (const cl_LF& x, const cl_LF& y) { return (x >= y ? x : y); } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_min.cc b/src/float/lfloat/misc/cl_LF_min.cc index b58bb42..60ca93f 100644 --- a/src/float/lfloat/misc/cl_LF_min.cc +++ b/src/float/lfloat/misc/cl_LF_min.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. +namespace cln { + const cl_LF min (const cl_LF& x, const cl_LF& y) { return (x <= y ? x : y); } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_precision.cc b/src/float/lfloat/misc/cl_LF_precision.cc index 7c9bdcd..2a2a411 100644 --- a/src/float/lfloat/misc/cl_LF_precision.cc +++ b/src/float/lfloat/misc/cl_LF_precision.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -15,9 +15,13 @@ #define MAYBE_INLINE inline #include "cl_LF_zerop.cc" +namespace cln { + MAYBE_INLINE2 uintL float_precision (const cl_LF& x) { if (zerop(x)) return 0; return intDsize*(uintL)(TheLfloat(x)->len); } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_shorten.cc b/src/float/lfloat/misc/cl_LF_shorten.cc index c3a023f..4d9696f 100644 --- a/src/float/lfloat/misc/cl_LF_shorten.cc +++ b/src/float/lfloat/misc/cl_LF_shorten.cc @@ -13,6 +13,8 @@ #include "cl_DS.h" #include "cl_F.h" +namespace cln { + const cl_LF shorten (const cl_LF& x, uintC len) { // x = 0.0 braucht nicht abgefangen zu werden, da bei Mantisse 0 dann @@ -42,3 +44,5 @@ const cl_LF shorten (const cl_LF& x, uintC len) } return y; } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_shortenrel.cc b/src/float/lfloat/misc/cl_LF_shortenrel.cc index 11c1c56..e37e72e 100644 --- a/src/float/lfloat/misc/cl_LF_shortenrel.cc +++ b/src/float/lfloat/misc/cl_LF_shortenrel.cc @@ -9,7 +9,7 @@ // Implementation. -#include "cl_abort.h" +#include "cln/abort.h" #undef MAYBE_INLINE2 #define MAYBE_INLINE2 inline @@ -18,6 +18,8 @@ #define MAYBE_INLINE inline #include "cl_LF_exponent.cc" +namespace cln { + const cl_LF cl_LF_shortenrelative (const cl_LF& x, const cl_LF& y) { // Methode: @@ -50,3 +52,5 @@ const cl_LF cl_LF_shortenrelative (const cl_LF& x, const cl_LF& y) else return x; } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_shortenwith.cc b/src/float/lfloat/misc/cl_LF_shortenwith.cc index 9b456f9..551c00e 100644 --- a/src/float/lfloat/misc/cl_LF_shortenwith.cc +++ b/src/float/lfloat/misc/cl_LF_shortenwith.cc @@ -9,7 +9,7 @@ // Implementation. -#include "cl_abort.h" +#include "cln/abort.h" #undef MAYBE_INLINE2 #define MAYBE_INLINE2 inline @@ -18,6 +18,8 @@ #define MAYBE_INLINE inline #include "cl_LF_exponent.cc" +namespace cln { + const cl_LF cl_LF_shortenwith (const cl_LF& x, const cl_LF& y) { // Methode: @@ -47,3 +49,5 @@ const cl_LF cl_LF_shortenwith (const cl_LF& x, const cl_LF& y) } else return x; } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_sign.cc b/src/float/lfloat/misc/cl_LF_sign.cc index 0d8787f..5fa601a 100644 --- a/src/float/lfloat/misc/cl_LF_sign.cc +++ b/src/float/lfloat/misc/cl_LF_sign.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -16,9 +16,13 @@ #define MAYBE_INLINE inline #include "cl_LF_minusp.cc" +namespace cln { + MAYBE_INLINE2 const cl_LF float_sign (const cl_LF& x) { // Methode: x>=0 -> Ergebnis 1.0; x<0 -> Ergebnis -1.0 return encode_LF1s(TheLfloat(x)->sign,TheLfloat(x)->len); } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_signum.cc b/src/float/lfloat/misc/cl_LF_signum.cc index 0ae4d41..eae4705 100644 --- a/src/float/lfloat/misc/cl_LF_signum.cc +++ b/src/float/lfloat/misc/cl_LF_signum.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_lfloat.h" +#include "cln/lfloat.h" // Implementation. @@ -17,6 +17,8 @@ #include "cl_LF_minusp.cc" #include "cl_LF_zerop.cc" +namespace cln { + MAYBE_INLINE2 const cl_LF signum (const cl_LF& x) { @@ -24,3 +26,5 @@ const cl_LF signum (const cl_LF& x) else // je nach Vorzeichen von x { return encode_LF1s(TheLfloat(x)->sign,TheLfloat(x)->len); } } + +} // namespace cln diff --git a/src/float/lfloat/misc/cl_LF_to_LF.cc b/src/float/lfloat/misc/cl_LF_to_LF.cc index 8426cd5..33232d5 100644 --- a/src/float/lfloat/misc/cl_LF_to_LF.cc +++ b/src/float/lfloat/misc/cl_LF_to_LF.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + const cl_LF LF_to_LF (const cl_LF& x, uintC len) { var uintC oldlen = TheLfloat(x)->len; @@ -17,3 +19,5 @@ const cl_LF LF_to_LF (const cl_LF& x, uintC len) // len = oldlen return x; } + +} // namespace cln diff --git a/src/float/misc/cl_F_abs.cc b/src/float/misc/cl_F_abs.cc index 879bc59..07df8c5 100644 --- a/src/float/misc/cl_F_abs.cc +++ b/src/float/misc/cl_F_abs.cc @@ -4,16 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #undef MAYBE_INLINE #define MAYBE_INLINE inline @@ -22,6 +22,8 @@ #include "cl_DF_minusp.cc" #include "cl_LF_minusp.cc" +namespace cln { + const cl_F abs (const cl_F& x) { // x<0 -> (- x), x>=0 -> x @@ -32,3 +34,5 @@ const cl_F abs (const cl_F& x) , if (minusp(x)) return -x; else return x; ); } + +} // namespace cln diff --git a/src/float/misc/cl_F_as.cc b/src/float/misc/cl_F_as.cc index 4f0f4c3..8301c8d 100644 --- a/src/float/misc/cl_F_as.cc +++ b/src/float/misc/cl_F_as.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_N.h" +namespace cln { + inline cl_boolean cl_F_p (const cl_number& x) { if (!x.pointer_p()) @@ -35,3 +37,5 @@ const cl_F& as_cl_F (const cl_number& x, const char * filename, int line) } else cl_as_error(x,"a floating-point number",filename,line); } + +} // namespace cln diff --git a/src/float/misc/cl_F_decode.cc b/src/float/misc/cl_F_decode.cc index af89c90..0c16e7c 100644 --- a/src/float/misc/cl_F_decode.cc +++ b/src/float/misc/cl_F_decode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -17,49 +17,51 @@ #include "cl_I.h" #include "cl_F.h" -inline const cl_decoded_float decode_float (const cl_SF& x) +namespace cln { + +inline const decoded_float decode_float (const cl_SF& x) { // x entpacken: var cl_signean sign; var sintL exp; var uint32 mant; - SF_decode(x, { return cl_decoded_float(SF_0, 0, SF_1); }, + SF_decode(x, { return decoded_float(SF_0, 0, SF_1); }, sign=,exp=,mant= ); - return cl_decoded_float( + return decoded_float( encode_SF(0,0,mant), // (-1)^0 * 2^0 * m erzeugen L_to_FN(exp), // e als Fixnum encode_SF(sign,1,bit(SF_mant_len)) // (-1)^s erzeugen ); } -inline const cl_decoded_float decode_float (const cl_FF& x) +inline const decoded_float decode_float (const cl_FF& x) { // x entpacken: var cl_signean sign; var sintL exp; var uint32 mant; - FF_decode(x, { return cl_decoded_float(cl_FF_0, 0, cl_FF_1); }, + FF_decode(x, { return decoded_float(cl_FF_0, 0, cl_FF_1); }, sign=,exp=,mant= ); - return cl_decoded_float( + return decoded_float( encode_FF(0,0,mant), // (-1)^0 * 2^0 * m erzeugen L_to_FN(exp), // e als Fixnum encode_FF(sign,1,bit(FF_mant_len)) // (-1)^s erzeugen ); } -inline const cl_decoded_float decode_float (const cl_DF& x) +inline const decoded_float decode_float (const cl_DF& x) { // x entpacken: var cl_signean sign; var sintL exp; #if (cl_word_size==64) var uint64 mant; - DF_decode(x, { return cl_decoded_float(cl_DF_0, 0, cl_DF_1); }, + DF_decode(x, { return decoded_float(cl_DF_0, 0, cl_DF_1); }, sign=,exp=,mant= ); - return cl_decoded_float( + return decoded_float( encode_DF(0,0,mant), // (-1)^0 * 2^0 * m erzeugen L_to_FN(exp), // e als Fixnum encode_DF(sign,1,bit(DF_mant_len)) // (-1)^s erzeugen @@ -67,10 +69,10 @@ inline const cl_decoded_float decode_float (const cl_DF& x) #else var uint32 manthi; var uint32 mantlo; - DF_decode2(x, { return cl_decoded_float(cl_DF_0, 0, cl_DF_1); }, + DF_decode2(x, { return decoded_float(cl_DF_0, 0, cl_DF_1); }, sign=,exp=,manthi=,mantlo= ); - return cl_decoded_float( + return decoded_float( encode_DF(0,0,manthi,mantlo), // (-1)^0 * 2^0 * m erzeugen L_to_FN(exp), // e als Fixnum encode_DF(sign,1,bit(DF_mant_len-32),0) // (-1)^s erzeugen @@ -78,23 +80,23 @@ inline const cl_decoded_float decode_float (const cl_DF& x) #endif } -inline const cl_decoded_float decode_float (const cl_LF& x) +inline const decoded_float decode_float (const cl_LF& x) { // x entpacken: var cl_signean sign; var sintL exp; var uintC mantlen; var const uintD* mantMSDptr; - LF_decode(x, { return cl_decoded_float(x, 0, encode_LF1(mantlen)); }, + LF_decode(x, { return decoded_float(x, 0, encode_LF1(mantlen)); }, sign=,exp=,mantMSDptr=,mantlen=,); - return cl_decoded_float( + return decoded_float( encode_LFu(0,0+LF_exp_mid,mantMSDptr,mantlen), // (-1)^0 * 2^0 * m erzeugen L_to_I(exp), // e als Fixnum encode_LF1s(sign,mantlen) // (-1)^s erzeugen ); } -const cl_decoded_float decode_float (const cl_F& x) +const decoded_float decode_float (const cl_F& x) { floatcase(x , return decode_float(x); @@ -103,3 +105,5 @@ const cl_decoded_float decode_float (const cl_F& x) , return decode_float(x); ); } + +} // namespace cln diff --git a/src/float/misc/cl_F_digits.cc b/src/float/misc/cl_F_digits.cc index 0e0e033..0c2212d 100644 --- a/src/float/misc/cl_F_digits.cc +++ b/src/float/misc/cl_F_digits.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -18,6 +18,8 @@ #include "cl_DF_digits.cc" #include "cl_LF_digits.cc" +namespace cln { + uintL float_digits (const cl_F& x) { floatcase(x @@ -27,3 +29,5 @@ uintL float_digits (const cl_F& x) , return float_digits(x); ); } + +} // namespace cln diff --git a/src/float/misc/cl_F_epsneg.cc b/src/float/misc/cl_F_epsneg.cc index c480f0f..89935d8 100644 --- a/src/float/misc/cl_F_epsneg.cc +++ b/src/float/misc/cl_F_epsneg.cc @@ -6,7 +6,7 @@ CL_PROVIDE(cl_F_epsneg) // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -17,6 +17,8 @@ CL_PROVIDE(cl_F_epsneg) #include "cl_LF.h" #include "cl_LF_impl.h" +namespace cln { + // Bei Floats mit d Bits (incl. Hiddem Bit, also d = ?F_mant_len+1) // ist ?F_negative_epsilon = 2^(-d-1)*(1+2^(1-d)), // d.h. Mantisse 10...01, Vorzeichen +. @@ -50,7 +52,7 @@ inline const cl_LF LF_negative_epsilon (uintC len) return erg; } -const cl_F float_negative_epsilon (cl_float_format_t f) +const cl_F float_negative_epsilon (float_format_t f) { floatformatcase((uintL)f , return SF_negative_epsilon; @@ -60,4 +62,6 @@ const cl_F float_negative_epsilon (cl_float_format_t f) ); } +} // namespace cln + CL_PROVIDE_END(cl_F_epsneg) diff --git a/src/float/misc/cl_F_epspos.cc b/src/float/misc/cl_F_epspos.cc index c39d106..52385c0 100644 --- a/src/float/misc/cl_F_epspos.cc +++ b/src/float/misc/cl_F_epspos.cc @@ -6,7 +6,7 @@ CL_PROVIDE(cl_F_epspos) // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -17,6 +17,8 @@ CL_PROVIDE(cl_F_epspos) #include "cl_LF.h" #include "cl_LF_impl.h" +namespace cln { + // Bei Floats mit d Bits (incl. Hiddem Bit, also d = ?F_mant_len+1) // ist ?F_epsilon = 2^-d*(1+2^(1-d)), d.h. Mantisse 10...01, Vorzeichen +. @@ -49,7 +51,7 @@ inline const cl_LF LF_epsilon (uintC len) return erg; } -const cl_F float_epsilon (cl_float_format_t f) +const cl_F float_epsilon (float_format_t f) { floatformatcase((uintL)f , return SF_epsilon; @@ -59,4 +61,6 @@ const cl_F float_epsilon (cl_float_format_t f) ); } +} // namespace cln + CL_PROVIDE_END(cl_F_epspos) diff --git a/src/float/misc/cl_F_eqhashcode.cc b/src/float/misc/cl_F_eqhashcode.cc index ae0b421..6f107a1 100644 --- a/src/float/misc/cl_F_eqhashcode.cc +++ b/src/float/misc/cl_F_eqhashcode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -19,12 +19,16 @@ #include "cl_DF_eqhashcode.cc" #include "cl_LF_eqhashcode.cc" -uint32 cl_equal_hashcode (const cl_F& x) +namespace cln { + +uint32 equal_hashcode (const cl_F& x) { floatcase(x - , return cl_equal_hashcode(x); - , return cl_equal_hashcode(x); - , return cl_equal_hashcode(x); - , return cl_equal_hashcode(x); + , return equal_hashcode(x); + , return equal_hashcode(x); + , return equal_hashcode(x); + , return equal_hashcode(x); ); } + +} // namespace cln diff --git a/src/float/misc/cl_F_exponent.cc b/src/float/misc/cl_F_exponent.cc index 490c960..10c89ba 100644 --- a/src/float/misc/cl_F_exponent.cc +++ b/src/float/misc/cl_F_exponent.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -18,6 +18,8 @@ #include "cl_DF_exponent.cc" #include "cl_LF_exponent.cc" +namespace cln { + sintL float_exponent (const cl_F& x) { floatcase(x @@ -27,3 +29,5 @@ sintL float_exponent (const cl_F& x) , return float_exponent(x); ); } + +} // namespace cln diff --git a/src/float/misc/cl_F_extendsqrt.cc b/src/float/misc/cl_F_extendsqrt.cc index 6faddb6..99f82e0 100644 --- a/src/float/misc/cl_F_extendsqrt.cc +++ b/src/float/misc/cl_F_extendsqrt.cc @@ -12,6 +12,8 @@ #include "cl_SF.h" #include "cl_LF.h" +namespace cln { + const cl_F cl_F_extendsqrt (const cl_F& x) { // Methode: @@ -35,3 +37,5 @@ const cl_F cl_F_extendsqrt (const cl_F& x) , return extend(x,cl_LF_len_incsqrt(TheLfloat(x)->len)); ); } + +} // namespace cln diff --git a/src/float/misc/cl_F_extendsqrtx.cc b/src/float/misc/cl_F_extendsqrtx.cc index ca9f891..51e9fa3 100644 --- a/src/float/misc/cl_F_extendsqrtx.cc +++ b/src/float/misc/cl_F_extendsqrtx.cc @@ -12,6 +12,8 @@ #include "cl_SF.h" #include "cl_LF.h" +namespace cln { + const cl_F cl_F_extendsqrtx (const cl_F& x) { // Methode: @@ -26,3 +28,5 @@ const cl_F cl_F_extendsqrtx (const cl_F& x) , return extend(x,cl_LF_len_incsqrtx(TheLfloat(x)->len)); ); } + +} // namespace cln diff --git a/src/float/misc/cl_F_idecode.cc b/src/float/misc/cl_F_idecode.cc index 88c2ba9..d6b0bb7 100644 --- a/src/float/misc/cl_F_idecode.cc +++ b/src/float/misc/cl_F_idecode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -18,6 +18,8 @@ #include "cl_DF_idecode.cc" #include "cl_LF_idecode.cc" +namespace cln { + const cl_idecoded_float integer_decode_float (const cl_F& x) { floatcase(x @@ -27,3 +29,5 @@ const cl_idecoded_float integer_decode_float (const cl_F& x) , return integer_decode_float(x); ); } + +} // namespace cln diff --git a/src/float/misc/cl_F_leastneg.cc b/src/float/misc/cl_F_leastneg.cc index 5f31488..8e669e8 100644 --- a/src/float/misc/cl_F_leastneg.cc +++ b/src/float/misc/cl_F_leastneg.cc @@ -6,7 +6,7 @@ CL_PROVIDE(cl_F_leastneg) // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -17,6 +17,8 @@ CL_PROVIDE(cl_F_leastneg) #include "cl_LF.h" #include "cl_LF_impl.h" +namespace cln { + // Exponent so klein wie möglich, Mantisse 10...0, Vorzeichen -. static const cl_SF least_negative_SF = @@ -45,7 +47,7 @@ inline const cl_LF least_negative_LF (uintC len) return erg; } -const cl_F least_negative_float (cl_float_format_t f) +const cl_F least_negative_float (float_format_t f) { floatformatcase((uintL)f , return least_negative_SF; @@ -55,4 +57,6 @@ const cl_F least_negative_float (cl_float_format_t f) ); } +} // namespace cln + CL_PROVIDE_END(cl_F_leastneg) diff --git a/src/float/misc/cl_F_leastpos.cc b/src/float/misc/cl_F_leastpos.cc index 4759378..d85014e 100644 --- a/src/float/misc/cl_F_leastpos.cc +++ b/src/float/misc/cl_F_leastpos.cc @@ -6,7 +6,7 @@ CL_PROVIDE(cl_F_leastpos) // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -17,6 +17,8 @@ CL_PROVIDE(cl_F_leastpos) #include "cl_LF.h" #include "cl_LF_impl.h" +namespace cln { + // Exponent so klein wie möglich, Mantisse 10...0, Vorzeichen +. static const cl_SF least_positive_SF = @@ -45,7 +47,7 @@ inline const cl_LF least_positive_LF (uintC len) return erg; } -const cl_F least_positive_float (cl_float_format_t f) +const cl_F least_positive_float (float_format_t f) { floatformatcase((uintL)f , return least_positive_SF; @@ -55,4 +57,6 @@ const cl_F least_positive_float (cl_float_format_t f) ); } +} // namespace cln + CL_PROVIDE_END(cl_F_leastpos) diff --git a/src/float/misc/cl_F_max.cc b/src/float/misc/cl_F_max.cc index d5f0fef..c6bd35e 100644 --- a/src/float/misc/cl_F_max.cc +++ b/src/float/misc/cl_F_max.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. +namespace cln { + const cl_F max (const cl_F& x, const cl_F& y) { return (x >= y ? x : y); } + +} // namespace cln diff --git a/src/float/misc/cl_F_min.cc b/src/float/misc/cl_F_min.cc index 4988f7e..104b6aa 100644 --- a/src/float/misc/cl_F_min.cc +++ b/src/float/misc/cl_F_min.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. +namespace cln { + const cl_F min (const cl_F& x, const cl_F& y) { return (x <= y ? x : y); } + +} // namespace cln diff --git a/src/float/misc/cl_F_mostneg.cc b/src/float/misc/cl_F_mostneg.cc index 066c630..1aa14b2 100644 --- a/src/float/misc/cl_F_mostneg.cc +++ b/src/float/misc/cl_F_mostneg.cc @@ -6,7 +6,7 @@ CL_PROVIDE(cl_F_mostneg) // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -17,6 +17,8 @@ CL_PROVIDE(cl_F_mostneg) #include "cl_LF.h" #include "cl_LF_impl.h" +namespace cln { + // Exponent so groß wie möglich, Mantisse 1...1, Vorzeichen -. static const cl_SF most_negative_SF = @@ -39,7 +41,7 @@ inline const cl_LF most_negative_LF (uintC len) return erg; } -const cl_F most_negative_float (cl_float_format_t f) +const cl_F most_negative_float (float_format_t f) { floatformatcase((uintL)f , return most_negative_SF; @@ -49,4 +51,6 @@ const cl_F most_negative_float (cl_float_format_t f) ); } +} // namespace cln + CL_PROVIDE_END(cl_F_mostneg) diff --git a/src/float/misc/cl_F_mostpos.cc b/src/float/misc/cl_F_mostpos.cc index 45668b4..ee3a42f 100644 --- a/src/float/misc/cl_F_mostpos.cc +++ b/src/float/misc/cl_F_mostpos.cc @@ -6,7 +6,7 @@ CL_PROVIDE(cl_F_mostpos) // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -17,6 +17,8 @@ CL_PROVIDE(cl_F_mostpos) #include "cl_LF.h" #include "cl_LF_impl.h" +namespace cln { + // Exponent so groß wie möglich, Mantisse 1...1, Vorzeichen +. static const cl_SF most_positive_SF = @@ -39,7 +41,7 @@ inline const cl_LF most_positive_LF (uintC len) return erg; } -const cl_F most_positive_float (cl_float_format_t f) +const cl_F most_positive_float (float_format_t f) { floatformatcase((uintL)f , return most_positive_SF; @@ -49,4 +51,6 @@ const cl_F most_positive_float (cl_float_format_t f) ); } +} // namespace cln + CL_PROVIDE_END(cl_F_mostpos) diff --git a/src/float/misc/cl_F_precision.cc b/src/float/misc/cl_F_precision.cc index eebe4e6..a2a167c 100644 --- a/src/float/misc/cl_F_precision.cc +++ b/src/float/misc/cl_F_precision.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -18,6 +18,8 @@ #include "cl_DF_precision.cc" #include "cl_LF_precision.cc" +namespace cln { + uintL float_precision (const cl_F& x) { floatcase(x @@ -27,3 +29,5 @@ uintL float_precision (const cl_F& x) , return float_precision(x); ); } + +} // namespace cln diff --git a/src/float/misc/cl_F_rational.cc b/src/float/misc/cl_F_rational.cc index bef429c..fdbc1ff 100644 --- a/src/float/misc/cl_F_rational.cc +++ b/src/float/misc/cl_F_rational.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_RA.h" +namespace cln { + const cl_RA rational (const cl_F& x) { // Methode: @@ -47,3 +49,5 @@ const cl_RA rational (const cl_F& x) #endif } } + +} // namespace cln diff --git a/src/float/misc/cl_F_shortenrel.cc b/src/float/misc/cl_F_shortenrel.cc index 63118d0..2438a76 100644 --- a/src/float/misc/cl_F_shortenrel.cc +++ b/src/float/misc/cl_F_shortenrel.cc @@ -10,7 +10,9 @@ // Implementation. #include "cl_LF.h" -#include "cl_abort.h" +#include "cln/abort.h" + +namespace cln { const cl_F cl_F_shortenrelative (const cl_F& x, const cl_F& y) { @@ -46,3 +48,5 @@ const cl_F cl_F_shortenrelative (const cl_F& x, const cl_F& y) return x; ); } + +} // namespace cln diff --git a/src/float/misc/cl_F_sign.cc b/src/float/misc/cl_F_sign.cc index 050272d..0f96b66 100644 --- a/src/float/misc/cl_F_sign.cc +++ b/src/float/misc/cl_F_sign.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -18,6 +18,8 @@ #include "cl_DF_sign.cc" #include "cl_LF_sign.cc" +namespace cln { + const cl_F float_sign (const cl_F& x) { // Methode: x>=0 -> Ergebnis 1.0; x<0 -> Ergebnis -1.0 @@ -28,3 +30,5 @@ const cl_F float_sign (const cl_F& x) , return float_sign(x); ); } + +} // namespace cln diff --git a/src/float/misc/cl_F_sign2.cc b/src/float/misc/cl_F_sign2.cc index edde7de..9e13494 100644 --- a/src/float/misc/cl_F_sign2.cc +++ b/src/float/misc/cl_F_sign2.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F.h" +namespace cln { + const cl_F float_sign (const cl_F& x, const cl_F& y) { // Methode: @@ -20,3 +22,5 @@ const cl_F float_sign (const cl_F& x, const cl_F& y) else return y; } + +} // namespace cln diff --git a/src/float/misc/cl_F_signum.cc b/src/float/misc/cl_F_signum.cc index 5d3b945..0b51f9e 100644 --- a/src/float/misc/cl_F_signum.cc +++ b/src/float/misc/cl_F_signum.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -18,6 +18,8 @@ #include "cl_DF_signum.cc" #include "cl_LF_signum.cc" +namespace cln { + const cl_F signum (const cl_F& x) { floatcase(x @@ -27,3 +29,5 @@ const cl_F signum (const cl_F& x) , return signum(x); ); } + +} // namespace cln diff --git a/src/float/misc/cl_float_format.cc b/src/float/misc/cl_float_format.cc index d033ddd..5bfbf60 100644 --- a/src/float/misc/cl_float_format.cc +++ b/src/float/misc/cl_float_format.cc @@ -1,15 +1,17 @@ -// cl_float_format(). +// float_format(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. -cl_float_format_t cl_float_format (uintL n) +namespace cln { + +float_format_t float_format (uintL n) { // Methode: // Mindestens 1+n Dezimalstellen (inklusive Vorkommastelle) @@ -19,9 +21,11 @@ cl_float_format_t cl_float_format (uintL n) // Durch diese Berechnungsmethode wird das Ergebnis sicher >= (1+n)*ln(10)/ln(2) // sein, evtl. um ein paar Bit zu groß, aber nicht zu klein. n = 1+n; - return (cl_float_format_t) + return (float_format_t) ((n << 2) - (n >> 1) - (n >> 3) - (n >> 5) - (n >> 6) - (n >> 8) - (n >> 9) - (n >> 12) - (n >> 14) - (n >> 15) ); } + +} // namespace cln diff --git a/src/float/output/cl_F_aprint.cc b/src/float/output/cl_F_aprint.cc index 5c1e5d3..2a3ff1e 100644 --- a/src/float/output/cl_F_aprint.cc +++ b/src/float/output/cl_F_aprint.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float_io.h" +#include "cln/float_io.h" // Implementation. -#include "cl_output.h" +#include "cln/output.h" + +namespace cln { void print_float (cl_ostream stream, const cl_print_flags& flags, const cl_F& z) { print_float(stream,(const cl_print_number_flags&)flags,z); } + +} // namespace cln diff --git a/src/float/output/cl_F_bprint.cc b/src/float/output/cl_F_bprint.cc index d19e1d5..aacc49c 100644 --- a/src/float/output/cl_F_bprint.cc +++ b/src/float/output/cl_F_bprint.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float_io.h" +#include "cln/float_io.h" // Implementation. -#include "cl_output.h" +#include "cln/output.h" + +namespace cln { void print_float (cl_ostream stream, const cl_print_number_flags& flags, const cl_F& z) { print_float(stream,(const cl_print_real_flags&)flags,z); } + +} // namespace cln diff --git a/src/float/output/cl_F_cprint.cc b/src/float/output/cl_F_cprint.cc index 28a3bd1..24985a2 100644 --- a/src/float/output/cl_F_cprint.cc +++ b/src/float/output/cl_F_cprint.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float_io.h" +#include "cln/float_io.h" // Implementation. -#include "cl_output.h" +#include "cln/output.h" + +namespace cln { void print_float (cl_ostream stream, const cl_print_real_flags& flags, const cl_F& z) { print_float(stream,(const cl_print_float_flags&)flags,z); } + +} // namespace cln diff --git a/src/float/output/cl_F_dprint.cc b/src/float/output/cl_F_dprint.cc index 8159e32..4b156c0 100644 --- a/src/float/output/cl_F_dprint.cc +++ b/src/float/output/cl_F_dprint.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float_io.h" +#include "cln/float_io.h" // Implementation. @@ -31,17 +31,19 @@ CL_REQUIRE(cl_F_ln2_var) CL_REQUIRE(cl_F_ln10_var) #include -#include "cl_output.h" +#include "cln/output.h" #include "cl_sstring.h" -#include "cl_float.h" +#include "cln/float.h" #include "cl_F.h" #include "cl_LF.h" #include "cl_F_tran.h" -#include "cl_rational.h" -#include "cl_integer.h" -#include "cl_integer_io.h" +#include "cln/rational.h" +#include "cln/integer.h" +#include "cln/integer_io.h" #include "cl_I.h" +namespace cln { + // Hauptfunktion zur Umwandlung von Floats ins Dezimalsystem: // Zu einem Float x werden ein String as und drei Integers k,e,s // berechnet mit folgenden Eigenschaften: @@ -144,7 +146,7 @@ static const cl_decimal_decoded_float decode_float_decimal (const cl_F& x) // e*log(2)-d*log(10) nötig. Dazu mit l'=integerlength(e) // für log(2): g+7+l' Bits abs. Gen., g+7+l' Bits rel. Gen., // für log(10): g+7+l' Bits abs. Gen., g+7+l'+2 Bist rel. Gen. - var cl_float_format_t gen = (cl_float_format_t)(g + integer_length(e) + 9); // Genauigkeit + var float_format_t gen = (float_format_t)(g + integer_length(e) + 9); // Genauigkeit var cl_F f2g = exp(The(cl_F)(e * cl_ln2(gen)) - The(cl_F)(d * cl_ln10(gen))); // f/2^g // Das so berechnete f/2^g ist >1, <100. // Mit 2^g multiplizieren und auf eine ganze Zahl runden: @@ -315,7 +317,7 @@ static const cl_decimal_decoded_float decode_float_decimal (const cl_F& x) // Nun a in einen Dezimalstring umwandeln // und dann Nullen am Schluß streichen: var char* as = cl_decimal_string(a); // Ziffernfolge zu a>0 - var uintL las = strlen(as); // Länge der Ziffernfolge + var uintL las = ::strlen(as); // Länge der Ziffernfolge var uintL k = las; // Länge ohne die gestrichenen Nullen am Schluß var cl_I ee = k+d; // a * 10^d = a * 10^(-k+ee) while (as[k-1] == '0') // eine 0 am Schluß? @@ -353,7 +355,7 @@ static const cl_decimal_decoded_float decode_float_decimal (const cl_F& x) } } var char* as = cl_decimal_string(a); // Ziffernfolge zu a>0 - var uintL k = strlen(as); + var uintL k = ::strlen(as); ASSERT(as[k-1] != '0'); return cl_decimal_decoded_float(as,k,k+d,sign); } @@ -438,5 +440,7 @@ void print_float (cl_ostream stream, const cl_print_float_flags& flags, const cl print_integer(stream,10,expo); } // Fertig. Aufräumen. - cl_free_hook(mantstring); + free_hook(mantstring); } + +} // namespace cln diff --git a/src/float/output/cl_F_printb.cc b/src/float/output/cl_F_printb.cc index fb0b598..7c20abb 100644 --- a/src/float/output/cl_F_printb.cc +++ b/src/float/output/cl_F_printb.cc @@ -4,16 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float_io.h" +#include "cln/float_io.h" // Implementation. -#include "cl_float.h" +#include "cln/float.h" #include "cl_F.h" -#include "cl_integer_io.h" +#include "cln/integer_io.h" #include "cl_I.h" +namespace cln { + void print_float_binary (cl_ostream stream, const cl_F& z) { // Vorzeichen, Punkt, Mantisse (binär), (Zweiersystem-)Exponent (dezimal) @@ -40,3 +42,5 @@ void print_float_binary (cl_ostream stream, const cl_F& z) // Exponenten dezimal ausgeben: print_integer(stream,10,cl_I(float_exponent(z))); } + +} // namespace cln diff --git a/src/float/random/cl_F_random.cc b/src/float/random/cl_F_random.cc index d37fe65..64c6dc0 100644 --- a/src/float/random/cl_F_random.cc +++ b/src/float/random/cl_F_random.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -13,7 +13,9 @@ #include "cl_DS.h" #include "cl_I.h" -const cl_F random_F (cl_random_state& randomstate, const cl_F& n) +namespace cln { + +const cl_F random_F (random_state& randomstate, const cl_F& n) { var uintL d = float_digits(n); // d = (float-digits n) > 0 // Bilde neue UDS mit d Zufallsbits: @@ -35,3 +37,5 @@ const cl_F random_F (cl_random_state& randomstate, const cl_F& n) { result = cl_float(0,result); } return result; } + +} // namespace cln diff --git a/src/float/sfloat/algebraic/cl_SF_sqrt.cc b/src/float/sfloat/algebraic/cl_SF_sqrt.cc index fbb254b..c1eba13 100644 --- a/src/float/sfloat/algebraic/cl_SF_sqrt.cc +++ b/src/float/sfloat/algebraic/cl_SF_sqrt.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_SF.h" #include "cl_low.h" +namespace cln { + const cl_SF sqrt (const cl_SF& x) { // Methode: @@ -62,3 +64,5 @@ const cl_SF sqrt (const cl_SF& x) } return encode_SF(0,exp,mant); } + +} // namespace cln diff --git a/src/float/sfloat/cl_SF.h b/src/float/sfloat/cl_SF.h index 07e6ef9..ab0f9f7 100644 --- a/src/float/sfloat/cl_SF.h +++ b/src/float/sfloat/cl_SF.h @@ -3,9 +3,11 @@ #ifndef _CL_SF_H #define _CL_SF_H -#include "cl_number.h" +#include "cln/number.h" #include "cl_F.h" +namespace cln { + // The immediate word contains: // |..|.......|..........................|....| // sign exponent mantissa tag @@ -130,4 +132,6 @@ extern const cl_SF cl_I_to_SF (const cl_I& x); // und rundet dabei. extern const cl_SF cl_RA_to_SF (const cl_RA& x); +} // namespace cln + #endif /* _CL_SF_H */ diff --git a/src/float/sfloat/division/cl_SF_ceil22.cc b/src/float/sfloat/division/cl_SF_ceil22.cc index a9c5bcc..db837ea 100644 --- a/src/float/sfloat/division/cl_SF_ceil22.cc +++ b/src/float/sfloat/division/cl_SF_ceil22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. #include "cl_SF.h" +namespace cln { + const cl_SF_div_t ceiling2 (const cl_SF& x, const cl_SF& y) { // Methode: @@ -20,3 +22,5 @@ const cl_SF_div_t ceiling2 (const cl_SF& x, const cl_SF& y) var cl_SF& r = q_r.remainder; return cl_SF_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/sfloat/division/cl_SF_fceil.cc b/src/float/sfloat/division/cl_SF_fceil.cc index ba46ba8..98b2498 100644 --- a/src/float/sfloat/division/cl_SF_fceil.cc +++ b/src/float/sfloat/division/cl_SF_fceil.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -15,6 +15,8 @@ #define MAYBE_INLINE inline #include "cl_SF_minusp.cc" +namespace cln { + const cl_SF fceiling (const cl_SF& x) { if (minusp(x)) @@ -22,3 +24,5 @@ const cl_SF fceiling (const cl_SF& x) else return futruncate(x); } + +} // namespace cln diff --git a/src/float/sfloat/division/cl_SF_ffloor.cc b/src/float/sfloat/division/cl_SF_ffloor.cc index f381d22..2f66751 100644 --- a/src/float/sfloat/division/cl_SF_ffloor.cc +++ b/src/float/sfloat/division/cl_SF_ffloor.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -15,6 +15,8 @@ #define MAYBE_INLINE inline #include "cl_SF_minusp.cc" +namespace cln { + const cl_SF ffloor (const cl_SF& x) { if (minusp(x)) @@ -22,3 +24,5 @@ const cl_SF ffloor (const cl_SF& x) else return ftruncate(x); } + +} // namespace cln diff --git a/src/float/sfloat/division/cl_SF_floor22.cc b/src/float/sfloat/division/cl_SF_floor22.cc index adf10d0..af4c765 100644 --- a/src/float/sfloat/division/cl_SF_floor22.cc +++ b/src/float/sfloat/division/cl_SF_floor22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. #include "cl_SF.h" +namespace cln { + const cl_SF_div_t floor2 (const cl_SF& x, const cl_SF& y) { // Methode: @@ -20,3 +22,5 @@ const cl_SF_div_t floor2 (const cl_SF& x, const cl_SF& y) var cl_SF& r = q_r.remainder; return cl_SF_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/sfloat/division/cl_SF_recip.cc b/src/float/sfloat/division/cl_SF_recip.cc index 508c1cb..23f62f8 100644 --- a/src/float/sfloat/division/cl_SF_recip.cc +++ b/src/float/sfloat/division/cl_SF_recip.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. #include "cl_SF.h" +namespace cln { + const cl_SF recip (const cl_SF& x) { return SF_1 / x; } + +} // namespace cln diff --git a/src/float/sfloat/division/cl_SF_round22.cc b/src/float/sfloat/division/cl_SF_round22.cc index cc4720b..d9fde3f 100644 --- a/src/float/sfloat/division/cl_SF_round22.cc +++ b/src/float/sfloat/division/cl_SF_round22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. #include "cl_SF.h" +namespace cln { + const cl_SF_div_t round2 (const cl_SF& x, const cl_SF& y) { // Methode: @@ -20,3 +22,5 @@ const cl_SF_div_t round2 (const cl_SF& x, const cl_SF& y) var cl_SF& r = q_r.remainder; return cl_SF_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/sfloat/division/cl_SF_trunc22.cc b/src/float/sfloat/division/cl_SF_trunc22.cc index d7737ef..8fd7368 100644 --- a/src/float/sfloat/division/cl_SF_trunc22.cc +++ b/src/float/sfloat/division/cl_SF_trunc22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. #include "cl_SF.h" +namespace cln { + const cl_SF_div_t truncate2 (const cl_SF& x, const cl_SF& y) { // Methode: @@ -20,3 +22,5 @@ const cl_SF_div_t truncate2 (const cl_SF& x, const cl_SF& y) var cl_SF& r = q_r.remainder; return cl_SF_div_t(q,y*r); } + +} // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_compare.cc b/src/float/sfloat/elem/cl_SF_compare.cc index d6c022c..ba3bb35 100644 --- a/src/float/sfloat/elem/cl_SF_compare.cc +++ b/src/float/sfloat/elem/cl_SF_compare.cc @@ -1,10 +1,10 @@ -// cl_compare(). +// compare(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -13,7 +13,9 @@ #define MAYBE_INLINE inline #include "cl_SF_minusp.cc" -cl_signean cl_compare (const cl_SF& x, const cl_SF& y) +namespace cln { + +cl_signean compare (const cl_SF& x, const cl_SF& y) { // Methode: // x und y haben verschiedenes Vorzeichen -> @@ -46,3 +48,5 @@ cl_signean cl_compare (const cl_SF& x, const cl_SF& y) } } } + +} // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_div.cc b/src/float/sfloat/elem/cl_SF_div.cc index ca315e1..e71e5de 100644 --- a/src/float/sfloat/elem/cl_SF_div.cc +++ b/src/float/sfloat/elem/cl_SF_div.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_N.h" #include "cl_low.h" +namespace cln { + const cl_SF operator/ (const cl_SF& x1, const cl_SF& x2) { // Methode: @@ -84,3 +86,5 @@ const cl_SF operator/ (const cl_SF& x1, const cl_SF& x2) } } return encode_SF(sign1,exp1,mant); } + +} // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_from_I.cc b/src/float/sfloat/elem/cl_SF_from_I.cc index edaa1a5..1ba7b77 100644 --- a/src/float/sfloat/elem/cl_SF_from_I.cc +++ b/src/float/sfloat/elem/cl_SF_from_I.cc @@ -9,10 +9,12 @@ // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_DS.h" +namespace cln { + const cl_SF cl_I_to_SF (const cl_I& x) { // Methode: @@ -112,3 +114,5 @@ const cl_SF cl_I_to_SF (const cl_I& x) #endif return encode_SF(sign,(sintL)exp,mant); } + +} // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_from_RA.cc b/src/float/sfloat/elem/cl_SF_from_RA.cc index ef157b2..e5f73bf 100644 --- a/src/float/sfloat/elem/cl_SF_from_RA.cc +++ b/src/float/sfloat/elem/cl_SF_from_RA.cc @@ -10,9 +10,11 @@ // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" +namespace cln { + const cl_SF cl_RA_to_SF (const cl_RA& x) { // Methode: @@ -102,3 +104,5 @@ const cl_SF cl_RA_to_SF (const cl_RA& x) // Fertig. return encode_SF(sign,lendiff,mant); }} + +} // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_fround.cc b/src/float/sfloat/elem/cl_SF_fround.cc index 1a651d7..1b70ad2 100644 --- a/src/float/sfloat/elem/cl_SF_fround.cc +++ b/src/float/sfloat/elem/cl_SF_fround.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. #include "cl_SF.h" +namespace cln { + const cl_SF fround (const cl_SF& x) { // Methode: @@ -75,3 +77,5 @@ const cl_SF fround (const cl_SF& x) } } } } + +} // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_ftrunc.cc b/src/float/sfloat/elem/cl_SF_ftrunc.cc index 073b0f6..8bbeb0a 100644 --- a/src/float/sfloat/elem/cl_SF_ftrunc.cc +++ b/src/float/sfloat/elem/cl_SF_ftrunc.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. #include "cl_SF.h" +namespace cln { + const cl_SF ftruncate (const cl_SF& x) { // Methode: @@ -32,3 +34,5 @@ const cl_SF ftruncate (const cl_SF& x) } } } + +} // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_futrunc.cc b/src/float/sfloat/elem/cl_SF_futrunc.cc index 867d992..458eb0d 100644 --- a/src/float/sfloat/elem/cl_SF_futrunc.cc +++ b/src/float/sfloat/elem/cl_SF_futrunc.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + const cl_SF futruncate (const cl_SF& x) { // Methode: @@ -47,3 +49,5 @@ const cl_SF futruncate (const cl_SF& x) ); } } } + +} // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_minus.cc b/src/float/sfloat/elem/cl_SF_minus.cc index 0447196..3496e63 100644 --- a/src/float/sfloat/elem/cl_SF_minus.cc +++ b/src/float/sfloat/elem/cl_SF_minus.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -15,6 +15,8 @@ #define MAYBE_INLINE inline #include "cl_SF_zerop.cc" +namespace cln { + const cl_SF operator- (const cl_SF& x1, const cl_SF& x2) { // Methode: @@ -24,3 +26,5 @@ const cl_SF operator- (const cl_SF& x1, const cl_SF& x2) else return x1 + cl_SF_from_word(x2.word ^ bit(SF_sign_shift)); } + +} // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_minusp.cc b/src/float/sfloat/elem/cl_SF_minusp.cc index 900519d..6e63159 100644 --- a/src/float/sfloat/elem/cl_SF_minusp.cc +++ b/src/float/sfloat/elem/cl_SF_minusp.cc @@ -4,15 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. #include "cl_SF.h" +namespace cln { + MAYBE_INLINE cl_boolean minusp (const cl_SF& x) { return (cl_boolean) ((x.word & bit(SF_sign_shift)) != 0); } + +} // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_mul.cc b/src/float/sfloat/elem/cl_SF_mul.cc index 3e5556d..642b05d 100644 --- a/src/float/sfloat/elem/cl_SF_mul.cc +++ b/src/float/sfloat/elem/cl_SF_mul.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_SF.h" #include "cl_low.h" +namespace cln { + const cl_SF operator* (const cl_SF& x1, const cl_SF& x2) { // Methode: @@ -94,3 +96,5 @@ const cl_SF operator* (const cl_SF& x1, const cl_SF& x2) // Runden fertig, 2^SF_mant_len <= manthi < 2^(SF_mant_len+1) return encode_SF(sign1,exp1,manthi); } + +} // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_plus.cc b/src/float/sfloat/elem/cl_SF_plus.cc index 9e81451..2f4fc48 100644 --- a/src/float/sfloat/elem/cl_SF_plus.cc +++ b/src/float/sfloat/elem/cl_SF_plus.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_SF.h" #include "cl_xmacros.h" +namespace cln { + const cl_SF operator+ (const cl_SF& x1, const cl_SF& x2) { // Methode (nach [Knuth, II, Seminumerical Algorithms, Abschnitt 4.2.1., S.200]): @@ -122,3 +124,5 @@ const cl_SF operator+ (const cl_SF& x1, const cl_SF& x2) return encode_SF(sign1,exp1,mant1); } } + +} // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_plusp.cc b/src/float/sfloat/elem/cl_SF_plusp.cc index 7fe1a0c..abc59e0 100644 --- a/src/float/sfloat/elem/cl_SF_plusp.cc +++ b/src/float/sfloat/elem/cl_SF_plusp.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -16,6 +16,8 @@ #include "cl_SF_minusp.cc" #include "cl_SF_zerop.cc" +namespace cln { + MAYBE_INLINE2 cl_boolean plusp (const cl_SF& x) { @@ -26,3 +28,5 @@ cl_boolean plusp (const cl_SF& x) else return cl_true; // sonst ist x>0. } + +} // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_scale.cc b/src/float/sfloat/elem/cl_SF_scale.cc index 4981e26..7e7e142 100644 --- a/src/float/sfloat/elem/cl_SF_scale.cc +++ b/src/float/sfloat/elem/cl_SF_scale.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_SF.h" #include "cl_F.h" +namespace cln { + const cl_SF scale_float (const cl_SF& x, sintL delta) { // Methode: @@ -47,3 +49,5 @@ const cl_SF scale_float (const cl_SF& x, sintL delta) { return SF_0; } } } + +} // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_scale_I.cc b/src/float/sfloat/elem/cl_SF_scale_I.cc index 443c2d7..1d0fe43 100644 --- a/src/float/sfloat/elem/cl_SF_scale_I.cc +++ b/src/float/sfloat/elem/cl_SF_scale_I.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_F.h" #include "cl_I.h" +namespace cln { + const cl_SF scale_float (const cl_SF& x, const cl_I& delta) { // Methode: @@ -53,3 +55,5 @@ const cl_SF scale_float (const cl_SF& x, const cl_I& delta) { return SF_0; } } } + +} // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_to_I.cc b/src/float/sfloat/elem/cl_SF_to_I.cc index 5c965a3..0483029 100644 --- a/src/float/sfloat/elem/cl_SF_to_I.cc +++ b/src/float/sfloat/elem/cl_SF_to_I.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" +namespace cln { + const cl_I cl_SF_to_I (const cl_SF& x) { // x entpacken: @@ -27,3 +29,5 @@ const cl_I cl_SF_to_I (const cl_SF& x) exp ); } + +} // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_uminus.cc b/src/float/sfloat/elem/cl_SF_uminus.cc index 7887698..93f3b31 100644 --- a/src/float/sfloat/elem/cl_SF_uminus.cc +++ b/src/float/sfloat/elem/cl_SF_uminus.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -15,6 +15,8 @@ #define MAYBE_INLINE inline #include "cl_SF_zerop.cc" +namespace cln { + const cl_SF operator- (const cl_SF& x) { // Methode: @@ -23,3 +25,5 @@ const cl_SF operator- (const cl_SF& x) return SF_0; return cl_SF_from_word(x.word ^ ((cl_uint)1 << SF_sign_shift)); } + +} // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_zerop.cc b/src/float/sfloat/elem/cl_SF_zerop.cc index 0a876d8..9404d0a 100644 --- a/src/float/sfloat/elem/cl_SF_zerop.cc +++ b/src/float/sfloat/elem/cl_SF_zerop.cc @@ -4,15 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. #include "cl_SF.h" +namespace cln { + MAYBE_INLINE cl_boolean zerop (const cl_SF& x) { return (cl_boolean) (x.word == make_SF_word(0,0,0)); } + +} // namespace cln diff --git a/src/float/sfloat/input/cl_SF_from_string.cc b/src/float/sfloat/input/cl_SF_from_string.cc index 6c9767e..063708e 100644 --- a/src/float/sfloat/input/cl_SF_from_string.cc +++ b/src/float/sfloat/input/cl_SF_from_string.cc @@ -4,20 +4,22 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat_class.h" +#include "cln/sfloat_class.h" // Implementation. -#include "cl_sfloat.h" -#include "cl_input.h" -#include "cl_float_io.h" +#include "cln/sfloat.h" +#include "cln/input.h" +#include "cln/float_io.h" + +namespace cln { cl_read_flags cl_SF_read_flags = { syntax_sfloat, lsyntax_all, 10, - { cl_float_format_sfloat, cl_float_format_lfloat_min, cl_false } + { float_format_sfloat, float_format_lfloat_min, cl_false } }; cl_SF::cl_SF (const char * string) @@ -25,3 +27,5 @@ cl_SF::cl_SF (const char * string) pointer = as_cl_private_thing( As(cl_SF)(read_float(cl_SF_read_flags,string,NULL,NULL))); } + +} // namespace cln diff --git a/src/float/sfloat/misc/cl_SF_abs.cc b/src/float/sfloat/misc/cl_SF_abs.cc index e65bb4e..4aeddde 100644 --- a/src/float/sfloat/misc/cl_SF_abs.cc +++ b/src/float/sfloat/misc/cl_SF_abs.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -13,8 +13,12 @@ #define MAYBE_INLINE inline #include "cl_SF_minusp.cc" +namespace cln { + const cl_SF abs (const cl_SF& x) { // x<0 -> (- x), x>=0 -> x if (minusp(x)) return -x; else return x; } + +} // namespace cln diff --git a/src/float/sfloat/misc/cl_SF_as.cc b/src/float/sfloat/misc/cl_SF_as.cc index fd02392..bcbe9ac 100644 --- a/src/float/sfloat/misc/cl_SF_as.cc +++ b/src/float/sfloat/misc/cl_SF_as.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. #include "cl_N.h" +namespace cln { + inline cl_boolean cl_SF_p (const cl_number& x) { if (!x.pointer_p()) @@ -27,3 +29,5 @@ const cl_SF& as_cl_SF (const cl_number& x, const char * filename, int line) } else cl_as_error(x,"a short-float number",filename,line); } + +} // namespace cln diff --git a/src/float/sfloat/misc/cl_SF_class.cc b/src/float/sfloat/misc/cl_SF_class.cc index f487db9..a4db7ba 100644 --- a/src/float/sfloat/misc/cl_SF_class.cc +++ b/src/float/sfloat/misc/cl_SF_class.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. +namespace cln { + cl_class cl_class_sfloat = { NULL, // destructor not used, since not heap objects cl_class_flags_subclass_complex | cl_class_flags_subclass_real | cl_class_flags_subclass_float @@ -18,3 +20,5 @@ AT_INITIALIZATION(ini_class_sfloat) { cl_immediate_classes[cl_SF_tag] = &cl_class_sfloat; } + +} // namespace cln diff --git a/src/float/sfloat/misc/cl_SF_debug.cc b/src/float/sfloat/misc/cl_SF_debug.cc index 256e8e1..c7b4531 100644 --- a/src/float/sfloat/misc/cl_SF_debug.cc +++ b/src/float/sfloat/misc/cl_SF_debug.cc @@ -8,9 +8,11 @@ // Implementation. -#include "cl_sfloat.h" -#include "cl_io.h" -#include "cl_float_io.h" +#include "cln/sfloat.h" +#include "cln/io.h" +#include "cln/float_io.h" + +namespace cln { static void dprint (cl_heap* pointer) { @@ -21,5 +23,7 @@ static void dprint (cl_heap* pointer) AT_INITIALIZATION(dprint_SF) { cl_register_type_printer(cl_class_sfloat,dprint); } -// This dummy links in this module when requires it. +// This dummy links in this module when requires it. int cl_SF_debug_module; + +} // namespace cln diff --git a/src/float/sfloat/misc/cl_SF_decode.cc b/src/float/sfloat/misc/cl_SF_decode.cc index ec78a27..ea0004a 100644 --- a/src/float/sfloat/misc/cl_SF_decode.cc +++ b/src/float/sfloat/misc/cl_SF_decode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -12,18 +12,22 @@ #include "cl_SF.h" #include "cl_I.h" -const cl_decoded_sfloat decode_float (const cl_SF& x) +namespace cln { + +const decoded_sfloat decode_float (const cl_SF& x) { // x entpacken: var cl_signean sign; var sintL exp; var uint32 mant; - SF_decode(x, { return cl_decoded_sfloat(SF_0, 0, SF_1); }, + SF_decode(x, { return decoded_sfloat(SF_0, 0, SF_1); }, sign=,exp=,mant= ); - return cl_decoded_sfloat( + return decoded_sfloat( encode_SF(0,0,mant), // (-1)^0 * 2^0 * m erzeugen L_to_FN(exp), // e als Fixnum encode_SF(sign,1,bit(SF_mant_len)) // (-1)^s erzeugen ); } + +} // namespace cln diff --git a/src/float/sfloat/misc/cl_SF_digits.cc b/src/float/sfloat/misc/cl_SF_digits.cc index aa92266..35043de 100644 --- a/src/float/sfloat/misc/cl_SF_digits.cc +++ b/src/float/sfloat/misc/cl_SF_digits.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. #include "cl_SF.h" +namespace cln { + MAYBE_INLINE uintL float_digits (const cl_SF& x) { unused x; return SF_mant_len+1; // 17 } + +} // namespace cln diff --git a/src/float/sfloat/misc/cl_SF_eqhashcode.cc b/src/float/sfloat/misc/cl_SF_eqhashcode.cc index e5fcbe6..948d70d 100644 --- a/src/float/sfloat/misc/cl_SF_eqhashcode.cc +++ b/src/float/sfloat/misc/cl_SF_eqhashcode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -12,8 +12,10 @@ #include "cl_N.h" #include "cl_SF.h" +namespace cln { + MAYBE_INLINE -uint32 cl_equal_hashcode (const cl_SF& x) +uint32 equal_hashcode (const cl_SF& x) { var cl_signean sign; var sintL exp; @@ -22,3 +24,5 @@ uint32 cl_equal_hashcode (const cl_SF& x) var uint32 msd = mant << (32-(SF_mant_len+1)); return equal_hashcode_low(msd,exp,sign); } + +} // namespace cln diff --git a/src/float/sfloat/misc/cl_SF_exponent.cc b/src/float/sfloat/misc/cl_SF_exponent.cc index 3717277..d9c8f3b 100644 --- a/src/float/sfloat/misc/cl_SF_exponent.cc +++ b/src/float/sfloat/misc/cl_SF_exponent.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. #include "cl_SF.h" +namespace cln { + MAYBE_INLINE sintL float_exponent (const cl_SF& x) { @@ -18,3 +20,5 @@ sintL float_exponent (const cl_SF& x) if (uexp==0) { return 0; } return (sintL)(uexp - SF_exp_mid); } + +} // namespace cln diff --git a/src/float/sfloat/misc/cl_SF_idecode.cc b/src/float/sfloat/misc/cl_SF_idecode.cc index a3b59a5..2fa34c1 100644 --- a/src/float/sfloat/misc/cl_SF_idecode.cc +++ b/src/float/sfloat/misc/cl_SF_idecode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_SF.h" #include "cl_I.h" +namespace cln { + MAYBE_INLINE const cl_idecoded_float integer_decode_float (const cl_SF& x) { @@ -28,3 +30,5 @@ const cl_idecoded_float integer_decode_float (const cl_SF& x) (sign>=0 ? cl_I(1) : cl_I(-1)) // (-1)^s erzeugen ); } + +} // namespace cln diff --git a/src/float/sfloat/misc/cl_SF_max.cc b/src/float/sfloat/misc/cl_SF_max.cc index 6098870..4e2d5b7 100644 --- a/src/float/sfloat/misc/cl_SF_max.cc +++ b/src/float/sfloat/misc/cl_SF_max.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. +namespace cln { + const cl_SF max (const cl_SF& x, const cl_SF& y) { return (x >= y ? x : y); } + +} // namespace cln diff --git a/src/float/sfloat/misc/cl_SF_min.cc b/src/float/sfloat/misc/cl_SF_min.cc index fe4ec52..3ea089c 100644 --- a/src/float/sfloat/misc/cl_SF_min.cc +++ b/src/float/sfloat/misc/cl_SF_min.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. +namespace cln { + const cl_SF min (const cl_SF& x, const cl_SF& y) { return (x <= y ? x : y); } + +} // namespace cln diff --git a/src/float/sfloat/misc/cl_SF_precision.cc b/src/float/sfloat/misc/cl_SF_precision.cc index 206e6ce..68e17d4 100644 --- a/src/float/sfloat/misc/cl_SF_precision.cc +++ b/src/float/sfloat/misc/cl_SF_precision.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -15,9 +15,13 @@ #define MAYBE_INLINE inline #include "cl_SF_zerop.cc" +namespace cln { + MAYBE_INLINE2 uintL float_precision (const cl_SF& x) { if (zerop(x)) return 0; return SF_mant_len+1; // 17 } + +} // namespace cln diff --git a/src/float/sfloat/misc/cl_SF_sign.cc b/src/float/sfloat/misc/cl_SF_sign.cc index 3a3d0bf..c780cc9 100644 --- a/src/float/sfloat/misc/cl_SF_sign.cc +++ b/src/float/sfloat/misc/cl_SF_sign.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -15,9 +15,13 @@ #define MAYBE_INLINE inline #include "cl_SF_minusp.cc" +namespace cln { + MAYBE_INLINE2 const cl_SF float_sign (const cl_SF& x) { // Methode: x>=0 -> Ergebnis 1.0; x<0 -> Ergebnis -1.0 return encode_SF(SF_sign(x),1,bit(SF_mant_len)); } + +} // namespace cln diff --git a/src/float/sfloat/misc/cl_SF_signum.cc b/src/float/sfloat/misc/cl_SF_signum.cc index 08e294e..b1239da 100644 --- a/src/float/sfloat/misc/cl_SF_signum.cc +++ b/src/float/sfloat/misc/cl_SF_signum.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_sfloat.h" +#include "cln/sfloat.h" // Implementation. @@ -16,6 +16,8 @@ #include "cl_SF_minusp.cc" #include "cl_SF_zerop.cc" +namespace cln { + MAYBE_INLINE2 const cl_SF signum (const cl_SF& x) { @@ -23,3 +25,5 @@ const cl_SF signum (const cl_SF& x) elif (zerop(x)) { return SF_0; } // x=0 -> 0.0 else { return SF_1; } // x>0 -> +1.0 } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_atanhx.cc b/src/float/transcendental/cl_F_atanhx.cc index 24131d5..fc732eb 100644 --- a/src/float/transcendental/cl_F_atanhx.cc +++ b/src/float/transcendental/cl_F_atanhx.cc @@ -6,13 +6,13 @@ // Specification. #include "cl_F_tran.h" #include "cl_F.h" -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" // Implementation. -#include "cl_float.h" +#include "cln/float.h" #include "cl_low.h" #undef MAYBE_INLINE @@ -21,6 +21,8 @@ #include "cl_LF_minusp.cc" #include "cl_LF_exponent.cc" +namespace cln { + // cl_F atanhx (const cl_F& x) // cl_LF atanhx (const cl_LF& x) // @@ -183,3 +185,5 @@ const cl_F atanhx (const cl_F& x) // 500 35.5 24.2 9.7 // 1000 168 116 29.6 // ==> using ln faster for N >= 34. + +} // namespace cln diff --git a/src/float/transcendental/cl_F_atanx.cc b/src/float/transcendental/cl_F_atanx.cc index 8132387..9a8cc10 100644 --- a/src/float/transcendental/cl_F_atanx.cc +++ b/src/float/transcendental/cl_F_atanx.cc @@ -9,12 +9,12 @@ // Implementation. -#include "cl_float.h" +#include "cln/float.h" #include "cl_low.h" #include "cl_F.h" -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" -#include "cl_integer.h" +#include "cln/integer.h" #undef MAYBE_INLINE #define MAYBE_INLINE inline @@ -22,6 +22,8 @@ #include "cl_LF_minusp.cc" #include "cl_LF_exponent.cc" +namespace cln { + // cl_F atanx_naive (const cl_F& x) // cl_LF atanx_naive (const cl_LF& x) // @@ -256,3 +258,4 @@ const cl_F atanx (const cl_F& x) } // Bit complexity (N = length(x)): O(log(N)^2*M(N)). +} // namespace cln diff --git a/src/float/transcendental/cl_F_catalanconst.cc b/src/float/transcendental/cl_F_catalanconst.cc index d31b4a3..72b0adf 100644 --- a/src/float/transcendental/cl_F_catalanconst.cc +++ b/src/float/transcendental/cl_F_catalanconst.cc @@ -1,10 +1,10 @@ -// cl_catalanconst(). +// catalanconst(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -13,12 +13,16 @@ #include "cl_F_tran.h" #include "cl_LF.h" -const cl_F cl_catalanconst (const cl_F& y) +namespace cln { + +const cl_F catalanconst (const cl_F& y) { floattypecase(y , return cl_SF_catalanconst; , return cl_FF_catalanconst; , return cl_DF_catalanconst; - , return cl_catalanconst(TheLfloat(y)->len); + , return catalanconst(TheLfloat(y)->len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_catalanconst_def.cc b/src/float/transcendental/cl_F_catalanconst_def.cc index f427257..5b07c25 100644 --- a/src/float/transcendental/cl_F_catalanconst_def.cc +++ b/src/float/transcendental/cl_F_catalanconst_def.cc @@ -1,10 +1,10 @@ -// cl_catalanconst(). +// catalanconst(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -12,12 +12,16 @@ #include "cl_F.h" #include "cl_F_tran.h" -const cl_F cl_catalanconst (void) +namespace cln { + +const cl_F catalanconst (void) { - floatformatcase(cl_default_float_format + floatformatcase(default_float_format , return cl_SF_catalanconst; , return cl_FF_catalanconst; , return cl_DF_catalanconst; - , return cl_catalanconst(len); + , return catalanconst(len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_catalanconst_f.cc b/src/float/transcendental/cl_F_catalanconst_f.cc index 3e4d325..bd40e28 100644 --- a/src/float/transcendental/cl_F_catalanconst_f.cc +++ b/src/float/transcendental/cl_F_catalanconst_f.cc @@ -1,10 +1,10 @@ -// cl_catalanconst(). +// catalanconst(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -12,12 +12,16 @@ #include "cl_F.h" #include "cl_F_tran.h" -const cl_F cl_catalanconst (cl_float_format_t f) +namespace cln { + +const cl_F catalanconst (float_format_t f) { floatformatcase((uintL)f , return cl_SF_catalanconst; , return cl_FF_catalanconst; , return cl_DF_catalanconst; - , return cl_catalanconst(len); + , return catalanconst(len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_catalanconst_var.cc b/src/float/transcendental/cl_F_catalanconst_var.cc index 733bc2e..b4799d2 100644 --- a/src/float/transcendental/cl_F_catalanconst_var.cc +++ b/src/float/transcendental/cl_F_catalanconst_var.cc @@ -16,18 +16,22 @@ CL_PROVIDE(cl_F_catalanconst_var) #include "cl_LF_impl.h" #include "cl_F.h" +namespace cln { + // Mantisse der Catalanschen Konstante : static const uintD catalanconst_mantisse [64/intDsize] = #include "cl_F_catalanconst_var.h" cl_LF cl_LF_catalanconst = encode_LF_array(0,0,catalanconst_mantisse,64/intDsize); -// Problem: If someone changes cl_free_hook, the destructor of this +// Problem: If someone changes free_hook, the destructor of this // will call the new hook, passing it some pointer obtained by the old -// cl_malloc_hook. ?? +// malloc_hook. ?? const cl_SF cl_SF_catalanconst = cl_LF_to_SF(cl_LF_catalanconst); const cl_FF cl_FF_catalanconst = cl_LF_to_FF(cl_LF_catalanconst); const cl_DF cl_DF_catalanconst = cl_LF_to_DF(cl_LF_catalanconst); +} // namespace cln + CL_PROVIDE_END(cl_F_catalanconst_var) diff --git a/src/float/transcendental/cl_F_cos.cc b/src/float/transcendental/cl_F_cos.cc index 87cf8d5..4c18531 100644 --- a/src/float/transcendental/cl_F_cos.cc +++ b/src/float/transcendental/cl_F_cos.cc @@ -4,17 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F_tran.h" #include "cl_F.h" -#include "cl_integer.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + const cl_F cos (const cl_F& x) { // Methode: @@ -89,3 +91,5 @@ const cl_F cos (const cl_F& x) // 1000 46 64 // 2500 239 260 // ==> ratseries faster for N >= 2850. + +} // namespace cln diff --git a/src/float/transcendental/cl_F_cosh.cc b/src/float/transcendental/cl_F_cosh.cc index 3885af3..3bab201 100644 --- a/src/float/transcendental/cl_F_cosh.cc +++ b/src/float/transcendental/cl_F_cosh.cc @@ -4,16 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F_tran.h" #include "cl_F.h" -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + const cl_F cosh (const cl_F& x) { // Methode: @@ -42,7 +44,7 @@ const cl_F cosh (const cl_F& x) if (TheLfloat(x)->len >= infty) { var cl_LF xx = extend(x,TheLfloat(x)->len+1); var cl_LF_cosh_sinh_t hyp = cl_coshsinh_ratseries(xx); - return cl_float(hyp.cosh,x); + return cln/float.hyp.cosh,x); } else #endif if (TheLfloat(x)->len >= 600) { @@ -82,3 +84,5 @@ const cl_F cosh (const cl_F& x) // 1000 46 61 35 // 2500 238 250 143 // ==> exp&recip fastest for N >= 600. + +} // namespace cln diff --git a/src/float/transcendental/cl_F_coshsinh.cc b/src/float/transcendental/cl_F_coshsinh.cc index 9aa32f2..1713299 100644 --- a/src/float/transcendental/cl_F_coshsinh.cc +++ b/src/float/transcendental/cl_F_coshsinh.cc @@ -1,20 +1,22 @@ -// cl_cosh_sinh(). +// cosh_sinh(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F_tran.h" #include "cl_F.h" -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" -const cl_cosh_sinh_t cl_cosh_sinh (const cl_F& x) +namespace cln { + +const cosh_sinh_t cosh_sinh (const cl_F& x) { // Methode: // Genauigkeit erhöhen, @@ -36,7 +38,7 @@ const cl_cosh_sinh_t cl_cosh_sinh (const cl_F& x) // e<0 if (zerop(x) || (e <= (1-(sintL)float_digits(x))>>1)) // e <= (1-d)/2 <==> e <= -ceiling((d-1)/2) - return cl_cosh_sinh_t(cl_float(1,x),x); + return cosh_sinh_t(cl_float(1,x),x); // Rechengenauigkeit erhöhen if (longfloatp(x)) { DeclareType(cl_LF,x); @@ -44,9 +46,9 @@ const cl_cosh_sinh_t cl_cosh_sinh (const cl_F& x) if (TheLfloat(x)->len >= infty) { var cl_LF xx = extend(x,TheLfloat(x)->len+1); var cl_LF_cosh_sinh_t hyp = cl_coshsinh_ratseries(xx); - return cl_cosh_sinh_t( - cl_float(hyp.cosh,x), - cl_float(hyp.sinh,x) + return cosh_sinh_t( + cln/float.hyp.cosh,x), + cln/float.hyp.sinh,x) ); } else #endif @@ -55,7 +57,7 @@ const cl_cosh_sinh_t cl_cosh_sinh (const cl_F& x) var cl_LF xx = extend(x,TheLfloat(x)->len+ceiling((uintL)(-e),intDsize)); var cl_F y = exp(xx); var cl_F y_inv = recip(y); - return cl_cosh_sinh_t( + return cosh_sinh_t( cl_float(scale_float(y + y_inv, -1), x), cl_float(scale_float(y - y_inv, -1), x) ); @@ -65,7 +67,7 @@ const cl_cosh_sinh_t cl_cosh_sinh (const cl_F& x) var cl_LF z = sqrt(y); if (minusp(xx)) z = -z; - return cl_cosh_sinh_t( + return cosh_sinh_t( cl_float(sqrt(1+y),x), // sqrt(1+y) cl_float(z,x) ); @@ -73,7 +75,7 @@ const cl_cosh_sinh_t cl_cosh_sinh (const cl_F& x) } else { var cl_F xx = cl_F_extendsqrt(x); var cl_F y = sinhxbyx_naive(xx); - return cl_cosh_sinh_t( + return cosh_sinh_t( cl_float(sqrt(1+square(xx)*y),x), // sqrt(1+x^2*y) cl_float(xx*sqrt(y),x) ); @@ -82,9 +84,11 @@ const cl_cosh_sinh_t cl_cosh_sinh (const cl_F& x) // e>=0 -> verwende exp(x) var cl_F y = exp(x); var cl_F y_inv = recip(y); - return cl_cosh_sinh_t( + return cosh_sinh_t( scale_float(y+y_inv,-1), scale_float(y-y_inv,-1) ); } } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_cossin.cc b/src/float/transcendental/cl_F_cossin.cc index 8283a5c..ea5dede 100644 --- a/src/float/transcendental/cl_F_cossin.cc +++ b/src/float/transcendental/cl_F_cossin.cc @@ -1,21 +1,23 @@ -// cl_cos_sin(). +// cos_sin(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F_tran.h" #include "cl_F.h" -#include "cl_integer.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/lfloat.h" #include "cl_LF.h" -const cl_cos_sin_t cl_cos_sin (const cl_F& x) +namespace cln { + +const cos_sin_t cos_sin (const cl_F& x) { // Methode: // Genauigkeit erhöhen, @@ -78,10 +80,12 @@ const cl_cos_sin_t cl_cos_sin (const cl_F& x) } // evtl. Vorzeichenwechsel oder Vertauschen: switch (cl_I_to_UL(logand(q,3))) { // q mod 4 - case 0: return cl_cos_sin_t(cos_r,sin_r); - case 1: return cl_cos_sin_t(-sin_r,cos_r); - case 2: return cl_cos_sin_t(-cos_r,-sin_r); - case 3: return cl_cos_sin_t(sin_r,-cos_r); + case 0: return cos_sin_t(cos_r,sin_r); + case 1: return cos_sin_t(-sin_r,cos_r); + case 2: return cos_sin_t(-cos_r,-sin_r); + case 3: return cos_sin_t(sin_r,-cos_r); default: NOTREACHED } } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_eulerconst.cc b/src/float/transcendental/cl_F_eulerconst.cc index d41d427..8650ed8 100644 --- a/src/float/transcendental/cl_F_eulerconst.cc +++ b/src/float/transcendental/cl_F_eulerconst.cc @@ -1,10 +1,10 @@ -// cl_eulerconst(). +// eulerconst(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -13,12 +13,16 @@ #include "cl_F_tran.h" #include "cl_LF.h" -const cl_F cl_eulerconst (const cl_F& y) +namespace cln { + +const cl_F eulerconst (const cl_F& y) { floattypecase(y , return cl_SF_eulerconst; , return cl_FF_eulerconst; , return cl_DF_eulerconst; - , return cl_eulerconst(TheLfloat(y)->len); + , return eulerconst(TheLfloat(y)->len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_eulerconst_def.cc b/src/float/transcendental/cl_F_eulerconst_def.cc index a841496..9a149a8 100644 --- a/src/float/transcendental/cl_F_eulerconst_def.cc +++ b/src/float/transcendental/cl_F_eulerconst_def.cc @@ -1,10 +1,10 @@ -// cl_eulerconst(). +// eulerconst(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -12,12 +12,16 @@ #include "cl_F.h" #include "cl_F_tran.h" -const cl_F cl_eulerconst (void) +namespace cln { + +const cl_F eulerconst (void) { - floatformatcase(cl_default_float_format + floatformatcase(default_float_format , return cl_SF_eulerconst; , return cl_FF_eulerconst; , return cl_DF_eulerconst; - , return cl_eulerconst(len); + , return eulerconst(len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_eulerconst_f.cc b/src/float/transcendental/cl_F_eulerconst_f.cc index 3643e0d..153cbac 100644 --- a/src/float/transcendental/cl_F_eulerconst_f.cc +++ b/src/float/transcendental/cl_F_eulerconst_f.cc @@ -1,10 +1,10 @@ -// cl_eulerconst(). +// eulerconst(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -12,12 +12,16 @@ #include "cl_F.h" #include "cl_F_tran.h" -const cl_F cl_eulerconst (cl_float_format_t f) +namespace cln { + +const cl_F eulerconst (float_format_t f) { floatformatcase((uintL)f , return cl_SF_eulerconst; , return cl_FF_eulerconst; , return cl_DF_eulerconst; - , return cl_eulerconst(len); + , return eulerconst(len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_eulerconst_var.cc b/src/float/transcendental/cl_F_eulerconst_var.cc index 997e985..153a4a1 100644 --- a/src/float/transcendental/cl_F_eulerconst_var.cc +++ b/src/float/transcendental/cl_F_eulerconst_var.cc @@ -16,18 +16,22 @@ CL_PROVIDE(cl_F_eulerconst_var) #include "cl_LF_impl.h" #include "cl_F.h" +namespace cln { + // Mantisse der Eulerschen Konstante : static const uintD eulerconst_mantisse [64/intDsize] = #include "cl_F_eulerconst_var.h" cl_LF cl_LF_eulerconst = encode_LF_array(0,0,eulerconst_mantisse,64/intDsize); -// Problem: If someone changes cl_free_hook, the destructor of this +// Problem: If someone changes free_hook, the destructor of this // will call the new hook, passing it some pointer obtained by the old -// cl_malloc_hook. ?? +// malloc_hook. ?? const cl_SF cl_SF_eulerconst = cl_LF_to_SF(cl_LF_eulerconst); const cl_FF cl_FF_eulerconst = cl_LF_to_FF(cl_LF_eulerconst); const cl_DF cl_DF_eulerconst = cl_LF_to_DF(cl_LF_eulerconst); +} // namespace cln + CL_PROVIDE_END(cl_F_eulerconst_var) diff --git a/src/float/transcendental/cl_F_exp.cc b/src/float/transcendental/cl_F_exp.cc index 553c972..0898a19 100644 --- a/src/float/transcendental/cl_F_exp.cc +++ b/src/float/transcendental/cl_F_exp.cc @@ -4,15 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F_tran.h" -#include "cl_float.h" +#include "cln/float.h" #include "cl_F.h" -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" #undef MAYBE_INLINE @@ -20,6 +20,8 @@ #include "cl_LF_minusp.cc" #include "cl_LF_exponent.cc" +namespace cln { + // Division durch ln(2). inline const cl_F_div_t cl_floor_ln2 (const cl_F& x) { @@ -60,3 +62,5 @@ const cl_F exp (const cl_F& x) return cl_float(scale_float(expx_naive(r),q),x); } } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_exp1.cc b/src/float/transcendental/cl_F_exp1.cc index 56a679e..96fe892 100644 --- a/src/float/transcendental/cl_F_exp1.cc +++ b/src/float/transcendental/cl_F_exp1.cc @@ -1,10 +1,10 @@ -// cl_exp1(). +// exp1(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -13,12 +13,16 @@ #include "cl_F.h" #include "cl_LF.h" -const cl_F cl_exp1 (const cl_F& y) +namespace cln { + +const cl_F exp1 (const cl_F& y) { floattypecase(y , return cl_SF_exp1; , return cl_FF_exp1; , return cl_DF_exp1; - , return cl_exp1(TheLfloat(y)->len); + , return exp1(TheLfloat(y)->len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_exp1_def.cc b/src/float/transcendental/cl_F_exp1_def.cc index 3667a28..ee74b05 100644 --- a/src/float/transcendental/cl_F_exp1_def.cc +++ b/src/float/transcendental/cl_F_exp1_def.cc @@ -1,10 +1,10 @@ -// cl_exp1(). +// exp1(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -12,12 +12,16 @@ #include "cl_F.h" #include "cl_F_tran.h" -const cl_F cl_exp1 (void) +namespace cln { + +const cl_F exp1 (void) { - floatformatcase(cl_default_float_format + floatformatcase(default_float_format , return cl_SF_exp1; , return cl_FF_exp1; , return cl_DF_exp1; - , return cl_exp1(len); + , return exp1(len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_exp1_f.cc b/src/float/transcendental/cl_F_exp1_f.cc index 2c09b64..4e23f0a 100644 --- a/src/float/transcendental/cl_F_exp1_f.cc +++ b/src/float/transcendental/cl_F_exp1_f.cc @@ -1,10 +1,10 @@ -// cl_exp1(). +// exp1(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -12,12 +12,16 @@ #include "cl_F_tran.h" #include "cl_F.h" -const cl_F cl_exp1 (cl_float_format_t f) +namespace cln { + +const cl_F exp1 (float_format_t f) { floatformatcase((uintL)f , return cl_SF_exp1; , return cl_FF_exp1; , return cl_DF_exp1; - , return cl_exp1(len); + , return exp1(len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_exp1_var.cc b/src/float/transcendental/cl_F_exp1_var.cc index d77161c..a68310d 100644 --- a/src/float/transcendental/cl_F_exp1_var.cc +++ b/src/float/transcendental/cl_F_exp1_var.cc @@ -16,18 +16,22 @@ CL_PROVIDE(cl_F_exp1_var) #include "cl_LF_impl.h" #include "cl_F.h" +namespace cln { + // Mantisse von exp(1) : static const uintD exp1_mantisse [64/intDsize] = #include "cl_F_exp1_var.h" cl_LF cl_LF_exp1 = encode_LF_array(0,2,exp1_mantisse,64/intDsize); -// Problem: If someone changes cl_free_hook, the destructor of this +// Problem: If someone changes free_hook, the destructor of this // will call the new hook, passing it some pointer obtained by the old -// cl_malloc_hook. ?? +// malloc_hook. ?? const cl_SF cl_SF_exp1 = cl_LF_to_SF(cl_LF_exp1); const cl_FF cl_FF_exp1 = cl_LF_to_FF(cl_LF_exp1); const cl_DF cl_DF_exp1 = cl_LF_to_DF(cl_LF_exp1); +} // namespace cln + CL_PROVIDE_END(cl_F_exp1_var) diff --git a/src/float/transcendental/cl_F_expx.cc b/src/float/transcendental/cl_F_expx.cc index 104c621..8069264 100644 --- a/src/float/transcendental/cl_F_expx.cc +++ b/src/float/transcendental/cl_F_expx.cc @@ -9,18 +9,20 @@ // Implementation. -#include "cl_float.h" +#include "cln/float.h" #include "cl_low.h" #include "cl_F.h" -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" -#include "cl_integer.h" +#include "cln/integer.h" #undef MAYBE_INLINE #define MAYBE_INLINE inline #include "cl_LF_zerop.cc" #include "cl_LF_exponent.cc" +namespace cln { + // cl_F expx_naive (const cl_F& x) // cl_LF expx_naive (const cl_LF& x) // @@ -188,3 +190,5 @@ const cl_LF expx_ratseries (const cl_LF& x) // 500 16.3 9.3 // 1000 68 29 // ==> ratseries faster for N >= 84. + +} // namespace cln diff --git a/src/float/transcendental/cl_F_ln.cc b/src/float/transcendental/cl_F_ln.cc index 7a2ed80..adc8a74 100644 --- a/src/float/transcendental/cl_F_ln.cc +++ b/src/float/transcendental/cl_F_ln.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -12,10 +12,12 @@ #include "cl_F_tran.h" #include "cl_F.h" #include "cl_SF.h" -#include "cl_integer.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + const cl_F ln (const cl_F& x) { // Methode: @@ -28,7 +30,7 @@ const cl_F ln (const cl_F& x) // Rechengenauigkeit erhöhen und m,e,s bestimmen: if (longfloatp(x) && (TheLfloat(x)->len >= 110)) { DeclareType(cl_LF,x); - var cl_decoded_lfloat m_e_s = decode_float(extend(x,TheLfloat(x)->len+1)); + var decoded_lfloat m_e_s = decode_float(extend(x,TheLfloat(x)->len+1)); var cl_LF& m = m_e_s.mantissa; var cl_I& e = m_e_s.exponent; if (m < make_SF(0,0+SF_exp_mid,floor(bit(SF_mant_len+2),3))) { // Short-Float 2/3 @@ -40,7 +42,7 @@ const cl_F ln (const cl_F& x) res = res + cl_float(e,m)*cl_ln2(m); // ln(m)+e*ln(2) return cl_float(res,x); } else { - var cl_decoded_float m_e_s = decode_float(cl_F_extendsqrtx(x)); + var decoded_float m_e_s = decode_float(cl_F_extendsqrtx(x)); var cl_F& m = m_e_s.mantissa; var cl_I& e = m_e_s.exponent; if (m < make_SF(0,0+SF_exp_mid,floor(bit(SF_mant_len+2),3))) { // Short-Float 2/3 @@ -53,3 +55,5 @@ const cl_F ln (const cl_F& x) return cl_float(res,x); } } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_ln10.cc b/src/float/transcendental/cl_F_ln10.cc index 69db310..f6367bf 100644 --- a/src/float/transcendental/cl_F_ln10.cc +++ b/src/float/transcendental/cl_F_ln10.cc @@ -12,6 +12,8 @@ #include "cl_F.h" #include "cl_LF.h" +namespace cln { + const cl_F cl_ln10 (const cl_F& y) { floattypecase(y @@ -21,3 +23,5 @@ const cl_F cl_ln10 (const cl_F& y) , return cl_ln10(TheLfloat(y)->len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_ln10_f.cc b/src/float/transcendental/cl_F_ln10_f.cc index 7552674..f4f2d84 100644 --- a/src/float/transcendental/cl_F_ln10_f.cc +++ b/src/float/transcendental/cl_F_ln10_f.cc @@ -11,7 +11,9 @@ #include "cl_F.h" -const cl_F cl_ln10 (cl_float_format_t f) +namespace cln { + +const cl_F cl_ln10 (float_format_t f) { floatformatcase((uintL)f , return cl_SF_ln10; @@ -20,3 +22,5 @@ const cl_F cl_ln10 (cl_float_format_t f) , return cl_ln10(len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_ln10_var.cc b/src/float/transcendental/cl_F_ln10_var.cc index 18b32f4..46a1e8d 100644 --- a/src/float/transcendental/cl_F_ln10_var.cc +++ b/src/float/transcendental/cl_F_ln10_var.cc @@ -16,18 +16,22 @@ CL_PROVIDE(cl_F_ln10_var) #include "cl_LF_impl.h" #include "cl_F.h" +namespace cln { + // Mantisse von ln(10) : static const uintD ln10_mantisse [64/intDsize] = #include "cl_F_ln10_var.h" cl_LF cl_LF_ln10 = encode_LF_array(0,2,ln10_mantisse,64/intDsize); -// Problem: If someone changes cl_free_hook, the destructor of this +// Problem: If someone changes free_hook, the destructor of this // will call the new hook, passing it some pointer obtained by the old -// cl_malloc_hook. ?? +// malloc_hook. ?? const cl_SF cl_SF_ln10 = cl_LF_to_SF(cl_LF_ln10); const cl_FF cl_FF_ln10 = cl_LF_to_FF(cl_LF_ln10); const cl_DF cl_DF_ln10 = cl_LF_to_DF(cl_LF_ln10); +} // namespace cln + CL_PROVIDE_END(cl_F_ln10_var) diff --git a/src/float/transcendental/cl_F_ln2.cc b/src/float/transcendental/cl_F_ln2.cc index 08ec12f..22234a6 100644 --- a/src/float/transcendental/cl_F_ln2.cc +++ b/src/float/transcendental/cl_F_ln2.cc @@ -12,6 +12,8 @@ #include "cl_F.h" #include "cl_LF.h" +namespace cln { + const cl_F cl_ln2 (const cl_F& y) { floattypecase(y @@ -21,3 +23,5 @@ const cl_F cl_ln2 (const cl_F& y) , return cl_ln2(TheLfloat(y)->len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_ln2_f.cc b/src/float/transcendental/cl_F_ln2_f.cc index f1bcc31..68faaec 100644 --- a/src/float/transcendental/cl_F_ln2_f.cc +++ b/src/float/transcendental/cl_F_ln2_f.cc @@ -11,7 +11,9 @@ #include "cl_F.h" -const cl_F cl_ln2 (cl_float_format_t f) +namespace cln { + +const cl_F cl_ln2 (float_format_t f) { floatformatcase((uintL)f , return cl_SF_ln2; @@ -20,3 +22,5 @@ const cl_F cl_ln2 (cl_float_format_t f) , return cl_ln2(len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_ln2_var.cc b/src/float/transcendental/cl_F_ln2_var.cc index eac6286..d9f6638 100644 --- a/src/float/transcendental/cl_F_ln2_var.cc +++ b/src/float/transcendental/cl_F_ln2_var.cc @@ -16,18 +16,22 @@ CL_PROVIDE(cl_F_ln2_var) #include "cl_LF_impl.h" #include "cl_F.h" +namespace cln { + // Mantisse von ln(2) : static const uintD ln2_mantisse [64/intDsize] = #include "cl_F_ln2_var.h" cl_LF cl_LF_ln2 = encode_LF_array(0,0,ln2_mantisse,64/intDsize); -// Problem: If someone changes cl_free_hook, the destructor of this +// Problem: If someone changes free_hook, the destructor of this // will call the new hook, passing it some pointer obtained by the old -// cl_malloc_hook. ?? +// malloc_hook. ?? const cl_SF cl_SF_ln2 = cl_LF_to_SF(cl_LF_ln2); const cl_FF cl_FF_ln2 = cl_LF_to_FF(cl_LF_ln2); const cl_DF cl_DF_ln2 = cl_LF_to_DF(cl_LF_ln2); +} // namespace cln + CL_PROVIDE_END(cl_F_ln2_var) diff --git a/src/float/transcendental/cl_F_lnx.cc b/src/float/transcendental/cl_F_lnx.cc index 10673db..c2a406c 100644 --- a/src/float/transcendental/cl_F_lnx.cc +++ b/src/float/transcendental/cl_F_lnx.cc @@ -9,12 +9,12 @@ // Implementation. -#include "cl_float.h" +#include "cln/float.h" #include "cl_low.h" #include "cl_F.h" -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" -#include "cl_integer.h" +#include "cln/integer.h" #undef MAYBE_INLINE #define MAYBE_INLINE inline @@ -22,6 +22,8 @@ #include "cl_LF_minusp.cc" #include "cl_LF_exponent.cc" +namespace cln { + // cl_F lnx_naive (const cl_F& x) // cl_LF lnx_naive (const cl_LF& x) // @@ -246,3 +248,5 @@ const cl_LF lnx_ratseries (const cl_LF& x) // 500 43.9 28.8 29.7 21.0 9.8 // 1000 223 149 144 107 30 // ==> ratseries faster for N >= 110. (N = length before extended by the caller.) + +} // namespace cln diff --git a/src/float/transcendental/cl_F_pi.cc b/src/float/transcendental/cl_F_pi.cc index b461e61..217d2c8 100644 --- a/src/float/transcendental/cl_F_pi.cc +++ b/src/float/transcendental/cl_F_pi.cc @@ -1,10 +1,10 @@ -// cl_pi(). +// pi(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -13,12 +13,16 @@ #include "cl_F_tran.h" #include "cl_LF.h" -const cl_F cl_pi (const cl_F& y) +namespace cln { + +const cl_F pi (const cl_F& y) { floattypecase(y , return cl_SF_pi; , return cl_FF_pi; , return cl_DF_pi; - , return cl_pi(TheLfloat(y)->len); + , return pi(TheLfloat(y)->len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_pi_def.cc b/src/float/transcendental/cl_F_pi_def.cc index 793e7e0..73e1e34 100644 --- a/src/float/transcendental/cl_F_pi_def.cc +++ b/src/float/transcendental/cl_F_pi_def.cc @@ -1,10 +1,10 @@ -// cl_pi(). +// pi(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -12,12 +12,16 @@ #include "cl_F.h" #include "cl_F_tran.h" -const cl_F cl_pi (void) +namespace cln { + +const cl_F pi (void) { - floatformatcase(cl_default_float_format + floatformatcase(default_float_format , return cl_SF_pi; , return cl_FF_pi; , return cl_DF_pi; - , return cl_pi(len); + , return pi(len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_pi_f.cc b/src/float/transcendental/cl_F_pi_f.cc index b2cd04f..c8444ec 100644 --- a/src/float/transcendental/cl_F_pi_f.cc +++ b/src/float/transcendental/cl_F_pi_f.cc @@ -1,10 +1,10 @@ -// cl_pi(). +// pi(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -12,12 +12,16 @@ #include "cl_F.h" #include "cl_F_tran.h" -const cl_F cl_pi (cl_float_format_t f) +namespace cln { + +const cl_F pi (float_format_t f) { floatformatcase((uintL)f , return cl_SF_pi; , return cl_FF_pi; , return cl_DF_pi; - , return cl_pi(len); + , return pi(len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_pi_var.cc b/src/float/transcendental/cl_F_pi_var.cc index 3c708f1..bbcb8ea 100644 --- a/src/float/transcendental/cl_F_pi_var.cc +++ b/src/float/transcendental/cl_F_pi_var.cc @@ -16,18 +16,22 @@ CL_PROVIDE(cl_F_pi_var) #include "cl_LF_impl.h" #include "cl_F.h" +namespace cln { + // Mantisse von pi : static const uintD pi_mantisse [2048/intDsize] = #include "cl_F_pi_var.h" cl_LF cl_LF_pi = encode_LF_array(0,2,pi_mantisse,2048/intDsize); -// Problem: If someone changes cl_free_hook, the destructor of this +// Problem: If someone changes free_hook, the destructor of this // will call the new hook, passing it some pointer obtained by the old -// cl_malloc_hook. ?? +// malloc_hook. ?? const cl_SF cl_SF_pi = cl_LF_to_SF(cl_LF_pi); const cl_FF cl_FF_pi = cl_LF_to_FF(cl_LF_pi); const cl_DF cl_DF_pi = cl_LF_to_DF(cl_LF_pi); +} // namespace cln + CL_PROVIDE_END(cl_F_pi_var) diff --git a/src/float/transcendental/cl_F_roundpi.cc b/src/float/transcendental/cl_F_roundpi.cc index dad4e04..df8959b 100644 --- a/src/float/transcendental/cl_F_roundpi.cc +++ b/src/float/transcendental/cl_F_roundpi.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + const cl_F_div_t cl_round_pi (const cl_F& x) { if (float_exponent(x) <= 0) @@ -16,5 +18,7 @@ const cl_F_div_t cl_round_pi (const cl_F& x) return cl_F_div_t(0,x); // Quotient 0, Rest x else // x durch pi (mit hinreichender Genauigkeit) dividieren - return round2(x,cl_pi(x)); + return round2(x,pi(x)); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_roundpi2.cc b/src/float/transcendental/cl_F_roundpi2.cc index 9503a77..671cdcf 100644 --- a/src/float/transcendental/cl_F_roundpi2.cc +++ b/src/float/transcendental/cl_F_roundpi2.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + const cl_F_div_t cl_round_pi2 (const cl_F& x) { if (float_exponent(x) < 0) @@ -16,5 +18,7 @@ const cl_F_div_t cl_round_pi2 (const cl_F& x) return cl_F_div_t(0,x); // Quotient 0, Rest x else // x durch pi/2 (mit hinreichender Genauigkeit) dividieren - return round2(x,scale_float(cl_pi(x),-1)); + return round2(x,scale_float(pi(x),-1)); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_sin.cc b/src/float/transcendental/cl_F_sin.cc index 517afcc..6411442 100644 --- a/src/float/transcendental/cl_F_sin.cc +++ b/src/float/transcendental/cl_F_sin.cc @@ -4,17 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F_tran.h" #include "cl_F.h" -#include "cl_integer.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + const cl_F sin (const cl_F& x) { // Methode: @@ -100,3 +102,5 @@ const cl_F sin (const cl_F& x) // 1000 48 64 // 2500 243 261 // ==> ratseries faster for N >= 2750. + +} // namespace cln diff --git a/src/float/transcendental/cl_F_sinh.cc b/src/float/transcendental/cl_F_sinh.cc index 25ae007..7ffdb1a 100644 --- a/src/float/transcendental/cl_F_sinh.cc +++ b/src/float/transcendental/cl_F_sinh.cc @@ -4,16 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F_tran.h" #include "cl_F.h" -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + const cl_F sinh (const cl_F& x) { // Methode: @@ -31,7 +33,7 @@ const cl_F sinh (const cl_F& x) if (TheLfloat(x)->len >= infty) { var cl_LF xx = extend(x,TheLfloat(x)->len+1); var cl_LF_cosh_sinh_t hyp = cl_coshsinh_ratseries(xx); - return cl_float(hyp.sinh,x); + return cln/float.hyp.sinh,x); } else #endif if ((TheLfloat(x)->len >= 500) @@ -75,3 +77,5 @@ const cl_F sinh (const cl_F& x) // 1000 59 61 // 2500 297 247 // ==> ratseries faster for N >= 1300. + +} // namespace cln diff --git a/src/float/transcendental/cl_F_sinhx.cc b/src/float/transcendental/cl_F_sinhx.cc index b440196..fc658d0 100644 --- a/src/float/transcendental/cl_F_sinhx.cc +++ b/src/float/transcendental/cl_F_sinhx.cc @@ -9,18 +9,20 @@ // Implementation. -#include "cl_float.h" +#include "cln/float.h" #include "cl_low.h" #include "cl_F.h" -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" -#include "cl_integer.h" +#include "cln/integer.h" #undef MAYBE_INLINE #define MAYBE_INLINE inline #include "cl_LF_zerop.cc" #include "cl_LF_exponent.cc" +namespace cln { + // sinhxbyx is mainly for cl_SF, cl_FF, cl_DF, where we want to avoid underflow. const cl_F sinhxbyx_naive (const cl_F& x) @@ -204,3 +206,4 @@ const cl_LF sinhx_naive (const cl_LF& x) // naive3 fastest for 6 <= N <= 500, // exp&recip (which uses exp's own ratseries) fastest for N >= 500. +} // namespace cln diff --git a/src/float/transcendental/cl_F_sinx.cc b/src/float/transcendental/cl_F_sinx.cc index 6df8643..4d79c3c 100644 --- a/src/float/transcendental/cl_F_sinx.cc +++ b/src/float/transcendental/cl_F_sinx.cc @@ -9,18 +9,20 @@ // Implementation. -#include "cl_float.h" +#include "cln/float.h" #include "cl_low.h" #include "cl_F.h" -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" -#include "cl_integer.h" +#include "cln/integer.h" #undef MAYBE_INLINE #define MAYBE_INLINE inline #include "cl_LF_zerop.cc" #include "cl_LF_exponent.cc" +namespace cln { + // sinxbyx is mainly for cl_SF, cl_FF, cl_DF, where we want to avoid underflow. const cl_F sinxbyx_naive (const cl_F& x) @@ -215,3 +217,4 @@ const cl_LF sinx_naive (const cl_LF& x) // 3500 339 303 // ==> ratseries faster for N >= 2750. +} // namespace cln diff --git a/src/float/transcendental/cl_F_tan.cc b/src/float/transcendental/cl_F_tan.cc index dac0f28..9cc66a4 100644 --- a/src/float/transcendental/cl_F_tan.cc +++ b/src/float/transcendental/cl_F_tan.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. +namespace cln { + MAYBE_INLINE const cl_F tan (const cl_F& x) { // Methode: // (/ (sin x) (cos x)) - var cl_cos_sin_t trig = cl_cos_sin(x); + var cos_sin_t trig = cos_sin(x); return The(cl_F)(trig.sin) / The(cl_F)(trig.cos); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_tanh.cc b/src/float/transcendental/cl_F_tanh.cc index 5694a04..0059984 100644 --- a/src/float/transcendental/cl_F_tanh.cc +++ b/src/float/transcendental/cl_F_tanh.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. +namespace cln { + MAYBE_INLINE const cl_F tanh (const cl_F& x) { // Methode: // (/ (sinh x) (cosh x)) - var cl_cosh_sinh_t hyp = cl_cosh_sinh(x); + var cosh_sinh_t hyp = cosh_sinh(x); return The(cl_F)(hyp.sinh) / The(cl_F)(hyp.cosh); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_tran.h b/src/float/transcendental/cl_F_tran.h index 70a39da..c49965d 100644 --- a/src/float/transcendental/cl_F_tran.h +++ b/src/float/transcendental/cl_F_tran.h @@ -3,15 +3,17 @@ #ifndef _CL_F_TRAN_H #define _CL_F_TRAN_H -#include "cl_number.h" -#include "cl_float.h" +#include "cln/number.h" +#include "cln/float.h" + +namespace cln { // pi. extern const cl_SF cl_SF_pi; extern const cl_FF cl_FF_pi; extern const cl_DF cl_DF_pi; extern cl_LF cl_LF_pi; // as long as it has ever been computed -extern const cl_LF cl_pi (uintC len); // computes it even further +extern const cl_LF pi (uintC len); // computes it even further //CL_REQUIRE(cl_F_pi_var) // cl_exp_aux(p,lq,len) liefert die Zahl exp(p/2^lq) mit len Digits. @@ -96,7 +98,7 @@ extern const cl_F cl_ln2 (const cl_F& y); // cl_ln2(y) liefert die Zahl ln(2) im Float-Format f. // > f: eine Float-Format-Spezifikation -extern const cl_F cl_ln2 (cl_float_format_t f); +extern const cl_F cl_ln2 (float_format_t f); // ln(10). extern const cl_SF cl_SF_ln10; @@ -112,14 +114,14 @@ extern const cl_F cl_ln10 (const cl_F& y); // cl_ln10(y) liefert die Zahl ln(10) im Float-Format f. // > f: eine Float-Format-Spezifikation -extern const cl_F cl_ln10 (cl_float_format_t f); +extern const cl_F cl_ln10 (float_format_t f); // e = exp(1). extern const cl_SF cl_SF_exp1; extern const cl_FF cl_FF_exp1; extern const cl_DF cl_DF_exp1; extern cl_LF cl_LF_exp1; // as long as it has ever been computed -extern const cl_LF cl_exp1 (uintC len); // computes it even further +extern const cl_LF exp1 (uintC len); // computes it even further // expx(x) liefert zu einem Float x (betragsmäßig <1) exp(x) als Float. extern const cl_F expx_naive (const cl_F& x); // requires cl_F_extendsqrtx @@ -131,18 +133,20 @@ extern const cl_SF cl_SF_eulerconst; extern const cl_FF cl_FF_eulerconst; extern const cl_DF cl_DF_eulerconst; extern cl_LF cl_LF_eulerconst; // as long as it has ever been computed -extern const cl_LF cl_eulerconst (uintC len); // computes it even further +extern const cl_LF eulerconst (uintC len); // computes it even further // Catalansche Konstante. extern const cl_SF cl_SF_catalanconst; extern const cl_FF cl_FF_catalanconst; extern const cl_DF cl_DF_catalanconst; extern cl_LF cl_LF_catalanconst; // as long as it has ever been computed -extern const cl_LF cl_catalanconst (uintC len); // computes it even further +extern const cl_LF catalanconst (uintC len); // computes it even further // Zeta-Funktion für s>1 ganzzahlig. -extern const cl_LF cl_zeta (int s, uintC len); +extern const cl_LF zeta (int s, uintC len); // Zeta-Funktion für s=3. -extern const cl_LF cl_zeta3 (uintC len); +extern const cl_LF zeta3 (uintC len); + +} // namespace cln #endif /* _CL_F_TRAN_H */ diff --git a/src/float/transcendental/cl_F_zeta_int.cc b/src/float/transcendental/cl_F_zeta_int.cc index 6e17d76..4f993e5 100644 --- a/src/float/transcendental/cl_F_zeta_int.cc +++ b/src/float/transcendental/cl_F_zeta_int.cc @@ -1,10 +1,10 @@ -// cl_zeta(). +// zeta(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -13,12 +13,16 @@ #include "cl_F_tran.h" #include "cl_LF.h" -const cl_F cl_zeta (int s, const cl_F& y) +namespace cln { + +const cl_F zeta (int s, const cl_F& y) { floattypecase(y - , return cl_LF_to_SF(cl_zeta(s,LF_minlen)); - , return cl_LF_to_FF(cl_zeta(s,LF_minlen)); - , return cl_LF_to_DF(cl_zeta(s,LF_minlen)); - , return cl_zeta(s,TheLfloat(y)->len); + , return cl_LF_to_SF(zeta(s,LF_minlen)); + , return cl_LF_to_FF(zeta(s,LF_minlen)); + , return cl_LF_to_DF(zeta(s,LF_minlen)); + , return zeta(s,TheLfloat(y)->len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_zeta_int_def.cc b/src/float/transcendental/cl_F_zeta_int_def.cc index ded95e2..b4210cf 100644 --- a/src/float/transcendental/cl_F_zeta_int_def.cc +++ b/src/float/transcendental/cl_F_zeta_int_def.cc @@ -1,10 +1,10 @@ -// cl_zeta(). +// zeta(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -13,12 +13,16 @@ #include "cl_F_tran.h" #include "cl_LF.h" -const cl_F cl_zeta (int s) +namespace cln { + +const cl_F zeta (int s) { - floatformatcase(cl_default_float_format - , return cl_LF_to_SF(cl_zeta(s,LF_minlen)); - , return cl_LF_to_FF(cl_zeta(s,LF_minlen)); - , return cl_LF_to_DF(cl_zeta(s,LF_minlen)); - , return cl_zeta(s,len); + floatformatcase(default_float_format + , return cl_LF_to_SF(zeta(s,LF_minlen)); + , return cl_LF_to_FF(zeta(s,LF_minlen)); + , return cl_LF_to_DF(zeta(s,LF_minlen)); + , return zeta(s,len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_F_zeta_int_f.cc b/src/float/transcendental/cl_F_zeta_int_f.cc index 78cf29e..84f3cea 100644 --- a/src/float/transcendental/cl_F_zeta_int_f.cc +++ b/src/float/transcendental/cl_F_zeta_int_f.cc @@ -1,10 +1,10 @@ -// cl_zeta(). +// zeta(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. @@ -13,12 +13,16 @@ #include "cl_F_tran.h" #include "cl_LF.h" -const cl_F cl_zeta (int s, cl_float_format_t f) +namespace cln { + +const cl_F zeta (int s, float_format_t f) { floatformatcase((uintL)f - , return cl_LF_to_SF(cl_zeta(s,LF_minlen)); - , return cl_LF_to_FF(cl_zeta(s,LF_minlen)); - , return cl_LF_to_DF(cl_zeta(s,LF_minlen)); - , return cl_zeta(s,len); + , return cl_LF_to_SF(zeta(s,LF_minlen)); + , return cl_LF_to_FF(zeta(s,LF_minlen)); + , return cl_LF_to_DF(zeta(s,LF_minlen)); + , return zeta(s,len); ); } + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_atan_recip.cc b/src/float/transcendental/cl_LF_atan_recip.cc index 44879a5..a12c0ef 100644 --- a/src/float/transcendental/cl_LF_atan_recip.cc +++ b/src/float/transcendental/cl_LF_atan_recip.cc @@ -9,16 +9,18 @@ // Implementation. -#include "cl_integer.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/lfloat.h" #include "cl_LF.h" #include "cl_LF_tran.h" #include "cl_alloca.h" #undef floor -#include +#include #define floor cln_floor +namespace cln { + // Method: // See examples/atan_recip.cc for a comparison of the algorithms. // Here we take algorithm 2d. It's the fastest throughout the range. @@ -27,7 +29,7 @@ const cl_LF cl_atan_recip (cl_I m, uintC len) { var uintC actuallen = len + 1; var cl_I m2 = m*m+1; - var uintL N = (uintL)(0.69314718*intDsize*actuallen/log(cl_double_approx(m2))) + 1; + var uintL N = (uintL)(0.69314718*intDsize*actuallen/::log(double_approx(m2))) + 1; CL_ALLOCA_STACK; var cl_I* pv = (cl_I*) cl_alloca(N*sizeof(cl_I)); var cl_I* qv = (cl_I*) cl_alloca(N*sizeof(cl_I)); @@ -48,3 +50,5 @@ const cl_LF cl_atan_recip (cl_I m, uintC len) return shorten(result,len); } // Bit complexity (N = len): O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_atanh_recip.cc b/src/float/transcendental/cl_LF_atanh_recip.cc index ab26505..b550481 100644 --- a/src/float/transcendental/cl_LF_atanh_recip.cc +++ b/src/float/transcendental/cl_LF_atanh_recip.cc @@ -9,16 +9,18 @@ // Implementation. -#include "cl_integer.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/lfloat.h" #include "cl_LF.h" #include "cl_LF_tran.h" #include "cl_alloca.h" #undef floor -#include +#include #define floor cln_floor +namespace cln { + // Method: // See examples/atanh_recip.cc for a comparison of the algorithms. // Here we take algorithm 1d. It's the fastest throughout the range. @@ -27,7 +29,7 @@ const cl_LF cl_atanh_recip (cl_I m, uintC len) { var uintC actuallen = len + 1; var cl_I m2 = m*m; - var uintL N = (uintL)(0.69314718*intDsize/2*actuallen/log(cl_double_approx(m))) + 1; + var uintL N = (uintL)(0.69314718*intDsize/2*actuallen/::log(double_approx(m))) + 1; CL_ALLOCA_STACK; var cl_I* bv = (cl_I*) cl_alloca(N*sizeof(cl_I)); var cl_I* qv = (cl_I*) cl_alloca(N*sizeof(cl_I)); @@ -47,3 +49,5 @@ const cl_LF cl_atanh_recip (cl_I m, uintC len) return shorten(result,len); } // Bit complexity (N = len): O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_catalanconst.cc b/src/float/transcendental/cl_LF_catalanconst.cc index 8a946f5..866c956 100644 --- a/src/float/transcendental/cl_LF_catalanconst.cc +++ b/src/float/transcendental/cl_LF_catalanconst.cc @@ -1,4 +1,4 @@ -// cl_catalanconst(). +// catalanconst(). // General includes. #include "cl_sysdep.h" @@ -9,12 +9,14 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF_tran.h" #include "cl_LF.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_alloca.h" +namespace cln { + const cl_LF compute_catalanconst_ramanujan (uintC len) { // [Jonathan M. Borwein, Peter B. Borwein: Pi and the AGM. @@ -37,7 +39,7 @@ const cl_LF compute_catalanconst_ramanujan (uintC len) var cl_LF fsum = scale_float(cl_I_to_LF(sum,actuallen),-scale); var cl_LF g = scale_float(The(cl_LF)(3*fsum) - + The(cl_LF)(cl_pi(actuallen)) + + The(cl_LF)(pi(actuallen)) * ln(cl_I_to_LF(2,actuallen)+sqrt(cl_I_to_LF(3,actuallen))), -3); return shorten(g,len); // verkürzen und fertig @@ -79,7 +81,7 @@ const cl_LF compute_catalanconst_ramanujan_fast (uintC len) } var cl_LF g = scale_float(The(cl_LF)(3*fsum) - + The(cl_LF)(cl_pi(actuallen)) + + The(cl_LF)(pi(actuallen)) * ln(cl_I_to_LF(2,actuallen)+sqrt(cl_I_to_LF(3,actuallen))), -3); return shorten(g,len); // verkürzen und fertig @@ -254,7 +256,7 @@ const cl_LF compute_catalanconst (uintC len) } // Bit complexity (N := len): O(log(N)^2*M(N)). -const cl_LF cl_catalanconst (uintC len) +const cl_LF catalanconst (uintC len) { var uintC oldlen = TheLfloat(cl_LF_catalanconst)->len; // vorhandene Länge if (len < oldlen) @@ -273,3 +275,5 @@ const cl_LF cl_catalanconst (uintC len) cl_LF_catalanconst = compute_catalanconst(newlen); return (len < newlen ? shorten(cl_LF_catalanconst,len) : cl_LF_catalanconst); } + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_coshsinh.cc b/src/float/transcendental/cl_LF_coshsinh.cc index 87d230a..da15148 100644 --- a/src/float/transcendental/cl_LF_coshsinh.cc +++ b/src/float/transcendental/cl_LF_coshsinh.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { inline const cl_LF_cosh_sinh_t operator* (const cl_LF_cosh_sinh_t& a, const cl_LF_cosh_sinh_t& b) { @@ -53,3 +55,5 @@ const cl_LF_cosh_sinh_t cl_coshsinh_ratseries (const cl_LF& x) return product; } // Bit complexity (N = length(x)): O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_coshsinh_aux.cc b/src/float/transcendental/cl_LF_coshsinh_aux.cc index 33d794d..a5c9cab 100644 --- a/src/float/transcendental/cl_LF_coshsinh_aux.cc +++ b/src/float/transcendental/cl_LF_coshsinh_aux.cc @@ -9,17 +9,19 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF_tran.h" #include "cl_LF.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_alloca.h" -#include "cl_abort.h" +#include "cln/abort.h" #undef floor -#include +#include #define floor cln_floor +namespace cln { + // Computing cosh(x) = sqrt(1+sinh(x)^2) instead of computing separately // by a power series evaluation brings 20% speedup, even more for small lengths. #define TRIVIAL_SPEEDUP @@ -64,8 +66,8 @@ const cl_LF_cosh_sinh_t cl_coshsinh_aux (const cl_I& p, uintL lq, uintC len) // N2 = ceiling(M*log(2)/(log(N1)-1+lp*log(2))), slightly too large. // N = N2+2, two more terms for safety. var uintL N0 = intDsize*actuallen; - var uintL N1 = (uintL)(0.693147*intDsize*actuallen/(log((double)N0)-1.0+0.693148*lp)); - var uintL N2 = (uintL)(0.693148*intDsize*actuallen/(log((double)N1)-1.0+0.693147*lp))+1; + var uintL N1 = (uintL)(0.693147*intDsize*actuallen/(::log((double)N0)-1.0+0.693148*lp)); + var uintL N2 = (uintL)(0.693148*intDsize*actuallen/(::log((double)N1)-1.0+0.693147*lp))+1; var uintL N = N2+2; N = ceiling(N,2); CL_ALLOCA_STACK; @@ -115,3 +117,4 @@ const cl_LF_cosh_sinh_t cl_coshsinh_aux (const cl_I& p, uintL lq, uintC len) // Bit complexity (N = len, and if p has length O(log N) and ql = O(log N)): // O(log(N)*M(N)). +} // namespace cln diff --git a/src/float/transcendental/cl_LF_cossin.cc b/src/float/transcendental/cl_LF_cossin.cc index 2dcd82f..624e3c6 100644 --- a/src/float/transcendental/cl_LF_cossin.cc +++ b/src/float/transcendental/cl_LF_cossin.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { inline const cl_LF_cos_sin_t operator* (const cl_LF_cos_sin_t& a, const cl_LF_cos_sin_t& b) { @@ -53,3 +55,5 @@ const cl_LF_cos_sin_t cl_cossin_ratseries (const cl_LF& x) return product; } // Bit complexity (N = length(x)): O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_cossin_aux.cc b/src/float/transcendental/cl_LF_cossin_aux.cc index ce47078..5e3e0b3 100644 --- a/src/float/transcendental/cl_LF_cossin_aux.cc +++ b/src/float/transcendental/cl_LF_cossin_aux.cc @@ -9,17 +9,19 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF_tran.h" #include "cl_LF.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_alloca.h" -#include "cl_abort.h" +#include "cln/abort.h" #undef floor -#include +#include #define floor cln_floor +namespace cln { + // Computing cos(x) = sqrt(1-sin(x)^2) instead of computing separately // by a power series evaluation brings 20% speedup, even more for small lengths. #define TRIVIAL_SPEEDUP @@ -64,8 +66,8 @@ const cl_LF_cos_sin_t cl_cossin_aux (const cl_I& p, uintL lq, uintC len) // N2 = ceiling(M*log(2)/(log(N1)-1+lp*log(2))), slightly too large. // N = N2+2, two more terms for safety. var uintL N0 = intDsize*actuallen; - var uintL N1 = (uintL)(0.693147*intDsize*actuallen/(log((double)N0)-1.0+0.693148*lp)); - var uintL N2 = (uintL)(0.693148*intDsize*actuallen/(log((double)N1)-1.0+0.693147*lp))+1; + var uintL N1 = (uintL)(0.693147*intDsize*actuallen/(::log((double)N0)-1.0+0.693148*lp)); + var uintL N2 = (uintL)(0.693148*intDsize*actuallen/(::log((double)N1)-1.0+0.693147*lp))+1; var uintL N = N2+2; N = ceiling(N,2); CL_ALLOCA_STACK; @@ -115,3 +117,4 @@ const cl_LF_cos_sin_t cl_cossin_aux (const cl_I& p, uintL lq, uintC len) // Bit complexity (N = len, and if p has length O(log N) and ql = O(log N)): // O(log(N)*M(N)). +} // namespace cln diff --git a/src/float/transcendental/cl_LF_eulerconst.cc b/src/float/transcendental/cl_LF_eulerconst.cc index d6cdcf7..9738f48 100644 --- a/src/float/transcendental/cl_LF_eulerconst.cc +++ b/src/float/transcendental/cl_LF_eulerconst.cc @@ -1,4 +1,4 @@ -// cl_eulerconst(). +// eulerconst(). // General includes. #include "cl_sysdep.h" @@ -9,12 +9,14 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF_tran.h" #include "cl_LF.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_alloca.h" -#include "cl_abort.h" +#include "cln/abort.h" + +namespace cln { #if 0 // works, but besselintegral4 is always faster @@ -498,7 +500,7 @@ const cl_LF compute_eulerconst (uintC len) return compute_eulerconst_besselintegral1(len); } -const cl_LF cl_eulerconst (uintC len) +const cl_LF eulerconst (uintC len) { var uintC oldlen = TheLfloat(cl_LF_eulerconst)->len; // vorhandene Länge if (len < oldlen) @@ -517,3 +519,5 @@ const cl_LF cl_eulerconst (uintC len) cl_LF_eulerconst = compute_eulerconst(newlen); return (len < newlen ? shorten(cl_LF_eulerconst,len) : cl_LF_eulerconst); } + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_exp1.cc b/src/float/transcendental/cl_LF_exp1.cc index c9272fb..713e2dd 100644 --- a/src/float/transcendental/cl_LF_exp1.cc +++ b/src/float/transcendental/cl_LF_exp1.cc @@ -1,4 +1,4 @@ -// cl_exp1(). +// exp1(). // General includes. #include "cl_sysdep.h" @@ -9,16 +9,18 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF_tran.h" #include "cl_LF.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_alloca.h" #undef floor -#include +#include #define floor cln_floor +namespace cln { + const cl_LF compute_exp1 (uintC len) { // Evaluate a sum(0 <= n < N, a(n)/b(n) * (p(0)...p(n))/(q(0)...q(n))) @@ -37,8 +39,8 @@ const cl_LF compute_exp1 (uintC len) // N2 = ceiling(M*log(2)/(log(N1)-1)), slightly too large. // N = N2+2, two more terms for safety. var uintL N0 = intDsize*actuallen; - var uintL N1 = (uintL)(0.693147*intDsize*actuallen/(log((double)N0)-1.0)); - var uintL N2 = (uintL)(0.693148*intDsize*actuallen/(log((double)N1)-1.0))+1; + var uintL N1 = (uintL)(0.693147*intDsize*actuallen/(::log((double)N0)-1.0)); + var uintL N2 = (uintL)(0.693148*intDsize*actuallen/(::log((double)N1)-1.0))+1; var uintL N = N2+2; CL_ALLOCA_STACK; var cl_I* qv = (cl_I*) cl_alloca(N*sizeof(cl_I)); @@ -73,7 +75,7 @@ const cl_LF compute_exp1 (uintC len) // 25000 111 // 50000 254 -const cl_LF cl_exp1 (uintC len) +const cl_LF exp1 (uintC len) { var uintC oldlen = TheLfloat(cl_LF_exp1)->len; // vorhandene Länge if (len < oldlen) @@ -92,3 +94,5 @@ const cl_LF cl_exp1 (uintC len) cl_LF_exp1 = compute_exp1(newlen); // (exp 1) return (len < newlen ? shorten(cl_LF_exp1,len) : cl_LF_exp1); } + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_exp_aux.cc b/src/float/transcendental/cl_LF_exp_aux.cc index 145bbe2..a0dfc3c 100644 --- a/src/float/transcendental/cl_LF_exp_aux.cc +++ b/src/float/transcendental/cl_LF_exp_aux.cc @@ -9,17 +9,19 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF_tran.h" #include "cl_LF.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_alloca.h" -#include "cl_abort.h" +#include "cln/abort.h" #undef floor -#include +#include #define floor cln_floor +namespace cln { + const cl_LF cl_exp_aux (const cl_I& p, uintL lq, uintC len) { { Mutable(cl_I,p); @@ -51,8 +53,8 @@ const cl_LF cl_exp_aux (const cl_I& p, uintL lq, uintC len) // N2 = ceiling(M*log(2)/(log(N1)-1+lp*log(2))), slightly too large. // N = N2+2, two more terms for safety. var uintL N0 = intDsize*actuallen; - var uintL N1 = (uintL)(0.693147*intDsize*actuallen/(log((double)N0)-1.0+0.693148*lp)); - var uintL N2 = (uintL)(0.693148*intDsize*actuallen/(log((double)N1)-1.0+0.693147*lp))+1; + var uintL N1 = (uintL)(0.693147*intDsize*actuallen/(::log((double)N0)-1.0+0.693148*lp)); + var uintL N2 = (uintL)(0.693148*intDsize*actuallen/(::log((double)N1)-1.0+0.693147*lp))+1; var uintL N = N2+2; CL_ALLOCA_STACK; var cl_I* pv = (cl_I*) cl_alloca(N*sizeof(cl_I)); @@ -77,3 +79,4 @@ const cl_LF cl_exp_aux (const cl_I& p, uintL lq, uintC len) // Bit complexity (N = len, and if p has length O(log N) and ql = O(log N)): // O(log(N)*M(N)). +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ln10.cc b/src/float/transcendental/cl_LF_ln10.cc index 8f05a8a..1473e1e 100644 --- a/src/float/transcendental/cl_LF_ln10.cc +++ b/src/float/transcendental/cl_LF_ln10.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + static inline const cl_LF compute_ln10_old (uintC len) { return ln(cl_I_to_LF(10,len)); @@ -63,3 +65,5 @@ const cl_LF cl_ln10 (uintC len) cl_LF_ln10 = compute_ln10(newlen); return (len < newlen ? shorten(cl_LF_ln10,len) : cl_LF_ln10); } + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ln2.cc b/src/float/transcendental/cl_LF_ln2.cc index 8ff8096..cdec528 100644 --- a/src/float/transcendental/cl_LF_ln2.cc +++ b/src/float/transcendental/cl_LF_ln2.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + static inline const cl_LF compute_ln2_old (uintC len) { // Here, it is tricky to avoid a recursive loop. We assume that ln() @@ -91,3 +93,5 @@ const cl_LF cl_ln2 (uintC len) cl_LF_ln2 = compute_ln2(newlen); return (len < newlen ? shorten(cl_LF_ln2,len) : cl_LF_ln2); } + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_pi.cc b/src/float/transcendental/cl_LF_pi.cc index ef22cb7..284ad1a 100644 --- a/src/float/transcendental/cl_LF_pi.cc +++ b/src/float/transcendental/cl_LF_pi.cc @@ -1,4 +1,4 @@ -// cl_pi(). +// pi(). // General includes. #include "cl_sysdep.h" @@ -9,12 +9,14 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF_tran.h" #include "cl_LF.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_alloca.h" +namespace cln { + ALL_cl_LF_OPERATIONS_SAME_PRECISION() // For the next algorithms, I warmly recommend @@ -76,8 +78,8 @@ const cl_LF compute_pi_brent_salamin (uintC len) a = new_a; k++; } - var cl_LF pi = square(a)/t; // a^2/t - return shorten(pi,len); // verkürzen und fertig + var cl_LF pires = square(a)/t; // a^2/t + return shorten(pires,len); // verkürzen und fertig } // Bit complexity (N := len): O(log(N)*M(N)). @@ -132,8 +134,8 @@ const cl_LF compute_pi_brent_salamin_quartic (uintC len) b = new_b; wb = new_wb; k += 2; } - var cl_LF pi = square(a)/t; - return shorten(pi,len); // verkürzen und fertig + var cl_LF pires = square(a)/t; + return shorten(pires,len); // verkürzen und fertig } // Bit complexity (N := len): O(log(N)*M(N)). @@ -174,8 +176,8 @@ const cl_LF compute_pi_ramanujan_163 (uintC len) } var cl_LF fsum = scale_float(cl_I_to_LF(sum,actuallen),-scale); static const cl_I J3 = "262537412640768000"; // -1728*J - var cl_LF pi = sqrt(cl_I_to_LF(J3,actuallen)) / fsum; - return shorten(pi,len); // verkürzen und fertig + var cl_LF pires = sqrt(cl_I_to_LF(J3,actuallen)) / fsum; + return shorten(pires,len); // verkürzen und fertig } // Bit complexity (N := len): O(N^2). @@ -230,8 +232,8 @@ const cl_LF compute_pi_ramanujan_163_fast (uintC len) qv[n].~cl_I(); } static const cl_I J3 = "262537412640768000"; // -1728*J - var cl_LF pi = sqrt(cl_I_to_LF(J3,actuallen)) / fsum; - return shorten(pi,len); // verkürzen und fertig + var cl_LF pires = sqrt(cl_I_to_LF(J3,actuallen)) / fsum; + return shorten(pires,len); // verkürzen und fertig } // Bit complexity (N := len): O(log(N)^2*M(N)). @@ -256,7 +258,7 @@ const cl_LF compute_pi_ramanujan_163_fast (uintC len) // it using binary splitting, is an O(log N * M(N)) algorithm, and // outperforms all of the others. -const cl_LF cl_pi (uintC len) +const cl_LF pi (uintC len) { var uintC oldlen = TheLfloat(cl_LF_pi)->len; // vorhandene Länge if (len < oldlen) @@ -275,3 +277,5 @@ const cl_LF cl_pi (uintC len) cl_LF_pi = compute_pi_ramanujan_163_fast(newlen); return (len < newlen ? shorten(cl_LF_pi,len) : cl_LF_pi); } + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries.cc b/src/float/transcendental/cl_LF_ratseries.cc index 23cdec6..5e15e61 100644 --- a/src/float/transcendental/cl_LF_ratseries.cc +++ b/src/float/transcendental/cl_LF_ratseries.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + // Subroutine. // Evaluates S = sum(N1 <= n < N2, a(n)/b(n) * (p(N1)...p(n))/(q(N1)...q(n))) // and returns P = p(N1)...p(N2-1), Q = q(N1)...q(N2-1), B = B(N1)...B(N2-1) @@ -106,3 +108,5 @@ const cl_LF eval_rational_series (uintL N, const cl_rational_series& args, uintC } // Bit complexity (if p(n), q(n), a(n), b(n) have length O(log(n))): // O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_.cc b/src/float/transcendental/cl_LF_ratseries_.cc index c8753eb..c08135f 100644 --- a/src/float/transcendental/cl_LF_ratseries_.cc +++ b/src/float/transcendental/cl_LF_ratseries_.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + // Subroutine. // Evaluates S = sum(N1 <= n < N2, a(n)/b(n) * (p(N1)...p(n))/(q(N1)...q(n))) // and returns P = p(N1)...p(N2-1), Q = q(N1)...q(N2-1), B = B(N1)...B(N2-1) @@ -38,3 +40,5 @@ const cl_LF eval_rational_series (uintL N, const cl__series& args, uintC len) } // Bit complexity (if p(n), q(n), a(n), b(n) have length O(log(n))): // O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_a.cc b/src/float/transcendental/cl_LF_ratseries_a.cc index 3e7bcf3..1b467c7 100644 --- a/src/float/transcendental/cl_LF_ratseries_a.cc +++ b/src/float/transcendental/cl_LF_ratseries_a.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + // Subroutine. // Evaluates S = sum(N1 <= n < N2, a(n)/b(n) * (p(N1)...p(n))/(q(N1)...q(n))) // and returns P = p(N1)...p(N2-1), Q = q(N1)...q(N2-1), B = B(N1)...B(N2-1) @@ -74,3 +76,5 @@ const cl_LF eval_rational_series (uintL N, const cl_a_series& args, uintC len) } // Bit complexity (if p(n), q(n), a(n), b(n) have length O(log(n))): // O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_ab.cc b/src/float/transcendental/cl_LF_ratseries_ab.cc index 945ba2e..e1544f1 100644 --- a/src/float/transcendental/cl_LF_ratseries_ab.cc +++ b/src/float/transcendental/cl_LF_ratseries_ab.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + // Subroutine. // Evaluates S = sum(N1 <= n < N2, a(n)/b(n) * (p(N1)...p(n))/(q(N1)...q(n))) // and returns P = p(N1)...p(N2-1), Q = q(N1)...q(N2-1), B = B(N1)...B(N2-1) @@ -82,3 +84,5 @@ const cl_LF eval_rational_series (uintL N, const cl_ab_series& args, uintC len) } // Bit complexity (if p(n), q(n), a(n), b(n) have length O(log(n))): // O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_b.cc b/src/float/transcendental/cl_LF_ratseries_b.cc index 4fc409b..0532361 100644 --- a/src/float/transcendental/cl_LF_ratseries_b.cc +++ b/src/float/transcendental/cl_LF_ratseries_b.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + // Subroutine. // Evaluates S = sum(N1 <= n < N2, a(n)/b(n) * (p(N1)...p(n))/(q(N1)...q(n))) // and returns P = p(N1)...p(N2-1), Q = q(N1)...q(N2-1), B = B(N1)...B(N2-1) @@ -82,3 +84,5 @@ const cl_LF eval_rational_series (uintL N, const cl_b_series& args, uintC len) } // Bit complexity (if p(n), q(n), a(n), b(n) have length O(log(n))): // O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_p.cc b/src/float/transcendental/cl_LF_ratseries_p.cc index 95cde10..ce9130f 100644 --- a/src/float/transcendental/cl_LF_ratseries_p.cc +++ b/src/float/transcendental/cl_LF_ratseries_p.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + // Subroutine. // Evaluates S = sum(N1 <= n < N2, a(n)/b(n) * (p(N1)...p(n))/(q(N1)...q(n))) // and returns P = p(N1)...p(N2-1), Q = q(N1)...q(N2-1), B = B(N1)...B(N2-1) @@ -85,3 +87,5 @@ const cl_LF eval_rational_series (uintL N, const cl_p_series& args, uintC len) } // Bit complexity (if p(n), q(n), a(n), b(n) have length O(log(n))): // O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_pa.cc b/src/float/transcendental/cl_LF_ratseries_pa.cc index 8c4e363..74f8b81 100644 --- a/src/float/transcendental/cl_LF_ratseries_pa.cc +++ b/src/float/transcendental/cl_LF_ratseries_pa.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + // Subroutine. // Evaluates S = sum(N1 <= n < N2, a(n)/b(n) * (p(N1)...p(n))/(q(N1)...q(n))) // and returns P = p(N1)...p(N2-1), Q = q(N1)...q(N2-1), B = B(N1)...B(N2-1) @@ -85,3 +87,5 @@ const cl_LF eval_rational_series (uintL N, const cl_pa_series& args, uintC len) } // Bit complexity (if p(n), q(n), a(n), b(n) have length O(log(n))): // O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_pab.cc b/src/float/transcendental/cl_LF_ratseries_pab.cc index 03a2bd4..cfec8d1 100644 --- a/src/float/transcendental/cl_LF_ratseries_pab.cc +++ b/src/float/transcendental/cl_LF_ratseries_pab.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + // Subroutine. // Evaluates S = sum(N1 <= n < N2, a(n)/b(n) * (p(N1)...p(n))/(q(N1)...q(n))) // and returns P = p(N1)...p(N2-1), Q = q(N1)...q(N2-1), B = B(N1)...B(N2-1) @@ -93,3 +95,5 @@ const cl_LF eval_rational_series (uintL N, const cl_pab_series& args, uintC len) } // Bit complexity (if p(n), q(n), a(n), b(n) have length O(log(n))): // O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_pb.cc b/src/float/transcendental/cl_LF_ratseries_pb.cc index 18d6424..9ddf079 100644 --- a/src/float/transcendental/cl_LF_ratseries_pb.cc +++ b/src/float/transcendental/cl_LF_ratseries_pb.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + // Subroutine. // Evaluates S = sum(N1 <= n < N2, a(n)/b(n) * (p(N1)...p(n))/(q(N1)...q(n))) // and returns P = p(N1)...p(N2-1), Q = q(N1)...q(N2-1), B = B(N1)...B(N2-1) @@ -93,3 +95,5 @@ const cl_LF eval_rational_series (uintL N, const cl_pb_series& args, uintC len) } // Bit complexity (if p(n), q(n), a(n), b(n) have length O(log(n))): // O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_pq.cc b/src/float/transcendental/cl_LF_ratseries_pq.cc index dbb9644..a5eb904 100644 --- a/src/float/transcendental/cl_LF_ratseries_pq.cc +++ b/src/float/transcendental/cl_LF_ratseries_pq.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + // Subroutine. // Evaluates S = sum(N1 <= n < N2, a(n)/b(n) * (p(N1)...p(n))/(q(N1)...q(n))) // and returns P = p(N1)...p(N2-1), Q = q(N1)...q(N2-1), B = B(N1)...B(N2-1) @@ -186,3 +188,5 @@ const cl_LF eval_rational_series (uintL N, const cl_pq_series& args, uintC len) } // Bit complexity (if p(n), q(n), a(n), b(n) have length O(log(n))): // O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_pqa.cc b/src/float/transcendental/cl_LF_ratseries_pqa.cc index 36fed64..05aa743 100644 --- a/src/float/transcendental/cl_LF_ratseries_pqa.cc +++ b/src/float/transcendental/cl_LF_ratseries_pqa.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + // Subroutine. // Evaluates S = sum(N1 <= n < N2, a(n)/b(n) * (p(N1)...p(n))/(q(N1)...q(n))) // and returns P = p(N1)...p(N2-1), Q = q(N1)...q(N2-1), B = B(N1)...B(N2-1) @@ -186,3 +188,5 @@ const cl_LF eval_rational_series (uintL N, const cl_pqa_series& args, uintC len) } // Bit complexity (if p(n), q(n), a(n), b(n) have length O(log(n))): // O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_pqab.cc b/src/float/transcendental/cl_LF_ratseries_pqab.cc index fdd2602..4680893 100644 --- a/src/float/transcendental/cl_LF_ratseries_pqab.cc +++ b/src/float/transcendental/cl_LF_ratseries_pqab.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + // Subroutine. // Evaluates S = sum(N1 <= n < N2, a(n)/b(n) * (p(N1)...p(n))/(q(N1)...q(n))) // and returns P = p(N1)...p(N2-1), Q = q(N1)...q(N2-1), B = B(N1)...B(N2-1) @@ -202,3 +204,5 @@ const cl_LF eval_rational_series (uintL N, const cl_pqab_series& args, uintC len } // Bit complexity (if p(n), q(n), a(n), b(n) have length O(log(n))): // O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_pqb.cc b/src/float/transcendental/cl_LF_ratseries_pqb.cc index 14d7f67..cee4716 100644 --- a/src/float/transcendental/cl_LF_ratseries_pqb.cc +++ b/src/float/transcendental/cl_LF_ratseries_pqb.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + // Subroutine. // Evaluates S = sum(N1 <= n < N2, a(n)/b(n) * (p(N1)...p(n))/(q(N1)...q(n))) // and returns P = p(N1)...p(N2-1), Q = q(N1)...q(N2-1), B = B(N1)...B(N2-1) @@ -202,3 +204,5 @@ const cl_LF eval_rational_series (uintL N, const cl_pqb_series& args, uintC len) } // Bit complexity (if p(n), q(n), a(n), b(n) have length O(log(n))): // O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_q.cc b/src/float/transcendental/cl_LF_ratseries_q.cc index a2e8f17..b664e71 100644 --- a/src/float/transcendental/cl_LF_ratseries_q.cc +++ b/src/float/transcendental/cl_LF_ratseries_q.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + // Subroutine. // Evaluates S = sum(N1 <= n < N2, a(n)/b(n) * (p(N1)...p(n))/(q(N1)...q(n))) // and returns P = p(N1)...p(N2-1), Q = q(N1)...q(N2-1), B = B(N1)...B(N2-1) @@ -82,3 +84,5 @@ const cl_LF eval_rational_series (uintL N, const cl_q_series& args, uintC len) } // Bit complexity (if p(n), q(n), a(n), b(n) have length O(log(n))): // O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_qa.cc b/src/float/transcendental/cl_LF_ratseries_qa.cc index b98e8bb..94554c7 100644 --- a/src/float/transcendental/cl_LF_ratseries_qa.cc +++ b/src/float/transcendental/cl_LF_ratseries_qa.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + // Subroutine. // Evaluates S = sum(N1 <= n < N2, a(n)/b(n) * (p(N1)...p(n))/(q(N1)...q(n))) // and returns P = p(N1)...p(N2-1), Q = q(N1)...q(N2-1), B = B(N1)...B(N2-1) @@ -82,3 +84,5 @@ const cl_LF eval_rational_series (uintL N, const cl_qa_series& args, uintC len) } // Bit complexity (if p(n), q(n), a(n), b(n) have length O(log(n))): // O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_qab.cc b/src/float/transcendental/cl_LF_ratseries_qab.cc index e862ac5..5bdd6eb 100644 --- a/src/float/transcendental/cl_LF_ratseries_qab.cc +++ b/src/float/transcendental/cl_LF_ratseries_qab.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + // Subroutine. // Evaluates S = sum(N1 <= n < N2, a(n)/b(n) * (p(N1)...p(n))/(q(N1)...q(n))) // and returns P = p(N1)...p(N2-1), Q = q(N1)...q(N2-1), B = B(N1)...B(N2-1) @@ -90,3 +92,5 @@ const cl_LF eval_rational_series (uintL N, const cl_qab_series& args, uintC len) } // Bit complexity (if p(n), q(n), a(n), b(n) have length O(log(n))): // O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_qb.cc b/src/float/transcendental/cl_LF_ratseries_qb.cc index 37b32c4..761de51 100644 --- a/src/float/transcendental/cl_LF_ratseries_qb.cc +++ b/src/float/transcendental/cl_LF_ratseries_qb.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + // Subroutine. // Evaluates S = sum(N1 <= n < N2, a(n)/b(n) * (p(N1)...p(n))/(q(N1)...q(n))) // and returns P = p(N1)...p(N2-1), Q = q(N1)...q(N2-1), B = B(N1)...B(N2-1) @@ -90,3 +92,5 @@ const cl_LF eval_rational_series (uintL N, const cl_qb_series& args, uintC len) } // Bit complexity (if p(n), q(n), a(n), b(n) have length O(log(n))): // O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_stream_pq.cc b/src/float/transcendental/cl_LF_ratseries_stream_pq.cc index a922fce..0d8fa64 100644 --- a/src/float/transcendental/cl_LF_ratseries_stream_pq.cc +++ b/src/float/transcendental/cl_LF_ratseries_stream_pq.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + static void eval_pq_series_aux (uintL N1, uintL N2, cl_pq_series_stream& args, cl_I* P, cl_I* Q, cl_I* T) @@ -96,3 +98,5 @@ const cl_LF eval_rational_series (uintL N, cl_pq_series_stream& args, uintC len) eval_pq_series_aux(0,N,args,NULL,&Q,&T); return cl_I_to_LF(T,len) / cl_I_to_LF(Q,len); } + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_stream_pqa.cc b/src/float/transcendental/cl_LF_ratseries_stream_pqa.cc index b76beb0..5b34c86 100644 --- a/src/float/transcendental/cl_LF_ratseries_stream_pqa.cc +++ b/src/float/transcendental/cl_LF_ratseries_stream_pqa.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + static void eval_pqa_series_aux (uintL N1, uintL N2, cl_pqa_series_stream& args, cl_I* P, cl_I* Q, cl_I* T) @@ -96,3 +98,5 @@ const cl_LF eval_rational_series (uintL N, cl_pqa_series_stream& args, uintC len eval_pqa_series_aux(0,N,args,NULL,&Q,&T); return cl_I_to_LF(T,len) / cl_I_to_LF(Q,len); } + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_stream_pqab.cc b/src/float/transcendental/cl_LF_ratseries_stream_pqab.cc index 0f406ac..cc3cec8 100644 --- a/src/float/transcendental/cl_LF_ratseries_stream_pqab.cc +++ b/src/float/transcendental/cl_LF_ratseries_stream_pqab.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + static void eval_pqab_series_aux (uintL N1, uintL N2, cl_pqab_series_stream& args, cl_I* P, cl_I* Q, cl_I* B, cl_I* T) @@ -104,3 +106,5 @@ const cl_LF eval_rational_series (uintL N, cl_pqab_series_stream& args, uintC le eval_pqab_series_aux(0,N,args,NULL,&Q,&B,&T); return cl_I_to_LF(T,len) / cl_I_to_LF(B*Q,len); } + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratseries_stream_pqb.cc b/src/float/transcendental/cl_LF_ratseries_stream_pqb.cc index efb6877..3ce7485 100644 --- a/src/float/transcendental/cl_LF_ratseries_stream_pqb.cc +++ b/src/float/transcendental/cl_LF_ratseries_stream_pqb.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + static void eval_pqb_series_aux (uintL N1, uintL N2, cl_pqb_series_stream& args, cl_I* P, cl_I* Q, cl_I* B, cl_I* T) @@ -104,3 +106,5 @@ const cl_LF eval_rational_series (uintL N, cl_pqb_series_stream& args, uintC len eval_pqb_series_aux(0,N,args,NULL,&Q,&B,&T); return cl_I_to_LF(T,len) / cl_I_to_LF(B*Q,len); } + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratsumseries_pqcd.cc b/src/float/transcendental/cl_LF_ratsumseries_pqcd.cc index 2cf52a7..618c994 100644 --- a/src/float/transcendental/cl_LF_ratsumseries_pqcd.cc +++ b/src/float/transcendental/cl_LF_ratsumseries_pqcd.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + const cl_LF eval_pqcd_series (uintL N, cl_pqcd_series_term* args, uintC len) { if (N==0) @@ -26,3 +28,5 @@ const cl_LF eval_pqcd_series (uintL N, cl_pqcd_series_term* args, uintC len) return cl_I_to_LF(sums.V,len) / The(cl_LF)(sums.D * cl_I_to_LF(sums.T,len)); } + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc b/src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc index b42ed08..3365389 100644 --- a/src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc +++ b/src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc @@ -9,8 +9,10 @@ // Implementation. -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/integer.h" +#include "cln/abort.h" + +namespace cln { void eval_pqcd_series_aux (uintL N, cl_pqcd_series_term* args, cl_pqcd_series_result& Z, cl_boolean rightmost) { @@ -77,3 +79,5 @@ void eval_pqcd_series_aux (uintL N, cl_pqcd_series_term* args, cl_pqcd_series_re } } } + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratsumseries_pqd.cc b/src/float/transcendental/cl_LF_ratsumseries_pqd.cc index 891c5b4..fab0ff2 100644 --- a/src/float/transcendental/cl_LF_ratsumseries_pqd.cc +++ b/src/float/transcendental/cl_LF_ratsumseries_pqd.cc @@ -9,11 +9,13 @@ // Implementation. -#include "cl_lfloat.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/lfloat.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_LF.h" +namespace cln { + const cl_LF eval_pqd_series (uintL N, cl_pqd_series_term* args, uintC len) { if (N==0) @@ -26,3 +28,5 @@ const cl_LF eval_pqd_series (uintL N, cl_pqd_series_term* args, uintC len) return cl_I_to_LF(sums.V,len) / The(cl_LF)(sums.D * cl_I_to_LF(sums.T,len)); } + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc b/src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc index 4266c1e..25f7d83 100644 --- a/src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc +++ b/src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc @@ -9,8 +9,10 @@ // Implementation. -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/integer.h" +#include "cln/abort.h" + +namespace cln { void eval_pqd_series_aux (uintL N, cl_pqd_series_term* args, cl_pqd_series_result& Z, cl_boolean rightmost) { @@ -73,3 +75,5 @@ void eval_pqd_series_aux (uintL N, cl_pqd_series_term* args, cl_pqd_series_resul } } } + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_tran.h b/src/float/transcendental/cl_LF_tran.h index f19083a..05ab5aa 100644 --- a/src/float/transcendental/cl_LF_tran.h +++ b/src/float/transcendental/cl_LF_tran.h @@ -3,9 +3,10 @@ #ifndef _CL_LF_TRAN_H #define _CL_LF_TRAN_H -#include "cl_integer.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/lfloat.h" +namespace cln { // Subroutine for evaluating // sum(0 <= n < N, a(n)/b(n) * (p(0)...p(n))/(q(0)...q(n))) @@ -258,5 +259,6 @@ extern void eval_pqd_series_aux (uintL N, cl_pqd_series_term* args, cl_pqd_serie // Ditto, but returns U/S. extern const cl_LF eval_pqd_series (uintL N, cl_pqd_series_term* args, uintC len); +} // namespace cln #endif /* _CL_LF_TRAN_H */ diff --git a/src/float/transcendental/cl_LF_zeta3.cc b/src/float/transcendental/cl_LF_zeta3.cc index 0455da5..d578dc5 100644 --- a/src/float/transcendental/cl_LF_zeta3.cc +++ b/src/float/transcendental/cl_LF_zeta3.cc @@ -1,4 +1,4 @@ -// cl_zeta3(). +// zeta3(). // General includes. #include "cl_sysdep.h" @@ -9,13 +9,15 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF_tran.h" #include "cl_LF.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_alloca.h" -const cl_LF cl_zeta3 (uintC len) +namespace cln { + +const cl_LF zeta3 (uintC len) { // Method: // /infinity \ @@ -81,3 +83,5 @@ const cl_LF cl_zeta3 (uintC len) // 50000 3723 // asymp. FAST N^2 FAST FAST // (FAST means O(log(N)^2*M(N))) + +} // namespace cln diff --git a/src/float/transcendental/cl_LF_zeta_int.cc b/src/float/transcendental/cl_LF_zeta_int.cc index a1167d3..281f763 100644 --- a/src/float/transcendental/cl_LF_zeta_int.cc +++ b/src/float/transcendental/cl_LF_zeta_int.cc @@ -1,4 +1,4 @@ -// cl_zeta(). +// zeta(). // General includes. #include "cl_sysdep.h" @@ -9,13 +9,15 @@ // Implementation. -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF_tran.h" #include "cl_LF.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/integer.h" +#include "cln/abort.h" #include "cl_alloca.h" +namespace cln { + const cl_LF compute_zeta_exp (int s, uintC len) { // Method: @@ -132,7 +134,7 @@ const cl_LF compute_zeta_cvz2 (int s, uintC len) // // The break-even point between cvz1 and cvz2 seems to grow linearly with s. -const cl_LF cl_zeta (int s, uintC len) +const cl_LF zeta (int s, uintC len) { if (!(s > 1)) cl_abort(); @@ -142,3 +144,5 @@ const cl_LF cl_zeta (int s, uintC len) return compute_zeta_cvz2(s,len); } // Bit complexity (N = len): O(log(N)^2*M(N)). + +} // namespace cln diff --git a/src/integer/2adic/cl_I_2adic_div.cc b/src/integer/2adic/cl_I_2adic_div.cc index 97791fe..44cca87 100644 --- a/src/integer/2adic/cl_I_2adic_div.cc +++ b/src/integer/2adic/cl_I_2adic_div.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_2DS.h" #include "cl_I_log.h" +namespace cln { + const cl_I cl_div2adic (uintL n, const cl_I& x, const cl_I& y) { var uintL len = ceiling(n,intDsize); @@ -48,3 +50,4 @@ const cl_I cl_div2adic (uintL n, const cl_I& x, const cl_I& y) } // Bit complexity (N := n): O(M(N)). +} // namespace cln diff --git a/src/integer/2adic/cl_I_2adic_recip.cc b/src/integer/2adic/cl_I_2adic_recip.cc index f997850..4ff9575 100644 --- a/src/integer/2adic/cl_I_2adic_recip.cc +++ b/src/integer/2adic/cl_I_2adic_recip.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_2DS.h" #include "cl_I_log.h" +namespace cln { + const cl_I cl_recip2adic (uintL n, const cl_I& x) { var uintL len = ceiling(n,intDsize); @@ -38,3 +40,4 @@ const cl_I cl_recip2adic (uintL n, const cl_I& x) } // Bit complexity (N := n): O(M(N)). +} // namespace cln diff --git a/src/integer/algebraic/cl_I_rootp.cc b/src/integer/algebraic/cl_I_rootp.cc index 934d948..e3b2d68 100644 --- a/src/integer/algebraic/cl_I_rootp.cc +++ b/src/integer/algebraic/cl_I_rootp.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + // Methode: // Falls x=0 oder x=1: x = x^n -> JA, x als Ergebnis. // Hier also x>1. Suche ein Integer y > 1 mit x=y^n. @@ -25,3 +27,5 @@ cl_boolean rootp (const cl_I& x, uintL n, cl_I* w) { return cl_false; } return cl_rootp_aux(x,n,w); } + +} // namespace cln diff --git a/src/integer/algebraic/cl_I_rootp_I.cc b/src/integer/algebraic/cl_I_rootp_I.cc index c229cb1..497f10a 100644 --- a/src/integer/algebraic/cl_I_rootp_I.cc +++ b/src/integer/algebraic/cl_I_rootp_I.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + // Methode: // Falls x=0 oder x=1: x = x^n -> JA, x als Ergebnis. // Hier also x>1. Suche ein Integer y > 1 mit x=y^n. @@ -26,3 +28,5 @@ cl_boolean rootp (const cl_I& x, const cl_I& n, cl_I* w) // Nun ist n < (integer-length x). Also paßt n in ein uintL. return cl_rootp_aux(x,cl_I_to_UL(n),w); } + +} // namespace cln diff --git a/src/integer/algebraic/cl_I_rootp_aux.cc b/src/integer/algebraic/cl_I_rootp_aux.cc index a8f5f95..4e53d1c 100644 --- a/src/integer/algebraic/cl_I_rootp_aux.cc +++ b/src/integer/algebraic/cl_I_rootp_aux.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -14,6 +14,8 @@ #include "cl_2D.h" #include "cl_2DS.h" +namespace cln { + // Stellt fest, ob ein Integer >=0 eine n-te Potenz ist. // rootp(x,n,&w) // > x: ein Integer >=0 @@ -194,3 +196,5 @@ cl_boolean cl_rootp_aux (cl_I x, uintL n, cl_I* w) return cl_true; } } + +} // namespace cln diff --git a/src/integer/algebraic/cl_I_sqrt.cc b/src/integer/algebraic/cl_I_sqrt.cc index 6d44f54..d59ba68 100644 --- a/src/integer/algebraic/cl_I_sqrt.cc +++ b/src/integer/algebraic/cl_I_sqrt.cc @@ -4,24 +4,26 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. -#include "cl_number.h" -#include "cl_io.h" -#include "cl_integer_io.h" -#include "cl_abort.h" +#include "cln/number.h" +#include "cln/io.h" +#include "cln/integer_io.h" +#include "cln/abort.h" #include "cl_I.h" #include "cl_DS.h" +namespace cln { + cl_boolean isqrt (const cl_I& x, cl_I* w) { if (minusp(x)) { - fprint(cl_stderr, "isqrt: applied to negative number: "); - fprint(cl_stderr, x); - fprint(cl_stderr, "\n"); + fprint(stderr, "isqrt: applied to negative number: "); + fprint(stderr, x); + fprint(stderr, "\n"); cl_abort(); } CL_ALLOCA_STACK; @@ -37,3 +39,4 @@ cl_boolean isqrt (const cl_I& x, cl_I* w) } // Bit complexity (x of length N): O(M(N)). +} // namespace cln diff --git a/src/integer/algebraic/cl_I_sqrtp.cc b/src/integer/algebraic/cl_I_sqrtp.cc index ab40247..14d3caa 100644 --- a/src/integer/algebraic/cl_I_sqrtp.cc +++ b/src/integer/algebraic/cl_I_sqrtp.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_DS.h" +namespace cln { + cl_boolean sqrtp (const cl_I& x, cl_I* w) { // Methode: @@ -85,3 +87,4 @@ cl_boolean sqrtp (const cl_I& x, cl_I* w) } // Bit complexity (x of length N): O(M(N)). +} // namespace cln diff --git a/src/integer/bitwise/cl_I_ash.cc b/src/integer/bitwise/cl_I_ash.cc index 388697f..bde719b 100644 --- a/src/integer/bitwise/cl_I_ash.cc +++ b/src/integer/bitwise/cl_I_ash.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_DS.h" #include "cl_I_ash.h" +namespace cln { + const cl_I ash (const cl_I& x, sintL y) { // Methode: @@ -86,3 +88,5 @@ const cl_I ash (const cl_I& x, sintL y) sign: // Ergebnis ist 0, falls x>=0, und -1, falls x<0: return (minusp(x) ? cl_I(-1) : cl_I(0)); } + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_ash.h b/src/integer/bitwise/cl_I_ash.h index d820b1a..1a15c60 100644 --- a/src/integer/bitwise/cl_I_ash.h +++ b/src/integer/bitwise/cl_I_ash.h @@ -3,10 +3,14 @@ #ifndef _CL_I_ASH_H #define _CL_I_ASH_H -#include "cl_number.h" -#include "cl_integer_class.h" +#include "cln/number.h" +#include "cln/integer_class.h" #include "cl_macros.h" +namespace cln { + nonreturning_function(extern, cl_ash_error, (const cl_I& badamount)); +} // namespace cln + #endif /* _CL_I_ASH_H */ diff --git a/src/integer/bitwise/cl_I_ash_I.cc b/src/integer/bitwise/cl_I_ash_I.cc index 8ff1a56..2ea5cd2 100644 --- a/src/integer/bitwise/cl_I_ash_I.cc +++ b/src/integer/bitwise/cl_I_ash_I.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_DS.h" #include "cl_I_ash.h" +namespace cln { + const cl_I ash (const cl_I& x, const cl_I& y) { // Methode: @@ -167,3 +169,5 @@ const cl_I ash (const cl_I& x, const cl_I& y) sign: // Ergebnis ist 0, falls x>=0, und -1, falls x<0: return (minusp(x) ? cl_I(-1) : cl_I(0)); } + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_asherr.cc b/src/integer/bitwise/cl_I_asherr.cc index 7ec6c2f..3e1d7cc 100644 --- a/src/integer/bitwise/cl_I_asherr.cc +++ b/src/integer/bitwise/cl_I_asherr.cc @@ -9,15 +9,19 @@ // Implementation. -#include "cl_number.h" -#include "cl_io.h" -#include "cl_integer_io.h" -#include "cl_abort.h" +#include "cln/number.h" +#include "cln/io.h" +#include "cln/integer_io.h" +#include "cln/abort.h" + +namespace cln { void cl_ash_error (const cl_I& badamount) { - fprint(cl_stderr, "ash: too large shift amount: "); - fprint(cl_stderr, badamount); - fprint(cl_stderr, "\n"); + fprint(stderr, "ash: too large shift amount: "); + fprint(stderr, badamount); + fprint(stderr, "\n"); cl_abort(); } + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_boole.cc b/src/integer/bitwise/cl_I_boole.cc index 7e69c25..48a08b6 100644 --- a/src/integer/bitwise/cl_I_boole.cc +++ b/src/integer/bitwise/cl_I_boole.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. +namespace cln { + const cl_I boole (cl_boole op, const cl_I& x, const cl_I& y) { switch (op) { @@ -48,3 +50,5 @@ const cl_I boole (cl_boole op, const cl_I& x, const cl_I& y) NOTREACHED } } + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_byte.h b/src/integer/bitwise/cl_I_byte.h index 370db10..2505d8f 100644 --- a/src/integer/bitwise/cl_I_byte.h +++ b/src/integer/bitwise/cl_I_byte.h @@ -3,8 +3,10 @@ #ifndef _CL_I_BYTE_H #define _CL_I_BYTE_H -#include "cl_number.h" -#include "cl_integer_class.h" +#include "cln/number.h" +#include "cln/integer_class.h" + +namespace cln { // cl_fullbyte(p,q) liefert zu p,q die Zahl 2^q-2^p als Integer, // wobei p und q uintL sind. Bei p<=q ist das Ergebnis also @@ -26,4 +28,6 @@ extern cl_boolean ldb_extract_test (const cl_I& x, uintL p, uintL q); // Ergebnis (wie bei MASK-FIELD) ein Integer >=0. extern const cl_I mkf_extract (const cl_I& x, uintL p, uintL q); +} // namespace cln + #endif /* _CL_I_BYTE_H */ diff --git a/src/integer/bitwise/cl_I_dpb.cc b/src/integer/bitwise/cl_I_dpb.cc index fc64225..03dded7 100644 --- a/src/integer/bitwise/cl_I_dpb.cc +++ b/src/integer/bitwise/cl_I_dpb.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" +namespace cln { + const cl_I dpb (const cl_I& newbyte, const cl_I& n, const cl_byte& b) { // Methode: @@ -19,3 +21,5 @@ const cl_I dpb (const cl_I& newbyte, const cl_I& n, const cl_byte& b) // = (DEPOSIT-FIELD (ASH newbyte p) (byte s p) integer) return deposit_field(ash(newbyte,b.position),n,b); } + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_dpf.cc b/src/integer/bitwise/cl_I_dpf.cc index 7597853..038fc13 100644 --- a/src/integer/bitwise/cl_I_dpf.cc +++ b/src/integer/bitwise/cl_I_dpf.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" +namespace cln { + const cl_I deposit_field (const cl_I& newbyte, const cl_I& n, const cl_byte& b) { // Methode: @@ -22,3 +24,5 @@ const cl_I deposit_field (const cl_I& newbyte, const cl_I& n, const cl_byte& b) // ) ) return logxor(n, ash(logxor(ldb(newbyte,b),ldb(n,b)), b.position)); } + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_fullbyte.cc b/src/integer/bitwise/cl_I_fullbyte.cc index 593378f..8177a4c 100644 --- a/src/integer/bitwise/cl_I_fullbyte.cc +++ b/src/integer/bitwise/cl_I_fullbyte.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" +namespace cln { + const cl_I cl_fullbyte (uintL p, uintL q) { if (p==q) @@ -19,3 +21,5 @@ const cl_I cl_fullbyte (uintL p, uintL q) else return ash(-1,UL_to_I(p)) + ash(1,UL_to_I(q)); } + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_ilength.cc b/src/integer/bitwise/cl_I_ilength.cc index 00e17aa..8dbfb5e 100644 --- a/src/integer/bitwise/cl_I_ilength.cc +++ b/src/integer/bitwise/cl_I_ilength.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_DS.h" +namespace cln { + uintL integer_length (const cl_I& x) { if (fixnump(x)) @@ -36,3 +38,5 @@ uintL integer_length (const cl_I& x) return bitcount; // 0 <= bitcount < intDsize*2^intCsize. } } + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_ldb.cc b/src/integer/bitwise/cl_I_ldb.cc index dd94d5c..43d6fc3 100644 --- a/src/integer/bitwise/cl_I_ldb.cc +++ b/src/integer/bitwise/cl_I_ldb.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_I_byte.h" +namespace cln { + const cl_I ldb (const cl_I& n, const cl_byte& b) { // Methode: @@ -46,3 +48,5 @@ const cl_I ldb (const cl_I& n, const cl_byte& b) return erg; } } + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_ldbtest.cc b/src/integer/bitwise/cl_I_ldbtest.cc index 2c9653c..9b62a97 100644 --- a/src/integer/bitwise/cl_I_ldbtest.cc +++ b/src/integer/bitwise/cl_I_ldbtest.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_I_byte.h" +namespace cln { + cl_boolean ldb_test (const cl_I& n, const cl_byte& b) { // Methode: @@ -46,3 +48,5 @@ cl_boolean ldb_test (const cl_I& n, const cl_byte& b) return ldb_extract_test(n,p,ps); } } + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_ldbx.cc b/src/integer/bitwise/cl_I_ldbx.cc index 587f9f2..788133b 100644 --- a/src/integer/bitwise/cl_I_ldbx.cc +++ b/src/integer/bitwise/cl_I_ldbx.cc @@ -9,10 +9,12 @@ // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_DS.h" +namespace cln { + const cl_I ldb_extract (const cl_I& x, uintL p, uintL q) { CL_ALLOCA_STACK; var const uintD* MSDptr; @@ -54,3 +56,5 @@ const cl_I ldb_extract (const cl_I& x, uintL p, uintL q) // Jetzt enthält die UDS newMSDptr/len/.. die extrahierten Bits. return UDS_to_I(newMSDptr,len); // UDS in Integer umwandeln } + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_ldbxtest.cc b/src/integer/bitwise/cl_I_ldbxtest.cc index 75678a3..9ee0767 100644 --- a/src/integer/bitwise/cl_I_ldbxtest.cc +++ b/src/integer/bitwise/cl_I_ldbxtest.cc @@ -9,10 +9,12 @@ // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_DS.h" +namespace cln { + cl_boolean ldb_extract_test (const cl_I& x, uintL p, uintL q) { var const uintD* MSDptr; var uintC len; @@ -55,3 +57,4 @@ cl_boolean ldb_extract_test (const cl_I& x, uintL p, uintL q) if (DS_test_loop(MSDptr,len,LSDptr)) { return cl_true; } else { return cl_false; } } +} // namespace cln diff --git a/src/integer/bitwise/cl_I_log.h b/src/integer/bitwise/cl_I_log.h index a424cfe..c774eb1 100644 --- a/src/integer/bitwise/cl_I_log.h +++ b/src/integer/bitwise/cl_I_log.h @@ -3,10 +3,12 @@ #ifndef _CL_I_LOG_H #define _CL_I_LOG_H -#include "cl_number.h" +#include "cln/number.h" #include "cl_I.h" #include "cl_DS.h" +namespace cln { + // Liefert die Anzahl Digits, die ein Integer als DS bräuchte. // (Leicht aufgerundet.) inline uintC I_to_DS_need (const cl_I& x) @@ -31,4 +33,6 @@ inline uintC I_to_DS_need (const cl_I& x) } extern uintD* I_to_DS_n_aux (const cl_I& obj, uintC n, uintD* destptr); +} // namespace cln + #endif /* _CL_I_LOG_H */ diff --git a/src/integer/bitwise/cl_I_log_aux.cc b/src/integer/bitwise/cl_I_log_aux.cc index f6dcaf4..002649a 100644 --- a/src/integer/bitwise/cl_I_log_aux.cc +++ b/src/integer/bitwise/cl_I_log_aux.cc @@ -8,10 +8,12 @@ // Implementation. -#include "cl_number.h" +#include "cln/number.h" #include "cl_I.h" #include "cl_DS.h" +namespace cln { + uintD* I_to_DS_n_aux (const cl_I& obj, uintC n, uintD* destptr) { // Nun sind unterhalb von destptr n Digits Platz. // oberen Teil der DS aus obj füllen, dabei destptr erniedrigen: @@ -51,3 +53,6 @@ uintD* I_to_DS_n_aux (const cl_I& obj, uintC n, uintD* destptr) // destptr zeigt nun aufs untere Ende der DS. return destptr; } + +} // namespace cln + diff --git a/src/integer/bitwise/cl_I_logand.cc b/src/integer/bitwise/cl_I_logand.cc index e7b4ccc..7ca2b17 100644 --- a/src/integer/bitwise/cl_I_logand.cc +++ b/src/integer/bitwise/cl_I_logand.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_DS.h" #include "cl_I_log.h" +namespace cln { + // Logische Operationen auf Integers: // Methode: aus den Längen der beiden Argumente eine obere Schranke für // die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und @@ -49,3 +51,5 @@ const cl_I logand (const cl_I& x, const cl_I& y) and_loop_msp(xptr,yptr,n); // mit AND verknüpfen return DS_to_I(zptr,n); // Ergebnis als Integer } }} + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_logandc2.cc b/src/integer/bitwise/cl_I_logandc2.cc index 52e8457..1fb71fe 100644 --- a/src/integer/bitwise/cl_I_logandc2.cc +++ b/src/integer/bitwise/cl_I_logandc2.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_DS.h" #include "cl_I_log.h" +namespace cln { + // Logische Operationen auf Integers: // Methode: aus den Längen der beiden Argumente eine obere Schranke für // die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und @@ -43,3 +45,5 @@ const cl_I logandc2 (const cl_I& x, const cl_I& y) andc2_loop_msp(xptr,yptr,n); // mit AND NOT verknüpfen return DS_to_I(zptr,n); // Ergebnis als Integer } }} + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_logbitp.cc b/src/integer/bitwise/cl_I_logbitp.cc index 0353ee0..5eedaa5 100644 --- a/src/integer/bitwise/cl_I_logbitp.cc +++ b/src/integer/bitwise/cl_I_logbitp.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_DS.h" +namespace cln { + cl_boolean logbitp (uintL x, const cl_I& y) { // Methode: @@ -35,3 +37,5 @@ cl_boolean logbitp (uintL x, const cl_I& y) else return cl_false; } + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_logbitp_I.cc b/src/integer/bitwise/cl_I_logbitp_I.cc index 2b58a56..83f217a 100644 --- a/src/integer/bitwise/cl_I_logbitp_I.cc +++ b/src/integer/bitwise/cl_I_logbitp_I.cc @@ -4,16 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" #include "cl_DS.h" -#include "cl_io.h" -#include "cl_integer_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/integer_io.h" +#include "cln/abort.h" + +namespace cln { cl_boolean logbitp (const cl_I& x, const cl_I& y) { @@ -42,9 +44,11 @@ cl_boolean logbitp (const cl_I& x, const cl_I& y) } else // x<0 - { fprint(cl_stderr, "logbitp: Index is negative: "); - fprint(cl_stderr, x); - fprint(cl_stderr, "\n"); + { fprint(stderr, "logbitp: Index is negative: "); + fprint(stderr, x); + fprint(stderr, "\n"); cl_abort(); } } + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_logcount.cc b/src/integer/bitwise/cl_I_logcount.cc index 50bf4db..7083069 100644 --- a/src/integer/bitwise/cl_I_logcount.cc +++ b/src/integer/bitwise/cl_I_logcount.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -14,6 +14,8 @@ #include "cl_D.h" #include "cl_low.h" +namespace cln { + uintL logcount (const cl_I& x) { if (fixnump(x)) @@ -35,3 +37,5 @@ uintL logcount (const cl_I& x) return bitcount; } } + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_logeqv.cc b/src/integer/bitwise/cl_I_logeqv.cc index 904231a..0ac56b8 100644 --- a/src/integer/bitwise/cl_I_logeqv.cc +++ b/src/integer/bitwise/cl_I_logeqv.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_DS.h" #include "cl_I_log.h" +namespace cln { + // Logische Operationen auf Integers: // Methode: aus den Längen der beiden Argumente eine obere Schranke für // die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und @@ -38,3 +40,5 @@ const cl_I logeqv (const cl_I& x, const cl_I& y) eqv_loop_msp(xptr,yptr,n); // mit NOT XOR verknüpfen return DS_to_I(zptr,n); // Ergebnis als Integer } }} + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_logior.cc b/src/integer/bitwise/cl_I_logior.cc index a2ee846..07803fa 100644 --- a/src/integer/bitwise/cl_I_logior.cc +++ b/src/integer/bitwise/cl_I_logior.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_DS.h" #include "cl_I_log.h" +namespace cln { + // Logische Operationen auf Integers: // Methode: aus den Längen der beiden Argumente eine obere Schranke für // die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und @@ -38,3 +40,5 @@ const cl_I logior (const cl_I& x, const cl_I& y) or_loop_msp(xptr,yptr,n); // mit OR verknüpfen return DS_to_I(zptr,n); // Ergebnis als Integer } }} + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_lognand.cc b/src/integer/bitwise/cl_I_lognand.cc index 2b4bd6f..9c0614b 100644 --- a/src/integer/bitwise/cl_I_lognand.cc +++ b/src/integer/bitwise/cl_I_lognand.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_DS.h" #include "cl_I_log.h" +namespace cln { + // Logische Operationen auf Integers: // Methode: aus den Längen der beiden Argumente eine obere Schranke für // die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und @@ -49,3 +51,5 @@ const cl_I lognand (const cl_I& x, const cl_I& y) nand_loop_msp(xptr,yptr,n); // mit NOT AND verknüpfen return DS_to_I(zptr,n); // Ergebnis als Integer } }} + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_lognor.cc b/src/integer/bitwise/cl_I_lognor.cc index b1debf0..3f09228 100644 --- a/src/integer/bitwise/cl_I_lognor.cc +++ b/src/integer/bitwise/cl_I_lognor.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_DS.h" #include "cl_I_log.h" +namespace cln { + // Logische Operationen auf Integers: // Methode: aus den Längen der beiden Argumente eine obere Schranke für // die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und @@ -38,3 +40,5 @@ const cl_I lognor (const cl_I& x, const cl_I& y) nor_loop_msp(xptr,yptr,n); // mit NOT OR verknüpfen return DS_to_I(zptr,n); // Ergebnis als Integer } }} + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_lognot.cc b/src/integer/bitwise/cl_I_lognot.cc index 7ce1685..4122128 100644 --- a/src/integer/bitwise/cl_I_lognot.cc +++ b/src/integer/bitwise/cl_I_lognot.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_DS.h" #include "cl_I_log.h" +namespace cln { + const cl_I lognot (const cl_I& x) { if (fixnump(x)) // Fixnum -> ganz einfach: { // bitweise als Fixnum zurück @@ -32,3 +34,5 @@ const cl_I lognot (const cl_I& x) // und die ersten intDsize+1 Bit nicht alle gleich sind. return NDS_to_I(MSDptr,n); // Ergebnis als Integer } } + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_logorc2.cc b/src/integer/bitwise/cl_I_logorc2.cc index ffa59b8..066506b 100644 --- a/src/integer/bitwise/cl_I_logorc2.cc +++ b/src/integer/bitwise/cl_I_logorc2.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_DS.h" #include "cl_I_log.h" +namespace cln { + // Logische Operationen auf Integers: // Methode: aus den Längen der beiden Argumente eine obere Schranke für // die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und @@ -38,3 +40,5 @@ const cl_I logorc2 (const cl_I& x, const cl_I& y) orc2_loop_msp(xptr,yptr,n); // mit OR NOT verknüpfen return DS_to_I(zptr,n); // Ergebnis als Integer } }} + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_logtest.cc b/src/integer/bitwise/cl_I_logtest.cc index 586b190..c605402 100644 --- a/src/integer/bitwise/cl_I_logtest.cc +++ b/src/integer/bitwise/cl_I_logtest.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_DS.h" +namespace cln { + cl_boolean logtest (const cl_I& x, const cl_I& y) { // Methode: @@ -93,3 +95,5 @@ cl_boolean logtest (const cl_I& x, const cl_I& y) return and_test_loop_msp(xMSDptr,yMSDptr,xlen); } } + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_logxor.cc b/src/integer/bitwise/cl_I_logxor.cc index 713fffd..f2d9c0f 100644 --- a/src/integer/bitwise/cl_I_logxor.cc +++ b/src/integer/bitwise/cl_I_logxor.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_DS.h" #include "cl_I_log.h" +namespace cln { + // Logische Operationen auf Integers: // Methode: aus den Längen der beiden Argumente eine obere Schranke für // die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und @@ -38,3 +40,5 @@ const cl_I logxor (const cl_I& x, const cl_I& y) xor_loop_msp(xptr,yptr,n); // mit XOR verknüpfen return DS_to_I(zptr,n); // Ergebnis als Integer } }} + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_mkf.cc b/src/integer/bitwise/cl_I_mkf.cc index 0e6b65c..f496376 100644 --- a/src/integer/bitwise/cl_I_mkf.cc +++ b/src/integer/bitwise/cl_I_mkf.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_I_byte.h" +namespace cln { + const cl_I mask_field (const cl_I& n, const cl_byte& b) { // Methode: @@ -47,3 +49,5 @@ const cl_I mask_field (const cl_I& n, const cl_byte& b) return erg; } } } + +} // namespace cln diff --git a/src/integer/bitwise/cl_I_mkfx.cc b/src/integer/bitwise/cl_I_mkfx.cc index ceb322c..851cfac 100644 --- a/src/integer/bitwise/cl_I_mkfx.cc +++ b/src/integer/bitwise/cl_I_mkfx.cc @@ -9,10 +9,12 @@ // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_DS.h" +namespace cln { + const cl_I mkf_extract (const cl_I& x, uintL p, uintL q) { CL_ALLOCA_STACK; @@ -48,3 +50,5 @@ const cl_I mkf_extract (const cl_I& x, uintL p, uintL q) // Jetzt enthält die UDS newMSDptr/len/.. die extrahierten Bits. return UDS_to_I(newMSDptr,len); } + +} // namespace cln diff --git a/src/integer/cl_I.h b/src/integer/cl_I.h index 44df5eb..843cd30 100644 --- a/src/integer/cl_I.h +++ b/src/integer/cl_I.h @@ -3,14 +3,15 @@ #ifndef _CL_I_H #define _CL_I_H -#include "cl_number.h" -#include "cl_integer.h" +#include "cln/number.h" +#include "cln/integer.h" #include "cl_macros.h" -#include "cl_malloc.h" -#include "cl_abort.h" +#include "cln/malloc.h" +#include "cln/abort.h" #include "cl_offsetof.h" #include "cl_DS.h" +namespace cln { // maximal needed length of a digit sequence for a fixnum #define FN_maxlength ceiling(cl_value_len,intDsize) @@ -52,7 +53,7 @@ inline cl_heap_bignum* TheBignum (const cl_number& obj) inline cl_heap_bignum* allocate_bignum (unsigned int length) { - cl_heap_bignum* p = (cl_heap_bignum*) cl_malloc_hook(offsetofa(cl_heap_bignum,data)+sizeof(uintD)*length); + cl_heap_bignum* p = (cl_heap_bignum*) malloc_hook(offsetofa(cl_heap_bignum,data)+sizeof(uintD)*length); p->refcount = 1; p->type = &cl_class_bignum; p->length = length; @@ -656,4 +657,6 @@ inline cl_boolean minusp (const cl_BN& x) inline cl_boolean zerop (const cl_BN& x) { unused x; return cl_false; } +} // namespace cln + #endif /* _CL_I_H */ diff --git a/src/integer/conv/cl_I_digits_need.cc b/src/integer/conv/cl_I_digits_need.cc index 8ffe13a..aefaab9 100644 --- a/src/integer/conv/cl_I_digits_need.cc +++ b/src/integer/conv/cl_I_digits_need.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + uintL cl_digits_need (const cl_I& x, uintL base) { if (fixnump(x)) @@ -60,3 +62,5 @@ uintL cl_digits_need (const cl_I& x, uintL base) return need; } } + +} // namespace cln diff --git a/src/integer/conv/cl_I_from_DS.cc b/src/integer/conv/cl_I_from_DS.cc index 8c4fb2d..883f98f 100644 --- a/src/integer/conv/cl_I_from_DS.cc +++ b/src/integer/conv/cl_I_from_DS.cc @@ -9,13 +9,15 @@ // Implementation. -#include "cl_number.h" +#include "cln/number.h" #include "cl_DS.h" #undef MAYBE_INLINE #define MAYBE_INLINE inline #include "cl_I_from_NDS.cc" +namespace cln { + MAYBE_INLINE2 const cl_I DS_to_I (const uintD* MSDptr, uintC len) { @@ -39,3 +41,5 @@ const cl_I DS_to_I (const uintD* MSDptr, uintC len) // aber NDS_to_I wird auch damit fertig. return NDS_to_I(MSDptr,len); } + +} // namespace cln diff --git a/src/integer/conv/cl_I_from_L.cc b/src/integer/conv/cl_I_from_L.cc index 3419d0c..119bd22 100644 --- a/src/integer/conv/cl_I_from_L.cc +++ b/src/integer/conv/cl_I_from_L.cc @@ -9,12 +9,14 @@ // Implementation. -#include "cl_number.h" +#include "cln/number.h" #if (cl_value_len < 32) #include "cl_DS.h" +namespace cln { + cl_private_thing cl_I_constructor_from_L (sint32 wert) { var uint32 test = wert & minus_bit(cl_value_len-1); @@ -101,4 +103,6 @@ cl_private_thing cl_I_constructor_from_L (sint32 wert) } } +} // namespace cln + #endif diff --git a/src/integer/conv/cl_I_from_L2.cc b/src/integer/conv/cl_I_from_L2.cc index 88dba6a..df4bfa3 100644 --- a/src/integer/conv/cl_I_from_L2.cc +++ b/src/integer/conv/cl_I_from_L2.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_number.h" +#include "cln/number.h" #include "cl_DS.h" +namespace cln { + cl_private_thing cl_I_constructor_from_L2 (sint32 wert_hi, uint32 wert_lo) { if (wert_hi == 0) { @@ -129,3 +131,5 @@ cl_private_thing cl_I_constructor_from_L2 (sint32 wert_hi, uint32 wert_lo) #undef IF_LENGTH } } + +} // namespace cln diff --git a/src/integer/conv/cl_I_from_NDS.cc b/src/integer/conv/cl_I_from_NDS.cc index 23f3285..e358573 100644 --- a/src/integer/conv/cl_I_from_NDS.cc +++ b/src/integer/conv/cl_I_from_NDS.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_number.h" +#include "cln/number.h" #include "cl_DS.h" +namespace cln { + MAYBE_INLINE const cl_I NDS_to_I (const uintD* MSDptr, uintC len) { @@ -98,3 +100,5 @@ const cl_I NDS_to_I (const uintD* MSDptr, uintC len) return result; } } + +} // namespace cln diff --git a/src/integer/conv/cl_I_from_NUDS.cc b/src/integer/conv/cl_I_from_NUDS.cc index 7b0ac8d..0ec397f 100644 --- a/src/integer/conv/cl_I_from_NUDS.cc +++ b/src/integer/conv/cl_I_from_NUDS.cc @@ -9,13 +9,15 @@ // Implementation. -#include "cl_number.h" +#include "cln/number.h" #include "cl_DS.h" #undef MAYBE_INLINE #define MAYBE_INLINE inline #include "cl_I_from_NDS.cc" +namespace cln { + MAYBE_INLINE2 const cl_I NUDS_to_I (uintD* MSDptr, uintC len) { @@ -25,3 +27,5 @@ const cl_I NUDS_to_I (uintD* MSDptr, uintC len) { lsprefnext(MSDptr) = 0; len++; } return NDS_to_I(MSDptr,len); } + +} // namespace cln diff --git a/src/integer/conv/cl_I_from_Q.cc b/src/integer/conv/cl_I_from_Q.cc index 9fd8265..50ca75a 100644 --- a/src/integer/conv/cl_I_from_Q.cc +++ b/src/integer/conv/cl_I_from_Q.cc @@ -9,12 +9,14 @@ // Implementation. -#include "cl_number.h" +#include "cln/number.h" #ifdef intQsize #include "cl_DS.h" +namespace cln { + cl_private_thing cl_I_constructor_from_Q (sint64 wert) { var uint64 test = wert & (sint64)minus_bit(cl_value_len-1); @@ -144,4 +146,6 @@ cl_private_thing cl_I_constructor_from_Q (sint64 wert) } } +} // namespace cln + #endif diff --git a/src/integer/conv/cl_I_from_UDS.cc b/src/integer/conv/cl_I_from_UDS.cc index 0f6b129..d73dbdb 100644 --- a/src/integer/conv/cl_I_from_UDS.cc +++ b/src/integer/conv/cl_I_from_UDS.cc @@ -9,13 +9,15 @@ // Implementation. -#include "cl_number.h" +#include "cln/number.h" #include "cl_DS.h" #undef MAYBE_INLINE #define MAYBE_INLINE inline #include "cl_I_from_NDS.cc" +namespace cln { + MAYBE_INLINE2 const cl_I UDS_to_I (uintD* MSDptr, uintC len) { @@ -28,3 +30,5 @@ const cl_I UDS_to_I (uintD* MSDptr, uintC len) { lsprefnext(MSDptr) = 0; len++; } return NDS_to_I(MSDptr,len); } + +} // namespace cln diff --git a/src/integer/conv/cl_I_from_UL.cc b/src/integer/conv/cl_I_from_UL.cc index b8401bb..adbd168 100644 --- a/src/integer/conv/cl_I_from_UL.cc +++ b/src/integer/conv/cl_I_from_UL.cc @@ -9,12 +9,14 @@ // Implementation. -#include "cl_number.h" +#include "cln/number.h" #if (cl_value_len <= 32) #include "cl_DS.h" +namespace cln { + cl_private_thing cl_I_constructor_from_UL (uint32 wert) { if ((wert & minus_bit(cl_value_len-1)) == 0) @@ -89,4 +91,6 @@ cl_private_thing cl_I_constructor_from_UL (uint32 wert) #undef UL_maxlength } +} // namespace cln + #endif diff --git a/src/integer/conv/cl_I_from_UL2.cc b/src/integer/conv/cl_I_from_UL2.cc index 4409b65..0fa45bd 100644 --- a/src/integer/conv/cl_I_from_UL2.cc +++ b/src/integer/conv/cl_I_from_UL2.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_number.h" +#include "cln/number.h" #include "cl_DS.h" +namespace cln { + cl_private_thing cl_I_constructor_from_UL2 (uint32 wert_hi, uint32 wert_lo) { if ((wert_hi == 0) @@ -100,3 +102,5 @@ cl_private_thing cl_I_constructor_from_UL2 (uint32 wert_hi, uint32 wert_lo) #undef IF_LENGTH #undef UL2_maxlength } + +} // namespace cln diff --git a/src/integer/conv/cl_I_from_UQ.cc b/src/integer/conv/cl_I_from_UQ.cc index 5721dcc..5c1d07e 100644 --- a/src/integer/conv/cl_I_from_UQ.cc +++ b/src/integer/conv/cl_I_from_UQ.cc @@ -9,12 +9,14 @@ // Implementation. -#include "cl_number.h" +#include "cln/number.h" #ifdef intQsize #include "cl_DS.h" +namespace cln { + cl_private_thing cl_I_constructor_from_UQ (uint64 wert) { if ((wert & (sint64)minus_bit(cl_value_len-1)) == 0) @@ -151,4 +153,6 @@ cl_private_thing cl_I_constructor_from_UQ (uint64 wert) #undef UQ_maxlength } +} // namespace cln + #endif diff --git a/src/integer/conv/cl_I_from_digits.cc b/src/integer/conv/cl_I_from_digits.cc index e79c298..5fc3426 100644 --- a/src/integer/conv/cl_I_from_digits.cc +++ b/src/integer/conv/cl_I_from_digits.cc @@ -11,6 +11,8 @@ #include "cl_DS.h" +namespace cln { + const cl_I digits_to_I (const char * MSBptr, uintL len, uintD base) { CL_ALLOCA_STACK; @@ -84,3 +86,5 @@ const cl_I digits_to_I (const char * MSBptr, uintL len, uintD base) } return NUDS_to_I(erg_MSDptr,erg_len); } + +} // namespace cln diff --git a/src/integer/conv/cl_I_mul10plus.cc b/src/integer/conv/cl_I_mul10plus.cc index 3f1fde9..f80c134 100644 --- a/src/integer/conv/cl_I_mul10plus.cc +++ b/src/integer/conv/cl_I_mul10plus.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_DS.h" +namespace cln { + const cl_I mul_10_plus_x (const cl_I& y, unsigned char x) { CL_ALLOCA_STACK; @@ -24,3 +26,5 @@ const cl_I mul_10_plus_x (const cl_I& y, unsigned char x) { lsprefnext(MSDptr) = carry; len++; } return UDS_to_I(MSDptr,len); // UDS als Integer zurück } + +} // namespace cln diff --git a/src/integer/conv/cl_I_to_L.cc b/src/integer/conv/cl_I_to_L.cc index c7e4b66..87e8f84 100644 --- a/src/integer/conv/cl_I_to_L.cc +++ b/src/integer/conv/cl_I_to_L.cc @@ -4,17 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. -#include "cl_number.h" +#include "cln/number.h" #include "cl_I.h" #include "cl_DS.h" -#include "cl_io.h" -#include "cl_integer_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/integer_io.h" +#include "cln/abort.h" + +namespace cln { sint32 cl_I_to_L (const cl_I& obj) { @@ -68,9 +70,11 @@ sint32 cl_I_to_L (const cl_I& obj) #undef IF_LENGTH } bad: // unpassendes Objekt - fprint(cl_stderr, "Not a 32-bit integer: "); - fprint(cl_stderr, obj); - fprint(cl_stderr, "\n"); + fprint(stderr, "Not a 32-bit integer: "); + fprint(stderr, obj); + fprint(stderr, "\n"); cl_abort(); } } + +} // namespace cln diff --git a/src/integer/conv/cl_I_to_Q.cc b/src/integer/conv/cl_I_to_Q.cc index 11a8c0b..66e7627 100644 --- a/src/integer/conv/cl_I_to_Q.cc +++ b/src/integer/conv/cl_I_to_Q.cc @@ -11,11 +11,13 @@ #ifdef intQsize -#include "cl_number.h" +#include "cln/number.h" #include "cl_DS.h" -#include "cl_io.h" -#include "cl_integer_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/integer_io.h" +#include "cln/abort.h" + +namespace cln { sint64 cl_I_to_Q (const cl_I& obj) { @@ -129,11 +131,13 @@ sint64 cl_I_to_Q (const cl_I& obj) #undef IF_LENGTH } bad: // unpassendes Objekt - fprint(cl_stderr, "Not a 64-bit integer: "); - fprint(cl_stderr, obj); - fprint(cl_stderr, "\n"); + fprint(stderr, "Not a 64-bit integer: "); + fprint(stderr, obj); + fprint(stderr, "\n"); cl_abort(); } } +} // namespace cln + #endif diff --git a/src/integer/conv/cl_I_to_UL.cc b/src/integer/conv/cl_I_to_UL.cc index e3aca20..c4fffac 100644 --- a/src/integer/conv/cl_I_to_UL.cc +++ b/src/integer/conv/cl_I_to_UL.cc @@ -4,17 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. -#include "cl_number.h" +#include "cln/number.h" #include "cl_I.h" #include "cl_DS.h" -#include "cl_io.h" -#include "cl_integer_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/integer_io.h" +#include "cln/abort.h" + +namespace cln { uint32 cl_I_to_UL (const cl_I& obj) { @@ -52,8 +54,10 @@ uint32 cl_I_to_UL (const cl_I& obj) #undef IF_LENGTH } bad: // unpassendes Objekt - fprint(cl_stderr, "Not a 32-bit integer: "); - fprint(cl_stderr, obj); - fprint(cl_stderr, "\n"); + fprint(stderr, "Not a 32-bit integer: "); + fprint(stderr, obj); + fprint(stderr, "\n"); cl_abort(); } + +} // namespace cln diff --git a/src/integer/conv/cl_I_to_UQ.cc b/src/integer/conv/cl_I_to_UQ.cc index 5e522f2..2367493 100644 --- a/src/integer/conv/cl_I_to_UQ.cc +++ b/src/integer/conv/cl_I_to_UQ.cc @@ -11,11 +11,13 @@ #ifdef intQsize -#include "cl_number.h" +#include "cln/number.h" #include "cl_DS.h" -#include "cl_io.h" -#include "cl_integer_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/integer_io.h" +#include "cln/abort.h" + +namespace cln { uint64 cl_I_to_UQ (const cl_I& obj) { @@ -89,10 +91,12 @@ uint64 cl_I_to_UQ (const cl_I& obj) #undef IF_LENGTH } bad: // unpassendes Objekt - fprint(cl_stderr, "Not a 64-bit integer: "); - fprint(cl_stderr, obj); - fprint(cl_stderr, "\n"); + fprint(stderr, "Not a 64-bit integer: "); + fprint(stderr, obj); + fprint(stderr, "\n"); cl_abort(); } +} // namespace cln + #endif diff --git a/src/integer/conv/cl_I_to_digits.cc b/src/integer/conv/cl_I_to_digits.cc index b66f6e4..f64e263 100644 --- a/src/integer/conv/cl_I_to_digits.cc +++ b/src/integer/conv/cl_I_to_digits.cc @@ -11,6 +11,8 @@ #include "cl_DS.h" +namespace cln { + // Tabelle: enthält zu jeder Basis b (2 <= b <= 36) // - eine Kettenbruchapproximation num/den von intDsize*log(2)/log(b) // (num/den >= intDsize*log(2)/log(b), mit num <= 2^10) @@ -214,8 +216,8 @@ cached_power_table () {} ~cached_power_table () {} // Allocation and deallocation. - void* operator new (size_t size) { return cl_malloc_hook(size); } - void operator delete (void* ptr) { cl_free_hook(ptr); } + void* operator new (size_t size) { return malloc_hook(size); } + void operator delete (void* ptr) { free_hook(ptr); } }; static cached_power_table* ctable [36-2+1] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @@ -409,3 +411,4 @@ void I_to_digits (const cl_I& X, uintD base, cl_digits* erg) } // Bit complexity (N := length(X)): O(log(N)*M(N)). +} // namespace cln diff --git a/src/integer/division/cl_I_ceil1.cc b/src/integer/division/cl_I_ceil1.cc index 6c117ac..4d8bd37 100644 --- a/src/integer/division/cl_I_ceil1.cc +++ b/src/integer/division/cl_I_ceil1.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + const cl_I ceiling1 (const cl_I& x, const cl_I& y) { // Methode: @@ -31,3 +33,5 @@ const cl_I ceiling1 (const cl_I& x, const cl_I& y) { q = -q; } return q; } + +} // namespace cln diff --git a/src/integer/division/cl_I_ceil2.cc b/src/integer/division/cl_I_ceil2.cc index 2686539..75795db 100644 --- a/src/integer/division/cl_I_ceil2.cc +++ b/src/integer/division/cl_I_ceil2.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + const cl_I_div_t ceiling2 (const cl_I& x, const cl_I& y) { // Methode: @@ -33,3 +35,5 @@ const cl_I_div_t ceiling2 (const cl_I& x, const cl_I& y) { q = -q; } return q_r; } + +} // namespace cln diff --git a/src/integer/division/cl_I_exquo.cc b/src/integer/division/cl_I_exquo.cc index 37d7189..771eef8 100644 --- a/src/integer/division/cl_I_exquo.cc +++ b/src/integer/division/cl_I_exquo.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + const cl_I exquo (const cl_I& x, const cl_I& y) { // Methode: @@ -25,3 +27,5 @@ const cl_I exquo (const cl_I& x, const cl_I& y) else { return -q_r.quotient; } } + +} // namespace cln diff --git a/src/integer/division/cl_I_exquoerr.cc b/src/integer/division/cl_I_exquoerr.cc index a295c96..3e4b6de 100644 --- a/src/integer/division/cl_I_exquoerr.cc +++ b/src/integer/division/cl_I_exquoerr.cc @@ -9,16 +9,20 @@ // Implementation. -#include "cl_io.h" -#include "cl_integer_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/integer_io.h" +#include "cln/abort.h" + +namespace cln { void cl_error_exquo (const cl_I& x, const cl_I& y) { - fprint(cl_stderr, "Quotient "); - fprint(cl_stderr, x); - fprint(cl_stderr, " / "); - fprint(cl_stderr, y); - fprint(cl_stderr, " is not an integer.\n"); + fprint(stderr, "Quotient "); + fprint(stderr, x); + fprint(stderr, " / "); + fprint(stderr, y); + fprint(stderr, " is not an integer.\n"); cl_abort(); } + +} // namespace cln diff --git a/src/integer/division/cl_I_exquopos.cc b/src/integer/division/cl_I_exquopos.cc index 91bbde2..5e28f72 100644 --- a/src/integer/division/cl_I_exquopos.cc +++ b/src/integer/division/cl_I_exquopos.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + const cl_I exquopos (const cl_I& x, const cl_I& y) { // Methode: @@ -22,3 +24,5 @@ const cl_I exquopos (const cl_I& x, const cl_I& y) if (!zerop(q_r.remainder)) { cl_error_exquo(x,y); } return q_r.quotient; } + +} // namespace cln diff --git a/src/integer/division/cl_I_floor1.cc b/src/integer/division/cl_I_floor1.cc index a0528aa..18996d0 100644 --- a/src/integer/division/cl_I_floor1.cc +++ b/src/integer/division/cl_I_floor1.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + const cl_I floor1 (const cl_I& x, const cl_I& y) { // Methode: @@ -31,3 +33,5 @@ const cl_I floor1 (const cl_I& x, const cl_I& y) } return q; } + +} // namespace cln diff --git a/src/integer/division/cl_I_floor2.cc b/src/integer/division/cl_I_floor2.cc index 1db80b1..962500f 100644 --- a/src/integer/division/cl_I_floor2.cc +++ b/src/integer/division/cl_I_floor2.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + const cl_I_div_t floor2 (const cl_I& x, const cl_I& y) { // Methode: @@ -33,3 +35,5 @@ const cl_I_div_t floor2 (const cl_I& x, const cl_I& y) { q = -q; } return q_r; } + +} // namespace cln diff --git a/src/integer/division/cl_I_mod.cc b/src/integer/division/cl_I_mod.cc index b770476..34bf816 100644 --- a/src/integer/division/cl_I_mod.cc +++ b/src/integer/division/cl_I_mod.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + const cl_I mod (const cl_I& x, const cl_I& y) { // Methode: @@ -27,3 +29,5 @@ const cl_I mod (const cl_I& x, const cl_I& y) } if (minusp(x)) { return -r; } else { return r; } } + +} // namespace cln diff --git a/src/integer/division/cl_I_rem.cc b/src/integer/division/cl_I_rem.cc index 5491677..139837e 100644 --- a/src/integer/division/cl_I_rem.cc +++ b/src/integer/division/cl_I_rem.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + const cl_I rem (const cl_I& x, const cl_I& y) { // Methode: @@ -21,3 +23,5 @@ const cl_I rem (const cl_I& x, const cl_I& y) var cl_I r = cl_divide(abs(x),abs(y)).remainder; if (minusp(x)) { return -r; } else { return r; } } + +} // namespace cln diff --git a/src/integer/division/cl_I_round1.cc b/src/integer/division/cl_I_round1.cc index 2709993..117835e 100644 --- a/src/integer/division/cl_I_round1.cc +++ b/src/integer/division/cl_I_round1.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + const cl_I round1 (const cl_I& x, const cl_I& y) { // Methode: @@ -35,3 +37,5 @@ const cl_I round1 (const cl_I& x, const cl_I& y) { q = -q; } return q; } + +} // namespace cln diff --git a/src/integer/division/cl_I_round2.cc b/src/integer/division/cl_I_round2.cc index bfa24c1..3aa5990 100644 --- a/src/integer/division/cl_I_round2.cc +++ b/src/integer/division/cl_I_round2.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + const cl_I_div_t round2 (const cl_I& x, const cl_I& y) { // Methode: @@ -37,3 +39,5 @@ const cl_I_div_t round2 (const cl_I& x, const cl_I& y) { q = -q; } return q_r; } + +} // namespace cln diff --git a/src/integer/division/cl_I_trunc1.cc b/src/integer/division/cl_I_trunc1.cc index 08f2205..a499d9d 100644 --- a/src/integer/division/cl_I_trunc1.cc +++ b/src/integer/division/cl_I_trunc1.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + const cl_I truncate1 (const cl_I& x, const cl_I& y) { // Methode: @@ -25,3 +27,5 @@ const cl_I truncate1 (const cl_I& x, const cl_I& y) { q = -q; } return q; } + +} // namespace cln diff --git a/src/integer/division/cl_I_trunc2.cc b/src/integer/division/cl_I_trunc2.cc index f9d6700..ac399cc 100644 --- a/src/integer/division/cl_I_trunc2.cc +++ b/src/integer/division/cl_I_trunc2.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + const cl_I_div_t truncate2 (const cl_I& x, const cl_I& y) { // Methode: @@ -28,3 +30,5 @@ const cl_I_div_t truncate2 (const cl_I& x, const cl_I& y) { q = -q; } return q_r; } + +} // namespace cln diff --git a/src/integer/elem/cl_I_compare.cc b/src/integer/elem/cl_I_compare.cc index f9b8adb..2ce6059 100644 --- a/src/integer/elem/cl_I_compare.cc +++ b/src/integer/elem/cl_I_compare.cc @@ -1,10 +1,10 @@ -// cl_compare(). +// compare(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -12,7 +12,9 @@ #include "cl_I.h" #include "cl_DS.h" -cl_signean cl_compare (const cl_I& x, const cl_I& y) +namespace cln { + +cl_signean compare (const cl_I& x, const cl_I& y) { // Methode: // x und y haben verschiedenes Vorzeichen -> @@ -101,3 +103,5 @@ cl_signean cl_compare (const cl_I& x, const cl_I& y) return (xlen > ylen ? signean_minus : signean_plus); } } + +} // namespace cln diff --git a/src/integer/elem/cl_I_div.cc b/src/integer/elem/cl_I_div.cc index 3ff043e..e09d179 100644 --- a/src/integer/elem/cl_I_div.cc +++ b/src/integer/elem/cl_I_div.cc @@ -11,6 +11,8 @@ #include "cl_N.h" +namespace cln { + // Dividiert zwei Integers x,y >=0 und liefert Quotient und Rest // der Division x/y. Bei y=0 Error. // cl_divide(x,y) @@ -86,3 +88,4 @@ } // Bit complexity (N = length(x)): O(M(N)). +} // namespace cln diff --git a/src/integer/elem/cl_I_equal.cc b/src/integer/elem/cl_I_equal.cc index 3476f5f..7946275 100644 --- a/src/integer/elem/cl_I_equal.cc +++ b/src/integer/elem/cl_I_equal.cc @@ -1,10 +1,10 @@ -// cl_equal(). +// equal(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -12,7 +12,9 @@ #include "cl_I.h" #include "cl_DS.h" -cl_boolean cl_equal (const cl_I& x, const cl_I& y) +namespace cln { + +cl_boolean equal (const cl_I& x, const cl_I& y) { // Methode: // x und y haben gleiches Vorzeichen -> @@ -52,3 +54,5 @@ cl_boolean cl_equal (const cl_I& x, const cl_I& y) return cl_false; } } + +} // namespace cln diff --git a/src/integer/elem/cl_I_minus.cc b/src/integer/elem/cl_I_minus.cc index 263728c..3f31b3c 100644 --- a/src/integer/elem/cl_I_minus.cc +++ b/src/integer/elem/cl_I_minus.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_DS.h" +namespace cln { + const cl_I operator- (const cl_I& x, const cl_I& y) { // Methode: @@ -204,3 +206,5 @@ const cl_I operator- (const cl_I& x, const cl_I& y) } } } } + +} // namespace cln diff --git a/src/integer/elem/cl_I_minus1.cc b/src/integer/elem/cl_I_minus1.cc index e7fd54a..d717e10 100644 --- a/src/integer/elem/cl_I_minus1.cc +++ b/src/integer/elem/cl_I_minus1.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_DS.h" +namespace cln { + const cl_I minus1 (const cl_I& x) { if (fixnump(x)) @@ -31,3 +33,5 @@ const cl_I minus1 (const cl_I& x) return DS_to_I(MSDptr,len); // wieder zum Integer machen } } + +} // namespace cln diff --git a/src/integer/elem/cl_I_minusp.cc b/src/integer/elem/cl_I_minusp.cc index b2a2cac..120c1dd 100644 --- a/src/integer/elem/cl_I_minusp.cc +++ b/src/integer/elem/cl_I_minusp.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,7 +13,11 @@ #include "cl_I.h" #undef minusp +namespace cln { + cl_boolean minusp (const cl_I& x) { return inline_minusp(x); } + +} // namespace cln diff --git a/src/integer/elem/cl_I_mul.cc b/src/integer/elem/cl_I_mul.cc index 1558797..62cab33 100644 --- a/src/integer/elem/cl_I_mul.cc +++ b/src/integer/elem/cl_I_mul.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_DS.h" #include "cl_low.h" +namespace cln { + const cl_I operator* (const cl_I& x, const cl_I& y) { // Methode: @@ -50,3 +52,4 @@ const cl_I operator* (const cl_I& x, const cl_I& y) } // Bit complexity (x,y of length N): O(M(N)). +} // namespace cln diff --git a/src/integer/elem/cl_I_plus.cc b/src/integer/elem/cl_I_plus.cc index bd2b014..fa88396 100644 --- a/src/integer/elem/cl_I_plus.cc +++ b/src/integer/elem/cl_I_plus.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_DS.h" +namespace cln { + const cl_I operator+ (const cl_I& x, const cl_I& y) { // Methode: @@ -199,3 +201,5 @@ const cl_I operator+ (const cl_I& x, const cl_I& y) } } } + +} // namespace cln diff --git a/src/integer/elem/cl_I_plus1.cc b/src/integer/elem/cl_I_plus1.cc index bc73cfc..45671a8 100644 --- a/src/integer/elem/cl_I_plus1.cc +++ b/src/integer/elem/cl_I_plus1.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_DS.h" +namespace cln { + const cl_I plus1 (const cl_I& x) { if (fixnump(x)) @@ -31,3 +33,5 @@ const cl_I plus1 (const cl_I& x) return DS_to_I(MSDptr,len); // wieder zum Integer machen } } + +} // namespace cln diff --git a/src/integer/elem/cl_I_plusp.cc b/src/integer/elem/cl_I_plusp.cc index ce47a98..d4d47b0 100644 --- a/src/integer/elem/cl_I_plusp.cc +++ b/src/integer/elem/cl_I_plusp.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -15,6 +15,8 @@ #undef zerop #undef minusp +namespace cln { + cl_boolean plusp (const cl_I& x) { if (inline_minusp(x)) @@ -24,3 +26,5 @@ cl_boolean plusp (const cl_I& x) else return cl_true; // sonst ist x>0. } + +} // namespace cln diff --git a/src/integer/elem/cl_I_square.cc b/src/integer/elem/cl_I_square.cc index d14f3cd..64aaf02 100644 --- a/src/integer/elem/cl_I_square.cc +++ b/src/integer/elem/cl_I_square.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_DS.h" #include "cl_low.h" +namespace cln { + const cl_I square (const cl_I& x) { // Methode: @@ -49,3 +51,4 @@ const cl_I square (const cl_I& x) } // Bit complexity (x of length N): O(M(N)). +} // namespace cln diff --git a/src/integer/elem/cl_I_uminus.cc b/src/integer/elem/cl_I_uminus.cc index d9dbb20..cb39479 100644 --- a/src/integer/elem/cl_I_uminus.cc +++ b/src/integer/elem/cl_I_uminus.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_DS.h" +namespace cln { + const cl_I operator- (const cl_I& x) { if (fixnump(x)) { @@ -41,3 +43,5 @@ const cl_I operator- (const cl_I& x) return DS_to_I(MSDptr,len); // DS wieder zum Integer machen } } + +} // namespace cln diff --git a/src/integer/elem/cl_I_zerop.cc b/src/integer/elem/cl_I_zerop.cc index db57125..93b58f2 100644 --- a/src/integer/elem/cl_I_zerop.cc +++ b/src/integer/elem/cl_I_zerop.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,7 +13,11 @@ #include "cl_I.h" #undef zerop +namespace cln { + cl_boolean zerop (const cl_I& x) { return inline_zerop(x); } + +} // namespace cln diff --git a/src/integer/gcd/cl_I_gcd.cc b/src/integer/gcd/cl_I_gcd.cc index f530ed6..f66b5fd 100644 --- a/src/integer/gcd/cl_I_gcd.cc +++ b/src/integer/gcd/cl_I_gcd.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -14,6 +14,8 @@ #include "cl_D.h" #include "cl_xmacros.h" +namespace cln { + #define GCD_ALGO 3 // 1: binär, 2: Schulmethode, 3: Lehmer @@ -154,7 +156,7 @@ { // bleibt Fixnum, da (gcd a b) <= (min a b) return L_to_FN(gcd(FN_to_UL(a),FN_to_UL(b))); } - { var cl_signean vergleich = cl_compare(a,b); + { var cl_signean vergleich = compare(a,b); if (vergleich == 0) { return a; } // a=b -> fertig if (vergleich < 0) { var cl_I tmp = a; a = b; b = a; } // a a,b vertauschen } @@ -517,3 +519,5 @@ } #endif /* GCD_ALGO == 3 */ + +} // namespace cln diff --git a/src/integer/gcd/cl_I_gcd_aux.cc b/src/integer/gcd/cl_I_gcd_aux.cc index 0062463..e42ac9b 100644 --- a/src/integer/gcd/cl_I_gcd_aux.cc +++ b/src/integer/gcd/cl_I_gcd_aux.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_D.h" +namespace cln { + void partial_gcd (uintD z1, uintD z2, partial_gcd_result* erg) { var uintD x1 = 1; var uintD y1 = 0; @@ -57,3 +59,5 @@ void partial_gcd (uintD z1, uintD z2, partial_gcd_result* erg) // Keine Subtraktion mehr möglich. erg->x1 = x1; erg->y1 = y1; erg->x2 = x2; erg->y2 = y2; // Ergebnis } + +} // namespace cln diff --git a/src/integer/gcd/cl_I_gcd_aux2.cc b/src/integer/gcd/cl_I_gcd_aux2.cc index adb6f61..0b8bf94 100644 --- a/src/integer/gcd/cl_I_gcd_aux2.cc +++ b/src/integer/gcd/cl_I_gcd_aux2.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_D.h" +namespace cln { + // Dasselbe wie partial_gcd(z1,z2,erg), nur daß z1 und z2 Doppelworte sind. // Bevor im Ergebnis erg ein Ãœberlauf eintritt, wird abgebrochen. @@ -451,3 +453,5 @@ void partial_gcd (uintD z1hi, uintD z1lo, uintD z2hi, uintD z2lo, partial_gcd_re } #endif + +} // namespace cln diff --git a/src/integer/gcd/cl_I_lcm.cc b/src/integer/gcd/cl_I_lcm.cc index e7837ef..36ccbc9 100644 --- a/src/integer/gcd/cl_I_lcm.cc +++ b/src/integer/gcd/cl_I_lcm.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + const cl_I lcm (const cl_I& a, const cl_I& b) { // Methode: @@ -30,3 +32,5 @@ const cl_I lcm (const cl_I& a, const cl_I& b) return a*b; } } + +} // namespace cln diff --git a/src/integer/gcd/cl_I_xgcd.cc b/src/integer/gcd/cl_I_xgcd.cc index 8286ec3..d99272a 100644 --- a/src/integer/gcd/cl_I_xgcd.cc +++ b/src/integer/gcd/cl_I_xgcd.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -14,6 +14,8 @@ #include "cl_D.h" #include "cl_xmacros.h" +namespace cln { + #define GCD_ALGO 3 // 1: binär, 2: Schulmethode, 3: Lehmer @@ -58,7 +60,7 @@ { *u = ua; *v = va; return a; } if (eq(a,0)) // a=0 -> g=b, (u,v) = (ub,vb) { *u = ub; *v = vb; return b; } - { var cl_signean vergleich = cl_compare(a,b); + { var cl_signean vergleich = compare(a,b); if (vergleich == 0) // a=b -> fertig { *u = ua; *v = va; return a; } if (vergleich < 0) // a a,b vertauschen @@ -528,3 +530,5 @@ } #endif /* GCD_ALGO == 3 */ + +} // namespace cln diff --git a/src/integer/gcd/cl_low_gcd.cc b/src/integer/gcd/cl_low_gcd.cc index b68729d..75f67c4 100644 --- a/src/integer/gcd/cl_low_gcd.cc +++ b/src/integer/gcd/cl_low_gcd.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. +namespace cln { + // Liefert den ggT zweier Integers. // gcd(a,b) // > a,b: zwei Integers @@ -89,3 +91,5 @@ // a=b>0 return a; } + +} // namespace cln diff --git a/src/integer/hash/cl_I_hash_gcobject.cc b/src/integer/hash/cl_I_hash_gcobject.cc index 31e4d70..a73382d 100644 --- a/src/integer/hash/cl_I_hash_gcobject.cc +++ b/src/integer/hash/cl_I_hash_gcobject.cc @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_hash1.h" +namespace cln { + static void cl_hashtable_from_integer_to_gcobject_destructor (cl_heap* pointer) { #if (defined(__mips__) || defined(__mips64__)) && !defined(__GNUC__) // workaround SGI CC bug @@ -46,3 +48,4 @@ void cl_ht_from_integer_to_gcobject::put (const cl_I& x, const cl_gcobject& y) c ((cl_heap_hashtable_from_integer_to_gcobject*)pointer)->put(x,y); } +} // namespace cln diff --git a/src/integer/hash/cl_I_hash_gcobject.h b/src/integer/hash/cl_I_hash_gcobject.h index 7839b39..a0b4671 100644 --- a/src/integer/hash/cl_I_hash_gcobject.h +++ b/src/integer/hash/cl_I_hash_gcobject.h @@ -3,17 +3,11 @@ #ifndef _CL_I_HASH_GCOBJECT_H #define _CL_I_HASH_GCOBJECT_H -#include "cl_number.h" -#include "cl_integer.h" - -// For the sake of gcc-2.7.x, this declaration must come before cl_hash1.h. -extern unsigned long hashcode (const cl_I& x); - +#include "cln/number.h" +#include "cln/integer.h" #include "cl_hash1.h" -// Equality. -static inline bool equal (const cl_I& x, const cl_I& y) -{ return (bool)cl_equal(x,y); } +namespace cln { typedef cl_htentry1 cl_htentry_from_integer_to_gcobject; @@ -36,4 +30,6 @@ struct cl_ht_from_integer_to_gcobject : public cl_gcpointer { void put (const cl_I& x, const cl_gcobject& y) const; }; +} // namespace cln + #endif /* _CL_I_HASH_GCOBJECT_H */ diff --git a/src/integer/hash/cl_I_hash_gcpointer.cc b/src/integer/hash/cl_I_hash_gcpointer.cc index a05cf8a..b21b6ac 100644 --- a/src/integer/hash/cl_I_hash_gcpointer.cc +++ b/src/integer/hash/cl_I_hash_gcpointer.cc @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_hash1.h" +namespace cln { + static void cl_hashtable_from_integer_to_gcpointer_destructor (cl_heap* pointer) { #if (defined(__mips__) || defined(__mips64__)) && !defined(__GNUC__) // workaround SGI CC bug @@ -46,3 +48,4 @@ void cl_ht_from_integer_to_gcpointer::put (const cl_I& x, const cl_gcpointer& y) ((cl_heap_hashtable_from_integer_to_gcpointer*)pointer)->put(x,y); } +} // namespace cln diff --git a/src/integer/hash/cl_I_hash_gcpointer.h b/src/integer/hash/cl_I_hash_gcpointer.h index e97cb3a..484a73d 100644 --- a/src/integer/hash/cl_I_hash_gcpointer.h +++ b/src/integer/hash/cl_I_hash_gcpointer.h @@ -3,17 +3,11 @@ #ifndef _CL_I_HASH_GCPOINTER_H #define _CL_I_HASH_GCPOINTER_H -#include "cl_number.h" -#include "cl_integer.h" - -// For the sake of gcc-2.7.x, this declaration must come before cl_hash1.h. -extern unsigned long hashcode (const cl_I& x); - +#include "cln/number.h" +#include "cln/integer.h" #include "cl_hash1.h" -// Equality. -static inline bool equal (const cl_I& x, const cl_I& y) -{ return (bool)cl_equal(x,y); } +namespace cln { typedef cl_htentry1 cl_htentry_from_integer_to_gcpointer; @@ -36,4 +30,6 @@ struct cl_ht_from_integer_to_gcpointer : public cl_gcpointer { void put (const cl_I& x, const cl_gcpointer& y) const; }; +} // namespace cln + #endif /* _CL_I_HASH_GCPOINTER_H */ diff --git a/src/integer/hash/cl_I_hash_pointer.cc b/src/integer/hash/cl_I_hash_pointer.cc index eb436e1..5ac0e46 100644 --- a/src/integer/hash/cl_I_hash_pointer.cc +++ b/src/integer/hash/cl_I_hash_pointer.cc @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_hash1.h" +namespace cln { + static void cl_hashtable_from_integer_to_pointer_destructor (cl_heap* pointer) { #if (defined(__mips__) || defined(__mips64__)) && !defined(__GNUC__) // workaround SGI CC bug @@ -46,3 +48,4 @@ void cl_ht_from_integer_to_pointer::put (const cl_I& x, void* y) const ((cl_heap_hashtable_from_integer_to_pointer*)pointer)->put(x,y); } +} // namespace cln diff --git a/src/integer/hash/cl_I_hash_pointer.h b/src/integer/hash/cl_I_hash_pointer.h index 77fd1ea..1c136d3 100644 --- a/src/integer/hash/cl_I_hash_pointer.h +++ b/src/integer/hash/cl_I_hash_pointer.h @@ -3,17 +3,11 @@ #ifndef _CL_I_HASH_POINTER_H #define _CL_I_HASH_POINTER_H -#include "cl_number.h" -#include "cl_integer.h" - -// For the sake of gcc-2.7.x, this declaration must come before cl_hash1.h. -extern unsigned long hashcode (const cl_I& x); - +#include "cln/number.h" +#include "cln/integer.h" #include "cl_hash1.h" -// Equality. -static inline bool equal (const cl_I& x, const cl_I& y) -{ return (bool)cl_equal(x,y); } +namespace cln { typedef cl_htentry1 cl_htentry_from_integer_to_pointer; @@ -36,4 +30,6 @@ struct cl_ht_from_integer_to_pointer : public cl_gcpointer { void put (const cl_I& x, void* y) const; }; +} // namespace cln + #endif /* _CL_I_HASH_POINTER_H */ diff --git a/src/integer/hash/cl_I_hash_rcobject.cc b/src/integer/hash/cl_I_hash_rcobject.cc index f6dcaf2..cafebb7 100644 --- a/src/integer/hash/cl_I_hash_rcobject.cc +++ b/src/integer/hash/cl_I_hash_rcobject.cc @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_hash1.h" +namespace cln { + static void cl_hashtable_from_integer_to_rcobject_destructor (cl_heap* pointer) { #if (defined(__mips__) || defined(__mips64__)) && !defined(__GNUC__) // workaround SGI CC bug @@ -46,3 +48,4 @@ void cl_ht_from_integer_to_rcobject::put (const cl_I& x, const cl_rcobject& y) c ((cl_heap_hashtable_from_integer_to_rcobject*)pointer)->put(x,y); } +} // namespace cln diff --git a/src/integer/hash/cl_I_hash_rcobject.h b/src/integer/hash/cl_I_hash_rcobject.h index e8c34ca..b6c385a 100644 --- a/src/integer/hash/cl_I_hash_rcobject.h +++ b/src/integer/hash/cl_I_hash_rcobject.h @@ -3,17 +3,11 @@ #ifndef _CL_I_HASH_RCOBJECT_H #define _CL_I_HASH_RCOBJECT_H -#include "cl_number.h" -#include "cl_integer.h" - -// For the sake of gcc-2.7.x, this declaration must come before cl_hash1.h. -extern unsigned long hashcode (const cl_I& x); - +#include "cln/number.h" +#include "cln/integer.h" #include "cl_hash1.h" -// Equality. -static inline bool equal (const cl_I& x, const cl_I& y) -{ return (bool)cl_equal(x,y); } +namespace cln { typedef cl_htentry1 cl_htentry_from_integer_to_rcobject; @@ -36,4 +30,6 @@ struct cl_ht_from_integer_to_rcobject : public cl_gcpointer { void put (const cl_I& x, const cl_rcobject& y) const; }; +} // namespace cln + #endif /* _CL_I_HASH_RCOBJECT_H */ diff --git a/src/integer/hash/cl_I_hash_rcpointer.cc b/src/integer/hash/cl_I_hash_rcpointer.cc index 00b7a7e..dbbc19e 100644 --- a/src/integer/hash/cl_I_hash_rcpointer.cc +++ b/src/integer/hash/cl_I_hash_rcpointer.cc @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_hash1.h" +namespace cln { + static void cl_hashtable_from_integer_to_rcpointer_destructor (cl_heap* pointer) { #if (defined(__mips__) || defined(__mips64__)) && !defined(__GNUC__) // workaround SGI CC bug @@ -46,3 +48,4 @@ void cl_ht_from_integer_to_rcpointer::put (const cl_I& x, const cl_rcpointer& y) ((cl_heap_hashtable_from_integer_to_rcpointer*)pointer)->put(x,y); } +} // namespace cln diff --git a/src/integer/hash/cl_I_hash_rcpointer.h b/src/integer/hash/cl_I_hash_rcpointer.h index 6f595ea..9d9ee3d 100644 --- a/src/integer/hash/cl_I_hash_rcpointer.h +++ b/src/integer/hash/cl_I_hash_rcpointer.h @@ -3,17 +3,11 @@ #ifndef _CL_I_HASH_RCPOINTER_H #define _CL_I_HASH_RCPOINTER_H -#include "cl_number.h" -#include "cl_integer.h" - -// For the sake of gcc-2.7.x, this declaration must come before cl_hash1.h. -extern unsigned long hashcode (const cl_I& x); - +#include "cln/number.h" +#include "cln/integer.h" #include "cl_hash1.h" -// Equality. -static inline bool equal (const cl_I& x, const cl_I& y) -{ return (bool)cl_equal(x,y); } +namespace cln { typedef cl_htentry1 cl_htentry_from_integer_to_rcpointer; @@ -36,4 +30,6 @@ struct cl_ht_from_integer_to_rcpointer : public cl_gcpointer { void put (const cl_I& x, const cl_rcpointer& y) const; }; +} // namespace cln + #endif /* _CL_I_HASH_RCPOINTER_H */ diff --git a/src/integer/hash/cl_I_hashcode.cc b/src/integer/hash/cl_I_hashcode.cc index 4d78ed9..35af799 100644 --- a/src/integer/hash/cl_I_hashcode.cc +++ b/src/integer/hash/cl_I_hashcode.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + unsigned long hashcode (const cl_I& x) { var unsigned long code = 0x814BE3A5; @@ -36,3 +38,5 @@ unsigned long hashcode (const cl_I& x) } return code; } + +} // namespace cln diff --git a/src/integer/hash/cl_I_hashweak_rcpointer.cc b/src/integer/hash/cl_I_hashweak_rcpointer.cc index 86af55e..d6a878b 100644 --- a/src/integer/hash/cl_I_hashweak_rcpointer.cc +++ b/src/integer/hash/cl_I_hashweak_rcpointer.cc @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_hash1weak.h" +namespace cln { + static void cl_weak_hashtable_from_integer_to_rcpointer_destructor (cl_heap* pointer) { #if (defined(__mips__) || defined(__mips64__)) && !defined(__GNUC__) // workaround SGI CC bug @@ -46,3 +48,4 @@ void cl_wht_from_integer_to_rcpointer::put (const cl_I& x, const cl_rcpointer& y ((cl_heap_weak_hashtable_from_integer_to_rcpointer*)pointer)->put(x,y); } +} // namespace cln diff --git a/src/integer/hash/cl_I_hashweak_rcpointer.h b/src/integer/hash/cl_I_hashweak_rcpointer.h index 833ef2a..50ad5e2 100644 --- a/src/integer/hash/cl_I_hashweak_rcpointer.h +++ b/src/integer/hash/cl_I_hashweak_rcpointer.h @@ -3,17 +3,11 @@ #ifndef _CL_I_HASHWEAK_RCPOINTER_H #define _CL_I_HASHWEAK_RCPOINTER_H -#include "cl_number.h" -#include "cl_integer.h" - -// For the sake of gcc-2.7.x, this declaration must come before cl_hash1.h. -extern unsigned long hashcode (const cl_I& x); - +#include "cln/number.h" +#include "cln/integer.h" #include "cl_hash1weak.h" -// Equality. -static inline bool equal (const cl_I& x, const cl_I& y) -{ return (bool)cl_equal(x,y); } +namespace cln { typedef cl_htentry1 cl_htentry_from_integer_to_rcpointer; @@ -36,4 +30,6 @@ struct cl_wht_from_integer_to_rcpointer : public cl_gcpointer { void put (const cl_I& x, const cl_rcpointer& y) const; }; +} // namespace cln + #endif /* _CL_I_HASHWEAK_RCPOINTER_H */ diff --git a/src/integer/input/cl_I_from_string.cc b/src/integer/input/cl_I_from_string.cc index 1ce6930..991f7bd 100644 --- a/src/integer/input/cl_I_from_string.cc +++ b/src/integer/input/cl_I_from_string.cc @@ -4,19 +4,21 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer_class.h" +#include "cln/integer_class.h" // Implementation. -#include "cl_input.h" -#include "cl_integer_io.h" +#include "cln/input.h" +#include "cln/integer_io.h" + +namespace cln { cl_read_flags cl_I_read_flags = { syntax_integer, lsyntax_all, 10, - { cl_float_format_ffloat, cl_float_format_lfloat_min, cl_true } + { float_format_ffloat, float_format_lfloat_min, cl_true } }; cl_I::cl_I (const char * string) @@ -24,3 +26,5 @@ cl_I::cl_I (const char * string) pointer = as_cl_private_thing( read_integer(cl_I_read_flags,string,NULL,NULL)); } + +} // namespace cln diff --git a/src/integer/input/cl_I_read.cc b/src/integer/input/cl_I_read.cc index 06f3cd4..eff618b 100644 --- a/src/integer/input/cl_I_read.cc +++ b/src/integer/input/cl_I_read.cc @@ -6,20 +6,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer_io.h" +#include "cln/integer_io.h" // Implementation. #include -#include "cl_input.h" -#include "cl_integer.h" +#include "cln/input.h" +#include "cln/integer.h" #include "cl_I.h" -#include "cl_abort.h" +#include "cln/abort.h" -#undef floor -#include -#define floor cln_floor +namespace cln { // Step forward over all digits, to the end of string or to the next non-digit. static const char * skip_digits (const char * ptr, const char * string_limit, unsigned int base) @@ -56,7 +54,7 @@ const cl_I read_integer (const cl_read_flags& flags, const char * string, const ASSERT((flags.syntax & ~(syntax_integer|syntax_maybe_bad)) == 0); // If no string_limit is given, it defaults to the end of the string. if (!string_limit) - string_limit = string + strlen(string); + string_limit = string + ::strlen(string); if (flags.syntax & syntax_integer) { // Check for integer syntax. var unsigned int rational_base = flags.rational_base; @@ -83,9 +81,9 @@ const cl_I read_integer (const cl_read_flags& flags, const char * string, const goto not_integer_syntax; var cl_I base = read_integer(10,0,ptr,0,base_end_ptr-ptr); if (!((base >= 2) && (base <= 36))) { - fprint(cl_stderr, "Base must be an integer in the range from 2 to 36, not "); - fprint(cl_stderr, base); - fprint(cl_stderr, "\n"); + fprint(stderr, "Base must be an integer in the range from 2 to 36, not "); + fprint(stderr, base); + fprint(stderr, "\n"); cl_abort(); } rational_base = FN_to_UL(base); ptr = base_end_ptr; @@ -132,3 +130,5 @@ bad_syntax: } read_number_bad_syntax(string,string_limit); } + +} // namespace cln diff --git a/src/integer/input/cl_I_read_stream.cc b/src/integer/input/cl_I_read_stream.cc index 44f79c0..dcb9176 100644 --- a/src/integer/input/cl_I_read_stream.cc +++ b/src/integer/input/cl_I_read_stream.cc @@ -6,15 +6,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer_io.h" +#include "cln/integer_io.h" // Implementation. -#include "cl_input.h" -#include "cl_io.h" +#include "cln/input.h" +#include "cln/io.h" #include "cl_spushstring.h" +namespace cln { + // We read an entire token (or even more, if it begins with #C) into a // buffer and then call read_integer() on the buffer. @@ -102,3 +104,5 @@ syntax1: buffer.push(c); // Handle premature EOF. eof: read_number_eof(); } + +} // namespace cln diff --git a/src/integer/input/cl_I_readparsed.cc b/src/integer/input/cl_I_readparsed.cc index 8f68249..a700e11 100644 --- a/src/integer/input/cl_I_readparsed.cc +++ b/src/integer/input/cl_I_readparsed.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer_io.h" +#include "cln/integer_io.h" // Implementation. #include "cl_I.h" +namespace cln { + const cl_I read_integer (unsigned int base, cl_signean sign, const char * string, uintL index1, uintL index2) { var cl_I x = digits_to_I(&string[index1],index2-index1,(uintD)base); @@ -19,3 +21,5 @@ const cl_I read_integer (unsigned int base, cl_signean sign, const char * string else return -x; // negatives Vorzeichen -> Vorzeichenwechsel } + +} // namespace cln diff --git a/src/integer/misc/cl_BN_class.cc b/src/integer/misc/cl_BN_class.cc index 9572725..f801583 100644 --- a/src/integer/misc/cl_BN_class.cc +++ b/src/integer/misc/cl_BN_class.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. +namespace cln { + cl_class cl_class_bignum = { NULL, // empty destructor cl_class_flags_subclass_complex | cl_class_flags_subclass_real | cl_class_flags_subclass_rational }; + +} // namespace cln diff --git a/src/integer/misc/cl_FN_class.cc b/src/integer/misc/cl_FN_class.cc index 0e383a8..03cfdc7 100644 --- a/src/integer/misc/cl_FN_class.cc +++ b/src/integer/misc/cl_FN_class.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. +namespace cln { + cl_class cl_class_fixnum = { NULL, // destructor not used, since not heap objects cl_class_flags_subclass_complex | cl_class_flags_subclass_real | cl_class_flags_subclass_rational @@ -18,3 +20,5 @@ AT_INITIALIZATION(ini_class_fixnum) { cl_immediate_classes[cl_FN_tag] = &cl_class_fixnum; } + +} // namespace cln diff --git a/src/integer/misc/cl_I_abs.cc b/src/integer/misc/cl_I_abs.cc index 6202f38..80a4913 100644 --- a/src/integer/misc/cl_I_abs.cc +++ b/src/integer/misc/cl_I_abs.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + const cl_I abs (const cl_I& x) { // Methode: @@ -20,3 +22,5 @@ const cl_I abs (const cl_I& x) else return x; } + +} // namespace cln diff --git a/src/integer/misc/cl_I_as.cc b/src/integer/misc/cl_I_as.cc index 6aaee30..0a90bc8 100644 --- a/src/integer/misc/cl_I_as.cc +++ b/src/integer/misc/cl_I_as.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_N.h" +namespace cln { + // Cf. cl_I_p in cl_I_ring.cc. // But here, for better inlining in g++, it is preferrable to finish every // alternative with either "return cl_true;" or "return cl_false;". @@ -36,3 +38,5 @@ const cl_I& as_cl_I (const cl_number& x, const char * filename, int line) } else cl_as_error(x,"an integer",filename,line); } + +} // namespace cln diff --git a/src/integer/misc/cl_I_debug.cc b/src/integer/misc/cl_I_debug.cc index 3941aaf..8ced7a1 100644 --- a/src/integer/misc/cl_I_debug.cc +++ b/src/integer/misc/cl_I_debug.cc @@ -8,9 +8,11 @@ // Implementation. -#include "cl_integer.h" -#include "cl_io.h" -#include "cl_integer_io.h" +#include "cln/integer.h" +#include "cln/io.h" +#include "cln/integer_io.h" + +namespace cln { static void dprint (cl_heap* pointer) { @@ -24,5 +26,7 @@ AT_INITIALIZATION(dprint_I) cl_register_type_printer(cl_class_bignum,dprint); } -// This dummy links in this module when requires it. +// This dummy links in this module when requires it. int cl_I_debug_module; + +} // namespace cln diff --git a/src/integer/misc/cl_I_eqhashcode.cc b/src/integer/misc/cl_I_eqhashcode.cc index b36072b..d61e219 100644 --- a/src/integer/misc/cl_I_eqhashcode.cc +++ b/src/integer/misc/cl_I_eqhashcode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -12,7 +12,9 @@ #include "cl_N.h" #include "cl_I.h" -inline uint32 cl_equal_hashcode (const cl_FN& x) +namespace cln { + +inline uint32 equal_hashcode (const cl_FN& x) { var cl_signean sign; var uint32 x32 = FN_to_L(x); // x als 32-Bit-Zahl @@ -31,7 +33,7 @@ inline uint32 cl_equal_hashcode (const cl_FN& x) return equal_hashcode_low(msd,exp,sign); } -inline uint32 cl_equal_hashcode (const cl_BN& x) +inline uint32 equal_hashcode (const cl_BN& x) { var const uintD* MSDptr; var uintC len; @@ -121,13 +123,15 @@ inline uint32 cl_equal_hashcode (const cl_BN& x) } MAYBE_INLINE -uint32 cl_equal_hashcode (const cl_I& x) +uint32 equal_hashcode (const cl_I& x) { if (fixnump(x)) { DeclareType(cl_FN,x); - return cl_equal_hashcode(x); + return equal_hashcode(x); } else { DeclareType(cl_BN,x); - return cl_equal_hashcode(x); + return equal_hashcode(x); } } + +} // namespace cln diff --git a/src/integer/misc/cl_I_exptpos.cc b/src/integer/misc/cl_I_exptpos.cc index d3a2de3..1bb1425 100644 --- a/src/integer/misc/cl_I_exptpos.cc +++ b/src/integer/misc/cl_I_exptpos.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. +namespace cln { + const cl_I expt_pos (const cl_I& x, uintL y) { // Methode: @@ -52,3 +54,4 @@ const cl_I expt_pos (const cl_I& x, uintL y) } // Bit complexity (x of length N): O(M(N*y)). +} // namespace cln diff --git a/src/integer/misc/cl_I_exptpos_I.cc b/src/integer/misc/cl_I_exptpos_I.cc index b0266aa..06d9e1c 100644 --- a/src/integer/misc/cl_I_exptpos_I.cc +++ b/src/integer/misc/cl_I_exptpos_I.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + const cl_I expt_pos (const cl_I& x, const cl_I& y) { // Methode: @@ -54,3 +56,4 @@ const cl_I expt_pos (const cl_I& x, const cl_I& y) } // Bit complexity (x of length N): O(M(N*y)). +} // namespace cln diff --git a/src/integer/misc/cl_I_max.cc b/src/integer/misc/cl_I_max.cc index c8cdef9..fd2e553 100644 --- a/src/integer/misc/cl_I_max.cc +++ b/src/integer/misc/cl_I_max.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. +namespace cln { + const cl_I max (const cl_I& x, const cl_I& y) { return (x >= y ? x : y); } + +} // namespace cln diff --git a/src/integer/misc/cl_I_min.cc b/src/integer/misc/cl_I_min.cc index 08ea62d..7c4ea33 100644 --- a/src/integer/misc/cl_I_min.cc +++ b/src/integer/misc/cl_I_min.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. +namespace cln { + const cl_I min (const cl_I& x, const cl_I& y) { return (x <= y ? x : y); } + +} // namespace cln diff --git a/src/integer/misc/cl_I_oddp.cc b/src/integer/misc/cl_I_oddp.cc index 98301de..fedaf17 100644 --- a/src/integer/misc/cl_I_oddp.cc +++ b/src/integer/misc/cl_I_oddp.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_DS.h" +namespace cln { + cl_boolean oddp (const cl_I& x) { if (fixnump(x)) { @@ -28,3 +30,5 @@ cl_boolean oddp (const cl_I& x) return cl_false; } } + +} // namespace cln diff --git a/src/integer/misc/cl_I_ord2.cc b/src/integer/misc/cl_I_ord2.cc index efc5fd6..797aea6 100644 --- a/src/integer/misc/cl_I_ord2.cc +++ b/src/integer/misc/cl_I_ord2.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_DS.h" +namespace cln { + // Methode 1a: // Sei n = ord2(x). Dann ist logxor(x,x-1) = 2^n + (2^n-1) = 2^(n+1)-1. // Also (ord2 x) = (1- (integer-length (logxor x (1- x)))) . @@ -42,3 +44,5 @@ uintL ord2 (const cl_I& x) // x /= 0 return bitcount; } } + +} // namespace cln diff --git a/src/integer/misc/cl_I_power2p.cc b/src/integer/misc/cl_I_power2p.cc index 07790ca..0ec593c 100644 --- a/src/integer/misc/cl_I_power2p.cc +++ b/src/integer/misc/cl_I_power2p.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_DS.h" +namespace cln { + uintL power2p (const cl_I& x) // x > 0 { // Methode 1: Wenn ord2(x) = integer_length(x)-1. @@ -38,3 +40,5 @@ uintL power2p (const cl_I& x) // x > 0 return intDsize*(uintL)(len-1) + msdlen; // integer_length(x) als Ergebnis }} } + +} // namespace cln diff --git a/src/integer/misc/cl_I_signum.cc b/src/integer/misc/cl_I_signum.cc index dd9f207..bbd236a 100644 --- a/src/integer/misc/cl_I_signum.cc +++ b/src/integer/misc/cl_I_signum.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I.h" +namespace cln { + MAYBE_INLINE const cl_I signum (const cl_I& x) { @@ -18,3 +20,5 @@ const cl_I signum (const cl_I& x) elif (zerop(x)) { return 0; } // x=0 -> 0 else { return 1; } // x>0 -> +1 } + +} // namespace cln diff --git a/src/integer/misc/combin/cl_I_binomial.cc b/src/integer/misc/combin/cl_I_binomial.cc index b85d387..cb80433 100644 --- a/src/integer/misc/combin/cl_I_binomial.cc +++ b/src/integer/misc/combin/cl_I_binomial.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. #include "cl_I_combin.h" +namespace cln { + const cl_I binomial (uintL n, uintL k) { // Method: @@ -54,3 +56,5 @@ const cl_I binomial (uintL n, uintL k) prod = prod << (k + logcount(m) - logcount(n)); return exquopos(prod,factorial(k)); } + +} // namespace cln diff --git a/src/integer/misc/combin/cl_I_combin.h b/src/integer/misc/combin/cl_I_combin.h index 73f02f0..5a565eb 100644 --- a/src/integer/misc/combin/cl_I_combin.h +++ b/src/integer/misc/combin/cl_I_combin.h @@ -3,11 +3,15 @@ #ifndef _CL_I_COMBIN_H #define _CL_I_COMBIN_H -#include "cl_number.h" -#include "cl_integer_class.h" +#include "cln/number.h" +#include "cln/integer_class.h" + +namespace cln { // UP für Fakultät: // Bilde das Produkt prod(a < i <= b, 2*i+1), wobei 0 <= a < b klein. extern const cl_I cl_I_prod_ungerade (uintL a, uintL b); +} // namespace cln + #endif /* _CL_I_COMBIN_H */ diff --git a/src/integer/misc/combin/cl_I_doublefactorial.cc b/src/integer/misc/combin/cl_I_doublefactorial.cc index 2b9193f..4816b3e 100644 --- a/src/integer/misc/combin/cl_I_doublefactorial.cc +++ b/src/integer/misc/combin/cl_I_doublefactorial.cc @@ -6,7 +6,7 @@ CL_PROVIDE(cl_I_doublefactorial) // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -14,6 +14,8 @@ CL_PROVIDE(cl_I_doublefactorial) #include "cl_I.h" #include "cl_I_combin.h" +namespace cln { + // Method: // n <= 19 -> Get result (Fixnum) from table // Else: @@ -135,5 +137,7 @@ const cl_I doublefactorial (uintL n) // assume n >= 0 small } // Bit complexity (N := n): O(log(N)^2*M(N)). +} // namespace cln + CL_PROVIDE_END(cl_I_doublefactorial) diff --git a/src/integer/misc/combin/cl_I_factorial.cc b/src/integer/misc/combin/cl_I_factorial.cc index 34ea69c..98b3203 100644 --- a/src/integer/misc/combin/cl_I_factorial.cc +++ b/src/integer/misc/combin/cl_I_factorial.cc @@ -6,7 +6,7 @@ CL_PROVIDE(cl_I_factorial) // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -14,6 +14,8 @@ CL_PROVIDE(cl_I_factorial) #include "cl_I.h" #include "cl_I_combin.h" +namespace cln { + // Methode: // n <= 10 -> Ergebnis (Fixnum) aus Tabelle // Sonst: @@ -96,4 +98,6 @@ const cl_I factorial (uintL n) // assume n >= 0 small } // Bit complexity (N := n): O(log(N)^2*M(N)). +} // namespace cln + CL_PROVIDE_END(cl_I_factorial) diff --git a/src/integer/misc/combin/cl_I_factorial_aux.cc b/src/integer/misc/combin/cl_I_factorial_aux.cc index 983c805..888b0a5 100644 --- a/src/integer/misc/combin/cl_I_factorial_aux.cc +++ b/src/integer/misc/combin/cl_I_factorial_aux.cc @@ -11,6 +11,8 @@ #include "cl_I.h" +namespace cln { + const cl_I cl_I_prod_ungerade (uintL a, uintL b) { var uintL diff = b-a; // Anzahl der Faktoren @@ -30,3 +32,5 @@ const cl_I cl_I_prod_ungerade (uintL a, uintL b) return cl_I_prod_ungerade(a,c) * cl_I_prod_ungerade(c,b); // zwei Teilprodukte } } + +} // namespace cln diff --git a/src/integer/output/cl_I_aprint.cc b/src/integer/output/cl_I_aprint.cc index 7c0e1c5..49c4577 100644 --- a/src/integer/output/cl_I_aprint.cc +++ b/src/integer/output/cl_I_aprint.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer_io.h" +#include "cln/integer_io.h" // Implementation. -#include "cl_output.h" +#include "cln/output.h" + +namespace cln { void print_integer (cl_ostream stream, const cl_print_flags& flags, const cl_I& z) { print_integer(stream,(const cl_print_number_flags&)flags,z); } + +} // namespace cln diff --git a/src/integer/output/cl_I_bprint.cc b/src/integer/output/cl_I_bprint.cc index 84253bd..a792a2e 100644 --- a/src/integer/output/cl_I_bprint.cc +++ b/src/integer/output/cl_I_bprint.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer_io.h" +#include "cln/integer_io.h" // Implementation. -#include "cl_output.h" +#include "cln/output.h" + +namespace cln { void print_integer (cl_ostream stream, const cl_print_number_flags& flags, const cl_I& z) { print_integer(stream,(const cl_print_real_flags&)flags,z); } + +} // namespace cln diff --git a/src/integer/output/cl_I_cprint.cc b/src/integer/output/cl_I_cprint.cc index 1a72b06..e53b066 100644 --- a/src/integer/output/cl_I_cprint.cc +++ b/src/integer/output/cl_I_cprint.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer_io.h" +#include "cln/integer_io.h" // Implementation. -#include "cl_output.h" +#include "cln/output.h" + +namespace cln { void print_integer (cl_ostream stream, const cl_print_real_flags& flags, const cl_I& z) { print_integer(stream,(const cl_print_rational_flags&)flags,z); } + +} // namespace cln diff --git a/src/integer/output/cl_I_decstring.cc b/src/integer/output/cl_I_decstring.cc index 013c482..26f9b68 100644 --- a/src/integer/output/cl_I_decstring.cc +++ b/src/integer/output/cl_I_decstring.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer_io.h" +#include "cln/integer_io.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_DS.h" #include "cl_sstring.h" +namespace cln { + char * cl_decimal_string (const cl_I& x) { CL_ALLOCA_STACK; @@ -23,3 +25,5 @@ char * cl_decimal_string (const cl_I& x) var char* result = cl_sstring((char*)erg.MSBptr,erg.len); // Ziffern in String schreiben return result; } + +} // namespace cln diff --git a/src/integer/output/cl_I_dprint.cc b/src/integer/output/cl_I_dprint.cc index 82d6c0c..99cf397 100644 --- a/src/integer/output/cl_I_dprint.cc +++ b/src/integer/output/cl_I_dprint.cc @@ -4,12 +4,14 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer_io.h" +#include "cln/integer_io.h" // Implementation. -#include "cl_output.h" +#include "cln/output.h" + +namespace cln { void print_integer (cl_ostream stream, const cl_print_rational_flags& flags, const cl_I& z) { @@ -45,3 +47,5 @@ void print_integer (cl_ostream stream, const cl_print_rational_flags& flags, con // Integer in Basis base ausgeben: print_integer(stream,base,z); } + +} // namespace cln diff --git a/src/integer/output/cl_I_print.cc b/src/integer/output/cl_I_print.cc index 5b973c1..938e526 100644 --- a/src/integer/output/cl_I_print.cc +++ b/src/integer/output/cl_I_print.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer_io.h" +#include "cln/integer_io.h" // Implementation. -#include "cl_io.h" +#include "cln/io.h" #include "cl_I.h" #include "cl_DS.h" +namespace cln { + void print_integer (cl_ostream stream, unsigned int base, const cl_I& z) { var cl_I abs_z; @@ -34,3 +36,5 @@ void print_integer (cl_ostream stream, unsigned int base, const cl_I& z) do { fprintchar(stream,*ptr++); } until (--count==0); } } + +} // namespace cln diff --git a/src/integer/output/cl_I_print_string.cc b/src/integer/output/cl_I_print_string.cc index 28d41ad..b6cb465 100644 --- a/src/integer/output/cl_I_print_string.cc +++ b/src/integer/output/cl_I_print_string.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer_io.h" +#include "cln/integer_io.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_DS.h" #include "cl_sstring.h" +namespace cln { + char * print_integer_to_string (unsigned int base, const cl_I& z) { var cl_boolean minus_p = cl_false; @@ -38,3 +40,5 @@ char * print_integer_to_string (unsigned int base, const cl_I& z) var char* result = cl_sstring(ergptr,erglen); // Ziffern in String schreiben return result; } + +} // namespace cln diff --git a/src/integer/random/cl_I_random.cc b/src/integer/random/cl_I_random.cc index 36c4f42..de51b84 100644 --- a/src/integer/random/cl_I_random.cc +++ b/src/integer/random/cl_I_random.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,7 +13,9 @@ #include "cl_I.h" #include "cl_DS.h" -const cl_I random_I (cl_random_state& randomstate, const cl_I& n) +namespace cln { + +const cl_I random_I (random_state& randomstate, const cl_I& n) { CL_ALLOCA_STACK; var const uintD* n_MSDptr; @@ -32,3 +34,5 @@ const cl_I random_I (cl_random_state& randomstate, const cl_I& n) // Rest in Integer umwandeln: return NUDS_to_I(r.MSDptr,r.len); } + +} // namespace cln diff --git a/src/integer/random/cl_I_trandom.cc b/src/integer/random/cl_I_trandom.cc index bd27ab1..5e00242 100644 --- a/src/integer/random/cl_I_trandom.cc +++ b/src/integer/random/cl_I_trandom.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_integer.h" +#include "cln/integer.h" // Implementation. @@ -13,7 +13,9 @@ #include "cl_I.h" #include "cl_DS.h" -const cl_I testrandom_I (cl_random_state& randomstate) +namespace cln { + +const cl_I testrandom_I (random_state& randomstate) { var uint32 ran = random32(randomstate); var cl_boolean negative = (cl_boolean)(ran & 1); @@ -39,3 +41,5 @@ const cl_I testrandom_I (cl_random_state& randomstate) var cl_I x = UDS_to_I(MSDptr,len); return (negative ? -x : x); } + +} // namespace cln diff --git a/src/integer/ring/cl_0_ring.cc b/src/integer/ring/cl_0_ring.cc index 8ba2a21..5e173ae 100644 --- a/src/integer/ring/cl_0_ring.cc +++ b/src/integer/ring/cl_0_ring.cc @@ -6,12 +6,14 @@ CL_PROVIDE(cl_0_ring) // Specification. -#include "cl_null_ring.h" +#include "cln/null_ring.h" // Implementation. -#include "cl_integer_class.h" +#include "cln/integer_class.h" + +namespace cln { static const _cl_ring_element null_op0 (cl_heap_ring* R) { @@ -126,4 +128,6 @@ inline cl_null_ring::cl_null_ring () const cl_null_ring cl_0_ring; +} // namespace cln + CL_PROVIDE_END(cl_0_ring) diff --git a/src/integer/ring/cl_I_ring.cc b/src/integer/ring/cl_I_ring.cc index 817715f..f7ae40b 100644 --- a/src/integer/ring/cl_I_ring.cc +++ b/src/integer/ring/cl_I_ring.cc @@ -6,15 +6,17 @@ CL_PROVIDE(cl_I_ring) // Specification. -#include "cl_integer_ring.h" +#include "cln/integer_ring.h" // Implementation. -#include "cl_integer.h" -#include "cl_integer_io.h" +#include "cln/integer.h" +#include "cln/integer_io.h" #include "cl_I.h" +namespace cln { + static void I_fprint (cl_heap_ring* R, cl_ostream stream, const _cl_ring_element& x) { unused R; @@ -24,7 +26,7 @@ static void I_fprint (cl_heap_ring* R, cl_ostream stream, const _cl_ring_element static cl_boolean I_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y) { unused R; - return cl_equal(The(cl_I)(x),The(cl_I)(y)); + return equal(The(cl_I)(x),The(cl_I)(y)); } static const _cl_ring_element I_zero (cl_heap_ring* R) @@ -108,7 +110,7 @@ static cl_ring_mulops I_mulops = { static cl_number_ring_ops I_ops = { cl_I_p, - cl_equal, + equal, zerop, operator+, operator-, @@ -153,4 +155,6 @@ inline cl_integer_ring::cl_specialized_number_ring () const cl_integer_ring cl_I_ring; +} // namespace cln + CL_PROVIDE_END(cl_I_ring) diff --git a/src/modinteger/cl_MI.cc b/src/modinteger/cl_MI.cc index 864d110..3aae64d 100644 --- a/src/modinteger/cl_MI.cc +++ b/src/modinteger/cl_MI.cc @@ -6,7 +6,7 @@ CL_PROVIDE(cl_MI) // Specification. -#include "cl_modinteger.h" +#include "cln/modinteger.h" // Implementation. @@ -14,13 +14,14 @@ CL_PROVIDE(cl_MI) #include "cl_I.h" #include "cl_DS.h" #include "cl_2DS.h" -#include "cl_io.h" -#include "cl_integer_io.h" +#include "cln/io.h" +#include "cln/integer_io.h" #include "cl_N.h" #include "cl_MI.h" -#include "cl_abort.h" +#include "cln/abort.h" #include "cl_alloca.h" +namespace cln { cl_heap_modint_ring::cl_heap_modint_ring (cl_I m, cl_modint_setops* setopv, cl_modint_addops* addopv, cl_modint_mulops* mulopv) : setops (setopv), addops (addopv), mulops (mulopv), modulus (m) @@ -28,7 +29,7 @@ cl_heap_modint_ring::cl_heap_modint_ring (cl_I m, cl_modint_setops* setopv, cl_m refcount = 0; // will be incremented by the `cl_modint_ring' constructor type = &cl_class_modint_ring; if (minusp(m)) cl_abort(); - if (!::zerop(m)) { + if (!cln::zerop(m)) { var uintL b = integer_length(m-1); // m <= 2^b, hence one needs b bits for a representative mod m. if (b <= 1) { @@ -63,9 +64,10 @@ void cl_heap_modint_ring::dummy () {} static cl_boolean modint_equal (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y) { unused R; - return cl_equal(x.rep,y.rep); + return equal(x.rep,y.rep); } +} // namespace cln #include "cl_MI_int.h" #include "cl_MI_std.h" #include "cl_MI_fix16.h" @@ -79,6 +81,7 @@ static cl_boolean modint_equal (cl_heap_modint_ring* R, const _cl_MI& x, const _ #include "cl_MI_pow2m1.h" #include "cl_MI_pow2p1.h" #include "cl_MI_montgom.h" +namespace cln { static inline cl_heap_modint_ring* make_modint_ring (const cl_I& m) // m >= 0 @@ -129,7 +132,9 @@ static inline cl_heap_modint_ring* make_modint_ring (const cl_I& m) // m >= 0 // A weak hash table cl_I -> cl_modint_ring. // (It could also be a weak hashuniq table cl_I -> cl_modint_ring.) +} // namespace cln #include "cl_I_hashweak_rcpointer.h" +namespace cln { // An entry can be collected when the value (the ring) isn't referenced any more // except from the hash table, and when the key (the modulus) isn't referenced @@ -157,7 +162,7 @@ static inline void store_modint_ring (const cl_modint_ring& R) } -const cl_modint_ring cl_find_modint_ring (const cl_I& m) +const cl_modint_ring find_modint_ring (const cl_I& m) { { Mutable(cl_I,m); m = abs(m); @@ -173,6 +178,8 @@ const cl_modint_ring cl_find_modint_ring (const cl_I& m) }} -const cl_modint_ring cl_modint0_ring = cl_find_modint_ring(0); +const cl_modint_ring cl_modint0_ring = find_modint_ring(0); + +} // namespace cln CL_PROVIDE_END(cl_MI) diff --git a/src/modinteger/cl_MI.h b/src/modinteger/cl_MI.h index 19ec66e..511f475 100644 --- a/src/modinteger/cl_MI.h +++ b/src/modinteger/cl_MI.h @@ -3,8 +3,12 @@ #ifndef _CL_MI_H #define _CL_MI_H -#include "cl_modinteger.h" +#include "cln/modinteger.h" + +namespace cln { extern cl_composite_condition* cl_notify_composite (const cl_modint_ring& R, const cl_I& nonunit); +} // namespace cln + #endif /* _CL_MI_H */ diff --git a/src/modinteger/cl_MI_cond_composite.cc b/src/modinteger/cl_MI_cond_composite.cc index 8dbfcd8..4cd014a 100644 --- a/src/modinteger/cl_MI_cond_composite.cc +++ b/src/modinteger/cl_MI_cond_composite.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_modinteger.h" +#include "cln/modinteger.h" // Implementation. -#include "cl_io.h" -#include "cl_integer_io.h" +#include "cln/io.h" +#include "cln/integer_io.h" + +namespace cln { const char * cl_composite_condition::name () const { return "cl_composite_condition"; } @@ -28,3 +30,5 @@ void cl_composite_condition::print (cl_ostream strm) const } fprint(strm, "\n"); } + +} // namespace cln diff --git a/src/modinteger/cl_MI_debug.cc b/src/modinteger/cl_MI_debug.cc index 1c47320..21a7d5e 100644 --- a/src/modinteger/cl_MI_debug.cc +++ b/src/modinteger/cl_MI_debug.cc @@ -8,9 +8,11 @@ // Implementation. -#include "cl_modinteger.h" -#include "cl_io.h" -#include "cl_integer_io.h" +#include "cln/modinteger.h" +#include "cln/io.h" +#include "cln/integer_io.h" + +namespace cln { static void dprint (cl_heap* pointer) { @@ -27,5 +29,7 @@ void cl_MI::debug_print () const fprint(cl_debugout, "\n"); } -// This dummy links in this module when requires it. +// This dummy links in this module when requires it. int cl_MI_debug_module; + +} // namespace cln diff --git a/src/modinteger/cl_MI_err_comp.cc b/src/modinteger/cl_MI_err_comp.cc index 2f785f0..536cf93 100644 --- a/src/modinteger/cl_MI_err_comp.cc +++ b/src/modinteger/cl_MI_err_comp.cc @@ -9,10 +9,14 @@ // Implementation. -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/abort.h" + +namespace cln { cl_composite_condition* cl_notify_composite (const cl_modint_ring& R, const cl_I& nonunit) { return new cl_composite_condition(R->modulus,gcd(R->modulus,nonunit)); } + +} // namespace cln diff --git a/src/modinteger/cl_MI_fix16.h b/src/modinteger/cl_MI_fix16.h index b5225e6..6bd2069 100644 --- a/src/modinteger/cl_MI_fix16.h +++ b/src/modinteger/cl_MI_fix16.h @@ -1,5 +1,7 @@ // 1 < m < 2^16, standard representation +namespace cln { + static const _cl_MI fix16_plus (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y) { var uint32 zr = FN_to_UL(x.rep) + FN_to_UL(y.rep); @@ -69,3 +71,5 @@ public: // Virtual destructor. ~cl_heap_modint_ring_fix16 () {} }; + +} // namespace cln diff --git a/src/modinteger/cl_MI_fix29.h b/src/modinteger/cl_MI_fix29.h index d940ee4..c72745a 100644 --- a/src/modinteger/cl_MI_fix29.h +++ b/src/modinteger/cl_MI_fix29.h @@ -1,6 +1,8 @@ // 1 < m < 2^(cl_value_len-1), standard representation // Assuming (cl_value_len <= 32). +namespace cln { + static const _cl_MI fix29_plus (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y) { var uint32 zr = FN_to_UL(x.rep) + FN_to_UL(y.rep); @@ -76,3 +78,5 @@ public: // Virtual destructor. ~cl_heap_modint_ring_fix29 () {} }; + +} // namespace cln diff --git a/src/modinteger/cl_MI_fix32.h b/src/modinteger/cl_MI_fix32.h index 3cdb776..f3b49d4 100644 --- a/src/modinteger/cl_MI_fix32.h +++ b/src/modinteger/cl_MI_fix32.h @@ -1,6 +1,8 @@ // 1 < m < 2^32, standard representation // Assuming (cl_value_len > 32). +namespace cln { + static const _cl_MI fix32_plus (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y) { var uint32 xr = FN_to_UL(x.rep); @@ -78,3 +80,5 @@ public: // Virtual destructor. ~cl_heap_modint_ring_fix32 () {} }; + +} // namespace cln diff --git a/src/modinteger/cl_MI_int.h b/src/modinteger/cl_MI_int.h index 10aadb9..4466b12 100644 --- a/src/modinteger/cl_MI_int.h +++ b/src/modinteger/cl_MI_int.h @@ -1,5 +1,7 @@ // m = 0 : Z/mZ \isomorph Z +namespace cln { + static void int_fprint (cl_heap_modint_ring* R, cl_ostream stream, const _cl_MI &x) { fprint(stream,R->_retract(x)); @@ -25,11 +27,11 @@ static const cl_I int_retract (cl_heap_modint_ring* R, const _cl_MI& x) } // This is the only case where random yields an error. -static const _cl_MI int_random (cl_heap_modint_ring* R, cl_random_state& randomstate) +static const _cl_MI int_random (cl_heap_modint_ring* R, random_state& randomstate) { unused R; unused randomstate; - fprint(cl_stderr, "Z / 0 Z not a finite set - no equidistributed random function.\n"); + fprint(stderr, "Z / 0 Z not a finite set - no equidistributed random function.\n"); cl_abort(); #if ((defined(__sparc__) || defined(__sparc64__)) && !defined(__GNUC__)) // Sun CC wants a return value return _cl_MI(R, 0); @@ -147,3 +149,5 @@ public: // Virtual destructor. ~cl_heap_modint_ring_int () {} }; + +} // namespace cln diff --git a/src/modinteger/cl_MI_int32.h b/src/modinteger/cl_MI_int32.h index 16e0f98..6d542ca 100644 --- a/src/modinteger/cl_MI_int32.h +++ b/src/modinteger/cl_MI_int32.h @@ -1,5 +1,7 @@ // 1 < m < 2^32, standard representation +namespace cln { + static const _cl_MI int32_plus (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y) { var uint32 xr = cl_I_to_UL(x.rep); @@ -77,3 +79,5 @@ public: // Virtual destructor. ~cl_heap_modint_ring_int32 () {} }; + +} // namespace cln diff --git a/src/modinteger/cl_MI_lshift.cc b/src/modinteger/cl_MI_lshift.cc index 0bfea4f..7f501b5 100644 --- a/src/modinteger/cl_MI_lshift.cc +++ b/src/modinteger/cl_MI_lshift.cc @@ -4,12 +4,14 @@ #include "cl_sysdep.h" // Specification. -#include "cl_modinteger.h" +#include "cln/modinteger.h" // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_MI operator<< (const cl_MI& x, sintL y) // assume 0 <= y < 2^31 { @@ -29,3 +31,5 @@ const cl_MI operator<< (const cl_MI& x, sintL y) // assume 0 <= y < 2^31 else return x * expt_pos(R->canonhom(2), (cl_I)(long)y); } + +} // namespace cln diff --git a/src/modinteger/cl_MI_montgom.h b/src/modinteger/cl_MI_montgom.h index e78e8dd..1061a81 100644 --- a/src/modinteger/cl_MI_montgom.h +++ b/src/modinteger/cl_MI_montgom.h @@ -1,5 +1,7 @@ // m > 1 odd, Montgomery representation +namespace cln { + // We use Montgomery's modular multiplication trick // [Peter L. Montgomery: Modular multiplication without trial division, // Mathematics of Computation 44 (1985), 519-521.] @@ -220,3 +222,5 @@ static cl_heap_modint_ring* try_make_modint_ring_montgom (const cl_I& M) var cl_I V = V_N >> n; return new cl_heap_modint_ring_montgom(M,m,n,V); } + +} // namespace cln diff --git a/src/modinteger/cl_MI_pow2.h b/src/modinteger/cl_MI_pow2.h index 195726b..248968f 100644 --- a/src/modinteger/cl_MI_pow2.h +++ b/src/modinteger/cl_MI_pow2.h @@ -1,5 +1,7 @@ // m > 0, m = 2^m1 +namespace cln { + class cl_heap_modint_ring_pow2 : public cl_heap_modint_ring { SUBCLASS_cl_heap_modint_ring() public: @@ -11,11 +13,7 @@ public: uintL m1; }; -static -#if !(defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ <= 90)) // workaround g++-2.7.2 and egcs-1.0.2-prerelease bug -inline -#endif -const cl_I pow2_reduce_modulo (cl_heap_modint_ring* _R, const cl_I& x) +static inline const cl_I pow2_reduce_modulo (cl_heap_modint_ring* _R, const cl_I& x) { var cl_heap_modint_ring_pow2* R = (cl_heap_modint_ring_pow2*)_R; return ldb(x,cl_byte(R->m1,0)); @@ -142,3 +140,5 @@ static cl_modint_mulops pow2_mulops = { // Constructor. inline cl_heap_modint_ring_pow2::cl_heap_modint_ring_pow2 (const cl_I& m, uintL _m1) : cl_heap_modint_ring (m, &std_setops, &pow2_addops, &pow2_mulops), m1 (_m1) {} + +} // namespace cln diff --git a/src/modinteger/cl_MI_pow2m1.h b/src/modinteger/cl_MI_pow2m1.h index 6c7f9d0..4c073a2 100644 --- a/src/modinteger/cl_MI_pow2m1.h +++ b/src/modinteger/cl_MI_pow2m1.h @@ -1,5 +1,7 @@ // m > 0, m = 2^m1 - 1 (m1 > 1) +namespace cln { + class cl_heap_modint_ring_pow2m1 : public cl_heap_modint_ring { SUBCLASS_cl_heap_modint_ring() public: @@ -11,11 +13,7 @@ public: uintL m1; }; -static -#if !(defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ <= 90)) // workaround g++-2.7.2 and egcs-1.0.2-prerelease bug -inline -#endif -const cl_I pow2m1_reduce_modulo (cl_heap_modint_ring* _R, const cl_I& x) +static inline const cl_I pow2m1_reduce_modulo (cl_heap_modint_ring* _R, const cl_I& x) { var cl_heap_modint_ring_pow2m1* R = (cl_heap_modint_ring_pow2m1*)_R; // Method: @@ -83,3 +81,5 @@ static cl_modint_mulops pow2m1_mulops = { // Constructor. inline cl_heap_modint_ring_pow2m1::cl_heap_modint_ring_pow2m1 (const cl_I& m, uintL _m1) : cl_heap_modint_ring (m, &std_setops, &pow2m1_addops, &pow2m1_mulops), m1 (_m1) {} + +} // namespace cln diff --git a/src/modinteger/cl_MI_pow2p1.h b/src/modinteger/cl_MI_pow2p1.h index 2b71d30..0ee98a7 100644 --- a/src/modinteger/cl_MI_pow2p1.h +++ b/src/modinteger/cl_MI_pow2p1.h @@ -1,5 +1,7 @@ // m > 0, m = 2^m1 + 1 (m1 > 1) +namespace cln { + class cl_heap_modint_ring_pow2p1 : public cl_heap_modint_ring { SUBCLASS_cl_heap_modint_ring() public: @@ -11,11 +13,7 @@ public: uintL m1; }; -static -#if !(defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ <= 90)) // workaround g++-2.7.2 and egcs-1.0.2-prerelease bug -inline -#endif -const cl_I pow2p1_reduce_modulo (cl_heap_modint_ring* _R, const cl_I& x) +static inline const cl_I pow2p1_reduce_modulo (cl_heap_modint_ring* _R, const cl_I& x) { var cl_heap_modint_ring_pow2p1* R = (cl_heap_modint_ring_pow2p1*)_R; // Method: @@ -94,3 +92,5 @@ static cl_modint_mulops pow2p1_mulops = { // Constructor. inline cl_heap_modint_ring_pow2p1::cl_heap_modint_ring_pow2p1 (const cl_I& m, uintL _m1) : cl_heap_modint_ring (m, &std_setops, &pow2p1_addops, &pow2p1_mulops), m1 (_m1) {} + +} // namespace cln diff --git a/src/modinteger/cl_MI_rshift.cc b/src/modinteger/cl_MI_rshift.cc index 09400fb..ca975e3 100644 --- a/src/modinteger/cl_MI_rshift.cc +++ b/src/modinteger/cl_MI_rshift.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_modinteger.h" +#include "cln/modinteger.h" // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_N.h" #include "cl_MI.h" +namespace cln { + const cl_MI operator>> (const cl_MI& x, sintL y) // assume 0 <= y < 2^31 { if (y == 0) @@ -40,3 +42,5 @@ const cl_MI operator>> (const cl_MI& x, sintL y) // assume 0 <= y < 2^31 #endif return R->div(x, expt_pos(R->canonhom(2), (cl_I)(long)y)); } + +} // namespace cln diff --git a/src/modinteger/cl_MI_std.h b/src/modinteger/cl_MI_std.h index 4cd56e0..7f02104 100644 --- a/src/modinteger/cl_MI_std.h +++ b/src/modinteger/cl_MI_std.h @@ -1,5 +1,7 @@ // m > 1, standard representation, no tricks +namespace cln { + static void std_fprint (cl_heap_modint_ring* R, cl_ostream stream, const _cl_MI &x) { fprint(stream,R->_retract(x)); @@ -23,7 +25,7 @@ static const cl_I std_retract (cl_heap_modint_ring* R, const _cl_MI& x) return x.rep; } -static const _cl_MI std_random (cl_heap_modint_ring* R, cl_random_state& randomstate) +static const _cl_MI std_random (cl_heap_modint_ring* R, random_state& randomstate) { return _cl_MI(R, random_I(randomstate,R->modulus)); } @@ -348,3 +350,5 @@ public: // Virtual destructor. ~cl_heap_modint_ring_std () {} }; + +} // namespace cln diff --git a/src/numtheory/cl_IF.h b/src/numtheory/cl_IF.h index 2d632db..6625e73 100644 --- a/src/numtheory/cl_IF.h +++ b/src/numtheory/cl_IF.h @@ -3,8 +3,10 @@ #ifndef _CL_IF_H #define _CL_IF_H -#include "cl_number.h" -#include "cl_integer.h" +#include "cln/number.h" +#include "cln/integer.h" + +namespace cln { // Table of primes > 2, < 2^16 const uint32 cl_small_prime_table_limit = 65536; @@ -48,5 +50,6 @@ extern uint32 cl_trialdivision (const cl_I& n, uint32 d1, uint32 d2); // nontrivial factor or 0. extern cl_boolean cl_miller_rabin_test (const cl_I& n, int count, cl_I* factor); +} // namespace cln #endif /* _CL_IF_H */ diff --git a/src/numtheory/cl_IF_millerrabin.cc b/src/numtheory/cl_IF_millerrabin.cc index a049eca..b720419 100644 --- a/src/numtheory/cl_IF_millerrabin.cc +++ b/src/numtheory/cl_IF_millerrabin.cc @@ -9,12 +9,14 @@ // Implementation. -#include "cl_modinteger.h" +#include "cln/modinteger.h" + +namespace cln { cl_boolean cl_miller_rabin_test (const cl_I& n, int count, cl_I* factor) { // [Cohen], section 8.2, algorithm 8.2.2. - var cl_modint_ring R = cl_find_modint_ring(n); // Z/nZ + var cl_modint_ring R = find_modint_ring(n); // Z/nZ var cl_I m = n-1; var uintL e = ord2(m); m = m>>e; @@ -61,3 +63,5 @@ cl_boolean cl_miller_rabin_test (const cl_I& n, int count, cl_I* factor) } return cl_true; } + +} // namespace cln diff --git a/src/numtheory/cl_IF_smallprimes.cc b/src/numtheory/cl_IF_smallprimes.cc index a07014a..4193bcb 100644 --- a/src/numtheory/cl_IF_smallprimes.cc +++ b/src/numtheory/cl_IF_smallprimes.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + uint16 cl_small_prime_table[cl_small_prime_table_size] = { 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, @@ -666,3 +668,5 @@ uint16 cl_small_prime_table[cl_small_prime_table_size] = { 65407, 65413, 65419, 65423, 65437, 65447, 65449, 65479, 65497, 65519, 65521, }; + +} // namespace cln diff --git a/src/numtheory/cl_IF_trialdiv.cc b/src/numtheory/cl_IF_trialdiv.cc index 8798ad5..e6e2d06 100644 --- a/src/numtheory/cl_IF_trialdiv.cc +++ b/src/numtheory/cl_IF_trialdiv.cc @@ -15,6 +15,8 @@ #error "intDsize too small for trialdivision!" #endif +namespace cln { + uint32 cl_trialdivision (const cl_I& n, uint32 d1, uint32 d2) { var uintL i = cl_small_prime_table_search(d1); @@ -38,3 +40,5 @@ uint32 cl_trialdivision (const cl_I& n, uint32 d1, uint32 d2) } return 0; } + +} // namespace cln diff --git a/src/numtheory/cl_IF_trialdiv1.cc b/src/numtheory/cl_IF_trialdiv1.cc index 136f800..b4ebe1f 100644 --- a/src/numtheory/cl_IF_trialdiv1.cc +++ b/src/numtheory/cl_IF_trialdiv1.cc @@ -11,6 +11,8 @@ #include "cl_low.h" +namespace cln { + uint32 cl_trialdivision (uint32 n, uint32 d1, uint32 d2) { var uintL i = cl_small_prime_table_search(d1); @@ -25,3 +27,5 @@ uint32 cl_trialdivision (uint32 n, uint32 d1, uint32 d2) } return 0; } + +} // namespace cln diff --git a/src/numtheory/cl_IF_trialdiv2.cc b/src/numtheory/cl_IF_trialdiv2.cc index bf8b3e6..ca51b84 100644 --- a/src/numtheory/cl_IF_trialdiv2.cc +++ b/src/numtheory/cl_IF_trialdiv2.cc @@ -11,6 +11,8 @@ #include "cl_low.h" +namespace cln { + uint32 cl_trialdivision (uint32 nhi, uint32 nlo, uint32 d1, uint32 d2) { var uintL i = cl_small_prime_table_search(d1); @@ -27,3 +29,5 @@ uint32 cl_trialdivision (uint32 nhi, uint32 nlo, uint32 d1, uint32 d2) } return 0; } + +} // namespace cln diff --git a/src/numtheory/cl_nt_cornacchia1.cc b/src/numtheory/cl_nt_cornacchia1.cc index 36b8e2d..dfdb89f 100644 --- a/src/numtheory/cl_nt_cornacchia1.cc +++ b/src/numtheory/cl_nt_cornacchia1.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_numtheory.h" +#include "cln/numtheory.h" // Implementation. #include "cl_xmacros.h" +namespace cln { + // [Cohen], section 1.5.2, algorithm 1.5.2. // For proofs refer to [F. Morain, J.-L. Nicolas: On Cornacchia's algorithm // for solving the diophantine equation u^2+v*d^2=m]. @@ -73,7 +75,7 @@ const cornacchia_t cornacchia1 (const cl_I& d, const cl_I& p) break; } // Compute x with x^2+d == 0 mod p. - var cl_modint_ring R = cl_find_modint_ring(p); + var cl_modint_ring R = find_modint_ring(p); var sqrt_mod_p_t init = sqrt_mod_p(R,R->canonhom(-d)); if (init.condition) return init.condition; @@ -99,3 +101,5 @@ const cornacchia_t cornacchia1 (const cl_I& d, const cl_I& p) return cornacchia_t(0); return cornacchia_t(1, x,y); } + +} // namespace cln diff --git a/src/numtheory/cl_nt_cornacchia4.cc b/src/numtheory/cl_nt_cornacchia4.cc index 460f186..614db87 100644 --- a/src/numtheory/cl_nt_cornacchia4.cc +++ b/src/numtheory/cl_nt_cornacchia4.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_numtheory.h" +#include "cln/numtheory.h" // Implementation. #include "cl_I.h" +namespace cln { + // [Cohen], section 1.5.2, algorithm 1.5.3. // For proofs refer to [F. Morain, J.-L. Nicolas: On Cornacchia's algorithm // for solving the diophantine equation u^2+v*d^2=m]. @@ -85,7 +87,7 @@ const cornacchia_t cornacchia4 (const cl_I& d, const cl_I& p) break; } // Compute x with x^2+d == 0 mod p. - var cl_modint_ring R = cl_find_modint_ring(p); + var cl_modint_ring R = find_modint_ring(p); var sqrt_mod_p_t init = sqrt_mod_p(R,R->canonhom(-d)); if (init.condition) return init.condition; @@ -113,3 +115,5 @@ const cornacchia_t cornacchia4 (const cl_I& d, const cl_I& p) return cornacchia_t(0); return cornacchia_t(1, x,y); } + +} // namespace cln diff --git a/src/numtheory/cl_nt_isprobprime.cc b/src/numtheory/cl_nt_isprobprime.cc index 2a0d096..3b79d2f 100644 --- a/src/numtheory/cl_nt_isprobprime.cc +++ b/src/numtheory/cl_nt_isprobprime.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_numtheory.h" +#include "cln/numtheory.h" // Implementation. #include "cl_IF.h" -#include "cl_abort.h" +#include "cln/abort.h" + +namespace cln { cl_boolean isprobprime (const cl_I& n) { @@ -53,3 +55,5 @@ cl_boolean isprobprime (const cl_I& n) // Step 2: Miller-Rabin test. return cl_miller_rabin_test(n,count,NULL); } + +} // namespace cln diff --git a/src/numtheory/cl_nt_jacobi.cc b/src/numtheory/cl_nt_jacobi.cc index 52191c0..04b4303 100644 --- a/src/numtheory/cl_nt_jacobi.cc +++ b/src/numtheory/cl_nt_jacobi.cc @@ -4,16 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_numtheory.h" +#include "cln/numtheory.h" // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" -#include "cl_abort.h" +#include "cln/abort.h" #include "cl_xmacros.h" +namespace cln { + int jacobi (const cl_I& a, const cl_I& b) { // Check b > 0, b odd. @@ -66,3 +68,5 @@ int jacobi (const cl_I& a, const cl_I& b) { a = a-b; do { a = a-b; } while (a >= b); } } }} + +} // namespace cln diff --git a/src/numtheory/cl_nt_jacobi_low.cc b/src/numtheory/cl_nt_jacobi_low.cc index 00368a2..e4dc3f1 100644 --- a/src/numtheory/cl_nt_jacobi_low.cc +++ b/src/numtheory/cl_nt_jacobi_low.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_numtheory.h" +#include "cln/numtheory.h" // Implementation. -#include "cl_abort.h" +#include "cln/abort.h" #include "cl_xmacros.h" +namespace cln { + // Assume 0 <= a < b. inline int jacobi_aux (uint32 a, uint32 b) { @@ -73,3 +75,5 @@ int jacobi (sint32 a, sint32 b) a = b-1-((uint32)(~a) % (uint32)b); return jacobi_aux(a,b); } + +} // namespace cln diff --git a/src/numtheory/cl_nt_nextprobprime.cc b/src/numtheory/cl_nt_nextprobprime.cc index ea702d4..cf16684 100644 --- a/src/numtheory/cl_nt_nextprobprime.cc +++ b/src/numtheory/cl_nt_nextprobprime.cc @@ -4,12 +4,14 @@ #include "cl_sysdep.h" // Specification. -#include "cl_numtheory.h" +#include "cln/numtheory.h" // Implementation. -#include "cl_real.h" +#include "cln/real.h" + +namespace cln { const cl_I nextprobprime (const cl_R& x) { @@ -29,3 +31,5 @@ const cl_I nextprobprime (const cl_R& x) n = n+2; } } + +} // namespace cln diff --git a/src/numtheory/cl_nt_sqrtmodp.cc b/src/numtheory/cl_nt_sqrtmodp.cc index 30cc801..6a74c5f 100644 --- a/src/numtheory/cl_nt_sqrtmodp.cc +++ b/src/numtheory/cl_nt_sqrtmodp.cc @@ -4,18 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_numtheory.h" +#include "cln/numtheory.h" // Implementation. #include "cl_I.h" -#include "cl_abort.h" +#include "cln/abort.h" #undef floor -#include +#include #define floor cln_floor +namespace cln { + // Algorithm 1 (for very small p only): // Try different values. // Assume p is prime and a nonzero square in Z/pZ. @@ -73,7 +75,7 @@ static const sqrt_mod_p_t cantor_zassenhaus_sqrt (const cl_modint_ring& R, const } const pol2 square (const pol2& u) { - return pol2(::square(u.c0) + ::square(u.c1)*a, (u.c0*u.c1)<<1); + return pol2(cln::square(u.c0) + cln::square(u.c1)*a, (u.c0*u.c1)<<1); } const pol2 expt_pos (const pol2& x, const cl_I& y) { @@ -119,7 +121,7 @@ static const sqrt_mod_p_t cantor_zassenhaus_sqrt (const cl_modint_ring& R, const if (c1inv.condition) return c1inv.condition; var cl_MI z = -u.c0*c1inv; - if (::square(z) == a) + if (cln::square(z) == a) return gcd_result(1,z); else return gcd_result(0); @@ -298,10 +300,12 @@ const sqrt_mod_p_t sqrt_mod_p (const cl_modint_ring& R, const cl_MI& a) var uintL l = integer_length(p); var uintL e = ord2(p-1); //if (e > 30 && e > l/(log((double)l)*0.72-1)) - if (e > 30 && e > l/(log((double)l)*0.92-2.41)) + if (e > 30 && e > l/(::log((double)l)*0.92-2.41)) // Algorithm 2. return cantor_zassenhaus_sqrt(R,a); else // Algorithm 3. return tonelli_shanks_sqrt(R,a); } + +} // namespace cln diff --git a/src/polynomial/cl_UP.h b/src/polynomial/cl_UP.h index a289f79..50efc51 100644 --- a/src/polynomial/cl_UP.h +++ b/src/polynomial/cl_UP.h @@ -3,8 +3,10 @@ #ifndef _CL_UP_H #define _CL_UP_H -#include "cl_univpoly.h" -#include "cl_output.h" +#include "cln/univpoly.h" +#include "cln/output.h" + +namespace cln { extern cl_heap_univpoly_ring* cl_make_univpoly_ring (const cl_ring& r); @@ -25,7 +27,9 @@ static inline const cl_string get_varname (cl_heap_univpoly_ring* UPR) if (p) return ((cl_varname_property*)p)->varname; else - return cl_default_print_flags.univpoly_varname; + return default_print_flags.univpoly_varname; } +} // namespace cln + #endif /* _CL_UP_H */ diff --git a/src/polynomial/elem/cl_UP.cc b/src/polynomial/elem/cl_UP.cc index a16d4d1..a52fe8d 100644 --- a/src/polynomial/elem/cl_UP.cc +++ b/src/polynomial/elem/cl_UP.cc @@ -8,13 +8,15 @@ CL_PROVIDE(cl_UP) // Specification. #define CL_GV_NO_RANGECHECKS #define CL_SV_NO_RANGECHECKS -#include "cl_univpoly.h" +#include "cln/univpoly.h" #include "cl_UP.h" // Implementation. -#include "cl_output.h" +#include "cln/output.h" + +namespace cln { cl_symbol cl_univpoly_varname_key = (cl_symbol)(cl_string)"variable name"; @@ -26,12 +28,16 @@ cl_symbol cl_univpoly_varname_key = (cl_symbol)(cl_string)"variable name"; type& __tmp_##x = *(type*) &(x).rep; \ type& x = __tmp_##x; +} // namespace cln + // Four different implementations of the polynomial operations, for efficiency: #include "cl_UP_number.h" // polynomials over number rings #include "cl_UP_MI.h" // polynomials over modular integer rings #include "cl_UP_GF2.h" // polynomials over the modular integer ring GF(2) #include "cl_UP_gen.h" // polynomials over all other rings +namespace cln { + cl_heap_univpoly_ring::cl_heap_univpoly_ring (const cl_ring& r, cl_univpoly_setops* setopv, cl_univpoly_addops* addopv, cl_univpoly_mulops* mulopv, cl_univpoly_modulops* modulopv, cl_univpoly_polyops* polyopv) : setops (setopv), addops (addopv), mulops (mulopv), modulops (modulopv), polyops (polyopv), _basering (r) @@ -70,4 +76,6 @@ cl_heap_univpoly_ring* cl_make_univpoly_ring (const cl_ring& r) return new cl_heap_gen_univpoly_ring(r); } +} // namespace cln + CL_PROVIDE_END(cl_UP) diff --git a/src/polynomial/elem/cl_UP_GF2.h b/src/polynomial/elem/cl_UP_GF2.h index cd95578..71caa21 100644 --- a/src/polynomial/elem/cl_UP_GF2.h +++ b/src/polynomial/elem/cl_UP_GF2.h @@ -1,11 +1,12 @@ // Univariate Polynomials over the ring GF(2) = Z/2Z. -#include "cl_GV_modinteger.h" -#include "cl_modinteger.h" -#include "cl_GV_integer.h" +#include "cln/GV_modinteger.h" +#include "cln/modinteger.h" +#include "cln/GV_integer.h" #include "cl_DS.h" -#include "cl_abort.h" +#include "cln/abort.h" +namespace cln { // This is actually defined in cl_GV_I.cc (*ugh*). struct cl_heap_GV_I_bits1 : public cl_heap_GV_I { @@ -1042,3 +1043,5 @@ public: cl_heap_gf2_univpoly_ring (const cl_ring& r) : cl_heap_univpoly_ring (r, &gf2_setops, &gf2_addops, &gf2_mulops, &gf2_modulops, &gf2_polyops) {} }; + +} // namespace cln diff --git a/src/polynomial/elem/cl_UP_MI.h b/src/polynomial/elem/cl_UP_MI.h index ceee70d..36f294c 100644 --- a/src/polynomial/elem/cl_UP_MI.h +++ b/src/polynomial/elem/cl_UP_MI.h @@ -1,8 +1,10 @@ // Univariate Polynomials over a ring of modular integers. -#include "cl_GV_modinteger.h" -#include "cl_modinteger.h" -#include "cl_abort.h" +#include "cln/GV_modinteger.h" +#include "cln/modinteger.h" +#include "cln/abort.h" + +namespace cln { // Assume a ring is a modint ring. inline cl_heap_modint_ring* TheModintRing (const cl_ring& R) @@ -469,3 +471,5 @@ public: cl_heap_modint_univpoly_ring (const cl_ring& r) : cl_heap_univpoly_ring (r, &modint_setops, &modint_addops, &modint_mulops, &modint_modulops, &modint_polyops) {} }; + +} // namespace cln diff --git a/src/polynomial/elem/cl_UP_gen.h b/src/polynomial/elem/cl_UP_gen.h index c5970dd..fc8dc86 100644 --- a/src/polynomial/elem/cl_UP_gen.h +++ b/src/polynomial/elem/cl_UP_gen.h @@ -1,8 +1,10 @@ // Univariate Polynomials over a general ring. -#include "cl_SV_ringelt.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/SV_ringelt.h" +#include "cln/integer.h" +#include "cln/abort.h" + +namespace cln { // Assume a ring is a ring. inline cl_heap_ring* TheRing (const cl_ring& R) @@ -449,3 +451,5 @@ public: cl_heap_gen_univpoly_ring (const cl_ring& r) : cl_heap_univpoly_ring (r, &gen_setops, &gen_addops, &gen_mulops, &gen_modulops, &gen_polyops) {} }; + +} // namespace cln diff --git a/src/polynomial/elem/cl_UP_named.cc b/src/polynomial/elem/cl_UP_named.cc index 959f08b..38a2994 100644 --- a/src/polynomial/elem/cl_UP_named.cc +++ b/src/polynomial/elem/cl_UP_named.cc @@ -1,4 +1,4 @@ -// cl_find_univpoly_ring(). +// find_univpoly_ring(). // General includes. #include "cl_sysdep.h" @@ -6,13 +6,15 @@ CL_PROVIDE(cl_UP_named) // Specification. -#include "cl_univpoly.h" +#include "cln/univpoly.h" // Implementation. #include "cl_UP.h" +namespace cln { + // Create a new univariate polynomial ring with a named variable. static inline cl_heap_univpoly_ring* cl_make_univpoly_ring (const cl_ring& r, const cl_symbol& varname) @@ -22,12 +24,15 @@ static inline cl_heap_univpoly_ring* cl_make_univpoly_ring (const cl_ring& r, co return UPR; } +} // namespace cln // The table of univariate polynomial rings with named variable. // A weak hash table (cl_ring,cl_symbol) -> cl_univpoly_ring. #include "cl_rcpointer2_hashweak_rcpointer.h" +namespace cln { + // An entry can be collected when the value (the ring) isn't referenced any more // except from the hash table, and when the keys (the base ring and the name) // are't referenced any more except from the hash table and the ring. Note that @@ -57,7 +62,7 @@ static inline void store_univpoly_ring (const cl_univpoly_ring& R) } -const cl_univpoly_ring cl_find_univpoly_ring (const cl_ring& r, const cl_symbol& varname) +const cl_univpoly_ring find_univpoly_ring (const cl_ring& r, const cl_symbol& varname) { var cl_univpoly_ring* ring_in_table = get_univpoly_ring(r,varname); if (!ring_in_table) { @@ -70,4 +75,6 @@ const cl_univpoly_ring cl_find_univpoly_ring (const cl_ring& r, const cl_symbol& return *ring_in_table; } +} // namespace cln + CL_PROVIDE_END(cl_UP_named) diff --git a/src/polynomial/elem/cl_UP_no_ring.cc b/src/polynomial/elem/cl_UP_no_ring.cc index 199fcf0..78482d7 100644 --- a/src/polynomial/elem/cl_UP_no_ring.cc +++ b/src/polynomial/elem/cl_UP_no_ring.cc @@ -6,29 +6,31 @@ CL_PROVIDE(cl_UP_no_ring) // Specification. -#include "cl_univpoly.h" +#include "cln/univpoly.h" // Implementation. -#include "cl_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/abort.h" + +namespace cln { nonreturning_function(static, uninitialized_ring, (void)); static void uninitialized_ring () { - fprint(cl_stderr, "Uninitialized ring operation called\n"); + fprint(stderr, "Uninitialized ring operation called\n"); cl_abort(); } nonreturning_function(static, uninitialized_error, (const _cl_UP&)); static void uninitialized_error (const _cl_UP& obj) { - fprint(cl_stderr, "Uninitialized ring element @0x"); - fprinthexadecimal(cl_stderr, (unsigned long)(void*)&obj); - fprint(cl_stderr, ": 0x"); - fprinthexadecimal(cl_stderr, (unsigned long)obj.rep.word); - fprint(cl_stderr, "\n"); + fprint(stderr, "Uninitialized ring element @0x"); + fprinthexadecimal(stderr, (unsigned long)(void*)&obj); + fprint(stderr, ": 0x"); + fprinthexadecimal(stderr, (unsigned long)obj.rep.word); + fprint(stderr, "\n"); cl_abort(); } @@ -199,4 +201,6 @@ cl_class cl_class_no_univpoly_ring = { const cl_univpoly_ring cl_no_univpoly_ring = cl_univpoly_ring (new cl_heap_no_univpoly_ring()); +} // namespace cln + CL_PROVIDE_END(cl_UP_no_ring) diff --git a/src/polynomial/elem/cl_UP_number.h b/src/polynomial/elem/cl_UP_number.h index 37e8c58..274849e 100644 --- a/src/polynomial/elem/cl_UP_number.h +++ b/src/polynomial/elem/cl_UP_number.h @@ -1,9 +1,11 @@ // Univariate Polynomials over some subring of the numbers. -#include "cl_SV_number.h" -#include "cl_number.h" -#include "cl_integer.h" -#include "cl_abort.h" +#include "cln/SV_number.h" +#include "cln/number.h" +#include "cln/integer.h" +#include "cln/abort.h" + +namespace cln { // Assume a ring is a number ring. inline cl_heap_number_ring* TheNumberRing (const cl_ring& R) @@ -451,3 +453,5 @@ public: cl_heap_num_univpoly_ring (const cl_ring& r) : cl_heap_univpoly_ring (r, &num_setops, &num_addops, &num_mulops, &num_modulops, &num_polyops) {} }; + +} // namespace cln diff --git a/src/polynomial/elem/cl_UP_unnamed.cc b/src/polynomial/elem/cl_UP_unnamed.cc index a37a992..5bb8ad6 100644 --- a/src/polynomial/elem/cl_UP_unnamed.cc +++ b/src/polynomial/elem/cl_UP_unnamed.cc @@ -1,4 +1,4 @@ -// cl_find_univpoly_ring(). +// find_univpoly_ring(). // General includes. #include "cl_sysdep.h" @@ -6,7 +6,7 @@ CL_PROVIDE(cl_UP_unnamed) // Specification. -#include "cl_univpoly.h" +#include "cln/univpoly.h" // Implementation. @@ -19,6 +19,8 @@ CL_PROVIDE(cl_UP_unnamed) #include "cl_rcpointer_hashweak_rcpointer.h" +namespace cln { + // An entry can be collected when the value (the ring) isn't referenced any more // except from the hash table, and when the key (the base ring) isn't referenced // any more except from the hash table and the ring. Note that the ring contains @@ -45,7 +47,7 @@ static inline void store_univpoly_ring (const cl_univpoly_ring& R) } -const cl_univpoly_ring cl_find_univpoly_ring (const cl_ring& r) +const cl_univpoly_ring find_univpoly_ring (const cl_ring& r) { var cl_univpoly_ring* ring_in_table = get_univpoly_ring(r); if (!ring_in_table) { @@ -58,4 +60,6 @@ const cl_univpoly_ring cl_find_univpoly_ring (const cl_ring& r) return *ring_in_table; } +} // namespace cln + CL_PROVIDE_END(cl_UP_unnamed) diff --git a/src/polynomial/elem/cl_asm_GF2.cc b/src/polynomial/elem/cl_asm_GF2.cc index dbdfb68..f8b3388 100644 --- a/src/polynomial/elem/cl_asm_GF2.cc +++ b/src/polynomial/elem/cl_asm_GF2.cc @@ -1,6 +1,6 @@ // Includes the CPU specific cl_asm_*.cc file. -#include "cl_config.h" +#include "cln/config.h" #if defined(__sparc__) || defined(__sparc64__) #include "cl_asm_sparc_GF2.cc" diff --git a/src/polynomial/misc/cl_UP_I_hermite.cc b/src/polynomial/misc/cl_UP_I_hermite.cc index b2807bf..90edea9 100644 --- a/src/polynomial/misc/cl_UP_I_hermite.cc +++ b/src/polynomial/misc/cl_UP_I_hermite.cc @@ -1,17 +1,19 @@ -// cl_hermite(). +// hermite(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_univpoly_integer.h" +#include "cln/univpoly_integer.h" // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" -const cl_UP_I cl_hermite (sintL n) +namespace cln { + +const cl_UP_I hermite (sintL n) { // The Hermite polynomials H_n(x) are defined as // @@ -41,7 +43,7 @@ const cl_UP_I cl_hermite (sintL n) // // H_n(x) = sum(j=0..floor(n/2), (-1)^j n!/j!(n-2j)! 2^(n-2j) x^(n-2j)) // - var cl_univpoly_integer_ring R = cl_find_univpoly_ring(cl_I_ring); + var cl_univpoly_integer_ring R = find_univpoly_ring(cl_I_ring); var cl_UP_I h = R->create(n); var sintL k = n; var cl_I c_k = ash(1,n); @@ -56,3 +58,5 @@ const cl_UP_I cl_hermite (sintL n) h.finalize(); return h; } + +} // namespace cln diff --git a/src/polynomial/misc/cl_UP_I_laguerre.cc b/src/polynomial/misc/cl_UP_I_laguerre.cc index 43e7400..1e0b5d0 100644 --- a/src/polynomial/misc/cl_UP_I_laguerre.cc +++ b/src/polynomial/misc/cl_UP_I_laguerre.cc @@ -1,17 +1,19 @@ -// cl_laguerre(). +// laguerre(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_univpoly_integer.h" +#include "cln/univpoly_integer.h" // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" -const cl_UP_I cl_laguerre (sintL n) +namespace cln { + +const cl_UP_I laguerre (sintL n) { // The Laguerre polynomials L_n(x) are defined as // @@ -40,7 +42,7 @@ const cl_UP_I cl_laguerre (sintL n) // // L_n(x) = sum(j=0..n, (-1)^(n-j) n!^2/j!(n-j)!^2 x^(n-j)) // - var cl_univpoly_integer_ring R = cl_find_univpoly_ring(cl_I_ring); + var cl_univpoly_integer_ring R = find_univpoly_ring(cl_I_ring); var cl_UP_I l = R->create(n); var sintL k = n; var cl_I c_k = (evenp(n) ? 1 : -1); @@ -55,3 +57,5 @@ const cl_UP_I cl_laguerre (sintL n) l.finalize(); return l; } + +} // namespace cln diff --git a/src/polynomial/misc/cl_UP_I_tchebychev.cc b/src/polynomial/misc/cl_UP_I_tchebychev.cc index 030e7ed..71b76ff 100644 --- a/src/polynomial/misc/cl_UP_I_tchebychev.cc +++ b/src/polynomial/misc/cl_UP_I_tchebychev.cc @@ -1,17 +1,19 @@ -// cl_tschebychev(). +// tschebychev(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_univpoly_integer.h" +#include "cln/univpoly_integer.h" // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" -const cl_UP_I cl_tschebychev (sintL n) +namespace cln { + +const cl_UP_I tschebychev (sintL n) { // The Tschebychev polynomials (of the 1st kind) T_n(x) are defined // through the recurrence relation @@ -37,7 +39,7 @@ const cl_UP_I cl_tschebychev (sintL n) // // T_n(x) = sum(j=0..floor(n/2), (-1)^j (n-j-1)!n/j!(n-2j)! 2^(n-2j-1) x^(n-2j)) // - var cl_univpoly_integer_ring R = cl_find_univpoly_ring(cl_I_ring); + var cl_univpoly_integer_ring R = find_univpoly_ring(cl_I_ring); if (n == 0) return R->one(); var cl_UP_I t = R->create(n); @@ -54,3 +56,5 @@ const cl_UP_I cl_tschebychev (sintL n) t.finalize(); return t; } + +} // namespace cln diff --git a/src/polynomial/misc/cl_UP_RA_legendre.cc b/src/polynomial/misc/cl_UP_RA_legendre.cc index 0879718..f1cb3ce 100644 --- a/src/polynomial/misc/cl_UP_RA_legendre.cc +++ b/src/polynomial/misc/cl_UP_RA_legendre.cc @@ -1,18 +1,20 @@ -// cl_legendre(). +// legendre(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_univpoly_rational.h" +#include "cln/univpoly_rational.h" // Implementation. -#include "cl_integer.h" -#include "cl_rational.h" +#include "cln/integer.h" +#include "cln/rational.h" -const cl_UP_RA cl_legendre (sintL n) +namespace cln { + +const cl_UP_RA legendre (sintL n) { // The Legendre polynomials P_n(x) are defined as // @@ -42,7 +44,7 @@ const cl_UP_RA cl_legendre (sintL n) // // P_n(x) = sum(j=0..floor(n/2), (-1)^j (2n-2j)!/j!(n-2j)!(n-j)! 2^-n x^(n-2j)) // - var cl_univpoly_rational_ring R = cl_find_univpoly_ring(cl_RA_ring); + var cl_univpoly_rational_ring R = find_univpoly_ring(cl_RA_ring); var cl_UP_RA p = R->create(n); var cl_I denom = ash(1,n); var sintL k = n; @@ -58,3 +60,5 @@ const cl_UP_RA cl_legendre (sintL n) p.finalize(); return p; } + +} // namespace cln diff --git a/src/polynomial/misc/cl_UP_debug.cc b/src/polynomial/misc/cl_UP_debug.cc index 25438a5..ca952cd 100644 --- a/src/polynomial/misc/cl_UP_debug.cc +++ b/src/polynomial/misc/cl_UP_debug.cc @@ -8,9 +8,11 @@ // Implementation. -#include "cl_univpoly.h" +#include "cln/univpoly.h" #include "cl_UP.h" -#include "cl_io.h" +#include "cln/io.h" + +namespace cln { static void dprint (cl_heap* pointer) { @@ -29,3 +31,5 @@ void cl_UP::debug_print () const // This dummy links in this module when requires it. int cl_UP_debug_module; + +} // namespace cln diff --git a/src/polynomial/misc/cl_UP_deriv.cc b/src/polynomial/misc/cl_UP_deriv.cc index 0697079..a8cae3f 100644 --- a/src/polynomial/misc/cl_UP_deriv.cc +++ b/src/polynomial/misc/cl_UP_deriv.cc @@ -4,12 +4,14 @@ #include "cl_sysdep.h" // Specification. -#include "cl_univpoly.h" +#include "cln/univpoly.h" // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_UP deriv (const cl_UP& x) { @@ -28,3 +30,5 @@ const cl_UP deriv (const cl_UP& x) return y; } } + +} // namespace cln diff --git a/src/rational/algebraic/cl_RA_rootp.cc b/src/rational/algebraic/cl_RA_rootp.cc index 9c998ea..0ad2dba 100644 --- a/src/rational/algebraic/cl_RA_rootp.cc +++ b/src/rational/algebraic/cl_RA_rootp.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { cl_boolean rootp (const cl_RA& x, uintL n, cl_RA* w) { @@ -35,3 +37,5 @@ cl_boolean rootp (const cl_RA& x, uintL n, cl_RA* w) // beides n-te Potenzen -> Quotient der Wurzeln bilden *w = I_I_to_RT(c,d); return cl_true; }} + +} // namespace cln diff --git a/src/rational/algebraic/cl_RA_rootp_I.cc b/src/rational/algebraic/cl_RA_rootp_I.cc index adf07d0..dc2f9af 100644 --- a/src/rational/algebraic/cl_RA_rootp_I.cc +++ b/src/rational/algebraic/cl_RA_rootp_I.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { cl_boolean rootp (const cl_RA& x, const cl_I& n, cl_RA* w) { @@ -35,3 +37,5 @@ cl_boolean rootp (const cl_RA& x, const cl_I& n, cl_RA* w) // beides n-te Potenzen -> Quotient der Wurzeln bilden *w = I_I_to_RT(c,d); return cl_true; }} + +} // namespace cln diff --git a/src/rational/algebraic/cl_RA_sqrtp.cc b/src/rational/algebraic/cl_RA_sqrtp.cc index d49cb99..f341482 100644 --- a/src/rational/algebraic/cl_RA_sqrtp.cc +++ b/src/rational/algebraic/cl_RA_sqrtp.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { cl_boolean sqrtp (const cl_RA& x, cl_RA* w) { @@ -35,3 +37,5 @@ cl_boolean sqrtp (const cl_RA& x, cl_RA* w) // beides Quadratzahlen -> Quotient der Wurzeln bilden *w = I_I_to_RT(c,d); return cl_true; }} + +} // namespace cln diff --git a/src/rational/cl_RA.h b/src/rational/cl_RA.h index 4c6a71c..1b4c5b1 100644 --- a/src/rational/cl_RA.h +++ b/src/rational/cl_RA.h @@ -3,12 +3,14 @@ #ifndef _CL_RA_H #define _CL_RA_H -#include "cl_number.h" -#include "cl_rational.h" +#include "cln/number.h" +#include "cln/rational.h" #include "cl_macros.h" -#include "cl_malloc.h" +#include "cln/malloc.h" #include "cl_I.h" +namespace cln { + struct cl_heap_ratio : cl_heap { cl_I numerator; cl_I denominator; @@ -21,7 +23,7 @@ inline cl_heap_ratio* TheRatio (const cl_number& obj) inline cl_heap_ratio* allocate_ratio (const cl_I& num, const cl_I& den) { - cl_heap_ratio* p = (cl_heap_ratio*) cl_malloc_hook(sizeof(cl_heap_ratio)); + cl_heap_ratio* p = (cl_heap_ratio*) malloc_hook(sizeof(cl_heap_ratio)); p->refcount = 1; p->type = &cl_class_ratio; p->numerator.pointer = num.pointer; cl_inc_refcount(num); @@ -168,5 +170,6 @@ inline const cl_I denominator (const cl_RA& r) } \ } +} // namespace cln #endif /* _CL_RA_H */ diff --git a/src/rational/division/cl_RA_ceil1.cc b/src/rational/division/cl_RA_ceil1.cc index e60c63c..a61342a 100644 --- a/src/rational/division/cl_RA_ceil1.cc +++ b/src/rational/division/cl_RA_ceil1.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_I ceiling1 (const cl_RA& x) { @@ -27,3 +29,5 @@ const cl_I ceiling1 (const cl_RA& x) return ceiling1(a,b); } } + +} // namespace cln diff --git a/src/rational/division/cl_RA_ceil12.cc b/src/rational/division/cl_RA_ceil12.cc index 8d1ced7..a7e4c3f 100644 --- a/src/rational/division/cl_RA_ceil12.cc +++ b/src/rational/division/cl_RA_ceil12.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_I ceiling1 (const cl_RA& x, const cl_RA& y) { @@ -45,3 +47,5 @@ const cl_I ceiling1 (const cl_RA& x, const cl_RA& y) } } } + +} // namespace cln diff --git a/src/rational/division/cl_RA_ceil2.cc b/src/rational/division/cl_RA_ceil2.cc index 3d40cd8..4d41dd2 100644 --- a/src/rational/division/cl_RA_ceil2.cc +++ b/src/rational/division/cl_RA_ceil2.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_RA_div_t ceiling2 (const cl_RA& x) { @@ -33,3 +35,5 @@ const cl_RA_div_t ceiling2 (const cl_RA& x) return cl_RA_div_t(q,I_I_to_RT(r,b)); } } + +} // namespace cln diff --git a/src/rational/division/cl_RA_ceil22.cc b/src/rational/division/cl_RA_ceil22.cc index 7980541..ac56d87 100644 --- a/src/rational/division/cl_RA_ceil22.cc +++ b/src/rational/division/cl_RA_ceil22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_RA_div_t ceiling2 (const cl_RA& x, const cl_RA& y) { @@ -68,3 +70,5 @@ const cl_RA_div_t ceiling2 (const cl_RA& x, const cl_RA& y) return cl_RA_div_t(q,y*r); #endif } + +} // namespace cln diff --git a/src/rational/division/cl_RA_floor1.cc b/src/rational/division/cl_RA_floor1.cc index 780dc23..776e53a 100644 --- a/src/rational/division/cl_RA_floor1.cc +++ b/src/rational/division/cl_RA_floor1.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_I floor1 (const cl_RA& x) { @@ -27,3 +29,5 @@ const cl_I floor1 (const cl_RA& x) return floor1(a,b); } } + +} // namespace cln diff --git a/src/rational/division/cl_RA_floor12.cc b/src/rational/division/cl_RA_floor12.cc index 501e367..b03d3b6 100644 --- a/src/rational/division/cl_RA_floor12.cc +++ b/src/rational/division/cl_RA_floor12.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_I floor1 (const cl_RA& x, const cl_RA& y) { @@ -45,3 +47,5 @@ const cl_I floor1 (const cl_RA& x, const cl_RA& y) } } } + +} // namespace cln diff --git a/src/rational/division/cl_RA_floor2.cc b/src/rational/division/cl_RA_floor2.cc index ef4e21b..71b3c2f 100644 --- a/src/rational/division/cl_RA_floor2.cc +++ b/src/rational/division/cl_RA_floor2.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_RA_div_t floor2 (const cl_RA& x) { @@ -33,3 +35,5 @@ const cl_RA_div_t floor2 (const cl_RA& x) return cl_RA_div_t(q,I_I_to_RT(r,b)); } } + +} // namespace cln diff --git a/src/rational/division/cl_RA_floor22.cc b/src/rational/division/cl_RA_floor22.cc index 3300961..79c3540 100644 --- a/src/rational/division/cl_RA_floor22.cc +++ b/src/rational/division/cl_RA_floor22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_RA_div_t floor2 (const cl_RA& x, const cl_RA& y) { @@ -68,3 +70,5 @@ const cl_RA_div_t floor2 (const cl_RA& x, const cl_RA& y) return cl_RA_div_t(q,y*r); #endif } + +} // namespace cln diff --git a/src/rational/division/cl_RA_round1.cc b/src/rational/division/cl_RA_round1.cc index 73c6f83..4c2ac7d 100644 --- a/src/rational/division/cl_RA_round1.cc +++ b/src/rational/division/cl_RA_round1.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_I round1 (const cl_RA& x) { @@ -27,3 +29,5 @@ const cl_I round1 (const cl_RA& x) return round1(a,b); } } + +} // namespace cln diff --git a/src/rational/division/cl_RA_round12.cc b/src/rational/division/cl_RA_round12.cc index c57078c..bf4b060 100644 --- a/src/rational/division/cl_RA_round12.cc +++ b/src/rational/division/cl_RA_round12.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_I round1 (const cl_RA& x, const cl_RA& y) { @@ -45,3 +47,5 @@ const cl_I round1 (const cl_RA& x, const cl_RA& y) } } } + +} // namespace cln diff --git a/src/rational/division/cl_RA_round2.cc b/src/rational/division/cl_RA_round2.cc index 8a38ee2..026ace4 100644 --- a/src/rational/division/cl_RA_round2.cc +++ b/src/rational/division/cl_RA_round2.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_RA_div_t round2 (const cl_RA& x) { @@ -33,3 +35,5 @@ const cl_RA_div_t round2 (const cl_RA& x) return cl_RA_div_t(q,I_I_to_RT(r,b)); } } + +} // namespace cln diff --git a/src/rational/division/cl_RA_round22.cc b/src/rational/division/cl_RA_round22.cc index 36141a7..f012d0b 100644 --- a/src/rational/division/cl_RA_round22.cc +++ b/src/rational/division/cl_RA_round22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_RA_div_t round2 (const cl_RA& x, const cl_RA& y) { @@ -68,3 +70,5 @@ const cl_RA_div_t round2 (const cl_RA& x, const cl_RA& y) return cl_RA_div_t(q,y*r); #endif } + +} // namespace cln diff --git a/src/rational/division/cl_RA_trunc1.cc b/src/rational/division/cl_RA_trunc1.cc index c64a7ba..323bdd1 100644 --- a/src/rational/division/cl_RA_trunc1.cc +++ b/src/rational/division/cl_RA_trunc1.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_I truncate1 (const cl_RA& x) { @@ -27,3 +29,5 @@ const cl_I truncate1 (const cl_RA& x) return truncate1(a,b); } } + +} // namespace cln diff --git a/src/rational/division/cl_RA_trunc12.cc b/src/rational/division/cl_RA_trunc12.cc index c6c7537..d592272 100644 --- a/src/rational/division/cl_RA_trunc12.cc +++ b/src/rational/division/cl_RA_trunc12.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_I truncate1 (const cl_RA& x, const cl_RA& y) { @@ -45,3 +47,5 @@ const cl_I truncate1 (const cl_RA& x, const cl_RA& y) } } } + +} // namespace cln diff --git a/src/rational/division/cl_RA_trunc2.cc b/src/rational/division/cl_RA_trunc2.cc index b0c483d..26b5038 100644 --- a/src/rational/division/cl_RA_trunc2.cc +++ b/src/rational/division/cl_RA_trunc2.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_RA_div_t truncate2 (const cl_RA& x) { @@ -33,3 +35,5 @@ const cl_RA_div_t truncate2 (const cl_RA& x) return cl_RA_div_t(q,I_I_to_RT(r,b)); } } + +} // namespace cln diff --git a/src/rational/division/cl_RA_trunc22.cc b/src/rational/division/cl_RA_trunc22.cc index 31e96eb..702ebae 100644 --- a/src/rational/division/cl_RA_trunc22.cc +++ b/src/rational/division/cl_RA_trunc22.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_RA_div_t truncate2 (const cl_RA& x, const cl_RA& y) { @@ -68,3 +70,5 @@ const cl_RA_div_t truncate2 (const cl_RA& x, const cl_RA& y) return cl_RA_div_t(q,y*r); #endif } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_compare.cc b/src/rational/elem/cl_RA_compare.cc index 1716020..213ed79 100644 --- a/src/rational/elem/cl_RA_compare.cc +++ b/src/rational/elem/cl_RA_compare.cc @@ -1,18 +1,20 @@ -// cl_compare(). +// compare(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" -cl_signean cl_compare (const cl_RA& r, const cl_RA& s) +namespace cln { + +cl_signean compare (const cl_RA& r, const cl_RA& s) { // Methode: // r,s Integer -> klar @@ -25,7 +27,7 @@ cl_signean cl_compare (const cl_RA& r, const cl_RA& s) if (integerp(r) && integerp(s)) { DeclareType(cl_I,r); DeclareType(cl_I,s); - return cl_compare(r,s); + return compare(r,s); } // r,s nicht beide Integers. // 2. Schritt: Test, ob die Vorzeichen bereits das Ergebnis hergeben: @@ -45,7 +47,7 @@ cl_signean cl_compare (const cl_RA& r, const cl_RA& s) var const cl_I& a = r; var const cl_I& b = numerator(s); var const cl_I& c = denominator(s); - return cl_compare(a*c,b); + return compare(a*c,b); } elif (integerp(s)) { DeclareType(cl_I,s); @@ -54,7 +56,7 @@ cl_signean cl_compare (const cl_RA& r, const cl_RA& s) var const cl_I& a = numerator(r); var const cl_I& b = denominator(r); var const cl_I& c = s; - return cl_compare(a,b*c); + return compare(a,b*c); } else { DeclareType(cl_RT,r); @@ -64,7 +66,9 @@ cl_signean cl_compare (const cl_RA& r, const cl_RA& s) var const cl_I& b = denominator(r); var const cl_I& c = numerator(s); var const cl_I& d = denominator(s); - return cl_compare(a*d,b*c); + return compare(a*d,b*c); } } // Beschleunigung durch Konversion zu Short-Floats diese zuerst vergleichen?? + +} // namespace cln diff --git a/src/rational/elem/cl_RA_denominator.cc b/src/rational/elem/cl_RA_denominator.cc index d2c2668..c25ab35 100644 --- a/src/rational/elem/cl_RA_denominator.cc +++ b/src/rational/elem/cl_RA_denominator.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. @@ -13,7 +13,11 @@ #include "cl_RA.h" #undef denominator +namespace cln { + const cl_I denominator (const cl_RA& r) { return inline_denominator(r); } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_div.cc b/src/rational/elem/cl_RA_div.cc index 00ed7b1..fe0d5e7 100644 --- a/src/rational/elem/cl_RA_div.cc +++ b/src/rational/elem/cl_RA_div.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_RA operator/ (const cl_RA& r, const cl_RA& s) { @@ -24,3 +26,5 @@ const cl_RA operator/ (const cl_RA& r, const cl_RA& s) } return r * recip(s); } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_equal.cc b/src/rational/elem/cl_RA_equal.cc index 9f131d0..9c21c0e 100644 --- a/src/rational/elem/cl_RA_equal.cc +++ b/src/rational/elem/cl_RA_equal.cc @@ -1,18 +1,20 @@ -// cl_equal(). +// equal(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" -cl_boolean cl_equal (const cl_RA& r, const cl_RA& s) +namespace cln { + +cl_boolean equal (const cl_RA& r, const cl_RA& s) { // Methode: // r,s Integer -> klar @@ -24,7 +26,7 @@ cl_boolean cl_equal (const cl_RA& r, const cl_RA& s) // r,s beide Integer DeclareType(cl_I,r); DeclareType(cl_I,s); - return cl_equal(r,s); + return equal(r,s); } else // r Integer, s Ratio return cl_false; @@ -36,10 +38,12 @@ cl_boolean cl_equal (const cl_RA& r, const cl_RA& s) DeclareType(cl_RT,r); DeclareType(cl_RT,s); // r,s Ratios - if (!cl_equal(numerator(r),numerator(s))) + if (!equal(numerator(r),numerator(s))) return cl_false; - if (!cl_equal(denominator(r),denominator(s))) + if (!equal(denominator(r),denominator(s))) return cl_false; return cl_true; } } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_from_I_I_div.cc b/src/rational/elem/cl_RA_from_I_I_div.cc index f6c51cb..3b7fa35 100644 --- a/src/rational/elem/cl_RA_from_I_I_div.cc +++ b/src/rational/elem/cl_RA_from_I_I_div.cc @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_N.h" +namespace cln { + const cl_RA I_I_div_RA (const cl_I& a, const cl_I& b) { // Methode: @@ -25,3 +27,5 @@ const cl_RA I_I_div_RA (const cl_I& a, const cl_I& b) else return I_posI_div_RA(a,b); } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_from_I_posI.cc b/src/rational/elem/cl_RA_from_I_posI.cc index bcecc7e..3346ee4 100644 --- a/src/rational/elem/cl_RA_from_I_posI.cc +++ b/src/rational/elem/cl_RA_from_I_posI.cc @@ -11,6 +11,8 @@ #include "cl_I.h" +namespace cln { + const cl_RA I_I_to_RA (const cl_I& a, const cl_I& b) { // Methode: @@ -20,3 +22,5 @@ const cl_RA I_I_to_RA (const cl_I& a, const cl_I& b) else return allocate_ratio(a,b); } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_from_I_posI1.cc b/src/rational/elem/cl_RA_from_I_posI1.cc index e1ff5c3..7bf48d5 100644 --- a/src/rational/elem/cl_RA_from_I_posI1.cc +++ b/src/rational/elem/cl_RA_from_I_posI1.cc @@ -9,7 +9,11 @@ // Implementation. +namespace cln { + const cl_RA I_I_to_RT (const cl_I& a, const cl_I& b) { return allocate_ratio(a,b); } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_from_I_posI_div.cc b/src/rational/elem/cl_RA_from_I_posI_div.cc index a0be726..2fd501a 100644 --- a/src/rational/elem/cl_RA_from_I_posI_div.cc +++ b/src/rational/elem/cl_RA_from_I_posI_div.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" +namespace cln { + const cl_RA I_posI_div_RA (const cl_I& a, const cl_I& b) { // Methode: @@ -24,3 +26,5 @@ const cl_RA I_posI_div_RA (const cl_I& a, const cl_I& b) else return I_I_to_RA(exquo(a,d),exquopos(b,d)); } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_minus.cc b/src/rational/elem/cl_RA_minus.cc index 385b3b2..31fda3b 100644 --- a/src/rational/elem/cl_RA_minus.cc +++ b/src/rational/elem/cl_RA_minus.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" +namespace cln { + const cl_RA operator- (const cl_RA& r, const cl_RA& s) { #if 0 @@ -108,3 +110,5 @@ const cl_RA operator- (const cl_RA& r, const cl_RA& s) } #endif } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_minus1.cc b/src/rational/elem/cl_RA_minus1.cc index 5f46e66..b3d368f 100644 --- a/src/rational/elem/cl_RA_minus1.cc +++ b/src/rational/elem/cl_RA_minus1.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_RA minus1 (const cl_RA& r) { @@ -27,3 +29,5 @@ const cl_RA minus1 (const cl_RA& r) return I_I_to_RT(a-b,b); } } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_minusp.cc b/src/rational/elem/cl_RA_minusp.cc index 4f3d325..0ae72f6 100644 --- a/src/rational/elem/cl_RA_minusp.cc +++ b/src/rational/elem/cl_RA_minusp.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. @@ -13,7 +13,11 @@ #include "cl_RA.h" #undef minusp +namespace cln { + cl_boolean minusp (const cl_RA& x) { return inline_minusp(x); } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_mul.cc b/src/rational/elem/cl_RA_mul.cc index 6f0dfab..b7458a1 100644 --- a/src/rational/elem/cl_RA_mul.cc +++ b/src/rational/elem/cl_RA_mul.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" +namespace cln { + const cl_RA operator* (const cl_RA& r, const cl_RA& s) { // Methode (vgl. [Buchberger, Collins, Loos: Computer Algebra, S.201]) @@ -97,3 +99,5 @@ const cl_RA operator* (const cl_RA& r, const cl_RA& s) } } } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_numerator.cc b/src/rational/elem/cl_RA_numerator.cc index b4d1b4c..ea5c045 100644 --- a/src/rational/elem/cl_RA_numerator.cc +++ b/src/rational/elem/cl_RA_numerator.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. @@ -13,7 +13,11 @@ #include "cl_RA.h" #undef numerator +namespace cln { + const cl_I numerator (const cl_RA& r) { return inline_numerator(r); } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_plus.cc b/src/rational/elem/cl_RA_plus.cc index a70b42f..bfb1a78 100644 --- a/src/rational/elem/cl_RA_plus.cc +++ b/src/rational/elem/cl_RA_plus.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" +namespace cln { + const cl_RA operator+ (const cl_RA& r, const cl_RA& s) { // Methode (vgl. [Buchberger, Collins, Loos: Computer Algebra, S.200-201]) @@ -97,3 +99,5 @@ const cl_RA operator+ (const cl_RA& r, const cl_RA& s) } } } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_plus1.cc b/src/rational/elem/cl_RA_plus1.cc index aa60f10..ef8f317 100644 --- a/src/rational/elem/cl_RA_plus1.cc +++ b/src/rational/elem/cl_RA_plus1.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_RA plus1 (const cl_RA& r) { @@ -27,3 +29,5 @@ const cl_RA plus1 (const cl_RA& r) return I_I_to_RT(a+b,b); } } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_plusp.cc b/src/rational/elem/cl_RA_plusp.cc index 5461caa..e0c99ae 100644 --- a/src/rational/elem/cl_RA_plusp.cc +++ b/src/rational/elem/cl_RA_plusp.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. @@ -15,6 +15,8 @@ #undef zerop #undef minusp +namespace cln { + cl_boolean plusp (const cl_RA& x) { if (inline_minusp(x)) @@ -24,3 +26,5 @@ cl_boolean plusp (const cl_RA& x) else return cl_true; // sonst ist x>0. } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_recip.cc b/src/rational/elem/cl_RA_recip.cc index c213dfd..120d2d6 100644 --- a/src/rational/elem/cl_RA_recip.cc +++ b/src/rational/elem/cl_RA_recip.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_N.h" #include "cl_I.h" +namespace cln { + const cl_RA recip (const cl_RA& r) { // Methode: @@ -31,3 +33,5 @@ const cl_RA recip (const cl_RA& r) // a<0 return I_I_to_RA(-b,-a); } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_square.cc b/src/rational/elem/cl_RA_square.cc index 490fd6a..5d58ba2 100644 --- a/src/rational/elem/cl_RA_square.cc +++ b/src/rational/elem/cl_RA_square.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_RA square (const cl_RA& r) { @@ -28,3 +30,5 @@ const cl_RA square (const cl_RA& r) return I_I_to_RT(square(a),square(b)); } } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_uminus.cc b/src/rational/elem/cl_RA_uminus.cc index c8ea606..d5a8326 100644 --- a/src/rational/elem/cl_RA_uminus.cc +++ b/src/rational/elem/cl_RA_uminus.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_RA operator- (const cl_RA& r) { @@ -28,3 +30,5 @@ const cl_RA operator- (const cl_RA& r) return I_I_to_RT(-a,b); } } + +} // namespace cln diff --git a/src/rational/elem/cl_RA_zerop.cc b/src/rational/elem/cl_RA_zerop.cc index 91b4f8a..e6db433 100644 --- a/src/rational/elem/cl_RA_zerop.cc +++ b/src/rational/elem/cl_RA_zerop.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. @@ -13,7 +13,11 @@ #include "cl_RA.h" #undef zerop +namespace cln { + cl_boolean zerop (const cl_RA& x) { return inline_zerop(x); } + +} // namespace cln diff --git a/src/rational/input/cl_RA_from_string.cc b/src/rational/input/cl_RA_from_string.cc index 4f68d73..13b7c80 100644 --- a/src/rational/input/cl_RA_from_string.cc +++ b/src/rational/input/cl_RA_from_string.cc @@ -4,19 +4,21 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational_class.h" +#include "cln/rational_class.h" // Implementation. -#include "cl_input.h" -#include "cl_rational_io.h" +#include "cln/input.h" +#include "cln/rational_io.h" + +namespace cln { cl_read_flags cl_RA_read_flags = { syntax_rational, lsyntax_all, 10, - { cl_float_format_ffloat, cl_float_format_lfloat_min, cl_true } + { float_format_ffloat, float_format_lfloat_min, cl_true } }; cl_RA::cl_RA (const char * string) @@ -24,3 +26,5 @@ cl_RA::cl_RA (const char * string) pointer = as_cl_private_thing( read_rational(cl_RA_read_flags,string,NULL,NULL)); } + +} // namespace cln diff --git a/src/rational/input/cl_RA_read.cc b/src/rational/input/cl_RA_read.cc index 8252a7d..ccfde0b 100644 --- a/src/rational/input/cl_RA_read.cc +++ b/src/rational/input/cl_RA_read.cc @@ -7,21 +7,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational_io.h" +#include "cln/rational_io.h" // Implementation. #include -#include "cl_input.h" -#include "cl_integer.h" -#include "cl_integer_io.h" +#include "cln/input.h" +#include "cln/integer.h" +#include "cln/integer_io.h" #include "cl_I.h" -#include "cl_abort.h" +#include "cln/abort.h" -#undef floor -#include -#define floor cln_floor +namespace cln { // Step forward over all digits, to the end of string or to the next non-digit. static const char * skip_digits (const char * ptr, const char * string_limit, unsigned int base) @@ -58,7 +56,7 @@ const cl_RA read_rational (const cl_read_flags& flags, const char * string, cons ASSERT((flags.syntax & ~(syntax_rational|syntax_maybe_bad)) == 0); // If no string_limit is given, it defaults to the end of the string. if (!string_limit) - string_limit = string + strlen(string); + string_limit = string + ::strlen(string); if (flags.syntax & syntax_rational) { // Check for rational number syntax. var unsigned int rational_base = flags.rational_base; @@ -85,9 +83,9 @@ const cl_RA read_rational (const cl_read_flags& flags, const char * string, cons goto not_rational_syntax; var cl_I base = read_integer(10,0,ptr,0,base_end_ptr-ptr); if (!((base >= 2) && (base <= 36))) { - fprint(cl_stderr, "Base must be an integer in the range from 2 to 36, not "); - fprint(cl_stderr, base); - fprint(cl_stderr, "\n"); + fprint(stderr, "Base must be an integer in the range from 2 to 36, not "); + fprint(stderr, base); + fprint(stderr, "\n"); cl_abort(); } rational_base = FN_to_UL(base); ptr = base_end_ptr; @@ -151,3 +149,5 @@ bad_syntax: } read_number_bad_syntax(string,string_limit); } + +} // namespace cln diff --git a/src/rational/input/cl_RA_read_stream.cc b/src/rational/input/cl_RA_read_stream.cc index f4266a7..58bbd9e 100644 --- a/src/rational/input/cl_RA_read_stream.cc +++ b/src/rational/input/cl_RA_read_stream.cc @@ -7,15 +7,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational_io.h" +#include "cln/rational_io.h" // Implementation. -#include "cl_input.h" -#include "cl_io.h" +#include "cln/input.h" +#include "cln/io.h" #include "cl_spushstring.h" +namespace cln { + // We read an entire token (or even more, if it begins with #C) into a // buffer and then call read_rational() on the buffer. @@ -103,3 +105,5 @@ syntax1: buffer.push(c); // Handle premature EOF. eof: read_number_eof(); } + +} // namespace cln diff --git a/src/rational/input/cl_RA_readparsed.cc b/src/rational/input/cl_RA_readparsed.cc index 59c017e..417a8fd 100644 --- a/src/rational/input/cl_RA_readparsed.cc +++ b/src/rational/input/cl_RA_readparsed.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational_io.h" +#include "cln/rational_io.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_I.h" #include "cl_N.h" +namespace cln { + const cl_RA read_rational (unsigned int base, cl_signean sign, const char * string, uintL index1, uintL index3, uintL index2) { var uintL index3_1 = index3+1; // Index der ersten Nennerziffer @@ -26,3 +28,5 @@ const cl_RA read_rational (unsigned int base, cl_signean sign, const char * stri num = -num; // incl. Vorzeichen return I_posI_div_RA(num,den); } + +} // namespace cln diff --git a/src/rational/misc/cl_RA_abs.cc b/src/rational/misc/cl_RA_abs.cc index 3c5113b..9f52421 100644 --- a/src/rational/misc/cl_RA_abs.cc +++ b/src/rational/misc/cl_RA_abs.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_RA abs (const cl_RA& r) { @@ -21,3 +23,5 @@ const cl_RA abs (const cl_RA& r) else return r; } + +} // namespace cln diff --git a/src/rational/misc/cl_RA_as.cc b/src/rational/misc/cl_RA_as.cc index f5d786e..57c8783 100644 --- a/src/rational/misc/cl_RA_as.cc +++ b/src/rational/misc/cl_RA_as.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_N.h" +namespace cln { + // Cf. cl_RA_p in cl_RA_ring.cc. // But here, for better inlining in g++, it is preferrable to finish every // alternative with either "return cl_true;" or "return cl_false;". @@ -36,3 +38,5 @@ const cl_RA& as_cl_RA (const cl_number& x, const char * filename, int line) } else cl_as_error(x,"a rational number",filename,line); } + +} // namespace cln diff --git a/src/rational/misc/cl_RA_class.cc b/src/rational/misc/cl_RA_class.cc index e44387c..f6e2a44 100644 --- a/src/rational/misc/cl_RA_class.cc +++ b/src/rational/misc/cl_RA_class.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" +namespace cln { + static void ratio_destructor (cl_heap* pointer) { (*(cl_heap_ratio*)pointer).~cl_heap_ratio(); @@ -20,3 +22,5 @@ cl_class cl_class_ratio = { ratio_destructor, cl_class_flags_subclass_complex | cl_class_flags_subclass_real | cl_class_flags_subclass_rational }; + +} // namespace cln diff --git a/src/rational/misc/cl_RA_debug.cc b/src/rational/misc/cl_RA_debug.cc index ade07df..3c4eaa3 100644 --- a/src/rational/misc/cl_RA_debug.cc +++ b/src/rational/misc/cl_RA_debug.cc @@ -8,9 +8,11 @@ // Implementation. -#include "cl_rational.h" -#include "cl_io.h" -#include "cl_rational_io.h" +#include "cln/rational.h" +#include "cln/io.h" +#include "cln/rational_io.h" + +namespace cln { static void dprint (cl_heap* pointer) { @@ -21,10 +23,12 @@ static void dprint (cl_heap* pointer) AT_INITIALIZATION(dprint_RA) { cl_register_type_printer(cl_class_ratio,dprint); } -// This dummy links in this module when requires it. +// This dummy links in this module when requires it. int cl_RA_debug_module; extern int cl_I_debug_module; static void* dummy[] = { &dummy, &cl_I_debug_module }; + +} // namespace cln diff --git a/src/rational/misc/cl_RA_eqhashcode.cc b/src/rational/misc/cl_RA_eqhashcode.cc index 32de95a..8e54c85 100644 --- a/src/rational/misc/cl_RA_eqhashcode.cc +++ b/src/rational/misc/cl_RA_eqhashcode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. @@ -12,18 +12,22 @@ #include "cl_N.h" #include "cl_RA.h" -uint32 cl_equal_hashcode (const cl_RA& r) +namespace cln { + +uint32 equal_hashcode (const cl_RA& r) { if (integerp(r)) { DeclareType(cl_I,r); - return cl_equal_hashcode(r); + return equal_hashcode(r); } else { // Making sure that a float and its rational equivalent have // the same hash code is tricky. This code depends on the fact // that the equal_hashcode_low macro is linear in `exp'. DeclareType(cl_RT,r); - return cl_equal_hashcode(numerator(r)) - - cl_equal_hashcode(denominator(r)) + return equal_hashcode(numerator(r)) + - equal_hashcode(denominator(r)) + equal_hashcode_one; } } + +} // namespace cln diff --git a/src/rational/misc/cl_RA_expt.cc b/src/rational/misc/cl_RA_expt.cc index d65f8d6..9d66f34 100644 --- a/src/rational/misc/cl_RA_expt.cc +++ b/src/rational/misc/cl_RA_expt.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. +namespace cln { + const cl_RA expt (const cl_RA& x, sintL y) { // Methode: @@ -22,3 +24,5 @@ const cl_RA expt (const cl_RA& x, sintL y) else // y < 0 return recip(expt_pos(x,(uintL)(-y))); } + +} // namespace cln diff --git a/src/rational/misc/cl_RA_expt_I.cc b/src/rational/misc/cl_RA_expt_I.cc index 0a0cd79..748b269 100644 --- a/src/rational/misc/cl_RA_expt_I.cc +++ b/src/rational/misc/cl_RA_expt_I.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" +namespace cln { + const cl_RA expt (const cl_RA& x, const cl_I& y) { // Methode: @@ -25,3 +27,5 @@ const cl_RA expt (const cl_RA& x, const cl_I& y) else // y > 0 return expt_pos(x,y); } + +} // namespace cln diff --git a/src/rational/misc/cl_RA_exptpos.cc b/src/rational/misc/cl_RA_exptpos.cc index 2db9d74..e5e4c3b 100644 --- a/src/rational/misc/cl_RA_exptpos.cc +++ b/src/rational/misc/cl_RA_exptpos.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_RA expt_pos (const cl_RA& x, uintL y) { @@ -27,3 +29,5 @@ const cl_RA expt_pos (const cl_RA& x, uintL y) return I_I_to_RT(expt_pos(a,y),expt_pos(b,y)); } } + +} // namespace cln diff --git a/src/rational/misc/cl_RA_exptpos_I.cc b/src/rational/misc/cl_RA_exptpos_I.cc index 2f048b8..46f7001 100644 --- a/src/rational/misc/cl_RA_exptpos_I.cc +++ b/src/rational/misc/cl_RA_exptpos_I.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_RA expt_pos (const cl_RA& x, const cl_I& y) { @@ -27,3 +29,5 @@ const cl_RA expt_pos (const cl_RA& x, const cl_I& y) return I_I_to_RT(expt_pos(a,y),expt_pos(b,y)); } } + +} // namespace cln diff --git a/src/rational/misc/cl_RA_max.cc b/src/rational/misc/cl_RA_max.cc index a1050f9..39e30ef 100644 --- a/src/rational/misc/cl_RA_max.cc +++ b/src/rational/misc/cl_RA_max.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. +namespace cln { + const cl_RA max (const cl_RA& x, const cl_RA& y) { return (x >= y ? x : y); } + +} // namespace cln diff --git a/src/rational/misc/cl_RA_min.cc b/src/rational/misc/cl_RA_min.cc index 9fead91..2f5bb29 100644 --- a/src/rational/misc/cl_RA_min.cc +++ b/src/rational/misc/cl_RA_min.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. +namespace cln { + const cl_RA min (const cl_RA& x, const cl_RA& y) { return (x <= y ? x : y); } + +} // namespace cln diff --git a/src/rational/misc/cl_RA_signum.cc b/src/rational/misc/cl_RA_signum.cc index 1a0ae86..40f5380 100644 --- a/src/rational/misc/cl_RA_signum.cc +++ b/src/rational/misc/cl_RA_signum.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_RA.h" #include "cl_I.h" +namespace cln { + MAYBE_INLINE const cl_RA signum (const cl_RA& x) { @@ -19,3 +21,5 @@ const cl_RA signum (const cl_RA& x) elif (zerop(x)) { return 0; } // x=0 -> 0 else { return 1; } // x>0 -> +1 } + +} // namespace cln diff --git a/src/rational/output/cl_RA_aprint.cc b/src/rational/output/cl_RA_aprint.cc index 2b4ae3c..522f071 100644 --- a/src/rational/output/cl_RA_aprint.cc +++ b/src/rational/output/cl_RA_aprint.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational_io.h" +#include "cln/rational_io.h" // Implementation. -#include "cl_output.h" +#include "cln/output.h" + +namespace cln { void print_rational (cl_ostream stream, const cl_print_flags& flags, const cl_RA& z) { print_rational(stream,(const cl_print_number_flags&)flags,z); } + +} // namespace cln diff --git a/src/rational/output/cl_RA_bprint.cc b/src/rational/output/cl_RA_bprint.cc index c735a6f..ae6e07c 100644 --- a/src/rational/output/cl_RA_bprint.cc +++ b/src/rational/output/cl_RA_bprint.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational_io.h" +#include "cln/rational_io.h" // Implementation. -#include "cl_output.h" +#include "cln/output.h" + +namespace cln { void print_rational (cl_ostream stream, const cl_print_number_flags& flags, const cl_RA& z) { print_rational(stream,(const cl_print_real_flags&)flags,z); } + +} // namespace cln diff --git a/src/rational/output/cl_RA_cprint.cc b/src/rational/output/cl_RA_cprint.cc index 4c56b64..69e71e4 100644 --- a/src/rational/output/cl_RA_cprint.cc +++ b/src/rational/output/cl_RA_cprint.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational_io.h" +#include "cln/rational_io.h" // Implementation. -#include "cl_output.h" +#include "cln/output.h" + +namespace cln { void print_rational (cl_ostream stream, const cl_print_real_flags& flags, const cl_RA& z) { print_rational(stream,(const cl_print_rational_flags&)flags,z); } + +} // namespace cln diff --git a/src/rational/output/cl_RA_dprint.cc b/src/rational/output/cl_RA_dprint.cc index 49a2037..035f50a 100644 --- a/src/rational/output/cl_RA_dprint.cc +++ b/src/rational/output/cl_RA_dprint.cc @@ -4,16 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational_io.h" +#include "cln/rational_io.h" // Implementation. -#include "cl_output.h" -#include "cl_integer_io.h" -#include "cl_rational.h" +#include "cln/output.h" +#include "cln/integer_io.h" +#include "cln/rational.h" #include "cl_RA.h" +namespace cln { + void print_rational (cl_ostream stream, const cl_print_rational_flags& flags, const cl_RA& z) { var unsigned int base = flags.rational_base; @@ -60,3 +62,5 @@ void print_rational (cl_ostream stream, const cl_print_rational_flags& flags, co print_integer(stream,base,denominator(z)); } } + +} // namespace cln diff --git a/src/rational/output/cl_RA_print.cc b/src/rational/output/cl_RA_print.cc index cc55872..2cf4c3c 100644 --- a/src/rational/output/cl_RA_print.cc +++ b/src/rational/output/cl_RA_print.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational_io.h" +#include "cln/rational_io.h" // Implementation. -#include "cl_integer_io.h" -#include "cl_rational.h" +#include "cln/integer_io.h" +#include "cln/rational.h" #include "cl_RA.h" +namespace cln { + void print_rational (cl_ostream stream, unsigned int base, const cl_RA& z) { if (integerp(z)) { @@ -28,3 +30,5 @@ void print_rational (cl_ostream stream, unsigned int base, const cl_RA& z) print_integer(stream,base,den); // Nenner ausgeben } } + +} // namespace cln diff --git a/src/rational/ring/cl_RA_ring.cc b/src/rational/ring/cl_RA_ring.cc index f5f25fc..e8e8da0 100644 --- a/src/rational/ring/cl_RA_ring.cc +++ b/src/rational/ring/cl_RA_ring.cc @@ -6,15 +6,17 @@ CL_PROVIDE(cl_RA_ring) // Specification. -#include "cl_rational_ring.h" +#include "cln/rational_ring.h" // Implementation. -#include "cl_rational.h" -#include "cl_rational_io.h" +#include "cln/rational.h" +#include "cln/rational_io.h" #include "cl_RA.h" +namespace cln { + static void RA_fprint (cl_heap_ring* R, cl_ostream stream, const _cl_ring_element& x) { unused R; @@ -24,7 +26,7 @@ static void RA_fprint (cl_heap_ring* R, cl_ostream stream, const _cl_ring_elemen static cl_boolean RA_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y) { unused R; - return cl_equal(The(cl_RA)(x),The(cl_RA)(y)); + return equal(The(cl_RA)(x),The(cl_RA)(y)); } static const _cl_ring_element RA_zero (cl_heap_ring* R) @@ -108,7 +110,7 @@ static cl_ring_mulops RA_mulops = { static cl_number_ring_ops RA_ops = { cl_RA_p, - cl_equal, + equal, zerop, operator+, operator-, @@ -153,4 +155,6 @@ inline cl_rational_ring::cl_specialized_number_ring () const cl_rational_ring cl_RA_ring; +} // namespace cln + CL_PROVIDE_END(cl_RA_ring) diff --git a/src/rational/transcendental/cl_I_logp.cc b/src/rational/transcendental/cl_I_logp.cc index 6b0279e..aada2f9 100644 --- a/src/rational/transcendental/cl_I_logp.cc +++ b/src/rational/transcendental/cl_I_logp.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. @@ -13,6 +13,8 @@ #include "cl_RA.h" #include "cl_xmacros.h" +namespace cln { + cl_boolean logp (const cl_I& a, const cl_I& b, cl_RA* l) { // Methode: @@ -68,3 +70,5 @@ cl_boolean logp (const cl_I& a, const cl_I& b, cl_RA* l) // a=1 -> c=0,d=1 -> Ergebnis ud/vd *l = I_I_to_RA(UL_to_I(ud),UL_to_I(vd)); return cl_true; }} + +} // namespace cln diff --git a/src/rational/transcendental/cl_RA_logp.cc b/src/rational/transcendental/cl_RA_logp.cc index 4c7bf34..161cbe3 100644 --- a/src/rational/transcendental/cl_RA_logp.cc +++ b/src/rational/transcendental/cl_RA_logp.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_rational.h" +#include "cln/rational.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_I.h" #include "cl_RA.h" +namespace cln { + cl_boolean logp (const cl_RA& a, const cl_RA& b, cl_RA* pl) { // Methode: @@ -101,3 +103,5 @@ cl_boolean logp (const cl_RA& a, const cl_RA& b, cl_RA* pl) return cl_false; } } + +} // namespace cln diff --git a/src/real/algebraic/cl_RA_sqrt.cc b/src/real/algebraic/cl_RA_sqrt.cc index 93fffd5..791c2d9 100644 --- a/src/real/algebraic/cl_RA_sqrt.cc +++ b/src/real/algebraic/cl_RA_sqrt.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" + +namespace cln { MAYBE_INLINE const cl_R sqrt (const cl_RA& x) @@ -22,3 +24,5 @@ const cl_R sqrt (const cl_RA& x) // x in Float umwandeln, dann die Wurzel ziehen: return sqrt(cl_float(x)); } + +} // namespace cln diff --git a/src/real/algebraic/cl_R_sqrt.cc b/src/real/algebraic/cl_R_sqrt.cc index e5bf39c..0d98e4c 100644 --- a/src/real/algebraic/cl_R_sqrt.cc +++ b/src/real/algebraic/cl_R_sqrt.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_float.h" -#include "cl_rational.h" +#include "cln/float.h" +#include "cln/rational.h" + +namespace cln { #undef MAYBE_INLINE #define MAYBE_INLINE inline @@ -19,3 +21,5 @@ const cl_R sqrt (const cl_R& x) GEN_R_OP1_2(x, sqrt, return) + +} // namespace cln diff --git a/src/real/cl_R.h b/src/real/cl_R.h index 7277a9b..6023994 100644 --- a/src/real/cl_R.h +++ b/src/real/cl_R.h @@ -3,8 +3,10 @@ #ifndef _CL_R_H #define _CL_R_H -#include "cl_number.h" -#include "cl_real.h" +#include "cln/number.h" +#include "cln/real.h" + +namespace cln { extern cl_class cl_class_bignum; extern cl_class cl_class_ratio; @@ -202,4 +204,6 @@ inline const cl_F cl_somefloat (const cl_R& x, const cl_F& y) } } +} // namespace cln + #endif /* _CL_R_H */ diff --git a/src/real/conv/cl_F_from_R.cc b/src/real/conv/cl_F_from_R.cc index 5bdeb57..54f16a2 100644 --- a/src/real/conv/cl_F_from_R.cc +++ b/src/real/conv/cl_F_from_R.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. @@ -13,6 +13,8 @@ #if 0 +namespace cln { + const cl_F cl_float (const cl_R& x, const cl_F& y) { if (rationalp(x)) { @@ -24,11 +26,15 @@ const cl_F cl_float (const cl_R& x, const cl_F& y) } } +} // namespace cln + #else // less type dispatch overhead #include "cl_F.h" #include "cl_LF.h" +namespace cln { + const cl_F cl_float (const cl_R& x, const cl_F& y) { floattypecase(y @@ -39,4 +45,6 @@ const cl_F cl_float (const cl_R& x, const cl_F& y) ); } +} // namespace cln + #endif diff --git a/src/real/conv/cl_F_from_R_def.cc b/src/real/conv/cl_F_from_R_def.cc index eeb0f49..3c8e852 100644 --- a/src/real/conv/cl_F_from_R_def.cc +++ b/src/real/conv/cl_F_from_R_def.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" +namespace cln { + MAYBE_INLINE const cl_F cl_float (const cl_R& x) { @@ -22,3 +24,5 @@ const cl_F cl_float (const cl_R& x) return x; } } + +} // namespace cln diff --git a/src/real/conv/cl_F_from_R_f.cc b/src/real/conv/cl_F_from_R_f.cc index c7d9d68..a88e05e 100644 --- a/src/real/conv/cl_F_from_R_f.cc +++ b/src/real/conv/cl_F_from_R_f.cc @@ -4,16 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_float.h" +#include "cln/float.h" #include "cl_F.h" -const cl_F cl_float (const cl_R& x, cl_float_format_t f) +namespace cln { + +const cl_F cl_float (const cl_R& x, float_format_t f) { floatformatcase((uintL)f , return cl_R_to_SF(x); @@ -22,3 +24,5 @@ const cl_F cl_float (const cl_R& x, cl_float_format_t f) , return cl_R_to_LF(x,len); ); } + +} // namespace cln diff --git a/src/real/conv/cl_R_to_DF.cc b/src/real/conv/cl_R_to_DF.cc index b645154..d6bf57b 100644 --- a/src/real/conv/cl_R_to_DF.cc +++ b/src/real/conv/cl_R_to_DF.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. @@ -15,6 +15,8 @@ #if 0 +namespace cln { + const cl_DF cl_R_to_DF (const cl_R& x) { if (rationalp(x)) { @@ -26,11 +28,15 @@ const cl_DF cl_R_to_DF (const cl_R& x) } } +} // namespace cln + #else // fully inlined, faster #include "cl_RA.h" #include "cl_I.h" +namespace cln { + const cl_DF cl_R_to_DF (const cl_R& x) { realcase6(x @@ -43,4 +49,6 @@ const cl_DF cl_R_to_DF (const cl_R& x) ); } +} // namespace cln + #endif diff --git a/src/real/conv/cl_R_to_FF.cc b/src/real/conv/cl_R_to_FF.cc index 5da5479..71531f9 100644 --- a/src/real/conv/cl_R_to_FF.cc +++ b/src/real/conv/cl_R_to_FF.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. @@ -15,6 +15,8 @@ #if 0 +namespace cln { + const cl_FF cl_R_to_FF (const cl_R& x) { if (rationalp(x)) { @@ -26,11 +28,15 @@ const cl_FF cl_R_to_FF (const cl_R& x) } } +} // namespace cln + #else // fully inlined, faster #include "cl_RA.h" #include "cl_I.h" +namespace cln { + const cl_FF cl_R_to_FF (const cl_R& x) { realcase6(x @@ -43,4 +49,6 @@ const cl_FF cl_R_to_FF (const cl_R& x) ); } +} // namespace cln + #endif diff --git a/src/real/conv/cl_R_to_LF.cc b/src/real/conv/cl_R_to_LF.cc index 4c84ce3..a4c59c1 100644 --- a/src/real/conv/cl_R_to_LF.cc +++ b/src/real/conv/cl_R_to_LF.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. @@ -15,6 +15,8 @@ #if 0 +namespace cln { + const cl_LF cl_R_to_LF (const cl_R& x, uintC len) { if (rationalp(x)) { @@ -26,11 +28,15 @@ const cl_LF cl_R_to_LF (const cl_R& x, uintC len) } } +} // namespace cln + #else // fully inlined, faster #include "cl_RA.h" #include "cl_I.h" +namespace cln { + const cl_LF cl_R_to_LF (const cl_R& x, uintC len) { realcase6(x @@ -43,4 +49,6 @@ const cl_LF cl_R_to_LF (const cl_R& x, uintC len) ); } +} // namespace cln + #endif diff --git a/src/real/conv/cl_R_to_SF.cc b/src/real/conv/cl_R_to_SF.cc index 5354534..b951ee5 100644 --- a/src/real/conv/cl_R_to_SF.cc +++ b/src/real/conv/cl_R_to_SF.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. @@ -15,6 +15,8 @@ #if 0 +namespace cln { + const cl_SF cl_R_to_SF (const cl_R& x) { if (rationalp(x)) { @@ -26,11 +28,15 @@ const cl_SF cl_R_to_SF (const cl_R& x) } } +} // namespace cln + #else // fully inlined, faster #include "cl_RA.h" #include "cl_I.h" +namespace cln { + const cl_SF cl_R_to_SF (const cl_R& x) { realcase6(x @@ -43,4 +49,6 @@ const cl_SF cl_R_to_SF (const cl_R& x) ); } +} // namespace cln + #endif diff --git a/src/real/conv/cl_R_to_double.cc b/src/real/conv/cl_R_to_double.cc index af22927..85e0e00 100644 --- a/src/real/conv/cl_R_to_double.cc +++ b/src/real/conv/cl_R_to_double.cc @@ -4,49 +4,57 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" #include "cl_F.h" -#include "cl_integer.h" -#include "cl_rational.h" -#include "cl_float.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/rational.h" +#include "cln/float.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #if 0 -double cl_double_approx (const cl_R& x) +namespace cln { + +double double_approx (const cl_R& x) { if (rationalp(x)) { DeclareType(cl_RA,x); - return cl_double_approx(x); + return double_approx(x); } else { DeclareType(cl_F,x); - return cl_double_approx(x); + return double_approx(x); } } +} // namespace cln + #else // fully inlined, faster #include "cl_RA.h" #include "cl_I.h" -double cl_double_approx (const cl_R& x) +namespace cln { + +double double_approx (const cl_R& x) { realcase6(x - , return cl_double_approx(x); - , return cl_double_approx(x); - , return cl_double_approx(x); - , return cl_double_approx(x); - , return cl_double_approx(x); - , return cl_double_approx(x); + , return double_approx(x); + , return double_approx(x); + , return double_approx(x); + , return double_approx(x); + , return double_approx(x); + , return double_approx(x); ); } +} // namespace cln + #endif diff --git a/src/real/conv/cl_R_to_float.cc b/src/real/conv/cl_R_to_float.cc index 8f8498e..f5b852f 100644 --- a/src/real/conv/cl_R_to_float.cc +++ b/src/real/conv/cl_R_to_float.cc @@ -4,49 +4,57 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" #include "cl_F.h" -#include "cl_integer.h" -#include "cl_rational.h" -#include "cl_float.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/rational.h" +#include "cln/float.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #if 0 -float cl_float_approx (const cl_R& x) +namespace cln { + +float float_approx (const cl_R& x) { if (rationalp(x)) { DeclareType(cl_RA,x); - return cl_float_approx(x); + return float_approx(x); } else { DeclareType(cl_F,x); - return cl_float_approx(x); + return float_approx(x); } } +} // namespace cln + #else // fully inlined, faster #include "cl_RA.h" #include "cl_I.h" -float cl_float_approx (const cl_R& x) +namespace cln { + +float float_approx (const cl_R& x) { realcase6(x - , return cl_float_approx(x); - , return cl_float_approx(x); - , return cl_float_approx(x); - , return cl_float_approx(x); - , return cl_float_approx(x); - , return cl_float_approx(x); + , return float_approx(x); + , return float_approx(x); + , return float_approx(x); + , return float_approx(x); + , return float_approx(x); + , return float_approx(x); ); } +} // namespace cln + #endif diff --git a/src/real/division/cl_R_ceil1.cc b/src/real/division/cl_R_ceil1.cc index 26fc0b3..697ad94 100644 --- a/src/real/division/cl_R_ceil1.cc +++ b/src/real/division/cl_R_ceil1.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" + +namespace cln { const cl_I ceiling1 (const cl_R& x) GEN_R_OP1_2(x, ceiling1, return) + +} // namespace cln diff --git a/src/real/division/cl_R_ceil12.cc b/src/real/division/cl_R_ceil12.cc index 48ffdfb..dfc443d 100644 --- a/src/real/division/cl_R_ceil12.cc +++ b/src/real/division/cl_R_ceil12.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" +#include "cln/rational.h" + +namespace cln { const cl_I ceiling1 (const cl_R& x, const cl_R& y) { @@ -25,3 +27,5 @@ const cl_I ceiling1 (const cl_R& x, const cl_R& y) } return ceiling1(x/y); } + +} // namespace cln diff --git a/src/real/division/cl_R_ceil2.cc b/src/real/division/cl_R_ceil2.cc index 667c181..6ff7546 100644 --- a/src/real/division/cl_R_ceil2.cc +++ b/src/real/division/cl_R_ceil2.cc @@ -4,15 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" #include "cl_R_div_t.h" +namespace cln { + const cl_R_div_t ceiling2 (const cl_R& x) GEN_R_OP1_2(x, ceiling2, return) + +} // namespace cln diff --git a/src/real/division/cl_R_ceil22.cc b/src/real/division/cl_R_ceil22.cc index e62b195..c5214b9 100644 --- a/src/real/division/cl_R_ceil22.cc +++ b/src/real/division/cl_R_ceil22.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" +#include "cln/rational.h" #include "cl_R_div_t.h" +namespace cln { + const cl_R_div_t ceiling2 (const cl_R& x, const cl_R& y) { // Methode: @@ -29,3 +31,5 @@ const cl_R_div_t ceiling2 (const cl_R& x, const cl_R& y) var cl_R& r = q_r.remainder; return cl_R_div_t(q,y*r); } + +} // namespace cln diff --git a/src/real/division/cl_R_div_t.h b/src/real/division/cl_R_div_t.h index b31125e..33db2d7 100644 --- a/src/real/division/cl_R_div_t.h +++ b/src/real/division/cl_R_div_t.h @@ -3,9 +3,11 @@ #ifndef _CL_R_DIV_T_H #define _CL_R_DIV_T_H -#include "cl_real.h" +#include "cln/real.h" #include "cl_RA.h" -#include "cl_float.h" +#include "cln/float.h" + +namespace cln { inline cl_R_div_t::cl_R_div_t (const cl_I_div_t& result) : quotient(result.quotient), remainder(result.remainder) {} @@ -19,4 +21,6 @@ inline cl_R_div_t::cl_R_div_t (const cl_F_div_t& result) inline cl_R_fdiv_t::cl_R_fdiv_t (const cl_F_fdiv_t& result) : quotient(result.quotient), remainder(result.remainder) {} +} // namespace cln + #endif /* _CL_R_DIV_T_H */ diff --git a/src/real/division/cl_R_fceil1.cc b/src/real/division/cl_R_fceil1.cc index f4fa263..bb765e1 100644 --- a/src/real/division/cl_R_fceil1.cc +++ b/src/real/division/cl_R_fceil1.cc @@ -4,18 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" #include "cl_RA.h" -#include "cl_integer.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" + +namespace cln { const cl_F fceiling (const cl_R& x) { @@ -30,3 +32,5 @@ const cl_F fceiling (const cl_R& x) , return fceiling(x); ); } + +} // namespace cln diff --git a/src/real/division/cl_R_fceil12.cc b/src/real/division/cl_R_fceil12.cc index 43beb64..5eede45 100644 --- a/src/real/division/cl_R_fceil12.cc +++ b/src/real/division/cl_R_fceil12.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" +namespace cln { + const cl_F fceiling (const cl_R& x, const cl_R& y) { // Methode: @@ -25,3 +27,5 @@ const cl_F fceiling (const cl_R& x, const cl_R& y) } return fceiling(x/y); } + +} // namespace cln diff --git a/src/real/division/cl_R_fceil2.cc b/src/real/division/cl_R_fceil2.cc index 9ec4a68..4ce2158 100644 --- a/src/real/division/cl_R_fceil2.cc +++ b/src/real/division/cl_R_fceil2.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. @@ -14,10 +14,12 @@ #if 0 // 2 type dispatches -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" #include "cl_R_div_t.h" +namespace cln { + const cl_R_fdiv_t fceiling2 (const cl_R& x) { if (rationalp(x)) { @@ -32,16 +34,20 @@ const cl_R_fdiv_t fceiling2 (const cl_R& x) } } +} // namespace cln + #else // 1 type dispatch #include "cl_RA.h" -#include "cl_integer.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + const cl_R_fdiv_t fceiling2 (const cl_R& x) { realcase6(x @@ -59,4 +65,6 @@ const cl_R_fdiv_t fceiling2 (const cl_R& x) ); } +} // namespace cln + #endif diff --git a/src/real/division/cl_R_fceil22.cc b/src/real/division/cl_R_fceil22.cc index 0e9f53d..b9781f3 100644 --- a/src/real/division/cl_R_fceil22.cc +++ b/src/real/division/cl_R_fceil22.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_R.h" #include "cl_R_div_t.h" +namespace cln { + const cl_R_fdiv_t fceiling2 (const cl_R& x, const cl_R& y) { // Methode: @@ -32,3 +34,5 @@ const cl_R_fdiv_t fceiling2 (const cl_R& x, const cl_R& y) var cl_R& r = q_r.remainder; return cl_R_fdiv_t(q,y*r); } + +} // namespace cln diff --git a/src/real/division/cl_R_ffloor1.cc b/src/real/division/cl_R_ffloor1.cc index fec326b..a2811d1 100644 --- a/src/real/division/cl_R_ffloor1.cc +++ b/src/real/division/cl_R_ffloor1.cc @@ -4,18 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" #include "cl_RA.h" -#include "cl_integer.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" + +namespace cln { const cl_F ffloor (const cl_R& x) { @@ -30,3 +32,5 @@ const cl_F ffloor (const cl_R& x) , return ffloor(x); ); } + +} // namespace cln diff --git a/src/real/division/cl_R_ffloor12.cc b/src/real/division/cl_R_ffloor12.cc index 83ede63..a86a6e9 100644 --- a/src/real/division/cl_R_ffloor12.cc +++ b/src/real/division/cl_R_ffloor12.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" +namespace cln { + const cl_F ffloor (const cl_R& x, const cl_R& y) { // Methode: @@ -25,3 +27,5 @@ const cl_F ffloor (const cl_R& x, const cl_R& y) } return ffloor(x/y); } + +} // namespace cln diff --git a/src/real/division/cl_R_ffloor2.cc b/src/real/division/cl_R_ffloor2.cc index 0a735a4..d6b4a83 100644 --- a/src/real/division/cl_R_ffloor2.cc +++ b/src/real/division/cl_R_ffloor2.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. @@ -14,10 +14,12 @@ #if 0 // 2 type dispatches -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" #include "cl_R_div_t.h" +namespace cln { + const cl_R_fdiv_t ffloor2 (const cl_R& x) { if (rationalp(x)) { @@ -32,16 +34,20 @@ const cl_R_fdiv_t ffloor2 (const cl_R& x) } } +} // namespace cln + #else // 1 type dispatch #include "cl_RA.h" -#include "cl_integer.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + const cl_R_fdiv_t ffloor2 (const cl_R& x) { realcase6(x @@ -59,4 +65,6 @@ const cl_R_fdiv_t ffloor2 (const cl_R& x) ); } +} // namespace cln + #endif diff --git a/src/real/division/cl_R_ffloor22.cc b/src/real/division/cl_R_ffloor22.cc index e2f85ac..9590ada 100644 --- a/src/real/division/cl_R_ffloor22.cc +++ b/src/real/division/cl_R_ffloor22.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_R.h" #include "cl_R_div_t.h" +namespace cln { + const cl_R_fdiv_t ffloor2 (const cl_R& x, const cl_R& y) { // Methode: @@ -32,3 +34,5 @@ const cl_R_fdiv_t ffloor2 (const cl_R& x, const cl_R& y) var cl_R& r = q_r.remainder; return cl_R_fdiv_t(q,y*r); } + +} // namespace cln diff --git a/src/real/division/cl_R_floor1.cc b/src/real/division/cl_R_floor1.cc index 14a70f2..9e90f53 100644 --- a/src/real/division/cl_R_floor1.cc +++ b/src/real/division/cl_R_floor1.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" + +namespace cln { const cl_I floor1 (const cl_R& x) GEN_R_OP1_2(x, floor1, return) + +} // namespace cln diff --git a/src/real/division/cl_R_floor12.cc b/src/real/division/cl_R_floor12.cc index 1441e9b..6f16994 100644 --- a/src/real/division/cl_R_floor12.cc +++ b/src/real/division/cl_R_floor12.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" +#include "cln/rational.h" + +namespace cln { const cl_I floor1 (const cl_R& x, const cl_R& y) { @@ -25,3 +27,5 @@ const cl_I floor1 (const cl_R& x, const cl_R& y) } return floor1(x/y); } + +} // namespace cln diff --git a/src/real/division/cl_R_floor2.cc b/src/real/division/cl_R_floor2.cc index 900b889..4756c58 100644 --- a/src/real/division/cl_R_floor2.cc +++ b/src/real/division/cl_R_floor2.cc @@ -4,15 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" #include "cl_R_div_t.h" +namespace cln { + const cl_R_div_t floor2 (const cl_R& x) GEN_R_OP1_2(x, floor2, return) + +} // namespace cln diff --git a/src/real/division/cl_R_floor22.cc b/src/real/division/cl_R_floor22.cc index 1cbb9ca..d1ea8a5 100644 --- a/src/real/division/cl_R_floor22.cc +++ b/src/real/division/cl_R_floor22.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" +#include "cln/rational.h" #include "cl_R_div_t.h" +namespace cln { + const cl_R_div_t floor2 (const cl_R& x, const cl_R& y) { // Methode: @@ -29,3 +31,5 @@ const cl_R_div_t floor2 (const cl_R& x, const cl_R& y) var cl_R& r = q_r.remainder; return cl_R_div_t(q,y*r); } + +} // namespace cln diff --git a/src/real/division/cl_R_fround1.cc b/src/real/division/cl_R_fround1.cc index efc4274..7b5ff8d 100644 --- a/src/real/division/cl_R_fround1.cc +++ b/src/real/division/cl_R_fround1.cc @@ -4,18 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" #include "cl_RA.h" -#include "cl_integer.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" + +namespace cln { const cl_F fround (const cl_R& x) { @@ -30,3 +32,5 @@ const cl_F fround (const cl_R& x) , return fround(x); ); } + +} // namespace cln diff --git a/src/real/division/cl_R_fround12.cc b/src/real/division/cl_R_fround12.cc index 6562bad..f3804dc 100644 --- a/src/real/division/cl_R_fround12.cc +++ b/src/real/division/cl_R_fround12.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" +namespace cln { + const cl_F fround (const cl_R& x, const cl_R& y) { // Methode: @@ -25,3 +27,5 @@ const cl_F fround (const cl_R& x, const cl_R& y) } return fround(x/y); } + +} // namespace cln diff --git a/src/real/division/cl_R_fround2.cc b/src/real/division/cl_R_fround2.cc index a256f77..641e044 100644 --- a/src/real/division/cl_R_fround2.cc +++ b/src/real/division/cl_R_fround2.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. @@ -14,10 +14,12 @@ #if 0 // 2 type dispatches -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" #include "cl_R_div_t.h" +namespace cln { + const cl_R_fdiv_t fround2 (const cl_R& x) { if (rationalp(x)) { @@ -32,16 +34,20 @@ const cl_R_fdiv_t fround2 (const cl_R& x) } } +} // namespace cln + #else // 1 type dispatch #include "cl_RA.h" -#include "cl_integer.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + const cl_R_fdiv_t fround2 (const cl_R& x) { realcase6(x @@ -59,4 +65,6 @@ const cl_R_fdiv_t fround2 (const cl_R& x) ); } +} // namespace cln + #endif diff --git a/src/real/division/cl_R_fround22.cc b/src/real/division/cl_R_fround22.cc index 2da3fa4..255324d 100644 --- a/src/real/division/cl_R_fround22.cc +++ b/src/real/division/cl_R_fround22.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_R.h" #include "cl_R_div_t.h" +namespace cln { + const cl_R_fdiv_t fround2 (const cl_R& x, const cl_R& y) { // Methode: @@ -32,3 +34,5 @@ const cl_R_fdiv_t fround2 (const cl_R& x, const cl_R& y) var cl_R& r = q_r.remainder; return cl_R_fdiv_t(q,y*r); } + +} // namespace cln diff --git a/src/real/division/cl_R_ftrunc1.cc b/src/real/division/cl_R_ftrunc1.cc index 62550bd..d3ffc55 100644 --- a/src/real/division/cl_R_ftrunc1.cc +++ b/src/real/division/cl_R_ftrunc1.cc @@ -4,18 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" #include "cl_RA.h" -#include "cl_integer.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" + +namespace cln { const cl_F ftruncate (const cl_R& x) { @@ -30,3 +32,5 @@ const cl_F ftruncate (const cl_R& x) , return ftruncate(x); ); } + +} // namespace cln diff --git a/src/real/division/cl_R_ftrunc12.cc b/src/real/division/cl_R_ftrunc12.cc index cb80654..2aa9c66 100644 --- a/src/real/division/cl_R_ftrunc12.cc +++ b/src/real/division/cl_R_ftrunc12.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" +namespace cln { + const cl_F ftruncate (const cl_R& x, const cl_R& y) { // Methode: @@ -25,3 +27,5 @@ const cl_F ftruncate (const cl_R& x, const cl_R& y) } return ftruncate(x/y); } + +} // namespace cln diff --git a/src/real/division/cl_R_ftrunc2.cc b/src/real/division/cl_R_ftrunc2.cc index 0101ba2..32fdc4b 100644 --- a/src/real/division/cl_R_ftrunc2.cc +++ b/src/real/division/cl_R_ftrunc2.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. @@ -14,10 +14,12 @@ #if 0 // 2 type dispatches -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" #include "cl_R_div_t.h" +namespace cln { + const cl_R_fdiv_t ftruncate2 (const cl_R& x) { if (rationalp(x)) { @@ -32,16 +34,20 @@ const cl_R_fdiv_t ftruncate2 (const cl_R& x) } } +} // namespace cln + #else // 1 type dispatch #include "cl_RA.h" -#include "cl_integer.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" +namespace cln { + const cl_R_fdiv_t ftruncate2 (const cl_R& x) { realcase6(x @@ -59,4 +65,6 @@ const cl_R_fdiv_t ftruncate2 (const cl_R& x) ); } +} // namespace cln + #endif diff --git a/src/real/division/cl_R_ftrunc22.cc b/src/real/division/cl_R_ftrunc22.cc index 8a6def8..0213a0a 100644 --- a/src/real/division/cl_R_ftrunc22.cc +++ b/src/real/division/cl_R_ftrunc22.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. @@ -12,6 +12,8 @@ #include "cl_R.h" #include "cl_R_div_t.h" +namespace cln { + const cl_R_fdiv_t ftruncate2 (const cl_R& x, const cl_R& y) { // Methode: @@ -32,3 +34,5 @@ const cl_R_fdiv_t ftruncate2 (const cl_R& x, const cl_R& y) var cl_R& r = q_r.remainder; return cl_R_fdiv_t(q,y*r); } + +} // namespace cln diff --git a/src/real/division/cl_R_mod.cc b/src/real/division/cl_R_mod.cc index 0ac034b..14b4b6e 100644 --- a/src/real/division/cl_R_mod.cc +++ b/src/real/division/cl_R_mod.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_R mod (const cl_R& x, const cl_R& y) { @@ -25,3 +27,5 @@ const cl_R mod (const cl_R& x, const cl_R& y) } return y * floor2(x/y).remainder; } + +} // namespace cln diff --git a/src/real/division/cl_R_rem.cc b/src/real/division/cl_R_rem.cc index c52031d..3a4ecce 100644 --- a/src/real/division/cl_R_rem.cc +++ b/src/real/division/cl_R_rem.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { const cl_R rem (const cl_R& x, const cl_R& y) { @@ -25,3 +27,5 @@ const cl_R rem (const cl_R& x, const cl_R& y) } return y * truncate2(x/y).remainder; } + +} // namespace cln diff --git a/src/real/division/cl_R_round1.cc b/src/real/division/cl_R_round1.cc index ee0fcc6..8f0d992 100644 --- a/src/real/division/cl_R_round1.cc +++ b/src/real/division/cl_R_round1.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" + +namespace cln { const cl_I round1 (const cl_R& x) GEN_R_OP1_2(x, round1, return) + +} // namespace cln diff --git a/src/real/division/cl_R_round12.cc b/src/real/division/cl_R_round12.cc index 71652e3..34ec994 100644 --- a/src/real/division/cl_R_round12.cc +++ b/src/real/division/cl_R_round12.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" +#include "cln/rational.h" + +namespace cln { const cl_I round1 (const cl_R& x, const cl_R& y) { @@ -25,3 +27,5 @@ const cl_I round1 (const cl_R& x, const cl_R& y) } return round1(x/y); } + +} // namespace cln diff --git a/src/real/division/cl_R_round2.cc b/src/real/division/cl_R_round2.cc index 21d9430..c88355e 100644 --- a/src/real/division/cl_R_round2.cc +++ b/src/real/division/cl_R_round2.cc @@ -4,15 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" #include "cl_R_div_t.h" +namespace cln { + const cl_R_div_t round2 (const cl_R& x) GEN_R_OP1_2(x, round2, return) + +} // namespace cln diff --git a/src/real/division/cl_R_round22.cc b/src/real/division/cl_R_round22.cc index 189ab0e..ef3b544 100644 --- a/src/real/division/cl_R_round22.cc +++ b/src/real/division/cl_R_round22.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" +#include "cln/rational.h" #include "cl_R_div_t.h" +namespace cln { + const cl_R_div_t round2 (const cl_R& x, const cl_R& y) { // Methode: @@ -29,3 +31,5 @@ const cl_R_div_t round2 (const cl_R& x, const cl_R& y) var cl_R& r = q_r.remainder; return cl_R_div_t(q,y*r); } + +} // namespace cln diff --git a/src/real/division/cl_R_trunc1.cc b/src/real/division/cl_R_trunc1.cc index a3177f0..31ceefa 100644 --- a/src/real/division/cl_R_trunc1.cc +++ b/src/real/division/cl_R_trunc1.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" + +namespace cln { const cl_I truncate1 (const cl_R& x) GEN_R_OP1_2(x, truncate1, return) + +} // namespace cln diff --git a/src/real/division/cl_R_trunc12.cc b/src/real/division/cl_R_trunc12.cc index a8d23e6..8180a00 100644 --- a/src/real/division/cl_R_trunc12.cc +++ b/src/real/division/cl_R_trunc12.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" +#include "cln/rational.h" + +namespace cln { const cl_I truncate1 (const cl_R& x, const cl_R& y) { @@ -25,3 +27,5 @@ const cl_I truncate1 (const cl_R& x, const cl_R& y) } return truncate1(x/y); } + +} // namespace cln diff --git a/src/real/division/cl_R_trunc2.cc b/src/real/division/cl_R_trunc2.cc index f18999a..ba0f6e5 100644 --- a/src/real/division/cl_R_trunc2.cc +++ b/src/real/division/cl_R_trunc2.cc @@ -4,15 +4,19 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" #include "cl_R_div_t.h" +namespace cln { + const cl_R_div_t truncate2 (const cl_R& x) GEN_R_OP1_2(x, truncate2, return) + +} // namespace cln diff --git a/src/real/division/cl_R_trunc22.cc b/src/real/division/cl_R_trunc22.cc index 1b7bdf7..304876e 100644 --- a/src/real/division/cl_R_trunc22.cc +++ b/src/real/division/cl_R_trunc22.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" +#include "cln/rational.h" #include "cl_R_div_t.h" +namespace cln { + const cl_R_div_t truncate2 (const cl_R& x, const cl_R& y) { // Methode: @@ -29,3 +31,5 @@ const cl_R_div_t truncate2 (const cl_R& x, const cl_R& y) var cl_R& r = q_r.remainder; return cl_R_div_t(q,y*r); } + +} // namespace cln diff --git a/src/real/elem/cl_R_compare.cc b/src/real/elem/cl_R_compare.cc index 771f144..b881c1d 100644 --- a/src/real/elem/cl_R_compare.cc +++ b/src/real/elem/cl_R_compare.cc @@ -1,19 +1,21 @@ -// cl_compare(). +// compare(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" -cl_signean cl_compare (const cl_R& x, const cl_R& y) +namespace cln { + +cl_signean compare (const cl_R& x, const cl_R& y) { // Methode: // Beide rational oder beide Floats -> klar. @@ -24,21 +26,23 @@ cl_signean cl_compare (const cl_R& x, const cl_R& y) realcase2(x , realcase2(y , // beides rationale Zahlen - return cl_compare(x,y); + return compare(x,y); , // x rational, y Float -> x in Float umwandeln - var cl_signean result = cl_compare(cl_float(x,y),y); + var cl_signean result = compare(cl_float(x,y),y); if (result != signean_null) return result; - return cl_compare(x,rational(y)); + return compare(x,rational(y)); ); , realcase2(y , // x Float, y rational -> y in Float umwandeln - var cl_signean result = cl_compare(x,cl_float(y,x)); + var cl_signean result = compare(x,cl_float(y,x)); if (result != signean_null) return result; - return cl_compare(rational(x),y); + return compare(rational(x),y); , // beides Floats - return cl_compare(x,y); + return compare(x,y); ); ); } + +} // namespace cln diff --git a/src/real/elem/cl_R_div.cc b/src/real/elem/cl_R_div.cc index df389e0..ba65336 100644 --- a/src/real/elem/cl_R_div.cc +++ b/src/real/elem/cl_R_div.cc @@ -4,27 +4,29 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" +#include "cln/rational.h" #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_F.h" -#include "cl_sfloat.h" +#include "cln/sfloat.h" #include "cl_SF.h" -#include "cl_ffloat.h" +#include "cln/ffloat.h" #include "cl_FF.h" -#include "cl_dfloat.h" +#include "cln/dfloat.h" #include "cl_DF.h" -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" #include "cl_N.h" +namespace cln { + ALL_cl_LF_OPERATIONS_SAME_PRECISION() const cl_R operator/ (const cl_R& x, const cl_R& y) @@ -95,3 +97,5 @@ const cl_R operator/ (const cl_R& x, const cl_R& y) ); ); } + +} // namespace cln diff --git a/src/real/elem/cl_R_equal.cc b/src/real/elem/cl_R_equal.cc index 6d6f17e..032ba3f 100644 --- a/src/real/elem/cl_R_equal.cc +++ b/src/real/elem/cl_R_equal.cc @@ -1,24 +1,26 @@ -// cl_equal(). +// equal(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" -inline cl_boolean cl_equal (const cl_F& x, const cl_F& y) +namespace cln { + +inline cl_boolean equal (const cl_F& x, const cl_F& y) { - return (cl_boolean) (cl_compare(x,y) == 0); + return (cl_boolean) (compare(x,y) == 0); } -cl_boolean cl_equal (const cl_R& x, const cl_R& y) +cl_boolean equal (const cl_R& x, const cl_R& y) { // Methode: // Beide rational oder beide Floats -> klar. @@ -30,23 +32,25 @@ cl_boolean cl_equal (const cl_R& x, const cl_R& y) realcase2(x , realcase2(y , // beides rationale Zahlen - return cl_equal(x,y); + return equal(x,y); , // x rational, y Float -> x in Float umwandeln if (!power2p(denominator(x))) return cl_false; - if (!cl_equal(cl_float(x,y),y)) + if (!equal(cl_float(x,y),y)) return cl_false; - return cl_equal(x,rational(y)); + return equal(x,rational(y)); ); , realcase2(y , // x Float, y rational -> y in Float umwandeln if (!power2p(denominator(y))) return cl_false; - if (!cl_equal(x,cl_float(y,x))) + if (!equal(x,cl_float(y,x))) return cl_false; - return cl_equal(rational(x),y); + return equal(rational(x),y); , // beides Floats - return cl_equal(x,y); + return equal(x,y); ); ); } + +} // namespace cln diff --git a/src/real/elem/cl_R_minus.cc b/src/real/elem/cl_R_minus.cc index ee2b105..3e89c6f 100644 --- a/src/real/elem/cl_R_minus.cc +++ b/src/real/elem/cl_R_minus.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" + +namespace cln { const cl_R operator- (const cl_R& x, const cl_R& y) { @@ -21,3 +23,5 @@ const cl_R operator- (const cl_R& x, const cl_R& y) #define minus(a,b) a-b GEN_R_OP2_2(x,y, minus, return) } + +} // namespace cln diff --git a/src/real/elem/cl_R_minus1.cc b/src/real/elem/cl_R_minus1.cc index 5344097..0b796b5 100644 --- a/src/real/elem/cl_R_minus1.cc +++ b/src/real/elem/cl_R_minus1.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" + +namespace cln { const cl_R minus1 (const cl_R& x) GEN_R_OP1_2(x, minus1, return) + +} // namespace cln diff --git a/src/real/elem/cl_R_minusp.cc b/src/real/elem/cl_R_minusp.cc index 497f89d..58e07c0 100644 --- a/src/real/elem/cl_R_minusp.cc +++ b/src/real/elem/cl_R_minusp.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. @@ -21,9 +21,13 @@ #include "cl_DF_minusp.cc" #include "cl_LF_minusp.cc" +namespace cln { + cl_boolean minusp (const cl_R& x) #if 0 GEN_R_OP1_2(x, minusp, return) #else // fully inlined, faster GEN_R_OP1_7(x, minusp, return) #endif + +} // namespace cln diff --git a/src/real/elem/cl_R_mul.cc b/src/real/elem/cl_R_mul.cc index ed23502..3c1ac8e 100644 --- a/src/real/elem/cl_R_mul.cc +++ b/src/real/elem/cl_R_mul.cc @@ -4,27 +4,29 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" +#include "cln/rational.h" #include "cl_RA.h" -#include "cl_integer.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_F.h" -#include "cl_sfloat.h" +#include "cln/sfloat.h" #include "cl_SF.h" -#include "cl_ffloat.h" +#include "cln/ffloat.h" #include "cl_FF.h" -#include "cl_dfloat.h" +#include "cln/dfloat.h" #include "cl_DF.h" -#include "cl_lfloat.h" +#include "cln/lfloat.h" #include "cl_LF.h" #include "cl_N.h" +namespace cln { + ALL_cl_LF_OPERATIONS_SAME_PRECISION() const cl_R operator* (const cl_R& x, const cl_R& y) @@ -90,3 +92,5 @@ const cl_R operator* (const cl_R& x, const cl_R& y) ); ); } + +} // namespace cln diff --git a/src/real/elem/cl_R_plus.cc b/src/real/elem/cl_R_plus.cc index 02d6692..021b792 100644 --- a/src/real/elem/cl_R_plus.cc +++ b/src/real/elem/cl_R_plus.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" + +namespace cln { const cl_R operator+ (const cl_R& x, const cl_R& y) { @@ -21,3 +23,5 @@ const cl_R operator+ (const cl_R& x, const cl_R& y) #define plus(a,b) a+b GEN_R_OP2_2(x,y, plus, return) } + +} // namespace cln diff --git a/src/real/elem/cl_R_plus1.cc b/src/real/elem/cl_R_plus1.cc index 208b88a..86ed49f 100644 --- a/src/real/elem/cl_R_plus1.cc +++ b/src/real/elem/cl_R_plus1.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" + +namespace cln { const cl_R plus1 (const cl_R& x) GEN_R_OP1_2(x, plus1, return) + +} // namespace cln diff --git a/src/real/elem/cl_R_plusp.cc b/src/real/elem/cl_R_plusp.cc index 7067f64..3726392 100644 --- a/src/real/elem/cl_R_plusp.cc +++ b/src/real/elem/cl_R_plusp.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. +namespace cln { + cl_boolean plusp (const cl_R& x) { if (minusp(x)) @@ -18,3 +20,5 @@ cl_boolean plusp (const cl_R& x) else return cl_true; // sonst ist x>0. } + +} // namespace cln diff --git a/src/real/elem/cl_R_recip.cc b/src/real/elem/cl_R_recip.cc index 7561ded..424c417 100644 --- a/src/real/elem/cl_R_recip.cc +++ b/src/real/elem/cl_R_recip.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" + +namespace cln { const cl_R recip (const cl_R& x) GEN_R_OP1_2(x, recip, return) + +} // namespace cln diff --git a/src/real/elem/cl_R_square.cc b/src/real/elem/cl_R_square.cc index 669770a..865b8f9 100644 --- a/src/real/elem/cl_R_square.cc +++ b/src/real/elem/cl_R_square.cc @@ -4,25 +4,29 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_integer.h" -#include "cl_float.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/rational.h" +#include "cln/integer.h" +#include "cln/float.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_RA.h" #include "cl_I.h" +namespace cln { + const cl_R square (const cl_R& x) #if 0 GEN_R_OP1_2(x, square, return) #else // fully inlined, faster GEN_R_OP1_7(x, square, return) #endif + +} // namespace cln diff --git a/src/real/elem/cl_R_uminus.cc b/src/real/elem/cl_R_uminus.cc index c8e5f06..c003ca9 100644 --- a/src/real/elem/cl_R_uminus.cc +++ b/src/real/elem/cl_R_uminus.cc @@ -4,22 +4,24 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_integer.h" -#include "cl_float.h" -#include "cl_sfloat.h" -#include "cl_ffloat.h" -#include "cl_dfloat.h" -#include "cl_lfloat.h" +#include "cln/rational.h" +#include "cln/integer.h" +#include "cln/float.h" +#include "cln/sfloat.h" +#include "cln/ffloat.h" +#include "cln/dfloat.h" +#include "cln/lfloat.h" #include "cl_RA.h" #include "cl_I.h" +namespace cln { + const cl_R operator- (const cl_R& x) #define minus(a) -a #if 0 @@ -27,3 +29,5 @@ GEN_R_OP1_2(x, minus, return) #else // fully inlined, faster GEN_R_OP1_7(x, minus, return) #endif + +} // namespace cln diff --git a/src/real/elem/cl_R_zerop.cc b/src/real/elem/cl_R_zerop.cc index 530d2e0..e4cba8c 100644 --- a/src/real/elem/cl_R_zerop.cc +++ b/src/real/elem/cl_R_zerop.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. @@ -21,9 +21,13 @@ #include "cl_DF_zerop.cc" #include "cl_LF_zerop.cc" +namespace cln { + cl_boolean zerop (const cl_R& x) #if 0 GEN_R_OP1_2(x, zerop, return) #else // fully inlined, faster GEN_R_OP1_7(x, zerop, return) #endif + +} // namespace cln diff --git a/src/real/format-output/cl_fmt_cardinal.cc b/src/real/format-output/cl_fmt_cardinal.cc index 2685f47..41be5ac 100644 --- a/src/real/format-output/cl_fmt_cardinal.cc +++ b/src/real/format-output/cl_fmt_cardinal.cc @@ -9,9 +9,11 @@ // Implementation. -#include "cl_integer.h" -#include "cl_integer_io.h" -#include "cl_abort.h" +#include "cln/integer.h" +#include "cln/integer_io.h" +#include "cln/abort.h" + +namespace cln { static const char * const cl_format_ones [20] = { NULL, @@ -105,9 +107,9 @@ void format_cardinal (cl_ostream stream, const cl_I& argument) var uintL * small_piece_ptr = &small_pieces[0]; do { if (*illion_ptr == NULL) { - fprint(cl_stderr, "format_cardinal: argument too large: "); - fprint(cl_stderr, argument); - fprint(cl_stderr, "\n"); + fprint(stderr, "format_cardinal: argument too large: "); + fprint(stderr, argument); + fprint(stderr, "\n"); cl_abort(); } var cl_I_div_t div = floor2(arg,1000); @@ -132,3 +134,5 @@ void format_cardinal (cl_ostream stream, const cl_I& argument) } until (illion_ptr == &illions[0]); } } + +} // namespace cln diff --git a/src/real/format-output/cl_fmt_floatstring.cc b/src/real/format-output/cl_fmt_floatstring.cc index dc20a6e..fc98ae8 100644 --- a/src/real/format-output/cl_fmt_floatstring.cc +++ b/src/real/format-output/cl_fmt_floatstring.cc @@ -14,13 +14,15 @@ CL_PROVIDE(cl_fmt_floatstring) // BUGS: // - This is slow. -#include "cl_output.h" -#include "cl_malloc.h" -#include "cl_float.h" -#include "cl_integer.h" +#include "cln/output.h" +#include "cln/malloc.h" +#include "cln/float.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_spushstring.h" +namespace cln { + // format_float_to_string(arg,width,d,k,dmin) // ergibt einen String zum Floating-point arg: // er hat den Wert von abs(arg)*expt(10,k), dabei mind. d Nachkommastellen @@ -39,7 +41,7 @@ const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width if (places >= width) places = width-1; // ein Punkt und places Nullen - var char* string = (char *) cl_malloc_hook(1+places+1); + var char* string = (char *) malloc_hook(1+places+1); string[0] = '.'; for (sintL i = 1; i <= places; i++) string[i] = '0'; string[1+places] = '\0'; @@ -251,4 +253,6 @@ const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width ); } +} // namespace cln + CL_PROVIDE_END(cl_fmt_floatstring) diff --git a/src/real/format-output/cl_fmt_integer.cc b/src/real/format-output/cl_fmt_integer.cc index 0a9393c..1645505 100644 --- a/src/real/format-output/cl_fmt_integer.cc +++ b/src/real/format-output/cl_fmt_integer.cc @@ -9,10 +9,12 @@ // Implementation. -#include "cl_integer_io.h" +#include "cln/integer_io.h" #include #include "cl_I.h" +namespace cln { + void format_integer (cl_ostream stream, const cl_I& arg, unsigned int base, sintL mincol, char padchar, char commachar, uintL commainterval, cl_boolean commaflag, @@ -24,12 +26,12 @@ void format_integer (cl_ostream stream, const cl_I& arg, return; } var char* oldstring = print_integer_to_string(base,arg); - var uintL oldstring_length = strlen(oldstring); + var uintL oldstring_length = ::strlen(oldstring); var uintL number_of_digits = (minusp(arg) ? oldstring_length-1 : oldstring_length); var uintL number_of_commas = (commaflag ? floor(number_of_digits-1,commainterval) : 0); var cl_boolean positive_sign = (cl_boolean) (positive_sign_flag && (arg > 0)); var uintL newstring_length = (positive_sign ? 1 : 0) + oldstring_length + number_of_commas; - var char* newstring = (char *) cl_malloc_hook(newstring_length+1); + var char* newstring = (char *) malloc_hook(newstring_length+1); newstring[newstring_length] = '\0'; // newstring termination // newstring füllen: { @@ -60,6 +62,8 @@ void format_integer (cl_ostream stream, const cl_I& arg, format_padding(stream,mincol-newstring_length,padchar); fprint(stream,newstring); #endif - cl_free_hook(newstring); - cl_free_hook(oldstring); + free_hook(newstring); + free_hook(oldstring); } + +} // namespace cln diff --git a/src/real/format-output/cl_fmt_newroman.cc b/src/real/format-output/cl_fmt_newroman.cc index 863a524..836f2c9 100644 --- a/src/real/format-output/cl_fmt_newroman.cc +++ b/src/real/format-output/cl_fmt_newroman.cc @@ -9,16 +9,18 @@ // Implementation. -#include "cl_integer.h" -#include "cl_integer_io.h" -#include "cl_abort.h" +#include "cln/integer.h" +#include "cln/integer_io.h" +#include "cln/abort.h" + +namespace cln { void format_new_roman (cl_ostream stream, const cl_I& arg) { if (!(0 < arg && arg < 4000)) { - fprint(cl_stderr, "format_new_roman: argument should be in the range 1 - 3999, not "); - fprint(cl_stderr, arg); - fprint(cl_stderr, ".\n"); + fprint(stderr, "format_new_roman: argument should be in the range 1 - 3999, not "); + fprint(stderr, arg); + fprint(stderr, ".\n"); cl_abort(); } var uintL value = cl_I_to_UL(arg); @@ -52,3 +54,5 @@ void format_new_roman (cl_ostream stream, const cl_I& arg) } } } + +} // namespace cln diff --git a/src/real/format-output/cl_fmt_oldroman.cc b/src/real/format-output/cl_fmt_oldroman.cc index 36e622e..df3343c 100644 --- a/src/real/format-output/cl_fmt_oldroman.cc +++ b/src/real/format-output/cl_fmt_oldroman.cc @@ -9,16 +9,18 @@ // Implementation. -#include "cl_integer.h" -#include "cl_integer_io.h" -#include "cl_abort.h" +#include "cln/integer.h" +#include "cln/integer_io.h" +#include "cln/abort.h" + +namespace cln { void format_old_roman (cl_ostream stream, const cl_I& arg) { if (!(0 < arg && arg < 5000)) { - fprint(cl_stderr, "format_old_roman: argument should be in the range 1 - 4999, not "); - fprint(cl_stderr, arg); - fprint(cl_stderr, ".\n"); + fprint(stderr, "format_old_roman: argument should be in the range 1 - 4999, not "); + fprint(stderr, arg); + fprint(stderr, ".\n"); cl_abort(); } var uintL value = cl_I_to_UL(arg); @@ -42,3 +44,5 @@ void format_old_roman (cl_ostream stream, const cl_I& arg) } } } + +} // namespace cln diff --git a/src/real/format-output/cl_fmt_ordinal.cc b/src/real/format-output/cl_fmt_ordinal.cc index 7bd3373..006cec2 100644 --- a/src/real/format-output/cl_fmt_ordinal.cc +++ b/src/real/format-output/cl_fmt_ordinal.cc @@ -9,7 +9,9 @@ // Implementation. -#include "cl_integer.h" +#include "cln/integer.h" + +namespace cln { static const char * const cl_format_ordinal_ones [20] = { NULL, @@ -81,3 +83,5 @@ void format_ordinal (cl_ostream stream, const cl_I& argument) } } } + +} // namespace cln diff --git a/src/real/format-output/cl_fmt_paddedstring.cc b/src/real/format-output/cl_fmt_paddedstring.cc index 4deefb0..b13b15d 100644 --- a/src/real/format-output/cl_fmt_paddedstring.cc +++ b/src/real/format-output/cl_fmt_paddedstring.cc @@ -11,9 +11,11 @@ #include +namespace cln { + void format_padded_string (cl_ostream stream, sintL mincol, sintL colinc, sintL minpad, char padchar, cl_boolean padleftflag, const char * str) { - var sintL need = strlen(str) + minpad; // so viele Zeichen mindestens + var sintL need = ::strlen(str) + minpad; // so viele Zeichen mindestens var uintL auxpad = (need < mincol ? ceiling((uintL)(mincol - need), colinc) * colinc : 0 @@ -24,3 +26,5 @@ void format_padded_string (cl_ostream stream, sintL mincol, sintL colinc, sintL if (padleftflag) fprint(stream,str); } + +} // namespace cln diff --git a/src/real/format-output/cl_fmt_scaleexp.cc b/src/real/format-output/cl_fmt_scaleexp.cc index 8d4af32..b24868b 100644 --- a/src/real/format-output/cl_fmt_scaleexp.cc +++ b/src/real/format-output/cl_fmt_scaleexp.cc @@ -11,15 +11,17 @@ CL_PROVIDE(cl_fmt_scaleexp) // Implementation. -#include "cl_real.h" -#include "cl_integer.h" -#include "cl_float.h" +#include "cln/real.h" +#include "cln/integer.h" +#include "cln/float.h" #include "cl_F.h" #include "cl_SF.h" #include "cl_FF.h" #include "cl_DF.h" #include "cl_LF.h" +namespace cln { + // NOTE: This may introduce roundoff-errors, through the use of *, /, expt. // But this doesn't matter since format_float_to_string() works with // exact integers, starting with integer_decode_float(). @@ -69,7 +71,7 @@ static const float_format_params get_float_params (const cl_F& arg) ); } -const cl_decoded_float format_scale_exponent (const cl_F& arg) +const decoded_float format_scale_exponent (const cl_F& arg) { // Get float format parameters. var const float_format_params params = get_float_params(arg); @@ -80,9 +82,9 @@ const cl_decoded_float format_scale_exponent (const cl_F& arg) var const cl_F& lg2 = params.lg2; // Decode arg. if (zerop(arg)) - return cl_decoded_float(zero,0,one); + return decoded_float(zero,0,one); var cl_F abs_arg = abs(arg); - var cl_decoded_float decoded = decode_float(abs_arg); + var decoded_float decoded = decode_float(abs_arg); var cl_I& expon = decoded.exponent; var cl_I expon10a = truncate1(expon*lg2); // nicht round, um Ãœberlauf zu vermeiden var cl_F signif10a = abs_arg / expt(ten,expon10a); @@ -108,7 +110,9 @@ const cl_decoded_float format_scale_exponent (const cl_F& arg) tenpow = tenpow * ten; } } - return cl_decoded_float(signif10c,expon10c,float_sign(arg)); + return decoded_float(signif10c,expon10c,float_sign(arg)); } +} // namespace cln + CL_PROVIDE_END(cl_fmt_scaleexp) diff --git a/src/real/format-output/cl_fmt_tens.cc b/src/real/format-output/cl_fmt_tens.cc index 8c8f6f7..5206962 100644 --- a/src/real/format-output/cl_fmt_tens.cc +++ b/src/real/format-output/cl_fmt_tens.cc @@ -9,6 +9,8 @@ // Implementation. +namespace cln { + const char * const cl_format_tens [10] = { NULL, NULL, @@ -21,3 +23,5 @@ const char * const cl_format_tens [10] = { "eighty", "ninety", }; + +} // namespace cln diff --git a/src/real/format-output/cl_format.h b/src/real/format-output/cl_format.h index be1a72d..b6f9219 100644 --- a/src/real/format-output/cl_format.h +++ b/src/real/format-output/cl_format.h @@ -3,9 +3,11 @@ #ifndef _CL_FORMAT_H #define _CL_FORMAT_H -#include "cl_number.h" -#include "cl_io.h" -#include "cl_float.h" +#include "cln/number.h" +#include "cln/io.h" +#include "cln/float.h" + +namespace cln { // gibt arg als römische Zahl auf stream aus, z.B. 4 als IIII. extern void format_old_roman (cl_ostream stream, const cl_I& arg); @@ -49,7 +51,7 @@ extern void format_integer (cl_ostream stream, const cl_I& arg, unsigned int bas // ganzem n und mantissa floating-point, 0.1 <= mantissa < 1, // arg = mantissa * 10^n * sign (also 10^(n-1) <= abs(arg) < 10^n ). // (Bei arg=0.0: 0.0 und n=0.) -extern const cl_decoded_float format_scale_exponent (const cl_F& arg); +extern const decoded_float format_scale_exponent (const cl_F& arg); CL_REQUIRE(cl_fmt_scaleexp) // format_float_to_string(arg,width,d,k,dmin) @@ -58,7 +60,7 @@ CL_REQUIRE(cl_fmt_scaleexp) // und höchstens die Länge width (width<=0 -> keine Einschränkung). // Trotzdem wird nicht auf weniger als dmin Stellen gerundet. struct digits_with_dot { - char * string; // Mit cl_malloc_hook() alloziert, mit cl_free_hook() freizugeben. + char * string; // Mit malloc_hook() alloziert, mit free_hook() freizugeben. uintL length; // strlen(string) cl_boolean dot_comes_first; // string[0] == '.' ? cl_boolean dot_comes_last; // string[strlen(string)-1] == '.' ? @@ -70,5 +72,6 @@ struct digits_with_dot { extern const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width, const sintL d, const sintL k, const sintL dmin); CL_REQUIRE(cl_fmt_floatstring) +} // namespace cln #endif /* _CL_FORMAT_H */ diff --git a/src/real/input/cl_R_from_string.cc b/src/real/input/cl_R_from_string.cc index a62e904..b3b3c9f 100644 --- a/src/real/input/cl_R_from_string.cc +++ b/src/real/input/cl_R_from_string.cc @@ -4,19 +4,21 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real_class.h" +#include "cln/real_class.h" // Implementation. -#include "cl_input.h" -#include "cl_real_io.h" +#include "cln/input.h" +#include "cln/real_io.h" + +namespace cln { cl_read_flags cl_R_read_flags = { syntax_real, lsyntax_all, 10, - { cl_float_format_ffloat, cl_float_format_lfloat_min, cl_true } + { float_format_ffloat, float_format_lfloat_min, cl_true } }; cl_R::cl_R (const char * string) @@ -24,3 +26,5 @@ cl_R::cl_R (const char * string) pointer = as_cl_private_thing( read_real(cl_R_read_flags,string,NULL,NULL)); } + +} // namespace cln diff --git a/src/real/input/cl_R_read.cc b/src/real/input/cl_R_read.cc index eda1ec7..e2f9b49 100644 --- a/src/real/input/cl_R_read.cc +++ b/src/real/input/cl_R_read.cc @@ -6,25 +6,27 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real_io.h" +#include "cln/real_io.h" // Implementation. #include -#include "cl_input.h" -#include "cl_rational_io.h" -#include "cl_integer_io.h" -#include "cl_float_io.h" -#include "cl_integer.h" +#include "cln/input.h" +#include "cln/rational_io.h" +#include "cln/integer_io.h" +#include "cln/float_io.h" +#include "cln/integer.h" #include "cl_I.h" #include "cl_F.h" -#include "cl_abort.h" +#include "cln/abort.h" #undef floor -#include +#include #define floor cln_floor +namespace cln { + // Step forward over all digits, to the end of string or to the next non-digit. static const char * skip_digits (const char * ptr, const char * string_limit, unsigned int base) { @@ -60,7 +62,7 @@ const cl_R read_real (const cl_read_flags& flags, const char * string, const cha ASSERT((flags.syntax & ~(syntax_real|syntax_maybe_bad)) == 0); // If no string_limit is given, it defaults to the end of the string. if (!string_limit) - string_limit = string + strlen(string); + string_limit = string + ::strlen(string); if (flags.syntax & syntax_rational) { // Check for rational number syntax. var unsigned int rational_base = flags.rational_base; @@ -87,9 +89,9 @@ const cl_R read_real (const cl_read_flags& flags, const char * string, const cha goto not_rational_syntax; var cl_I base = read_integer(10,0,ptr,0,base_end_ptr-ptr); if (!((base >= 2) && (base <= 36))) { - fprint(cl_stderr, "Base must be an integer in the range from 2 to 36, not "); - fprint(cl_stderr, base); - fprint(cl_stderr, "\n"); + fprint(stderr, "Base must be an integer in the range from 2 to 36, not "); + fprint(stderr, base); + fprint(stderr, "\n"); cl_abort(); } rational_base = FN_to_UL(base); ptr = base_end_ptr; @@ -211,21 +213,21 @@ not_rational_syntax: } ptr = ptr_after_exponent; var const char * ptr_after_prec = ptr; - var cl_float_format_t prec; + var float_format_t prec; if ((ptr != string_limit) && (*ptr == '_')) { ptr++; ptr_after_prec = skip_digits(ptr,string_limit,10); if (ptr_after_prec == ptr) goto not_float_syntax; var cl_I prec1 = digits_to_I(ptr,ptr_after_prec-ptr,10); var uintL prec2 = cl_I_to_UL(prec1); - prec = (float_base==10 ? cl_float_format(prec2) - : (cl_float_format_t)((uintL)((1+prec2)*log((double)float_base)*1.442695041)+1) + prec = (float_base==10 ? float_format(prec2) + : (float_format_t)((uintL)((1+prec2)*::log((double)float_base)*1.442695041)+1) ); } else { switch (exponent_marker) { - case 'S': prec = cl_float_format_sfloat; break; - case 'F': prec = cl_float_format_ffloat; break; - case 'D': prec = cl_float_format_dfloat; break; + case 'S': prec = float_format_sfloat; break; + case 'F': prec = float_format_ffloat; break; + case 'D': prec = float_format_dfloat; break; case 'L': prec = flags.float_flags.default_lfloat_format; break; case 'E': prec = flags.float_flags.default_float_format; break; default: NOTREACHED @@ -237,9 +239,9 @@ not_rational_syntax: var uintL num_significant_digits = (ptr_after_fracpart - ptr) - (ptr_before_fracpart > ptr ? 1 : 0); var uintL prec2 = (num_significant_digits>=2 ? num_significant_digits-2 : 0); - var cl_float_format_t precx = - (float_base==10 ? cl_float_format(prec2) - : (cl_float_format_t)((uintL)((1+prec2)*log((double)float_base)*1.442695041)+1) + var float_format_t precx = + (float_base==10 ? float_format(prec2) + : (float_format_t)((uintL)((1+prec2)*::log((double)float_base)*1.442695041)+1) ); if ((uintL)precx > (uintL)prec) prec = precx; @@ -264,3 +266,5 @@ bad_syntax: } read_number_bad_syntax(string,string_limit); } + +} // namespace cln diff --git a/src/real/input/cl_R_read_stream.cc b/src/real/input/cl_R_read_stream.cc index c798358..7be4ecb 100644 --- a/src/real/input/cl_R_read_stream.cc +++ b/src/real/input/cl_R_read_stream.cc @@ -6,14 +6,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real_io.h" +#include "cln/real_io.h" // Implementation. -#include "cl_io.h" +#include "cln/io.h" #include "cl_spushstring.h" -#include "cl_input.h" +#include "cln/input.h" + +namespace cln { // We read an entire token (or even more, if it begins with #C) into a // buffer and then call read_real() on the buffer. @@ -102,3 +104,5 @@ syntax1: buffer.push(c); // Handle premature EOF. eof: read_number_eof(); } + +} // namespace cln diff --git a/src/real/misc/cl_R_abs.cc b/src/real/misc/cl_R_abs.cc index 8c8601c..745311f 100644 --- a/src/real/misc/cl_R_abs.cc +++ b/src/real/misc/cl_R_abs.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. +namespace cln { + const cl_R abs (const cl_R& x) { // Methode: @@ -18,3 +20,5 @@ const cl_R abs (const cl_R& x) else return x; } + +} // namespace cln diff --git a/src/real/misc/cl_R_as.cc b/src/real/misc/cl_R_as.cc index 555614a..5b3cf55 100644 --- a/src/real/misc/cl_R_as.cc +++ b/src/real/misc/cl_R_as.cc @@ -4,13 +4,15 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_N.h" +namespace cln { + // Cf. cl_R_p in cl_R_ring.cc. // But here, for better inlining in g++, it is preferrable to finish every // alternative with either "return cl_true;" or "return cl_false;". @@ -40,3 +42,5 @@ const cl_R& as_cl_R (const cl_number& x, const char * filename, int line) } else cl_as_error(x,"a real number",filename,line); } + +} // namespace cln diff --git a/src/real/misc/cl_R_contagion.cc b/src/real/misc/cl_R_contagion.cc index a02d460..77d7b36 100644 --- a/src/real/misc/cl_R_contagion.cc +++ b/src/real/misc/cl_R_contagion.cc @@ -11,6 +11,8 @@ #include "cl_LF.h" +namespace cln { + const cl_R contagion (const cl_R& x, const cl_R& y) { #define X { return x; } @@ -41,3 +43,5 @@ const cl_R contagion (const cl_R& x, const cl_R& y) ); #endif } + +} // namespace cln diff --git a/src/real/misc/cl_R_debug.cc b/src/real/misc/cl_R_debug.cc index 8525c1a..62d20bc 100644 --- a/src/real/misc/cl_R_debug.cc +++ b/src/real/misc/cl_R_debug.cc @@ -8,7 +8,9 @@ // Implementation. -// This dummy links in this module when requires it. +namespace cln { + +// This dummy links in this module when requires it. int cl_R_debug_module; extern int cl_SF_debug_module; @@ -23,3 +25,5 @@ static void* dummy[] = { &dummy, &cl_LF_debug_module, &cl_RA_debug_module }; + +} // namespace cln diff --git a/src/real/misc/cl_R_eqhashcode.cc b/src/real/misc/cl_R_eqhashcode.cc index be89b0c..243695a 100644 --- a/src/real/misc/cl_R_eqhashcode.cc +++ b/src/real/misc/cl_R_eqhashcode.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. @@ -23,5 +23,9 @@ #include "cl_DF_eqhashcode.cc" #include "cl_LF_eqhashcode.cc" -uint32 cl_equal_hashcode (const cl_R& x) -GEN_R_OP1_7(x, cl_equal_hashcode, return) +namespace cln { + +uint32 equal_hashcode (const cl_R& x) +GEN_R_OP1_7(x, equal_hashcode, return) + +} // namespace cln diff --git a/src/real/misc/cl_R_expt.cc b/src/real/misc/cl_R_expt.cc index 4d0e013..c1f581d 100644 --- a/src/real/misc/cl_R_expt.cc +++ b/src/real/misc/cl_R_expt.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_integer.h" +#include "cln/rational.h" +#include "cln/integer.h" + +namespace cln { // Methode: // Für y>0: @@ -52,3 +54,5 @@ const cl_R expt (const cl_R& x, sintL y) var cl_R z = expt_pos(x,abs_y); // (expt x (abs y)) return (y<0 ? recip(z) : z); // evtl. noch Kehrwert nehmen } + +} // namespace cln diff --git a/src/real/misc/cl_R_expt_I.cc b/src/real/misc/cl_R_expt_I.cc index 93db843..6988eae 100644 --- a/src/real/misc/cl_R_expt_I.cc +++ b/src/real/misc/cl_R_expt_I.cc @@ -4,16 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_rational.h" -#include "cl_integer.h" +#include "cln/rational.h" +#include "cln/integer.h" #include "cl_I.h" +namespace cln { + // Methode: // Für y>0: // a:=x, b:=y. @@ -54,3 +56,5 @@ const cl_R expt (const cl_R& x, const cl_I& y) var cl_R z = expt_pos(x,abs_y); // (expt x (abs y)) return (y_negative ? recip(z) : z); // evtl. noch Kehrwert nehmen } + +} // namespace cln diff --git a/src/real/misc/cl_R_max.cc b/src/real/misc/cl_R_max.cc index b353887..8560709 100644 --- a/src/real/misc/cl_R_max.cc +++ b/src/real/misc/cl_R_max.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. +namespace cln { + const cl_R max (const cl_R& x, const cl_R& y) { return (x >= y ? x : y); } + +} // namespace cln diff --git a/src/real/misc/cl_R_min.cc b/src/real/misc/cl_R_min.cc index 6b5861c..892a029 100644 --- a/src/real/misc/cl_R_min.cc +++ b/src/real/misc/cl_R_min.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. +namespace cln { + const cl_R min (const cl_R& x, const cl_R& y) { return (x <= y ? x : y); } + +} // namespace cln diff --git a/src/real/misc/cl_R_rational.cc b/src/real/misc/cl_R_rational.cc index fdace63..ce81730 100644 --- a/src/real/misc/cl_R_rational.cc +++ b/src/real/misc/cl_R_rational.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" +namespace cln { + const cl_RA rational (const cl_R& x) GEN_R_OP1_2(x, rational, return) + +} // namespace cln diff --git a/src/real/misc/cl_R_rationalize.cc b/src/real/misc/cl_R_rationalize.cc index f5e43f1..1e752a8 100644 --- a/src/real/misc/cl_R_rationalize.cc +++ b/src/real/misc/cl_R_rationalize.cc @@ -4,18 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" -#include "cl_float.h" -#include "cl_rational.h" -#include "cl_integer.h" +#include "cln/float.h" +#include "cln/rational.h" +#include "cln/integer.h" #include "cl_RA.h" #include "cl_I.h" +namespace cln { + // Methode (rekursiv dargestellt): // Falls x rational ist: x. // Falls x=0.0: 0. @@ -111,3 +113,5 @@ inline const cl_RA rationalize (const cl_F& x) const cl_RA rationalize (const cl_R& x) GEN_R_OP1_2(x, rationalize, return) + +} // namespace cln diff --git a/src/real/misc/cl_R_signum.cc b/src/real/misc/cl_R_signum.cc index 0653a03..f151d6c 100644 --- a/src/real/misc/cl_R_signum.cc +++ b/src/real/misc/cl_R_signum.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. @@ -22,5 +22,9 @@ #include "cl_DF_signum.cc" #include "cl_LF_signum.cc" +namespace cln { + const cl_R signum (const cl_R& x) GEN_R_OP1_7(x, signum, return) + +} // namespace cln diff --git a/src/real/output/cl_R_aprint.cc b/src/real/output/cl_R_aprint.cc index e1c4472..2f09a32 100644 --- a/src/real/output/cl_R_aprint.cc +++ b/src/real/output/cl_R_aprint.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real_io.h" +#include "cln/real_io.h" // Implementation. -#include "cl_output.h" +#include "cln/output.h" + +namespace cln { void print_real (cl_ostream stream, const cl_print_flags& flags, const cl_R& z) { print_real(stream,(const cl_print_number_flags&)flags,z); } + +} // namespace cln diff --git a/src/real/output/cl_R_bprint.cc b/src/real/output/cl_R_bprint.cc index f346060..6ac1176 100644 --- a/src/real/output/cl_R_bprint.cc +++ b/src/real/output/cl_R_bprint.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real_io.h" +#include "cln/real_io.h" // Implementation. -#include "cl_output.h" +#include "cln/output.h" + +namespace cln { void print_real (cl_ostream stream, const cl_print_number_flags& flags, const cl_R& z) { print_real(stream,(const cl_print_real_flags&)flags,z); } + +} // namespace cln diff --git a/src/real/output/cl_R_cprint.cc b/src/real/output/cl_R_cprint.cc index 317ee46..37e7196 100644 --- a/src/real/output/cl_R_cprint.cc +++ b/src/real/output/cl_R_cprint.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real_io.h" +#include "cln/real_io.h" // Implementation. -#include "cl_real.h" +#include "cln/real.h" #include "cl_R.h" -#include "cl_rational_io.h" -#include "cl_float_io.h" +#include "cln/rational_io.h" +#include "cln/float_io.h" + +namespace cln { void print_real (cl_ostream stream, const cl_print_real_flags& flags, const cl_R& z) { @@ -26,3 +28,5 @@ void print_real (cl_ostream stream, const cl_print_real_flags& flags, const cl_R print_float(stream,flags,z); } } + +} // namespace cln diff --git a/src/real/random/cl_R_random.cc b/src/real/random/cl_R_random.cc index 1d9b3ff..e30ba67 100644 --- a/src/real/random/cl_R_random.cc +++ b/src/real/random/cl_R_random.cc @@ -4,18 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_R.h" #include "cl_RA.h" -#include "cl_io.h" -#include "cl_real_io.h" -#include "cl_abort.h" +#include "cln/io.h" +#include "cln/real_io.h" +#include "cln/abort.h" -const cl_R random_R (cl_random_state& r, const cl_R& n) +namespace cln { + +const cl_R random_R (random_state& r, const cl_R& n) { // n muß eine reelle Zahl sein, >0 und Float oder Integer if (plusp(n)) { @@ -30,8 +32,10 @@ const cl_R random_R (cl_random_state& r, const cl_R& n) } } } - fprint(cl_stderr, "random: argument should be positive and an integer or float: "); - fprint(cl_stderr, n); - fprint(cl_stderr, "\n"); + fprint(stderr, "random: argument should be positive and an integer or float: "); + fprint(stderr, n); + fprint(stderr, "\n"); cl_abort(); } + +} // namespace cln diff --git a/src/real/ring/cl_R_ring.cc b/src/real/ring/cl_R_ring.cc index 1105bbe..28cf3e3 100644 --- a/src/real/ring/cl_R_ring.cc +++ b/src/real/ring/cl_R_ring.cc @@ -6,15 +6,17 @@ CL_PROVIDE(cl_R_ring) // Specification. -#include "cl_real_ring.h" +#include "cln/real_ring.h" // Implementation. -#include "cl_real.h" +#include "cln/real.h" #include "cl_R.h" -#include "cl_io.h" -#include "cl_real_io.h" +#include "cln/io.h" +#include "cln/real_io.h" + +namespace cln { static void R_fprint (cl_heap_ring* R, cl_ostream stream, const _cl_ring_element& x) { @@ -25,7 +27,7 @@ static void R_fprint (cl_heap_ring* R, cl_ostream stream, const _cl_ring_element static cl_boolean R_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y) { unused R; - return cl_equal(The(cl_R)(x),The(cl_R)(y)); + return equal(The(cl_R)(x),The(cl_R)(y)); } static const _cl_ring_element R_zero (cl_heap_ring* R) @@ -112,7 +114,7 @@ static cl_ring_mulops R_mulops = { static cl_number_ring_ops R_ops = { cl_R_p, - cl_equal, + equal, exact_zerop, operator+, operator-, @@ -157,4 +159,6 @@ inline cl_real_ring::cl_specialized_number_ring () const cl_real_ring cl_R_ring; +} // namespace cln + CL_PROVIDE_END(cl_R_ring) diff --git a/src/real/transcendental/cl_R_atan.cc b/src/real/transcendental/cl_R_atan.cc index be80b3e..4042f22 100644 --- a/src/real/transcendental/cl_R_atan.cc +++ b/src/real/transcendental/cl_R_atan.cc @@ -4,14 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. +namespace cln { + const cl_R atan (const cl_R& x) { // Methode: // arctan(x) = arctan(X=1,Y=x). return atan(1,x); } + +} // namespace cln diff --git a/src/real/transcendental/cl_R_atan2.cc b/src/real/transcendental/cl_R_atan2.cc index 1e967a9..0546e14 100644 --- a/src/real/transcendental/cl_R_atan2.cc +++ b/src/real/transcendental/cl_R_atan2.cc @@ -4,16 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. -#include "cl_float.h" +#include "cln/float.h" #include "cl_F_tran.h" #include "cl_N.h" #include "cl_R.h" +namespace cln { + const cl_R atan (const cl_R& x, const cl_R& y) { // Methode: @@ -34,7 +36,7 @@ const cl_R atan (const cl_R& x, const cl_R& y) if (zerop(x)) // x=0 -> Error { cl_error_division_by_0(); } if (minusp(x)) // x<0 -> pi in Default-Float-Genauigkeit - { return cl_pi(); } + { return pi(); } return 0; // x>0 -> 0 } elif (eq(x,0)) { @@ -42,8 +44,8 @@ const cl_R atan (const cl_R& x, const cl_R& y) if (zerop(y)) // y=0 -> Error { cl_error_division_by_0(); } if (minusp(y)) // y<0 -> -pi/2 - { return - scale_float(cl_pi(),-1); } - return scale_float(cl_pi(),-1); // y>0 -> pi/2 + { return - scale_float(pi(),-1); } + return scale_float(pi(),-1); // y>0 -> pi/2 } else { Mutable(cl_R,x); Mutable(cl_R,y); @@ -63,10 +65,10 @@ const cl_R atan (const cl_R& x, const cl_R& y) // x<0 -> pi bzw. -pi addieren: if (!minusp(y)) // y>=0 -> atan(y/x) + pi - return z + cl_pi(z); + return z + pi(z); else // y<0 -> atan(y/x) - pi - return z - cl_pi(z); + return z - pi(z); else return z; } else { @@ -75,10 +77,12 @@ const cl_R atan (const cl_R& x, const cl_R& y) // von pi/2 bzw. -pi/2 subtrahieren: if (!minusp(y)) // y>=0 -> pi/2 - atan(x/y) - return scale_float(cl_pi(z),-1) - z; + return scale_float(pi(z),-1) - z; else // y<0 -> -pi/2 - atan(x/y) - return - scale_float(cl_pi(z),-1) - z; + return - scale_float(pi(z),-1) - z; } } } + +} // namespace cln diff --git a/src/real/transcendental/cl_R_cos.cc b/src/real/transcendental/cl_R_cos.cc index 5630d1a..236304f 100644 --- a/src/real/transcendental/cl_R_cos.cc +++ b/src/real/transcendental/cl_R_cos.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. -#include "cl_float.h" +#include "cln/float.h" #include "cl_R.h" +namespace cln { + const cl_R cos (const cl_R& x) { // Methode: @@ -28,3 +30,5 @@ const cl_R cos (const cl_R& x) return cos(x); } } + +} // namespace cln diff --git a/src/real/transcendental/cl_R_cosh.cc b/src/real/transcendental/cl_R_cosh.cc index 52b7ed4..9dc0c8a 100644 --- a/src/real/transcendental/cl_R_cosh.cc +++ b/src/real/transcendental/cl_R_cosh.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. -#include "cl_float.h" +#include "cln/float.h" #include "cl_R.h" +namespace cln { + const cl_R cosh (const cl_R& x) { // Methode: @@ -28,3 +30,5 @@ const cl_R cosh (const cl_R& x) return cosh(x); } } + +} // namespace cln diff --git a/src/real/transcendental/cl_R_coshsinh.cc b/src/real/transcendental/cl_R_coshsinh.cc index fc341de..12fbb18 100644 --- a/src/real/transcendental/cl_R_coshsinh.cc +++ b/src/real/transcendental/cl_R_coshsinh.cc @@ -1,18 +1,20 @@ -// cl_cosh_sinh(). +// cosh_sinh(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. -#include "cl_float.h" +#include "cln/float.h" #include "cl_R.h" -const cl_cosh_sinh_t cl_cosh_sinh (const cl_R& x) +namespace cln { + +const cosh_sinh_t cosh_sinh (const cl_R& x) { // Methode: // x rational -> bei x=0 (1,0) als Ergebnis, sonst x in Float umwandeln. @@ -21,10 +23,12 @@ const cl_cosh_sinh_t cl_cosh_sinh (const cl_R& x) if (rationalp(x)) { DeclareType(cl_RA,x); if (zerop(x)) // x=0 -> (1,0) als Ergebnis - return cl_cosh_sinh_t(1,0); - return cl_cosh_sinh(cl_float(x)); // sonst in Float umwandeln + return cosh_sinh_t(1,0); + return cosh_sinh(cl_float(x)); // sonst in Float umwandeln } else { DeclareType(cl_F,x); - return cl_cosh_sinh(x); + return cosh_sinh(x); } } + +} // namespace cln diff --git a/src/real/transcendental/cl_R_cossin.cc b/src/real/transcendental/cl_R_cossin.cc index 0a3fc7e..8893f71 100644 --- a/src/real/transcendental/cl_R_cossin.cc +++ b/src/real/transcendental/cl_R_cossin.cc @@ -1,18 +1,20 @@ -// cl_cos_sin(). +// cos_sin(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. -#include "cl_float.h" +#include "cln/float.h" #include "cl_R.h" -const cl_cos_sin_t cl_cos_sin (const cl_R& x) +namespace cln { + +const cos_sin_t cos_sin (const cl_R& x) { // Methode: // x rational -> bei x=0 (1,0) als Ergebnis, sonst x in Float umwandeln. @@ -21,10 +23,12 @@ const cl_cos_sin_t cl_cos_sin (const cl_R& x) if (rationalp(x)) { DeclareType(cl_RA,x); if (zerop(x)) // x=0 -> (1,0) als Ergebnis - return cl_cos_sin_t(1,0); - return cl_cos_sin(cl_float(x)); // sonst in Float umwandeln + return cos_sin_t(1,0); + return cos_sin(cl_float(x)); // sonst in Float umwandeln } else { DeclareType(cl_F,x); - return cl_cos_sin(x); + return cos_sin(x); } } + +} // namespace cln diff --git a/src/real/transcendental/cl_R_exp.cc b/src/real/transcendental/cl_R_exp.cc index 1c62b07..4babcb9 100644 --- a/src/real/transcendental/cl_R_exp.cc +++ b/src/real/transcendental/cl_R_exp.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. -#include "cl_float.h" +#include "cln/float.h" #include "cl_R.h" +namespace cln { + const cl_R exp (const cl_R& x) { // Methode: @@ -28,3 +30,5 @@ const cl_R exp (const cl_R& x) return exp(x); } } + +} // namespace cln diff --git a/src/real/transcendental/cl_R_ln.cc b/src/real/transcendental/cl_R_ln.cc index 7862428..39c3943 100644 --- a/src/real/transcendental/cl_R_ln.cc +++ b/src/real/transcendental/cl_R_ln.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. -#include "cl_float.h" +#include "cln/float.h" #include "cl_R.h" +namespace cln { + const cl_R ln (const cl_R& x) { // Methode: @@ -28,3 +30,5 @@ const cl_R ln (const cl_R& x) return ln(x); } } + +} // namespace cln diff --git a/src/real/transcendental/cl_R_log.cc b/src/real/transcendental/cl_R_log.cc index f183e3a..2834b54 100644 --- a/src/real/transcendental/cl_R_log.cc +++ b/src/real/transcendental/cl_R_log.cc @@ -4,15 +4,17 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. #include "cl_N.h" #include "cl_R.h" -#include "cl_rational.h" -#include "cl_float.h" +#include "cln/rational.h" +#include "cln/float.h" + +namespace cln { const cl_R log (const cl_R& a, const cl_R& b) { @@ -49,3 +51,5 @@ const cl_R log (const cl_R& a, const cl_R& b) // Nun a,b beide Floats. return ln(The(cl_F)(a)) / ln(The(cl_F)(b)); }} + +} // namespace cln diff --git a/src/real/transcendental/cl_R_sin.cc b/src/real/transcendental/cl_R_sin.cc index 045ea25..35c0947 100644 --- a/src/real/transcendental/cl_R_sin.cc +++ b/src/real/transcendental/cl_R_sin.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. -#include "cl_float.h" +#include "cln/float.h" #include "cl_R.h" +namespace cln { + const cl_R sin (const cl_R& x) { // Methode: @@ -28,3 +30,5 @@ const cl_R sin (const cl_R& x) return sin(x); } } + +} // namespace cln diff --git a/src/real/transcendental/cl_R_sinh.cc b/src/real/transcendental/cl_R_sinh.cc index 85d53c0..af9e7ba 100644 --- a/src/real/transcendental/cl_R_sinh.cc +++ b/src/real/transcendental/cl_R_sinh.cc @@ -4,14 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. -#include "cl_float.h" +#include "cln/float.h" #include "cl_R.h" +namespace cln { + const cl_R sinh (const cl_R& x) { // Methode: @@ -28,3 +30,5 @@ const cl_R sinh (const cl_R& x) return sinh(x); } } + +} // namespace cln diff --git a/src/real/transcendental/cl_R_tan.cc b/src/real/transcendental/cl_R_tan.cc index d155217..14faf89 100644 --- a/src/real/transcendental/cl_R_tan.cc +++ b/src/real/transcendental/cl_R_tan.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. +namespace cln { + MAYBE_INLINE const cl_R tan (const cl_R& x) { // Methode: // (/ (sin x) (cos x)) - var cl_cos_sin_t trig = cl_cos_sin(x); + var cos_sin_t trig = cos_sin(x); return trig.sin / trig.cos; } + +} // namespace cln diff --git a/src/real/transcendental/cl_R_tanh.cc b/src/real/transcendental/cl_R_tanh.cc index 04be1ec..2b6e984 100644 --- a/src/real/transcendental/cl_R_tanh.cc +++ b/src/real/transcendental/cl_R_tanh.cc @@ -4,16 +4,20 @@ #include "cl_sysdep.h" // Specification. -#include "cl_real.h" +#include "cln/real.h" // Implementation. +namespace cln { + MAYBE_INLINE const cl_R tanh (const cl_R& x) { // Methode: // (/ (sinh x) (cosh x)) - var cl_cosh_sinh_t hyp = cl_cosh_sinh(x); + var cosh_sinh_t hyp = cosh_sinh(x); return hyp.sinh / hyp.cosh; } + +} // namespace cln diff --git a/src/timing/cl_t_c1.cc b/src/timing/cl_t_c1.cc index 5367e8d..3007748 100644 --- a/src/timing/cl_t_c1.cc +++ b/src/timing/cl_t_c1.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_timing.h" +#include "cln/timing.h" // Implementation. +namespace cln { + static void report_accu (const cl_timing& t) { var const cl_time_consumption usage_end = cl_current_time_consumption(); @@ -27,3 +29,5 @@ cl_timing::cl_timing (cl_time_consumption& accumulator) report_fn = report_accu; report_destination = &accumulator; tmp = cl_current_time_consumption(); } + +} // namespace cln diff --git a/src/timing/cl_t_c2.cc b/src/timing/cl_t_c2.cc index c42237b..3b46861 100644 --- a/src/timing/cl_t_c2.cc +++ b/src/timing/cl_t_c2.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_timing.h" +#include "cln/timing.h" // Implementation. +namespace cln { + static void report_stream (const cl_timing& t) { var const cl_time_consumption usage_end = cl_current_time_consumption(); @@ -17,13 +19,7 @@ static void report_stream (const cl_timing& t) usage.realtime = usage_end.realtime - usage_start.realtime; usage.usertime = usage_end.usertime - usage_start.usertime; - var cl_ostream destination = -#if defined(CL_IO_STDIO) - (FILE*) t.report_destination; -#endif -#if defined(CL_IO_IOSTREAM) - *(ostream*) t.report_destination; -#endif + var cl_ostream destination = *(std::ostream*) t.report_destination; if (t.comment) fprint(destination,t.comment); cl_timing_report(destination,usage); @@ -33,12 +29,7 @@ static void report_stream (const cl_timing& t) cl_timing::cl_timing (cl_ostream destination) { report_fn = report_stream; -#if defined(CL_IO_STDIO) - report_destination = destination; -#endif -#if defined(CL_IO_IOSTREAM) report_destination = &destination; -#endif comment = NULL; tmp = cl_current_time_consumption(); } @@ -46,12 +37,9 @@ cl_timing::cl_timing (cl_ostream destination) cl_timing::cl_timing (const char * msg, cl_ostream destination) { report_fn = report_stream; -#if defined(CL_IO_STDIO) - report_destination = destination; -#endif -#if defined(CL_IO_IOSTREAM) report_destination = &destination; -#endif comment = msg; tmp = cl_current_time_consumption(); } + +} // namespace cln diff --git a/src/timing/cl_t_current.cc b/src/timing/cl_t_current.cc index 93b40d2..c46a09a 100644 --- a/src/timing/cl_t_current.cc +++ b/src/timing/cl_t_current.cc @@ -4,13 +4,14 @@ #include "cl_sysdep.h" // Specification. -#include "cl_timing.h" +#include "cln/timing.h" // Implementation. #include "cl_t_config.h" + #if defined(HAVE_GETTIMEOFDAY) #include #ifdef GETTIMEOFDAY_DOTS @@ -35,6 +36,8 @@ extern "C" int perror (const char *); #endif +namespace cln { + const cl_timespec cl_current_time () { #if defined(HAVE_GETTIMEOFDAY) @@ -56,3 +59,5 @@ const cl_timespec cl_current_time () return cl_timespec(time(NULL),0); #endif } + +} // namespace cln diff --git a/src/timing/cl_t_current2.cc b/src/timing/cl_t_current2.cc index 5a0bfb0..6a86883 100644 --- a/src/timing/cl_t_current2.cc +++ b/src/timing/cl_t_current2.cc @@ -4,7 +4,7 @@ #include "cl_sysdep.h" // Specification. -#include "cl_timing.h" +#include "cln/timing.h" // Implementation. @@ -29,6 +29,8 @@ extern "C" int perror (const char *); #endif +namespace cln { + const cl_time_consumption cl_current_time_consumption () { var cl_time_consumption result; @@ -64,3 +66,5 @@ const cl_time_consumption cl_current_time_consumption () return result; } + +} // namespace cln diff --git a/src/timing/cl_t_d.cc b/src/timing/cl_t_d.cc index 00d0e1e..6f4716e 100644 --- a/src/timing/cl_t_d.cc +++ b/src/timing/cl_t_d.cc @@ -4,12 +4,16 @@ #include "cl_sysdep.h" // Specification. -#include "cl_timing.h" +#include "cln/timing.h" // Implementation. +namespace cln { + cl_timing::~cl_timing () { report_fn(*this); } + +} // namespace cln diff --git a/src/timing/cl_t_dec.cc b/src/timing/cl_t_dec.cc index f15096c..4791bd5 100644 --- a/src/timing/cl_t_dec.cc +++ b/src/timing/cl_t_dec.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_timing.h" +#include "cln/timing.h" // Implementation. +namespace cln { + const cl_timespec operator- (const cl_timespec& a, const cl_time_duration& b) { var uintL sec = a.tv_sec - b.tv_sec; @@ -19,3 +21,5 @@ const cl_timespec operator- (const cl_timespec& a, const cl_time_duration& b) } return cl_timespec(sec,nsec); } + +} // namespace cln diff --git a/src/timing/cl_t_inc.cc b/src/timing/cl_t_inc.cc index 349167e..980275b 100644 --- a/src/timing/cl_t_inc.cc +++ b/src/timing/cl_t_inc.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_timing.h" +#include "cln/timing.h" // Implementation. +namespace cln { + const cl_timespec operator+ (const cl_timespec& a, const cl_time_duration& b) { var uintL sec = a.tv_sec + b.tv_sec; @@ -19,3 +21,5 @@ const cl_timespec operator+ (const cl_timespec& a, const cl_time_duration& b) } return cl_timespec(sec,nsec); } + +} // namespace cln diff --git a/src/timing/cl_t_minus.cc b/src/timing/cl_t_minus.cc index 7dbf194..b9da896 100644 --- a/src/timing/cl_t_minus.cc +++ b/src/timing/cl_t_minus.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_timing.h" +#include "cln/timing.h" // Implementation. +namespace cln { + const cl_time_duration operator- (const cl_timespec& a, const cl_timespec& b) { var sintL sec = a.tv_sec - b.tv_sec; @@ -22,3 +24,5 @@ const cl_time_duration operator- (const cl_timespec& a, const cl_timespec& b) } return cl_time_duration(sec,nsec); } + +} // namespace cln diff --git a/src/timing/cl_t_report.cc b/src/timing/cl_t_report.cc index e0c23bd..95b4fb9 100644 --- a/src/timing/cl_t_report.cc +++ b/src/timing/cl_t_report.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_timing.h" +#include "cln/timing.h" // Implementation. +namespace cln { + // Round to 3 decimal places. #define CL_HZ 1000 #define CL_HZ_NSECS (1000000000/CL_HZ) @@ -21,11 +23,6 @@ void cl_timing_report (cl_ostream stream, const cl_time_consumption& t) var uintL user_sec = t.usertime.tv_sec; var uintL user_msec = (t.usertime.tv_nsec + (CL_HZ_NSECS-1)/2) / CL_HZ_NSECS; if (user_msec >= CL_HZ) { user_msec -= CL_HZ; user_sec += 1; } -#if defined(CL_IO_STDIO) - fprintf(stream, "real time: %4u.%03u s, run time: %4u.%03u s", - real_sec, real_msec, user_sec, user_msec); -#endif -#if defined(CL_IO_IOSTREAM) var char oldfill = stream.fill(); var int oldwidth = stream.width(); stream << "real time: "; @@ -39,5 +36,6 @@ void cl_timing_report (cl_ostream stream, const cl_time_consumption& t) stream.fill(oldfill); stream << " s"; stream.width(oldwidth); -#endif } + +} // namespace cln diff --git a/src/timing/cl_t_td_minus.cc b/src/timing/cl_t_td_minus.cc index 609a656..920da0c 100644 --- a/src/timing/cl_t_td_minus.cc +++ b/src/timing/cl_t_td_minus.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_timing.h" +#include "cln/timing.h" // Implementation. +namespace cln { + const cl_time_duration operator- (const cl_time_duration& a, const cl_time_duration& b) { var sintL sec = a.tv_sec - b.tv_sec; @@ -22,3 +24,5 @@ const cl_time_duration operator- (const cl_time_duration& a, const cl_time_durat } return cl_time_duration(sec,nsec); } + +} // namespace cln diff --git a/src/timing/cl_t_td_plus.cc b/src/timing/cl_t_td_plus.cc index fc2f9a6..c118108 100644 --- a/src/timing/cl_t_td_plus.cc +++ b/src/timing/cl_t_td_plus.cc @@ -4,11 +4,13 @@ #include "cl_sysdep.h" // Specification. -#include "cl_timing.h" +#include "cln/timing.h" // Implementation. +namespace cln { + const cl_time_duration operator+ (const cl_time_duration& a, const cl_time_duration& b) { var uintL sum_sec = a.tv_sec + b.tv_sec; @@ -19,3 +21,5 @@ const cl_time_duration operator+ (const cl_time_duration& a, const cl_time_durat } return cl_time_duration(sum_sec,sum_nsec); } + +} // namespace cln diff --git a/src/vector/cl_GV_I.cc b/src/vector/cl_GV_I.cc index c1520a2..64a4015 100644 --- a/src/vector/cl_GV_I.cc +++ b/src/vector/cl_GV_I.cc @@ -6,16 +6,17 @@ CL_PROVIDE(cl_GV_I) // Specification. -#include "cl_GV_integer.h" +#include "cln/GV_integer.h" // Implementation. #include "cl_I.h" #include "cl_DS.h" -#include "cl_abort.h" +#include "cln/abort.h" #include "cl_offsetof.h" +namespace cln { // Memory-efficient integer vectors: If all entries are known in advance to // be >= 0 and < 2^m, we reserve only m bits for each entry. (m=1,2,4,8,16,32). @@ -123,7 +124,7 @@ static cl_GV_I_vectorops general_vectorops = {{ cl_heap_GV_I* cl_make_heap_GV_I (uintL len) { - var cl_heap_GV_I_general* hv = (cl_heap_GV_I_general*) cl_malloc_hook(offsetofa(cl_heap_GV_I_general,data)+sizeof(cl_I)*len); + var cl_heap_GV_I_general* hv = (cl_heap_GV_I_general*) malloc_hook(offsetofa(cl_heap_GV_I_general,data)+sizeof(cl_I)*len); hv->refcount = 1; hv->type = &cl_class_gvector_integer; new (&hv->v) cl_GV_inner (len,&general_vectorops.ops); @@ -469,7 +470,7 @@ cl_heap_GV_I* cl_make_heap_GV_I (uintL len, sintL m) // For room allocation purposes, be pessimistic: assume the uintD case (since intDsize>=32). var uintL words = // ceiling(len*2^log2_bits,intDsize) (((sintL)len-1)>>(log2_intDsize-log2_bits))+1; - var cl_heap_GV_I_bits32* hv = (cl_heap_GV_I_bits32*) cl_malloc_hook(offsetofa(cl_heap_GV_I_bits32,data)+sizeof(uintD)*words); + var cl_heap_GV_I_bits32* hv = (cl_heap_GV_I_bits32*) malloc_hook(offsetofa(cl_heap_GV_I_bits32,data)+sizeof(uintD)*words); hv->refcount = 1; hv->type = &cl_class_gvector_integer; new (&hv->v) cl_GV_inner (len,&bits_vectorops[log2_bits]->ops); @@ -489,4 +490,6 @@ sintL cl_heap_GV_I::maxbits () const // An empty vector. const cl_GV_I cl_null_GV_I = cl_GV_I((uintL)0); +} // namespace cln + CL_PROVIDE_END(cl_GV_I) diff --git a/src/vector/cl_GV_I_copy.cc b/src/vector/cl_GV_I_copy.cc index 28c36d7..2cbc88f 100644 --- a/src/vector/cl_GV_I_copy.cc +++ b/src/vector/cl_GV_I_copy.cc @@ -5,11 +5,13 @@ // Specification. #define CL_GV_NO_RANGECHECKS -#include "cl_GV_integer.h" +#include "cln/GV_integer.h" // Implementation. +namespace cln { + const cl_GV_I copy (const cl_GV_I& v) { var uintL len = v.length(); @@ -17,3 +19,5 @@ const cl_GV_I copy (const cl_GV_I& v) cl_GV_I::copy_elements(v,0,w,0,len); return w; } + +} // namespace cln diff --git a/src/vector/cl_GV_I_debug.cc b/src/vector/cl_GV_I_debug.cc index a2c5439..723d25e 100644 --- a/src/vector/cl_GV_I_debug.cc +++ b/src/vector/cl_GV_I_debug.cc @@ -8,8 +8,10 @@ // Implementation. -#include "cl_GV_integer.h" -#include "cl_io.h" +#include "cln/GV_integer.h" +#include "cln/io.h" + +namespace cln { static void dprint (cl_heap* pointer) { @@ -20,5 +22,7 @@ static void dprint (cl_heap* pointer) AT_INITIALIZATION(dprint_GV_I) { cl_register_type_printer(cl_class_gvector_integer,dprint); } -// This dummy links in this module when requires it. +// This dummy links in this module when requires it. int cl_GV_I_debug_module; + +} // namespace cln diff --git a/src/vector/cl_GV_io.h b/src/vector/cl_GV_io.h index 40e9e65..ed935a1 100644 --- a/src/vector/cl_GV_io.h +++ b/src/vector/cl_GV_io.h @@ -3,10 +3,11 @@ #ifndef _CL_GV_IO_H #define _CL_GV_IO_H -#include "cl_number_io.h" -#include "cl_GV.h" -#include "cl_GV_complex.h" +#include "cln/number_io.h" +#include "cln/GV.h" +#include "cln/GV_complex.h" +namespace cln { // Gibt einen Vektor aus. // print_vector(stream,flags,fun,z); @@ -16,5 +17,6 @@ // > vector: Vektor extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_GV_number& vector); +} // namespace cln #endif /* _CL_GV_IO_H */ diff --git a/src/vector/cl_GV_number.cc b/src/vector/cl_GV_number.cc index 30d00ec..4b019ee 100644 --- a/src/vector/cl_GV_number.cc +++ b/src/vector/cl_GV_number.cc @@ -6,14 +6,15 @@ CL_PROVIDE(cl_GV_number) // Specification. -#include "cl_GV_number.h" +#include "cln/GV_number.h" // Implementation. -#include "cl_abort.h" +#include "cln/abort.h" #include "cl_offsetof.h" +namespace cln { static void cl_gvector_number_destructor (cl_heap* pointer) { @@ -98,7 +99,7 @@ static cl_GV_vectorops general_vectorops = { cl_heap_GV_number* cl_make_heap_GV_number (uintL len) { - var cl_heap_GV_number_general* hv = (cl_heap_GV_number_general*) cl_malloc_hook(offsetofa(cl_heap_GV_number_general,data)+sizeof(cl_number)*len); + var cl_heap_GV_number_general* hv = (cl_heap_GV_number_general*) malloc_hook(offsetofa(cl_heap_GV_number_general,data)+sizeof(cl_number)*len); hv->refcount = 1; hv->type = &cl_class_gvector_number; new (&hv->v) cl_GV_inner (len,&general_vectorops); @@ -110,4 +111,6 @@ cl_heap_GV_number* cl_make_heap_GV_number (uintL len) // An empty vector. const cl_GV_number cl_null_GV_number = cl_GV_number((uintL)0); +} // namespace cln + CL_PROVIDE_END(cl_GV_number) diff --git a/src/vector/cl_GV_number_copy.cc b/src/vector/cl_GV_number_copy.cc index cdd92ce..9622f19 100644 --- a/src/vector/cl_GV_number_copy.cc +++ b/src/vector/cl_GV_number_copy.cc @@ -5,11 +5,13 @@ // Specification. #define CL_GV_NO_RANGECHECKS -#include "cl_GV_number.h" +#include "cln/GV_number.h" // Implementation. +namespace cln { + const cl_GV_number copy (const cl_GV_number& v) { var uintL len = v.length(); @@ -17,3 +19,5 @@ const cl_GV_number copy (const cl_GV_number& v) cl_GV_number::copy_elements(v,0,w,0,len); return w; } + +} // namespace cln diff --git a/src/vector/cl_GV_number_debug.cc b/src/vector/cl_GV_number_debug.cc index 1e9e2bd..37745b2 100644 --- a/src/vector/cl_GV_number_debug.cc +++ b/src/vector/cl_GV_number_debug.cc @@ -8,15 +8,17 @@ // Implementation. -#include "cl_output.h" -#include "cl_GV_number.h" -#include "cl_io.h" +#include "cln/output.h" +#include "cln/GV_number.h" +#include "cln/io.h" #include "cl_GV_io.h" +namespace cln { + static void print_for_debug (cl_ostream stream, const cl_print_flags& flags, const cl_number& z) { unused stream; // must be cl_debugout - unused flags; // must be cl_default_print_flags + unused flags; // must be default_print_flags z.debug_print(); } @@ -24,15 +26,17 @@ static void dprint (cl_heap* pointer) { var const cl_GV_number& obj = *(const cl_GV_number*)&pointer; fprint(cl_debugout, "(cl_GV_number) "); - print_vector(cl_debugout,cl_default_print_flags,&print_for_debug,obj); + print_vector(cl_debugout,default_print_flags,&print_for_debug,obj); } AT_INITIALIZATION(dprint_GV_number) { cl_register_type_printer(cl_class_gvector_number,dprint); } -// This dummy links in this module when requires it. +// This dummy links in this module when requires it. int cl_GV_number_debug_module; extern int cl_GV_I_debug_module; static void* dummy[] = { &dummy, &cl_GV_I_debug_module }; + +} // namespace cln diff --git a/src/vector/cl_SV_copy.cc b/src/vector/cl_SV_copy.cc index b3a0155..9277c29 100644 --- a/src/vector/cl_SV_copy.cc +++ b/src/vector/cl_SV_copy.cc @@ -5,17 +5,19 @@ // Specification. #define CL_SV_NO_RANGECHECKS -#include "cl_SV.h" +#include "cln/SV.h" // Implementation. -#include "cl_malloc.h" +#include "cln/malloc.h" + +namespace cln { const cl_SV_any copy (const cl_SV_any& src) { var uintL len = src.length(); - var cl_heap_SV_any* hv = (cl_heap_SV_any*) cl_malloc_hook(sizeof(cl_heap_SV_any)+sizeof(cl_gcobject)*len); + var cl_heap_SV_any* hv = (cl_heap_SV_any*) malloc_hook(sizeof(cl_heap_SV_any)+sizeof(cl_gcobject)*len); hv->refcount = 1; hv->type = src.pointer_type(); new (&hv->v) cl_SV_inner (len); @@ -23,3 +25,5 @@ const cl_SV_any copy (const cl_SV_any& src) init1(cl_gcobject, hv->v[i]) (src[i]); return hv; } + +} // namespace cln diff --git a/src/vector/cl_SV_io.h b/src/vector/cl_SV_io.h index 420266f..eb0da90 100644 --- a/src/vector/cl_SV_io.h +++ b/src/vector/cl_SV_io.h @@ -3,10 +3,11 @@ #ifndef _CL_SV_IO_H #define _CL_SV_IO_H -#include "cl_number_io.h" -#include "cl_SV.h" -#include "cl_SV_number.h" +#include "cln/number_io.h" +#include "cln/SV.h" +#include "cln/SV_number.h" +namespace cln { // Gibt einen Vektor aus. // print_vector(stream,flags,fun,z); @@ -16,5 +17,6 @@ // > vector: Vektor extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_SV_number& vector); +} // namespace cln #endif /* _CL_SV_IO_H */ diff --git a/src/vector/cl_SV_number.cc b/src/vector/cl_SV_number.cc index af45534..d694ab4 100644 --- a/src/vector/cl_SV_number.cc +++ b/src/vector/cl_SV_number.cc @@ -6,13 +6,14 @@ CL_PROVIDE(cl_SV_number) // Specification. -#include "cl_SV_number.h" +#include "cln/SV_number.h" // Implementation. -#include "cl_abort.h" +#include "cln/abort.h" +namespace cln { static void cl_svector_number_destructor (cl_heap* pointer) { @@ -30,7 +31,7 @@ cl_class cl_class_svector_number = { cl_heap_SV_number* cl_make_heap_SV_number_uninit (uintL len) { - var cl_heap_SV_number* hv = (cl_heap_SV_number*) cl_malloc_hook(sizeof(cl_heap_SV_number)+sizeof(cl_number)*len); + var cl_heap_SV_number* hv = (cl_heap_SV_number*) malloc_hook(sizeof(cl_heap_SV_number)+sizeof(cl_number)*len); hv->refcount = 1; hv->type = &cl_class_svector_number; new (&hv->v) cl_SV_inner (len); @@ -40,7 +41,7 @@ cl_heap_SV_number* cl_make_heap_SV_number_uninit (uintL len) cl_heap_SV_number* cl_make_heap_SV_number (uintL len) { - var cl_heap_SV_number* hv = (cl_heap_SV_number*) cl_malloc_hook(sizeof(cl_heap_SV_number)+sizeof(cl_number)*len); + var cl_heap_SV_number* hv = (cl_heap_SV_number*) malloc_hook(sizeof(cl_heap_SV_number)+sizeof(cl_number)*len); hv->refcount = 1; hv->type = &cl_class_svector_number; new (&hv->v) cl_SV_inner (len); @@ -52,4 +53,6 @@ cl_heap_SV_number* cl_make_heap_SV_number (uintL len) // An empty vector. const cl_SV_number cl_null_SV_number = cl_SV_number((uintL)0); +} // namespace cln + CL_PROVIDE_END(cl_SV_number) diff --git a/src/vector/cl_SV_number_debug.cc b/src/vector/cl_SV_number_debug.cc index 8060081..3990903 100644 --- a/src/vector/cl_SV_number_debug.cc +++ b/src/vector/cl_SV_number_debug.cc @@ -8,15 +8,17 @@ // Implementation. -#include "cl_output.h" -#include "cl_SV_number.h" -#include "cl_io.h" +#include "cln/output.h" +#include "cln/SV_number.h" +#include "cln/io.h" #include "cl_SV_io.h" +namespace cln { + static void print_for_debug (cl_ostream stream, const cl_print_flags& flags, const cl_number& z) { unused stream; // must be cl_debugout - unused flags; // must be cl_default_print_flags + unused flags; // must be default_print_flags z.debug_print(); } @@ -24,10 +26,12 @@ static void dprint (cl_heap* pointer) { var const cl_SV_number& obj = *(const cl_SV_number*)&pointer; fprint(cl_debugout, "(cl_SV_number) "); - print_vector(cl_debugout,cl_default_print_flags,&print_for_debug,obj); + print_vector(cl_debugout,default_print_flags,&print_for_debug,obj); } AT_INITIALIZATION(dprint_SV_number) { cl_register_type_printer(cl_class_svector_number,dprint); } -// This dummy links in this module when requires it. +// This dummy links in this module when requires it. int cl_SV_number_debug_module; + +} // namespace cln diff --git a/src/vector/cl_SV_ringelt.cc b/src/vector/cl_SV_ringelt.cc index 0af6c93..4071daa 100644 --- a/src/vector/cl_SV_ringelt.cc +++ b/src/vector/cl_SV_ringelt.cc @@ -6,13 +6,14 @@ CL_PROVIDE(cl_SV_ringelt) // Specification. -#include "cl_SV_ringelt.h" +#include "cln/SV_ringelt.h" // Implementation. -#include "cl_abort.h" +#include "cln/abort.h" +namespace cln { static void cl_svector_ringelt_destructor (cl_heap* pointer) { @@ -30,7 +31,7 @@ cl_class cl_class_svector_ringelt = { cl_heap_SV_ringelt* cl_make_heap_SV_ringelt_uninit (uintL len) { - var cl_heap_SV_ringelt* hv = (cl_heap_SV_ringelt*) cl_malloc_hook(sizeof(cl_heap_SV_ringelt)+sizeof(_cl_ring_element)*len); + var cl_heap_SV_ringelt* hv = (cl_heap_SV_ringelt*) malloc_hook(sizeof(cl_heap_SV_ringelt)+sizeof(_cl_ring_element)*len); hv->refcount = 1; hv->type = &cl_class_svector_ringelt; new (&hv->v) cl_SV_inner<_cl_ring_element> (len); @@ -40,7 +41,7 @@ cl_heap_SV_ringelt* cl_make_heap_SV_ringelt_uninit (uintL len) cl_heap_SV_ringelt* cl_make_heap_SV_ringelt (uintL len) { - var cl_heap_SV_ringelt* hv = (cl_heap_SV_ringelt*) cl_malloc_hook(sizeof(cl_heap_SV_ringelt)+sizeof(_cl_ring_element)*len); + var cl_heap_SV_ringelt* hv = (cl_heap_SV_ringelt*) malloc_hook(sizeof(cl_heap_SV_ringelt)+sizeof(_cl_ring_element)*len); hv->refcount = 1; hv->type = &cl_class_svector_ringelt; new (&hv->v) cl_SV_inner<_cl_ring_element> (len); @@ -52,4 +53,6 @@ cl_heap_SV_ringelt* cl_make_heap_SV_ringelt (uintL len) // An empty vector. const cl_SV_ringelt cl_null_SV_ringelt = cl_SV_ringelt((uintL)0); +} // namespace cln + CL_PROVIDE_END(cl_SV_ringelt) diff --git a/src/vector/cl_SV_ringelt_debug.cc b/src/vector/cl_SV_ringelt_debug.cc index b46a9d6..0133fc0 100644 --- a/src/vector/cl_SV_ringelt_debug.cc +++ b/src/vector/cl_SV_ringelt_debug.cc @@ -8,8 +8,10 @@ // Implementation. -#include "cl_SV_ringelt.h" -#include "cl_io.h" +#include "cln/SV_ringelt.h" +#include "cln/io.h" + +namespace cln { extern void cl_dprint_unknown (cl_heap* pointer); static void dprint (cl_heap* pointer) @@ -21,5 +23,7 @@ static void dprint (cl_heap* pointer) AT_INITIALIZATION(dprint_SV_ringelt) { cl_register_type_printer(cl_class_svector_ringelt,dprint); } -// This dummy links in this module when requires it. +// This dummy links in this module when requires it. int cl_SV_ringelt_debug_module; + +} // namespace cln diff --git a/src/vector/output/cl_GV_number_aprint.cc b/src/vector/output/cl_GV_number_aprint.cc index dae97cf..aaebb8a 100644 --- a/src/vector/output/cl_GV_number_aprint.cc +++ b/src/vector/output/cl_GV_number_aprint.cc @@ -4,16 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_GV_complex.h" -#include "cl_GV_real.h" -#include "cl_GV_rational.h" -#include "cl_GV_integer.h" +#include "cln/GV_complex.h" +#include "cln/GV_real.h" +#include "cln/GV_rational.h" +#include "cln/GV_integer.h" #include "cl_GV_io.h" // Implementation. -#include "cl_output.h" +#include "cln/output.h" + +namespace cln { void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* printfun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_GV_number& vector) { @@ -37,3 +39,5 @@ void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* print else fprintchar(stream,']'); } + +} // namespace cln diff --git a/src/vector/output/cl_SV_aprint.cc b/src/vector/output/cl_SV_aprint.cc index 1891c25..42cc1fd 100644 --- a/src/vector/output/cl_SV_aprint.cc +++ b/src/vector/output/cl_SV_aprint.cc @@ -4,16 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_SV_ringelt.h" +#include "cln/SV_ringelt.h" // Implementation. -#include "cl_output.h" +#include "cln/output.h" + +namespace cln { void fprint (cl_ostream stream, const cl_ring& R, const cl_SV_ringelt& vector) { - var const cl_print_flags& flags = cl_default_print_flags; + var const cl_print_flags& flags = default_print_flags; var uintL len = vector.length(); if (flags.vector_syntax == vsyntax_commonlisp) { fprintchar(stream,'#'); @@ -33,3 +35,5 @@ void fprint (cl_ostream stream, const cl_ring& R, const cl_SV_ringelt& vector) else fprintchar(stream,']'); } + +} // namespace cln diff --git a/src/vector/output/cl_SV_number_aprint.cc b/src/vector/output/cl_SV_number_aprint.cc index 762aa22..fefd174 100644 --- a/src/vector/output/cl_SV_number_aprint.cc +++ b/src/vector/output/cl_SV_number_aprint.cc @@ -4,16 +4,18 @@ #include "cl_sysdep.h" // Specification. -#include "cl_SV_complex.h" -#include "cl_SV_real.h" -#include "cl_SV_rational.h" -#include "cl_SV_integer.h" +#include "cln/SV_complex.h" +#include "cln/SV_real.h" +#include "cln/SV_rational.h" +#include "cln/SV_integer.h" #include "cl_SV_io.h" // Implementation. -#include "cl_output.h" +#include "cln/output.h" + +namespace cln { void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* printfun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_SV_number& vector) { @@ -36,3 +38,5 @@ void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* print else fprintchar(stream,']'); } + +} // namespace cln diff --git a/tests/Makefile.in b/tests/Makefile.in index 3d696c0..3807271 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -177,6 +177,7 @@ mostlyclean : clean clean : force $(RM) *.s *.o *.a exam tests main a.out core + $(RM) -r .libs _libs distclean : clean $(RM) config.status config.log config.cache Makefile diff --git a/tests/exam.cc b/tests/exam.cc index b1a4e7b..683a631 100644 --- a/tests/exam.cc +++ b/tests/exam.cc @@ -1,6 +1,9 @@ #include -#include -#include +#include +#include + +using namespace std; +using namespace cln; extern int test_integer(); extern int test_rational(); @@ -38,10 +41,10 @@ int test_all (void) int main () { if (!test_all()) { - fprint (cl_stdout, "Tests passed.\n"); + cout << "Tests passed." << endl; exit(0); } else { - fprint (cl_stdout, "Tests failed.\n"); + cout << "Tests failed" << endl; exit(1); } } diff --git a/tests/exam.h b/tests/exam.h index 6d5b2dc..a2e6f70 100644 --- a/tests/exam.h +++ b/tests/exam.h @@ -1,8 +1,10 @@ #ifndef _EXAM_H #define _EXAM_H -#include -#include +#include +#include +using namespace std; +using namespace cln; // Michael Stoll 23. 3. 1993 // C++ version: Bruno Haible 1.11.1995 @@ -51,16 +53,9 @@ static int test_##typename##_##opname (void) \ rtype computed_result = arg1 op arg2; \ rtype result = rtype(test.result); \ if (computed_result != result) { \ - fprint(cl_stderr, "Error in " #typename "_" #opname "_tests["); \ - fprintdecimal(cl_stderr, i); \ - fprint(cl_stderr, "] !\n"); \ - fprint(cl_stderr, "Result should be: "); \ - fprint(cl_stderr, result); \ - fprint(cl_stderr, "\n"); \ - fprint(cl_stderr, "Result computed : "); \ - fprint(cl_stderr, computed_result); \ - fprint(cl_stderr, "\n"); \ - fprint(cl_stderr, "\n"); \ + stderr << "Error in " #typename "_" #opname "_tests[" << i << "] !" << endl; \ + stderr << "Result should be: " << result << endl; \ + stderr << "Result computed : " << computed_result << endl << endl; \ error = 1; \ } \ } \ @@ -79,20 +74,9 @@ static int test_##typename##_floor (void) \ cl_I result1 = cl_I(test.result1); \ type result2 = type(test.result2); \ if ((computed_result.quotient != result1) || (computed_result.remainder != result2)) { \ - fprint(cl_stderr, "Error in " #typename "_floor_tests["); \ - fprintdecimal(cl_stderr, i); \ - fprint(cl_stderr, "] !\n"); \ - fprint(cl_stderr, "Results should be: "); \ - fprint(cl_stderr, result1); \ - fprint(cl_stderr, ", "); \ - fprint(cl_stderr, result2); \ - fprint(cl_stderr, "\n"); \ - fprint(cl_stderr, "Results computed : "); \ - fprint(cl_stderr, computed_result.quotient); \ - fprint(cl_stderr, ", "); \ - fprint(cl_stderr, computed_result.remainder); \ - fprint(cl_stderr, "\n"); \ - fprint(cl_stderr, "\n"); \ + stderr << "Error in " #typename "_floor_tests[" << i << endl; \ + stderr << "Results should be: " << result1 << ", " << result2 << endl; \ + stderr << "Results computed : " << computed_result.quotient << ", " << computed_result.remainder << endl << endl; \ error = 1; \ } \ } \ diff --git a/tests/exam_DF_div.cc b/tests/exam_DF_div.cc index 02edee8..1eff8ac 100644 --- a/tests/exam_DF_div.cc +++ b/tests/exam_DF_div.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static div_test dfloat_div_tests[] = { diff --git a/tests/exam_DF_floor.cc b/tests/exam_DF_floor.cc index 2ee83d4..2482b05 100644 --- a/tests/exam_DF_floor.cc +++ b/tests/exam_DF_floor.cc @@ -1,8 +1,8 @@ #include "exam.h" -#include -#include -#include -#include +#include +#include +#include +#include static floor_test dfloat_floor_tests[] = { diff --git a/tests/exam_DF_minus.cc b/tests/exam_DF_minus.cc index 09fbad5..c7efe0c 100644 --- a/tests/exam_DF_minus.cc +++ b/tests/exam_DF_minus.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static minus_test dfloat_minus_tests[] = { diff --git a/tests/exam_DF_mul.cc b/tests/exam_DF_mul.cc index 8526f43..460b67c 100644 --- a/tests/exam_DF_mul.cc +++ b/tests/exam_DF_mul.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static mul_test dfloat_mul_tests[] = { diff --git a/tests/exam_DF_plus.cc b/tests/exam_DF_plus.cc index c7e9faf..51df03d 100644 --- a/tests/exam_DF_plus.cc +++ b/tests/exam_DF_plus.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static plus_test dfloat_plus_tests[] = { diff --git a/tests/exam_FF_div.cc b/tests/exam_FF_div.cc index 30ca9c6..20f9cf2 100644 --- a/tests/exam_FF_div.cc +++ b/tests/exam_FF_div.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static div_test ffloat_div_tests[] = { diff --git a/tests/exam_FF_floor.cc b/tests/exam_FF_floor.cc index 00e7922..88609e3 100644 --- a/tests/exam_FF_floor.cc +++ b/tests/exam_FF_floor.cc @@ -1,8 +1,8 @@ #include "exam.h" -#include -#include -#include -#include +#include +#include +#include +#include static floor_test ffloat_floor_tests[] = { diff --git a/tests/exam_FF_minus.cc b/tests/exam_FF_minus.cc index 7544001..7871d17 100644 --- a/tests/exam_FF_minus.cc +++ b/tests/exam_FF_minus.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static minus_test ffloat_minus_tests[] = { diff --git a/tests/exam_FF_mul.cc b/tests/exam_FF_mul.cc index 396225c..ab728f2 100644 --- a/tests/exam_FF_mul.cc +++ b/tests/exam_FF_mul.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static mul_test ffloat_mul_tests[] = { diff --git a/tests/exam_FF_plus.cc b/tests/exam_FF_plus.cc index 4000735..0a71b3b 100644 --- a/tests/exam_FF_plus.cc +++ b/tests/exam_FF_plus.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static plus_test ffloat_plus_tests[] = { diff --git a/tests/exam_I_div.cc b/tests/exam_I_div.cc index 3311796..a96cd65 100644 --- a/tests/exam_I_div.cc +++ b/tests/exam_I_div.cc @@ -1,8 +1,8 @@ #include "exam.h" -#include -#include -#include -#include +#include +#include +#include +#include static div_test integer_div_tests[] = { diff --git a/tests/exam_I_floor.cc b/tests/exam_I_floor.cc index 2030722..e865589 100644 --- a/tests/exam_I_floor.cc +++ b/tests/exam_I_floor.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static floor_test integer_floor_tests[] = { diff --git a/tests/exam_I_gcd.cc b/tests/exam_I_gcd.cc index 9d2b7b4..2d53660 100644 --- a/tests/exam_I_gcd.cc +++ b/tests/exam_I_gcd.cc @@ -1,21 +1,20 @@ -#include -#include -#include +#include +#include +#include + +using namespace std; +using namespace cln; #define ASSERT(expr) \ - if (!(expr)) { \ - fprint(cl_stderr,"Assertion failed! File "); \ - fprint(cl_stderr,__FILE__); \ - fprint(cl_stderr,", line "); \ - fprintdecimal(cl_stderr,__LINE__); \ - fprint(cl_stderr,".\n"); \ - error = 1; \ + if (!(expr)) { \ + stderr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl; \ + error = 1; \ } struct gcd_test { const char * arg1; - const char * arg2; - const char * result; + const char * arg2; + const char * result; }; #define num_elements(array) (sizeof(array)/sizeof(array[0])) @@ -32,16 +31,9 @@ static int test_##typename##_##opname (void) \ rtype computed_result = opname(arg1,arg2); \ rtype result = rtype(test.result); \ if (computed_result != result) { \ - fprint(cl_stderr, "Error in " #typename "_" #opname "_tests["); \ - fprintdecimal(cl_stderr, i); \ - fprint(cl_stderr, "] !\n"); \ - fprint(cl_stderr, "Result should be: "); \ - fprint(cl_stderr, result); \ - fprint(cl_stderr, "\n"); \ - fprint(cl_stderr, "Result computed : "); \ - fprint(cl_stderr, computed_result); \ - fprint(cl_stderr, "\n"); \ - fprint(cl_stderr, "\n"); \ + stderr << "Error in " #typename "_" #opname "_tests[" << i << "] !" << endl; \ + stderr << "Result should be: " << result << endl; \ + stderr << "Result computed : " << computed_result << endl << endl; \ error = 1; \ } \ } \ diff --git a/tests/exam_I_minus.cc b/tests/exam_I_minus.cc index 29fca86..057130b 100644 --- a/tests/exam_I_minus.cc +++ b/tests/exam_I_minus.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static minus_test integer_minus_tests[] = { diff --git a/tests/exam_I_mul.cc b/tests/exam_I_mul.cc index f90d61e..ca830ff 100644 --- a/tests/exam_I_mul.cc +++ b/tests/exam_I_mul.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static mul_test integer_mul_tests[] = { diff --git a/tests/exam_I_plus.cc b/tests/exam_I_plus.cc index cef57c1..2a804c7 100644 --- a/tests/exam_I_plus.cc +++ b/tests/exam_I_plus.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static plus_test integer_plus_tests[] = { diff --git a/tests/exam_LF_div.cc b/tests/exam_LF_div.cc index fb13927..d54ed44 100644 --- a/tests/exam_LF_div.cc +++ b/tests/exam_LF_div.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static div_test lfloat_div_tests[] = { diff --git a/tests/exam_LF_floor.cc b/tests/exam_LF_floor.cc index 795b856..895b171 100644 --- a/tests/exam_LF_floor.cc +++ b/tests/exam_LF_floor.cc @@ -1,8 +1,8 @@ #include "exam.h" -#include -#include -#include -#include +#include +#include +#include +#include static floor_test lfloat_floor_tests[] = { diff --git a/tests/exam_LF_minus.cc b/tests/exam_LF_minus.cc index 2ba301a..1c57e5e 100644 --- a/tests/exam_LF_minus.cc +++ b/tests/exam_LF_minus.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static minus_test lfloat_minus_tests[] = { diff --git a/tests/exam_LF_mul.cc b/tests/exam_LF_mul.cc index 953fda7..68af8ae 100644 --- a/tests/exam_LF_mul.cc +++ b/tests/exam_LF_mul.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static mul_test lfloat_mul_tests[] = { diff --git a/tests/exam_LF_plus.cc b/tests/exam_LF_plus.cc index 67bc9c1..c249a48 100644 --- a/tests/exam_LF_plus.cc +++ b/tests/exam_LF_plus.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static plus_test lfloat_plus_tests[] = { diff --git a/tests/exam_RA_div.cc b/tests/exam_RA_div.cc index 605dbe9..43e604d 100644 --- a/tests/exam_RA_div.cc +++ b/tests/exam_RA_div.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static div_test rational_div_tests[] = { diff --git a/tests/exam_RA_floor.cc b/tests/exam_RA_floor.cc index fca1fdc..5e70d92 100644 --- a/tests/exam_RA_floor.cc +++ b/tests/exam_RA_floor.cc @@ -1,8 +1,8 @@ #include "exam.h" -#include -#include -#include -#include +#include +#include +#include +#include static floor_test rational_floor_tests[] = { diff --git a/tests/exam_RA_minus.cc b/tests/exam_RA_minus.cc index fa38820..eb33d53 100644 --- a/tests/exam_RA_minus.cc +++ b/tests/exam_RA_minus.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static minus_test rational_minus_tests[] = { diff --git a/tests/exam_RA_mul.cc b/tests/exam_RA_mul.cc index 0beabc2..70bad59 100644 --- a/tests/exam_RA_mul.cc +++ b/tests/exam_RA_mul.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static mul_test rational_mul_tests[] = { diff --git a/tests/exam_RA_plus.cc b/tests/exam_RA_plus.cc index db60c3c..5cd8ae9 100644 --- a/tests/exam_RA_plus.cc +++ b/tests/exam_RA_plus.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static plus_test rational_plus_tests[] = { diff --git a/tests/exam_SF_div.cc b/tests/exam_SF_div.cc index 49caa43..2614ef2 100644 --- a/tests/exam_SF_div.cc +++ b/tests/exam_SF_div.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static div_test sfloat_div_tests[] = { diff --git a/tests/exam_SF_floor.cc b/tests/exam_SF_floor.cc index d31ec96..4e58b11 100644 --- a/tests/exam_SF_floor.cc +++ b/tests/exam_SF_floor.cc @@ -1,8 +1,8 @@ #include "exam.h" -#include -#include -#include -#include +#include +#include +#include +#include static floor_test sfloat_floor_tests[] = { diff --git a/tests/exam_SF_minus.cc b/tests/exam_SF_minus.cc index e5fc941..48bf2b7 100644 --- a/tests/exam_SF_minus.cc +++ b/tests/exam_SF_minus.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static minus_test sfloat_minus_tests[] = { diff --git a/tests/exam_SF_mul.cc b/tests/exam_SF_mul.cc index fbc6195..cced4d9 100644 --- a/tests/exam_SF_mul.cc +++ b/tests/exam_SF_mul.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static mul_test sfloat_mul_tests[] = { diff --git a/tests/exam_SF_plus.cc b/tests/exam_SF_plus.cc index 3a9742b..309b5ca 100644 --- a/tests/exam_SF_plus.cc +++ b/tests/exam_SF_plus.cc @@ -1,6 +1,6 @@ #include "exam.h" -#include -#include +#include +#include static plus_test sfloat_plus_tests[] = { diff --git a/tests/main.cc b/tests/main.cc index 6978abd..23aaff9 100644 --- a/tests/main.cc +++ b/tests/main.cc @@ -1,28 +1,28 @@ //#define WANT_OBFUSCATING_OPERATORS -#include -#include -//#include -//#include -//#include -//#include -//#include -#include -#include -//#include -//#include -#include +#include +#include +//#include +//#include +//#include +//#include +//#include +#include +#include +//#include +//#include +#include #define DUMP(expr) \ - fprint(cl_stdout, #expr" = "); fprint(cl_stdout, expr); fprint(cl_stdout, "\n"); + fprint(stdout, #expr" = "); fprint(stdout, expr); fprint(stdout, "\n"); int main (int argc, char* argv[]) { (void)argc; (void)argv; #if 0 - cl_F pi = cl_pi((cl_float_format_t)10000); - fprint(cl_stdout, pi); - fprint(cl_stdout, "\n"); + cl_F archimedes = pi((float_format_t)10000); + fprint(stdout, archimedes); + fprint(stdout, "\n"); #endif #if 0 @@ -30,11 +30,11 @@ int main (int argc, char* argv[]) cl_FF x1 = "-0.2173f0"; cl_FF x2 = "5.5084f9"; cl_FF y = "-1.19698f9"; - fprint(cl_stdout, "x1 = "); print_float_binary(cl_stdout,x1); fprint(cl_stdout, " = "); fprint(cl_stdout,x1); fprint(cl_stdout, "\n"); - fprint(cl_stdout, "x2 = "); print_float_binary(cl_stdout,x2); fprint(cl_stdout, " = "); fprint(cl_stdout,x2); fprint(cl_stdout, "\n"); - fprint(cl_stdout, "y = "); print_float_binary(cl_stdout,y); fprint(cl_stdout, " = "); fprint(cl_stdout,y); fprint(cl_stdout, "\n"); + fprint(stdout, "x1 = "); print_float_binary(stdout,x1); fprint(stdout, " = "); fprint(stdout,x1); fprint(stdout, "\n"); + fprint(stdout, "x2 = "); print_float_binary(stdout,x2); fprint(stdout, " = "); fprint(stdout,x2); fprint(stdout, "\n"); + fprint(stdout, "y = "); print_float_binary(stdout,y); fprint(stdout, " = "); fprint(stdout,y); fprint(stdout, "\n"); cl_FF x = x1*x2; - fprint(cl_stdout, "x1*x2 = "); print_float_binary(cl_stdout,x); fprint(cl_stdout, " = "); fprint(cl_stdout,x); fprint(cl_stdout, "\n"); + fprint(stdout, "x1*x2 = "); print_float_binary(stdout,x); fprint(stdout, " = "); fprint(stdout,x); fprint(stdout, "\n"); #endif #if 0 @@ -42,8 +42,8 @@ int main (int argc, char* argv[]) cl_I y = ++x; x *= 2; x++; - fprint(cl_stdout, "x = "); fprint(cl_stdout, x); fprint(cl_stdout, "\n"); - fprint(cl_stdout, "y = "); fprint(cl_stdout, y); fprint(cl_stdout, "\n"); + fprint(stdout, "x = "); fprint(stdout, x); fprint(stdout, "\n"); + fprint(stdout, "y = "); fprint(stdout, y); fprint(stdout, "\n"); #endif #if 0 @@ -59,7 +59,7 @@ int main (int argc, char* argv[]) #if 0 cl_I m = "79228162513111556826425457664"; cl_I a = "19787815858762768436681494528"; - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_I b = R->retract(R->canonhom(a)); cl_I c = mod(a,abs(m)); DUMP(b); @@ -80,14 +80,14 @@ int main (int argc, char* argv[]) #endif #if 0 - cl_float_format_t f = cl_float_format(atoi(argv[1])); - extern cl_LF cl_zeta3 (uintC len); + float_format_t f = float_format(atoi(argv[1])); + extern cl_LF zeta3 (uintC len); uintC len = (uintL)f/intDsize+1; - { CL_TIMING; cout << cl_zeta(2,f) << endl; } - { CL_TIMING; cout << expt(cl_pi(f),2)/6 << endl; } - { CL_TIMING; cout << cl_zeta(3,f) << endl; } - { CL_TIMING; cout << cl_zeta3(len) << endl; } - { CL_TIMING; cout << cl_zeta(4,f) << endl; } + { CL_TIMING; cout << zeta(2,f) << endl; } + { CL_TIMING; cout << expt(pi(f),2)/6 << endl; } + { CL_TIMING; cout << zeta(3,f) << endl; } + { CL_TIMING; cout << zeta3(len) << endl; } + { CL_TIMING; cout << zeta(4,f) << endl; } #endif cl_I a = cl_I(argv[1]); diff --git a/tests/test.h b/tests/test.h index ae3c3c4..9e17d77 100644 --- a/tests/test.h +++ b/tests/test.h @@ -1,76 +1,43 @@ -#include +#include +using namespace std; +using namespace cln; #define ASSERT(expr) \ if (!(expr)) { \ - fprint(cl_stderr,"Assertion failed! File "); \ - fprint(cl_stderr,__FILE__); \ - fprint(cl_stderr,", line "); \ - fprintdecimal(cl_stderr,__LINE__); \ - fprint(cl_stderr,".\n"); \ + stderr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl; \ error = 1; \ } #define ASSERT1(expr,a) \ if (!(expr)) { \ - fprint(cl_stderr,"Assertion failed! File "); \ - fprint(cl_stderr,__FILE__); \ - fprint(cl_stderr,", line "); \ - fprintdecimal(cl_stderr,__LINE__); \ - fprint(cl_stderr,".\n"); \ - fprint(cl_stderr,#a" = "); \ - fprint(cl_stderr,a); \ - fprint(cl_stderr,"\n"); \ + stderr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl; \ + stderr << #a" = " << a << endl; \ error = 1; \ } #define ASSERT2(expr,a,b) \ if (!(expr)) { \ - fprint(cl_stderr,"Assertion failed! File "); \ - fprint(cl_stderr,__FILE__); \ - fprint(cl_stderr,", line "); \ - fprintdecimal(cl_stderr,__LINE__); \ - fprint(cl_stderr,".\n"); \ - fprint(cl_stderr,#a" = "); \ - fprint(cl_stderr,a); \ - fprint(cl_stderr,"\n"#b" = "); \ - fprint(cl_stderr,b); \ - fprint(cl_stderr,"\n"); \ + stderr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl; \ + stderr << #a" = " << a << endl; \ + stderr << #b" = " << b << endl; \ error = 1; \ } #define ASSERT3(expr,a,b,c) \ if (!(expr)) { \ - fprint(cl_stderr,"Assertion failed! File "); \ - fprint(cl_stderr,__FILE__); \ - fprint(cl_stderr,", line "); \ - fprintdecimal(cl_stderr,__LINE__); \ - fprint(cl_stderr,".\n"); \ - fprint(cl_stderr,#a" = "); \ - fprint(cl_stderr,a); \ - fprint(cl_stderr,"\n"#b" = "); \ - fprint(cl_stderr,b); \ - fprint(cl_stderr,"\n"#c" = "); \ - fprint(cl_stderr,c); \ - fprint(cl_stderr,"\n"); \ + stderr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl; \ + stderr << #a" = " << a << endl; \ + stderr << #b" = " << b << endl; \ + stderr << #c" = " << c << endl; \ error = 1; \ } #define ASSERT4(expr,a,b,c,d) \ if (!(expr)) { \ - fprint(cl_stderr,"Assertion failed! File "); \ - fprint(cl_stderr,__FILE__); \ - fprint(cl_stderr,", line "); \ - fprintdecimal(cl_stderr,__LINE__); \ - fprint(cl_stderr,".\n"); \ - fprint(cl_stderr,#a" = "); \ - fprint(cl_stderr,a); \ - fprint(cl_stderr,"\n"#b" = "); \ - fprint(cl_stderr,b); \ - fprint(cl_stderr,"\n"#c" = "); \ - fprint(cl_stderr,c); \ - fprint(cl_stderr,"\n"#d" = "); \ - fprint(cl_stderr,d); \ - fprint(cl_stderr,"\n"); \ + stderr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl; \ + stderr << #a" = " << a << endl; \ + stderr << #b" = " << b << endl; \ + stderr << #c" = " << c << endl; \ + stderr << #d" = " << d << endl; \ error = 1; \ } - diff --git a/tests/test_I.cc b/tests/test_I.cc index 06dc83b..6073620 100644 --- a/tests/test_I.cc +++ b/tests/test_I.cc @@ -1,4 +1,4 @@ -#include +#include // Elementary operations. extern int test_I_abs (int iterations); @@ -46,9 +46,10 @@ extern int test_I_sqrtp (int iterations); extern int test_I_GV (int iterations); #define RUN(tester,iterations) \ - fprint(cl_stdout,"Testing "#tester"...\n"); \ + std::cout << "Testing "#tester"..." << std::endl; \ error |= tester (iterations); + int test_I (int iterations) { int error = 0; diff --git a/tests/test_I.h b/tests/test_I.h index 26d08f6..c613035 100644 --- a/tests/test_I.h +++ b/tests/test_I.h @@ -1,4 +1,4 @@ -#include -#include +#include +#include #include "test.h" diff --git a/tests/test_I_GV.cc b/tests/test_I_GV.cc index cfb3185..6ee037d 100644 --- a/tests/test_I_GV.cc +++ b/tests/test_I_GV.cc @@ -1,5 +1,5 @@ #include "test_I.h" -#include "cl_GV_integer.h" +#include "cln/GV_integer.h" int test_I_GV (int iterations) { @@ -15,11 +15,7 @@ int test_I_GV (int iterations) for (j = 0; j < len; j++) v[j] = mod(a*(j*j),M); for (j = len-1; j >= 0; j--) -#if !(defined(__GNUC__) && (__GNUC_MINOR__ < 8)) ASSERT4(v[j] == mod(a*(j*j),M), m,len,M,j); -#else // work around g++ 2.7.2 bug - ASSERT4(v[j] == mod(a*(j*j),M), (cl_I)m,(cl_I)len,M,(cl_I)j); -#endif } return error; } diff --git a/tests/test_I_compare.cc b/tests/test_I_compare.cc index cd530d3..521ddeb 100644 --- a/tests/test_I_compare.cc +++ b/tests/test_I_compare.cc @@ -8,14 +8,14 @@ int test_I_compare (int iterations) for (i = iterations; i > 0; i--) { cl_I a = testrandom_I(); cl_I b = testrandom_I(); - ASSERT2(cl_compare(a,b) == -cl_compare(b,a), a,b); + ASSERT2(compare(a,b) == -compare(b,a), a,b); } // Check a < b <==> a+c < b+c . for (i = iterations; i > 0; i--) { cl_I a = testrandom_I(); cl_I b = testrandom_I(); cl_I c = testrandom_I(); - ASSERT3(cl_compare(a,b) == cl_compare(a+c,b+c), a,b,c); + ASSERT3(compare(a,b) == compare(a+c,b+c), a,b,c); } return error; } diff --git a/tests/test_I_ilength.cc b/tests/test_I_ilength.cc index 0332c55..9a45a4d 100644 --- a/tests/test_I_ilength.cc +++ b/tests/test_I_ilength.cc @@ -9,9 +9,6 @@ int test_I_integer_length (int iterations) cl_I a = testrandom_I(); uintL l = integer_length(a); if (a >= 0) { -#if !(defined(__GNUC__) && (__GNUC_MINOR__ < 8)) - ASSERT1(a < ash(1,l) && (a == 0 ? l == 0 : l > 0 && a >= ash(1,l-1)), a); -#else // work around g++ 2.7.0 bug int b = 0; if (a < ash(1,l)) { if (a == 0) @@ -20,11 +17,7 @@ int test_I_integer_length (int iterations) b = (l > 0 && a >= ash(1,l-1)); } ASSERT1(b, a); -#endif } else { -#if !(defined(__GNUC__) && (__GNUC_MINOR__ < 8)) - ASSERT1(a >= ash(-1,l) && (a == -1 ? l == 0 : l > 0 && a < ash(-1,l-1)), a); -#else // work around g++ 2.7.0 bug int b = 0; if (a >= ash(-1,l)) { if (a == -1) @@ -33,7 +26,6 @@ int test_I_integer_length (int iterations) b = (l > 0 && a < ash(-1,l-1)); } ASSERT1(b, a); -#endif } } return error; diff --git a/tests/test_MI.cc b/tests/test_MI.cc index 6ae77f6..691565d 100644 --- a/tests/test_MI.cc +++ b/tests/test_MI.cc @@ -1,4 +1,4 @@ -#include +#include #include "cl_macros.h" extern int test_MI_canonhom (int iterations); @@ -10,7 +10,7 @@ extern int test_MI_div (int iterations); extern int test_MI_expt (int iterations); #define RUN(tester,iterations) \ - fprint(cl_stdout,"Testing "#tester"...\n"); \ + std::cout << "Testing "#tester"..." << std::endl; \ error |= tester (iterations); int test_MI (int iterations) diff --git a/tests/test_MI.h b/tests/test_MI.h index f4a8337..99a6aee 100644 --- a/tests/test_MI.h +++ b/tests/test_MI.h @@ -1,5 +1,5 @@ -#include -#include -#include +#include +#include +#include #include "test.h" diff --git a/tests/test_MI_canonhom.cc b/tests/test_MI_canonhom.cc index 5fd2b97..87b4452 100644 --- a/tests/test_MI_canonhom.cc +++ b/tests/test_MI_canonhom.cc @@ -7,7 +7,7 @@ int test_MI_canonhom (int iterations) // Check canonhom followed by retract. for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_I a = testrandom_I(); ASSERT2(R->retract(R->canonhom(a)) == (m==0 ? a : mod(a,abs(m))), m,a); } diff --git a/tests/test_MI_div.cc b/tests/test_MI_div.cc index fb64be2..033ab83 100644 --- a/tests/test_MI_div.cc +++ b/tests/test_MI_div.cc @@ -7,7 +7,7 @@ int test_MI_div (int iterations) // Check against multiplication. for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_I ai = testrandom_I(); if (gcd(m,ai)==1) { cl_MI a = R->canonhom(ai); diff --git a/tests/test_MI_expt.cc b/tests/test_MI_expt.cc index c976d14..efa7e8a 100644 --- a/tests/test_MI_expt.cc +++ b/tests/test_MI_expt.cc @@ -4,10 +4,10 @@ int test_MI_expt (int iterations) { int error = 0; int i; - // Check special cases 0, 1, 2. + // Check special caSes 0, 1, 2. for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_MI a = R->canonhom(testrandom_I()); ASSERT2(expt(a,0) == R->one(), m,a); ASSERT2(expt(a,1) == a, m,a); @@ -16,7 +16,7 @@ int test_MI_expt (int iterations) // Check special cases -1, -2. for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_I ai = testrandom_I(); if (gcd(m,ai)==1) { cl_MI a = R->canonhom(ai); @@ -29,7 +29,7 @@ int test_MI_expt (int iterations) for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); if (!zerop(m)) { // avoid generating huge numbers - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_MI a = R->canonhom(testrandom_I()); cl_MI b = R->canonhom(testrandom_I()); cl_I e = abs(testrandom_I()); @@ -40,7 +40,7 @@ int test_MI_expt (int iterations) for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); if (!zerop(m)) { // avoid generating huge numbers - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_MI a = R->canonhom(testrandom_I()); cl_I e = abs(testrandom_I()); cl_I f = abs(testrandom_I()); diff --git a/tests/test_MI_minus.cc b/tests/test_MI_minus.cc index 7694f0f..08ae038 100644 --- a/tests/test_MI_minus.cc +++ b/tests/test_MI_minus.cc @@ -7,7 +7,7 @@ int test_MI_minus (int iterations) // Check anti-commutativity. for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_MI a = R->canonhom(testrandom_I()); cl_MI b = R->canonhom(testrandom_I()); cl_MI z = R->zero(); @@ -16,7 +16,7 @@ int test_MI_minus (int iterations) // Check associativity. for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_MI a = R->canonhom(testrandom_I()); cl_MI b = R->canonhom(testrandom_I()); cl_MI c = R->canonhom(testrandom_I()); @@ -25,7 +25,7 @@ int test_MI_minus (int iterations) // Check special case 0. for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_MI a = R->canonhom(testrandom_I()); cl_MI z = R->zero(); ASSERT2(a-z == a, m,a); diff --git a/tests/test_MI_mul.cc b/tests/test_MI_mul.cc index 0b733b8..f06ea2b 100644 --- a/tests/test_MI_mul.cc +++ b/tests/test_MI_mul.cc @@ -7,7 +7,7 @@ int test_MI_mul (int iterations) // Check commutativity. for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_MI a = R->canonhom(testrandom_I()); cl_MI b = R->canonhom(testrandom_I()); ASSERT3(a*b == b*a, m,a,b); @@ -15,7 +15,7 @@ int test_MI_mul (int iterations) // Check associativity. for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_MI a = R->canonhom(testrandom_I()); cl_MI b = R->canonhom(testrandom_I()); cl_MI c = R->canonhom(testrandom_I()); @@ -24,7 +24,7 @@ int test_MI_mul (int iterations) // Check second binomial formula. for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_MI a = R->canonhom(testrandom_I()); cl_MI b = R->canonhom(testrandom_I()); ASSERT3((a+b)*(a-b) == a*a-b*b, m,a,b); @@ -32,7 +32,7 @@ int test_MI_mul (int iterations) // Check distributive formula. for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_MI a = R->canonhom(testrandom_I()); cl_MI b = R->canonhom(testrandom_I()); cl_MI c = R->canonhom(testrandom_I()); @@ -41,7 +41,7 @@ int test_MI_mul (int iterations) // Check special cases 0, 1, -1. for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_MI a = R->canonhom(testrandom_I()); cl_MI z = R->zero(); cl_MI o = R->one(); diff --git a/tests/test_MI_plus.cc b/tests/test_MI_plus.cc index 492bf18..e83ca0d 100644 --- a/tests/test_MI_plus.cc +++ b/tests/test_MI_plus.cc @@ -7,7 +7,7 @@ int test_MI_plus (int iterations) // Check commutativity. for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_MI a = R->canonhom(testrandom_I()); cl_MI b = R->canonhom(testrandom_I()); ASSERT3(a+b == b+a, m,a,b); @@ -15,7 +15,7 @@ int test_MI_plus (int iterations) // Check associativity. for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_MI a = R->canonhom(testrandom_I()); cl_MI b = R->canonhom(testrandom_I()); cl_MI c = R->canonhom(testrandom_I()); @@ -24,7 +24,7 @@ int test_MI_plus (int iterations) // Check special case 0. for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_MI a = R->canonhom(testrandom_I()); cl_MI z = R->zero(); ASSERT2(a+z == a, m,a); diff --git a/tests/test_MI_recip.cc b/tests/test_MI_recip.cc index 7c02fac..dddce33 100644 --- a/tests/test_MI_recip.cc +++ b/tests/test_MI_recip.cc @@ -7,7 +7,7 @@ int test_MI_recip (int iterations) // Check against multiplication. for (i = iterations; i > 0; i--) { cl_I m = testrandom_I(); - cl_modint_ring R = cl_find_modint_ring(m); + cl_modint_ring R = find_modint_ring(m); cl_I ai = testrandom_I(); if (gcd(m,ai)==1) { cl_MI a = R->canonhom(ai); diff --git a/tests/test_nt.cc b/tests/test_nt.cc index 51f1496..4057df0 100644 --- a/tests/test_nt.cc +++ b/tests/test_nt.cc @@ -1,9 +1,9 @@ -#include +#include extern int test_nt_jacobi (int iterations); #define RUN(tester,iterations) \ - fprint(cl_stdout,"Testing "#tester"...\n"); \ + std::cout << "Testing "#tester"..." << std::endl; \ error |= tester (iterations); int test_nt (int iterations) diff --git a/tests/test_nt.h b/tests/test_nt.h index 425abba..6181a71 100644 --- a/tests/test_nt.h +++ b/tests/test_nt.h @@ -1,5 +1,5 @@ -#include -#include -#include +#include +#include +#include #include "test.h" diff --git a/tests/tests.cc b/tests/tests.cc index 29a9573..905235a 100644 --- a/tests/tests.cc +++ b/tests/tests.cc @@ -1,11 +1,14 @@ #include #include -#include +#include extern int test_I (int iterations); extern int test_MI (int iterations); extern int test_nt (int iterations); +using namespace std; +using namespace cln; + int test_all (int iterations) { int error = 0; @@ -26,10 +29,10 @@ int main (int argc, char* argv[]) exit(1); if (!test_all(iterations)) { - fprint (cl_stdout, "Tests passed.\n"); + cout << "Tests passed." << endl; exit(0); } else { - fprint (cl_stdout, "Tests failed.\n"); + cout << "Tests failed." << endl; exit(1); } } diff --git a/tests/timeLFRAmul.cc b/tests/timeLFRAmul.cc index 11f7cea..0ce6422 100644 --- a/tests/timeLFRAmul.cc +++ b/tests/timeLFRAmul.cc @@ -1,14 +1,14 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include "cl_LF.h" -#include -#include -#include +#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timeLFatan-compare.cc b/tests/timeLFatan-compare.cc index 2667507..3abeb19 100644 --- a/tests/timeLFatan-compare.cc +++ b/tests/timeLFatan-compare.cc @@ -1,13 +1,13 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include "cl_LF.h" -#include -#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timeLFatan.cc b/tests/timeLFatan.cc index d4d58a8..53386dc 100644 --- a/tests/timeLFatan.cc +++ b/tests/timeLFatan.cc @@ -1,14 +1,14 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "cl_LF.h" -#include -#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timeLFatanh-compare.cc b/tests/timeLFatanh-compare.cc index 847c13b..03f45b4 100644 --- a/tests/timeLFatanh-compare.cc +++ b/tests/timeLFatanh-compare.cc @@ -1,14 +1,14 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include "cl_LF.h" -#include -#include -#include +#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timeLFatanh.cc b/tests/timeLFatanh.cc index 8e6a826..e56ce7b 100644 --- a/tests/timeLFatanh.cc +++ b/tests/timeLFatanh.cc @@ -1,15 +1,15 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include "cl_LF.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timeLFcos-compare.cc b/tests/timeLFcos-compare.cc index d7b7f49..29e874c 100644 --- a/tests/timeLFcos-compare.cc +++ b/tests/timeLFcos-compare.cc @@ -1,13 +1,13 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include "cl_LF.h" -#include -#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timeLFcos.cc b/tests/timeLFcos.cc index 9e21d1a..625ef78 100644 --- a/tests/timeLFcos.cc +++ b/tests/timeLFcos.cc @@ -1,14 +1,14 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "cl_LF.h" -#include -#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timeLFcosh.cc b/tests/timeLFcosh.cc index 8c1eb91..d27caa9 100644 --- a/tests/timeLFcosh.cc +++ b/tests/timeLFcosh.cc @@ -1,14 +1,14 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "cl_LF.h" -#include -#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timeLFexp-compare.cc b/tests/timeLFexp-compare.cc index 6678909..b35abdc 100644 --- a/tests/timeLFexp-compare.cc +++ b/tests/timeLFexp-compare.cc @@ -1,13 +1,13 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include "cl_LF.h" -#include -#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timeLFexp.cc b/tests/timeLFexp.cc index 94b4c1c..60ac74c 100644 --- a/tests/timeLFexp.cc +++ b/tests/timeLFexp.cc @@ -1,14 +1,14 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "cl_LF.h" -#include -#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timeLFln-compare.cc b/tests/timeLFln-compare.cc index 51df5c9..1753041 100644 --- a/tests/timeLFln-compare.cc +++ b/tests/timeLFln-compare.cc @@ -1,13 +1,13 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include "cl_LF.h" -#include -#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timeLFln.cc b/tests/timeLFln.cc index 315500c..5d40f40 100644 --- a/tests/timeLFln.cc +++ b/tests/timeLFln.cc @@ -1,14 +1,14 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "cl_LF.h" -#include -#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timeLFsin-compare.cc b/tests/timeLFsin-compare.cc index ab1d32d..6fb42c8 100644 --- a/tests/timeLFsin-compare.cc +++ b/tests/timeLFsin-compare.cc @@ -1,13 +1,13 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include "cl_LF.h" -#include -#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timeLFsin.cc b/tests/timeLFsin.cc index 451963a..eb99db3 100644 --- a/tests/timeLFsin.cc +++ b/tests/timeLFsin.cc @@ -1,14 +1,14 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "cl_LF.h" -#include -#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timeLFsinh.cc b/tests/timeLFsinh.cc index 5dcbac1..f04cac0 100644 --- a/tests/timeLFsinh.cc +++ b/tests/timeLFsinh.cc @@ -1,14 +1,14 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "cl_LF.h" -#include -#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timeLFsqrt.cc b/tests/timeLFsqrt.cc index 5e22e84..f527635 100644 --- a/tests/timeLFsqrt.cc +++ b/tests/timeLFsqrt.cc @@ -1,14 +1,14 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "cl_LF.h" -#include -#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timeMImisc5.cc b/tests/timeMImisc5.cc index 36e8134..5473f06 100644 --- a/tests/timeMImisc5.cc +++ b/tests/timeMImisc5.cc @@ -1,10 +1,10 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { @@ -16,21 +16,21 @@ int main (int argc, char * argv[]) if (argc < 1) exit(1); cl_I p = "1269281897404513557783934075031171555202695168107"; - cl_modint_ring R = cl_find_modint_ring(p); + cl_modint_ring R = find_modint_ring(p); { cl_MI a = R->canonhom("1111111111111111111111111111111111111111111111111"); cl_MI b = R->canonhom("777777777777777777777777777777777777777777777777"); - cl_stdout << "product modulo p" << endl; + stdout << "product modulo p" << endl; { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { cl_MI c = R->mul(a,b); } } - cl_stdout << "square modulo p" << endl; + stdout << "square modulo p" << endl; { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { cl_MI c = R->square(a); } } - cl_stdout << "quotient modulo p" << endl; + stdout << "quotient modulo p" << endl; { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { cl_MI c = R->div(a,b); } @@ -39,17 +39,17 @@ int main (int argc, char * argv[]) { cl_MI a = R->canonhom("1234567890123456789012345678901234567890123456789"); cl_MI b = R->canonhom("909090909090909090909090909090909090909090909090"); - cl_stdout << "product modulo p" << endl; + stdout << "product modulo p" << endl; { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { cl_MI c = R->mul(a,b); } } - cl_stdout << "square modulo p" << endl; + stdout << "square modulo p" << endl; { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { cl_MI c = R->square(a); } } - cl_stdout << "quotient modulo p" << endl; + stdout << "quotient modulo p" << endl; { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { cl_MI c = R->div(a,b); } diff --git a/tests/timeMIpow2div.cc b/tests/timeMIpow2div.cc index 54c36a9..f5b7f62 100644 --- a/tests/timeMIpow2div.cc +++ b/tests/timeMIpow2div.cc @@ -1,10 +1,10 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { @@ -16,7 +16,7 @@ int main (int argc, char * argv[]) if (argc < 2) exit(1); uintL len = atoi(argv[1]); - cl_modint_ring R = cl_find_modint_ring((cl_I)1 << (intDsize*len)); + cl_modint_ring R = find_modint_ring((cl_I)1 << (intDsize*len)); cl_MI a = R->random(); cl_MI b; do { b = R->random(); } while (!oddp(R->retract(b))); diff --git a/tests/timeMIpow2recip.cc b/tests/timeMIpow2recip.cc index c5972ee..1993cf9 100644 --- a/tests/timeMIpow2recip.cc +++ b/tests/timeMIpow2recip.cc @@ -1,10 +1,10 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { @@ -16,7 +16,7 @@ int main (int argc, char * argv[]) if (argc < 2) exit(1); uintL len = atoi(argv[1]); - cl_modint_ring R = cl_find_modint_ring((cl_I)1 << (intDsize*len)); + cl_modint_ring R = find_modint_ring((cl_I)1 << (intDsize*len)); cl_MI a; do { a = R->random(); } while (!oddp(R->retract(a))); { CL_TIMING; diff --git a/tests/timeRALFdiv.cc b/tests/timeRALFdiv.cc index 84cd86e..3fc1a8c 100644 --- a/tests/timeRALFdiv.cc +++ b/tests/timeRALFdiv.cc @@ -1,14 +1,14 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include "cl_LF.h" -#include -#include -#include +#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timeRAtoLF.cc b/tests/timeRAtoLF.cc index 70bf671..71f7deb 100644 --- a/tests/timeRAtoLF.cc +++ b/tests/timeRAtoLF.cc @@ -1,13 +1,13 @@ -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { @@ -23,7 +23,7 @@ int main (int argc, char * argv[]) cl_I M2 = (cl_I)1 << (intDsize*m2); cl_I m3 = cl_I(argv[3]); cl_I M3 = (cl_I)1 << (intDsize*m3); - cl_float_format_t M1 = (cl_float_format_t)(m1*intDsize); + float_format_t M1 = (float_format_t)(m1*intDsize); cl_I u; cl_I v; do { u = random_I(M2); } while (zerop(u)); diff --git a/tests/timeUPMImul.cc b/tests/timeUPMImul.cc index d26dcf9..98b5f6a 100644 --- a/tests/timeUPMImul.cc +++ b/tests/timeUPMImul.cc @@ -1,11 +1,11 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { @@ -21,14 +21,14 @@ int main (int argc, char * argv[]) cl_I m = 100001; int i; - cl_modint_ring R1 = cl_find_modint_ring(m); - cl_univpoly_ring PR1 = cl_find_univpoly_ring(R1); + cl_modint_ring R1 = find_modint_ring(m); + cl_univpoly_ring PR1 = find_univpoly_ring(R1); cl_UP p1 = PR1->create(n-1); for (i = 0; i < n; i++) p1.set_coeff(i, R1->canonhom((int)(1.618033989*i*i))); p1.finalize(); - cl_stdout << p1 << endl; + stdout << p1 << endl; cl_UP sp1 = PR1->zero(); { CL_TIMING; @@ -36,7 +36,7 @@ int main (int argc, char * argv[]) { sp1 = square(p1); } } - cl_stdout << sp1 << endl; + stdout << sp1 << endl; } // Time: diff --git a/tests/timecatalan.cc b/tests/timecatalan.cc index 840990a..920694e 100644 --- a/tests/timecatalan.cc +++ b/tests/timecatalan.cc @@ -1,11 +1,11 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include -#include +#include #include "cl_LF.h" int main (int argc, char * argv[]) diff --git a/tests/timediv.cc b/tests/timediv.cc index a2431ee..dacf292 100644 --- a/tests/timediv.cc +++ b/tests/timediv.cc @@ -1,10 +1,10 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timediv2adic-compare.cc b/tests/timediv2adic-compare.cc index de1aeeb..0daf777 100644 --- a/tests/timediv2adic-compare.cc +++ b/tests/timediv2adic-compare.cc @@ -1,14 +1,14 @@ -#include -#include -#include +#include +#include +#include #include "cl_DS.h" #include "cl_2DS.h" -#include +#include #include "cl_random_impl.h" -#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { @@ -36,8 +36,8 @@ int main (int argc, char * argv[]) num_stack_alloc(b_len,b_MSDptr=,b_LSDptr=); num_stack_alloc(a_len,q_MSDptr=,q_LSDptr=); num_stack_alloc(a_len,q1_MSDptr=,q1_LSDptr=); - random_UDS(cl_default_random_state,a_MSDptr,a_len); - random_UDS(cl_default_random_state,b_MSDptr,b_len); + random_UDS(default_random_state,a_MSDptr,a_len); + random_UDS(default_random_state,b_MSDptr,b_len); lspref(b_LSDptr,0) |= 1; // force b to be odd extern int div2adic_algo; // Check. diff --git a/tests/timediv2adic.cc b/tests/timediv2adic.cc index a944574..af822ce 100644 --- a/tests/timediv2adic.cc +++ b/tests/timediv2adic.cc @@ -1,14 +1,14 @@ -#include -#include -#include +#include +#include +#include #include "cl_DS.h" #include "cl_2DS.h" -#include +#include #include "cl_random_impl.h" -#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { @@ -36,8 +36,8 @@ int main (int argc, char * argv[]) num_stack_alloc(b_len,b_MSDptr=,b_LSDptr=); num_stack_alloc(a_len,q_MSDptr=,q_LSDptr=); num_stack_alloc(a_len,q1_MSDptr=,q1_LSDptr=); - random_UDS(cl_default_random_state,a_MSDptr,a_len); - random_UDS(cl_default_random_state,b_MSDptr,b_len); + random_UDS(default_random_state,a_MSDptr,a_len); + random_UDS(default_random_state,b_MSDptr,b_len); lspref(b_LSDptr,0) |= 1; // force b to be odd { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) diff --git a/tests/timeeuler.cc b/tests/timeeuler.cc index 712f588..bc2f5d3 100644 --- a/tests/timeeuler.cc +++ b/tests/timeeuler.cc @@ -1,11 +1,11 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include -#include +#include #include "cl_LF.h" int main (int argc, char * argv[]) diff --git a/tests/timeexp1.cc b/tests/timeexp1.cc index ca840f5..48f39de 100644 --- a/tests/timeexp1.cc +++ b/tests/timeexp1.cc @@ -1,11 +1,11 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timefact.cc b/tests/timefact.cc index 78688b7..4c23d08 100644 --- a/tests/timefact.cc +++ b/tests/timefact.cc @@ -1,11 +1,11 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include "cl_I.h" #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timegcd.cc b/tests/timegcd.cc index a15dfd4..a5b98b8 100644 --- a/tests/timegcd.cc +++ b/tests/timegcd.cc @@ -1,10 +1,10 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timemul-compare.cc b/tests/timemul-compare.cc index 0939d7b..b4586ee 100644 --- a/tests/timemul-compare.cc +++ b/tests/timemul-compare.cc @@ -1,10 +1,10 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timemul.cc b/tests/timemul.cc index 253d1e4..af95ed8 100644 --- a/tests/timemul.cc +++ b/tests/timemul.cc @@ -1,10 +1,10 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timepi.cc b/tests/timepi.cc index f2bdcbe..bb88b9a 100644 --- a/tests/timepi.cc +++ b/tests/timepi.cc @@ -1,12 +1,15 @@ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include -#include +#include + +using namespace std; +using namespace cln; int main (int argc, char * argv[]) { @@ -47,11 +50,11 @@ int main (int argc, char * argv[]) #else // Here the argument is N *decimal* digits, not N*32 bits! int n = atoi(argv[1]); - cl_float_format_t prec = cl_float_format(n); + float_format_t prec = float_format(n); cl_F p; - fprint(cl_stderr, "Computing pi\n"); - { CL_TIMING; p = cl_pi(prec); } - fprint(cl_stderr, "Converting pi to decimal\n"); + stderr << "Computing pi" << endl; + { CL_TIMING; p = pi(prec); } + stderr << "Converting pi to decimal" << endl; { CL_TIMING; cout << p << endl << endl; } #endif } diff --git a/tests/timeprint-compare.cc b/tests/timeprint-compare.cc index 91cb703..7ef4441 100644 --- a/tests/timeprint-compare.cc +++ b/tests/timeprint-compare.cc @@ -1,13 +1,13 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include +#include #include -#include -#include +#include +#include int main (int argc, char * argv[]) { @@ -27,18 +27,18 @@ int main (int argc, char * argv[]) char* p = (cl_digits_algo = 0, cl_decimal_string(a)); char* q = (cl_digits_algo = 1, cl_decimal_string(a)); if (strcmp(p,q)) cl_abort(); - cl_free_hook(p); - cl_free_hook(q); + free_hook(p); + free_hook(q); } // Now start the timing. cl_digits_algo = 0; { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { char* p = cl_decimal_string(a); cl_free_hook(p); } + { char* p = cl_decimal_string(a); free_hook(p); } } cl_digits_algo = 1; { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { char* p = cl_decimal_string(a); cl_free_hook(p); } + { char* p = cl_decimal_string(a); free_hook(p); } } } diff --git a/tests/timeprint.cc b/tests/timeprint.cc index b8774aa..830cccd 100644 --- a/tests/timeprint.cc +++ b/tests/timeprint.cc @@ -1,13 +1,13 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include -#include -#include -#include +#include +#include +#include int main (int argc, char * argv[]) { @@ -24,11 +24,11 @@ int main (int argc, char * argv[]) // One run to fill the cache. { char* p = cl_decimal_string(a); - cl_free_hook(p); + free_hook(p); } // Now start the timing. { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { char* p = cl_decimal_string(a); cl_free_hook(p); } + { char* p = cl_decimal_string(a); free_hook(p); } } } diff --git a/tests/timerecip2adic-compare.cc b/tests/timerecip2adic-compare.cc index 9d45328..3db0b73 100644 --- a/tests/timerecip2adic-compare.cc +++ b/tests/timerecip2adic-compare.cc @@ -1,14 +1,14 @@ -#include -#include -#include +#include +#include +#include #include "cl_DS.h" #include "cl_2DS.h" -#include +#include #include "cl_random_impl.h" -#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { @@ -31,7 +31,7 @@ int main (int argc, char * argv[]) num_stack_alloc(len,a_MSDptr=,a_LSDptr=); num_stack_alloc(len,b_MSDptr=,b_LSDptr=); num_stack_alloc(len,bn_MSDptr=,bn_LSDptr=); - random_UDS(cl_default_random_state,a_MSDptr,len); + random_UDS(default_random_state,a_MSDptr,len); lspref(a_LSDptr,0) |= 1; // force a to be odd extern int recip2adic_threshold; // Check. diff --git a/tests/timerecip2adic.cc b/tests/timerecip2adic.cc index 0006859..075cb06 100644 --- a/tests/timerecip2adic.cc +++ b/tests/timerecip2adic.cc @@ -1,13 +1,13 @@ -#include -#include -#include +#include +#include +#include #include "cl_DS.h" #include "cl_2DS.h" -#include +#include #include "cl_random_impl.h" #include #include -#include +#include int main (int argc, char * argv[]) { @@ -26,7 +26,7 @@ int main (int argc, char * argv[]) uintD* b_LSDptr; num_stack_alloc(len,a_MSDptr=,a_LSDptr=); num_stack_alloc(len,b_MSDptr=,b_LSDptr=); - random_UDS(cl_default_random_state,a_MSDptr,len); + random_UDS(default_random_state,a_MSDptr,len); lspref(a_LSDptr,0) |= 1; // force a to be odd { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) diff --git a/tests/timesqrt.cc b/tests/timesqrt.cc index 9f4e1d9..34f564b 100644 --- a/tests/timesqrt.cc +++ b/tests/timesqrt.cc @@ -1,10 +1,10 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { diff --git a/tests/timesqrtmodp.cc b/tests/timesqrtmodp.cc index 6c5371a..dab3d16 100644 --- a/tests/timesqrtmodp.cc +++ b/tests/timesqrtmodp.cc @@ -1,12 +1,12 @@ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { @@ -28,7 +28,7 @@ int main (int argc, char * argv[]) p = ((random_I((cl_I)1 << (len-1-e))*2+1) << e) + 1; } while (!isprobprime(p)); cout << "p = " << p << endl; - cl_modint_ring R = cl_find_modint_ring(p); + cl_modint_ring R = find_modint_ring(p); cl_MI x = R->random(); cl_MI a = square(x); sqrt_mod_p_t sol; diff --git a/tests/timesquare.cc b/tests/timesquare.cc index 5e47164..0175596 100644 --- a/tests/timesquare.cc +++ b/tests/timesquare.cc @@ -1,10 +1,10 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include +#include int main (int argc, char * argv[]) { @@ -21,12 +21,12 @@ int main (int argc, char * argv[]) cl_I M2 = (cl_I)1 << (intDsize*m2); cl_I a = random_I(M1); cl_I b = random_I(M2); - fprint(cl_stderr, "Squaring: "); + fprint(stderr, "Squaring: "); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { cl_I p = a * a; } } - fprint(cl_stderr, "Multiplication: "); + fprint(stderr, "Multiplication: "); { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) { cl_I p = a * b; } diff --git a/tests/timezeta3.cc b/tests/timezeta3.cc index 8488f26..c58690f 100644 --- a/tests/timezeta3.cc +++ b/tests/timezeta3.cc @@ -1,10 +1,10 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include +#include #include "cl_LF.h" int main (int argc, char * argv[]) @@ -17,11 +17,11 @@ int main (int argc, char * argv[]) if (argc < 2) exit(1); uintL len = atoi(argv[1]); - extern cl_LF cl_zeta (int s, uintC len); + extern cl_LF zeta (int s, uintC len); extern cl_LF compute_zeta_exp (int s, uintC len); extern cl_LF compute_zeta_cvz1 (int s, uintC len); extern cl_LF compute_zeta_cvz2 (int s, uintC len); - extern cl_LF cl_zeta3 (uintC len); + extern cl_LF zeta3 (uintC len); cl_LF p; ln(cl_I_to_LF(1000,len+10)); // fill cache { CL_TIMING; @@ -41,7 +41,7 @@ int main (int argc, char * argv[]) cout << p << endl; { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) - { p = cl_zeta3(len); } + { p = zeta3(len); } } cout << p << endl; } -- 2.45.2