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

358 lines
14 KiB

25 years ago
25 years ago
25 years ago
Extend the exponent range from 32 bits to 64 bits on selected platforms. * include/cln/number.h: Add signatures for operations with long long. * include/cln/complex_class.h: Likewise. * include/cln/real_class.h: Likewise. * include/cln/real.h: Likewise. * include/cln/rational_class.h: Likewise. * include/cln/rational.h: Likewise. * include/cln/integer_class.h: Likewise. * include/cln/integer.h: Likewise. * include/cln/float.h: Likewise. * include/cln/lfloat.h: Likewise. * include/cln/types.h (sintE and uintE): New types for exponents. * include/cln/*float.h: Use the new types for exponents. * include/cln/floatformat.h (float_format_t): Make underlying type compatible with sintE. * doc/cln.tex: Document changed float_exponent return value. * src/float/cl_F.h: Likewise. * src/float/ffloat/misc/cl_FF_exponent.cc: Likewise. * src/float/input/cl_F_read.cc: Likewise. * src/float/lfloat/cl_LF.h: Likewise. * src/float/lfloat/cl_LF_impl.h: Likewise. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Likewise. * src/float/lfloat/elem/cl_LF_1plus.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_compare.cc: Likewise. * src/float/lfloat/elem/cl_LF_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_from_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_fround.cc: Likewise. * src/float/lfloat/elem/cl_LF_ftrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_futrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_square.cc: Likewise. * src/float/lfloat/elem/cl_LF_to_I.cc: Likewise. * src/float/lfloat/misc/cl_LF_decode.cc: Likewise. * src/float/lfloat/misc/cl_LF_exponent.cc: Likewise. * src/float/lfloat/misc/cl_LF_idecode.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Likewise. * src/float/misc/cl_F_decode.cc: Likewise. * src/float/misc/cl_F_exponent.cc: Likewise. * src/float/misc/cl_F_shortenrel.cc: Likewise. * src/float/misc/cl_float_format.cc: Likewise. * src/float/output/cl_F_dprint.cc: Likewise. * src/float/sfloat/misc/cl_SF_exponent.cc: Likewise. * src/float/transcendental/cl_F_atanhx.cc: Likewise. * src/float/transcendental/cl_F_atanx.cc: Likewise. * src/float/transcendental/cl_F_cosh.cc: Likewise. * src/float/transcendental/cl_F_expx.cc: Likewise. * src/float/transcendental/cl_F_lnx.cc: Likewise. * src/float/transcendental/cl_F_sinhx.cc: Likewise. * src/float/transcendental/cl_F_sinx.cc: Likewise. * src/float/transcendental/cl_LF_pi.cc: Likewise. * src/integer/cl_I.h: Likewise. * src/complex/algebraic/cl_LF_hypot.cc: Likewise. * src/complex/elem/division/cl_C_LF_recip.cc: Likewise. * src/float/dfloat/misc/cl_DF_exponent.cc: Likewise. * src/integer/conv/cl_I_from_Q2.cc: Added. * src/base/cl_low.h (isqrtC): New function, for 64 bit falls back to... * src/base/low/cl_low_isqrt.cc (isqrt): ...this new implementation. * src/base/cl_macros.h (bitc): Make sure 64 bit is used if required by exponent operations. * examples/pi.cc: Support more than 646456614 decimal digits.
18 years ago
25 years ago
Extend the exponent range from 32 bits to 64 bits on selected platforms. * include/cln/number.h: Add signatures for operations with long long. * include/cln/complex_class.h: Likewise. * include/cln/real_class.h: Likewise. * include/cln/real.h: Likewise. * include/cln/rational_class.h: Likewise. * include/cln/rational.h: Likewise. * include/cln/integer_class.h: Likewise. * include/cln/integer.h: Likewise. * include/cln/float.h: Likewise. * include/cln/lfloat.h: Likewise. * include/cln/types.h (sintE and uintE): New types for exponents. * include/cln/*float.h: Use the new types for exponents. * include/cln/floatformat.h (float_format_t): Make underlying type compatible with sintE. * doc/cln.tex: Document changed float_exponent return value. * src/float/cl_F.h: Likewise. * src/float/ffloat/misc/cl_FF_exponent.cc: Likewise. * src/float/input/cl_F_read.cc: Likewise. * src/float/lfloat/cl_LF.h: Likewise. * src/float/lfloat/cl_LF_impl.h: Likewise. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Likewise. * src/float/lfloat/elem/cl_LF_1plus.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_compare.cc: Likewise. * src/float/lfloat/elem/cl_LF_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_from_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_fround.cc: Likewise. * src/float/lfloat/elem/cl_LF_ftrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_futrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_square.cc: Likewise. * src/float/lfloat/elem/cl_LF_to_I.cc: Likewise. * src/float/lfloat/misc/cl_LF_decode.cc: Likewise. * src/float/lfloat/misc/cl_LF_exponent.cc: Likewise. * src/float/lfloat/misc/cl_LF_idecode.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Likewise. * src/float/misc/cl_F_decode.cc: Likewise. * src/float/misc/cl_F_exponent.cc: Likewise. * src/float/misc/cl_F_shortenrel.cc: Likewise. * src/float/misc/cl_float_format.cc: Likewise. * src/float/output/cl_F_dprint.cc: Likewise. * src/float/sfloat/misc/cl_SF_exponent.cc: Likewise. * src/float/transcendental/cl_F_atanhx.cc: Likewise. * src/float/transcendental/cl_F_atanx.cc: Likewise. * src/float/transcendental/cl_F_cosh.cc: Likewise. * src/float/transcendental/cl_F_expx.cc: Likewise. * src/float/transcendental/cl_F_lnx.cc: Likewise. * src/float/transcendental/cl_F_sinhx.cc: Likewise. * src/float/transcendental/cl_F_sinx.cc: Likewise. * src/float/transcendental/cl_LF_pi.cc: Likewise. * src/integer/cl_I.h: Likewise. * src/complex/algebraic/cl_LF_hypot.cc: Likewise. * src/complex/elem/division/cl_C_LF_recip.cc: Likewise. * src/float/dfloat/misc/cl_DF_exponent.cc: Likewise. * src/integer/conv/cl_I_from_Q2.cc: Added. * src/base/cl_low.h (isqrtC): New function, for 64 bit falls back to... * src/base/low/cl_low_isqrt.cc (isqrt): ...this new implementation. * src/base/cl_macros.h (bitc): Make sure 64 bit is used if required by exponent operations. * examples/pi.cc: Support more than 646456614 decimal digits.
18 years ago
25 years ago
Extend the exponent range from 32 bits to 64 bits on selected platforms. * include/cln/number.h: Add signatures for operations with long long. * include/cln/complex_class.h: Likewise. * include/cln/real_class.h: Likewise. * include/cln/real.h: Likewise. * include/cln/rational_class.h: Likewise. * include/cln/rational.h: Likewise. * include/cln/integer_class.h: Likewise. * include/cln/integer.h: Likewise. * include/cln/float.h: Likewise. * include/cln/lfloat.h: Likewise. * include/cln/types.h (sintE and uintE): New types for exponents. * include/cln/*float.h: Use the new types for exponents. * include/cln/floatformat.h (float_format_t): Make underlying type compatible with sintE. * doc/cln.tex: Document changed float_exponent return value. * src/float/cl_F.h: Likewise. * src/float/ffloat/misc/cl_FF_exponent.cc: Likewise. * src/float/input/cl_F_read.cc: Likewise. * src/float/lfloat/cl_LF.h: Likewise. * src/float/lfloat/cl_LF_impl.h: Likewise. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Likewise. * src/float/lfloat/elem/cl_LF_1plus.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_compare.cc: Likewise. * src/float/lfloat/elem/cl_LF_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_from_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_fround.cc: Likewise. * src/float/lfloat/elem/cl_LF_ftrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_futrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_square.cc: Likewise. * src/float/lfloat/elem/cl_LF_to_I.cc: Likewise. * src/float/lfloat/misc/cl_LF_decode.cc: Likewise. * src/float/lfloat/misc/cl_LF_exponent.cc: Likewise. * src/float/lfloat/misc/cl_LF_idecode.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Likewise. * src/float/misc/cl_F_decode.cc: Likewise. * src/float/misc/cl_F_exponent.cc: Likewise. * src/float/misc/cl_F_shortenrel.cc: Likewise. * src/float/misc/cl_float_format.cc: Likewise. * src/float/output/cl_F_dprint.cc: Likewise. * src/float/sfloat/misc/cl_SF_exponent.cc: Likewise. * src/float/transcendental/cl_F_atanhx.cc: Likewise. * src/float/transcendental/cl_F_atanx.cc: Likewise. * src/float/transcendental/cl_F_cosh.cc: Likewise. * src/float/transcendental/cl_F_expx.cc: Likewise. * src/float/transcendental/cl_F_lnx.cc: Likewise. * src/float/transcendental/cl_F_sinhx.cc: Likewise. * src/float/transcendental/cl_F_sinx.cc: Likewise. * src/float/transcendental/cl_LF_pi.cc: Likewise. * src/integer/cl_I.h: Likewise. * src/complex/algebraic/cl_LF_hypot.cc: Likewise. * src/complex/elem/division/cl_C_LF_recip.cc: Likewise. * src/float/dfloat/misc/cl_DF_exponent.cc: Likewise. * src/integer/conv/cl_I_from_Q2.cc: Added. * src/base/cl_low.h (isqrtC): New function, for 64 bit falls back to... * src/base/low/cl_low_isqrt.cc (isqrt): ...this new implementation. * src/base/cl_macros.h (bitc): Make sure 64 bit is used if required by exponent operations. * examples/pi.cc: Support more than 646456614 decimal digits.
18 years ago
25 years ago
Extend the exponent range from 32 bits to 64 bits on selected platforms. * include/cln/number.h: Add signatures for operations with long long. * include/cln/complex_class.h: Likewise. * include/cln/real_class.h: Likewise. * include/cln/real.h: Likewise. * include/cln/rational_class.h: Likewise. * include/cln/rational.h: Likewise. * include/cln/integer_class.h: Likewise. * include/cln/integer.h: Likewise. * include/cln/float.h: Likewise. * include/cln/lfloat.h: Likewise. * include/cln/types.h (sintE and uintE): New types for exponents. * include/cln/*float.h: Use the new types for exponents. * include/cln/floatformat.h (float_format_t): Make underlying type compatible with sintE. * doc/cln.tex: Document changed float_exponent return value. * src/float/cl_F.h: Likewise. * src/float/ffloat/misc/cl_FF_exponent.cc: Likewise. * src/float/input/cl_F_read.cc: Likewise. * src/float/lfloat/cl_LF.h: Likewise. * src/float/lfloat/cl_LF_impl.h: Likewise. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Likewise. * src/float/lfloat/elem/cl_LF_1plus.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_compare.cc: Likewise. * src/float/lfloat/elem/cl_LF_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_from_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_fround.cc: Likewise. * src/float/lfloat/elem/cl_LF_ftrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_futrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_square.cc: Likewise. * src/float/lfloat/elem/cl_LF_to_I.cc: Likewise. * src/float/lfloat/misc/cl_LF_decode.cc: Likewise. * src/float/lfloat/misc/cl_LF_exponent.cc: Likewise. * src/float/lfloat/misc/cl_LF_idecode.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Likewise. * src/float/misc/cl_F_decode.cc: Likewise. * src/float/misc/cl_F_exponent.cc: Likewise. * src/float/misc/cl_F_shortenrel.cc: Likewise. * src/float/misc/cl_float_format.cc: Likewise. * src/float/output/cl_F_dprint.cc: Likewise. * src/float/sfloat/misc/cl_SF_exponent.cc: Likewise. * src/float/transcendental/cl_F_atanhx.cc: Likewise. * src/float/transcendental/cl_F_atanx.cc: Likewise. * src/float/transcendental/cl_F_cosh.cc: Likewise. * src/float/transcendental/cl_F_expx.cc: Likewise. * src/float/transcendental/cl_F_lnx.cc: Likewise. * src/float/transcendental/cl_F_sinhx.cc: Likewise. * src/float/transcendental/cl_F_sinx.cc: Likewise. * src/float/transcendental/cl_LF_pi.cc: Likewise. * src/integer/cl_I.h: Likewise. * src/complex/algebraic/cl_LF_hypot.cc: Likewise. * src/complex/elem/division/cl_C_LF_recip.cc: Likewise. * src/float/dfloat/misc/cl_DF_exponent.cc: Likewise. * src/integer/conv/cl_I_from_Q2.cc: Added. * src/base/cl_low.h (isqrtC): New function, for 64 bit falls back to... * src/base/low/cl_low_isqrt.cc (isqrt): ...this new implementation. * src/base/cl_macros.h (bitc): Make sure 64 bit is used if required by exponent operations. * examples/pi.cc: Support more than 646456614 decimal digits.
18 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
Extend the exponent range from 32 bits to 64 bits on selected platforms. * include/cln/number.h: Add signatures for operations with long long. * include/cln/complex_class.h: Likewise. * include/cln/real_class.h: Likewise. * include/cln/real.h: Likewise. * include/cln/rational_class.h: Likewise. * include/cln/rational.h: Likewise. * include/cln/integer_class.h: Likewise. * include/cln/integer.h: Likewise. * include/cln/float.h: Likewise. * include/cln/lfloat.h: Likewise. * include/cln/types.h (sintE and uintE): New types for exponents. * include/cln/*float.h: Use the new types for exponents. * include/cln/floatformat.h (float_format_t): Make underlying type compatible with sintE. * doc/cln.tex: Document changed float_exponent return value. * src/float/cl_F.h: Likewise. * src/float/ffloat/misc/cl_FF_exponent.cc: Likewise. * src/float/input/cl_F_read.cc: Likewise. * src/float/lfloat/cl_LF.h: Likewise. * src/float/lfloat/cl_LF_impl.h: Likewise. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Likewise. * src/float/lfloat/elem/cl_LF_1plus.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_compare.cc: Likewise. * src/float/lfloat/elem/cl_LF_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_from_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_fround.cc: Likewise. * src/float/lfloat/elem/cl_LF_ftrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_futrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_square.cc: Likewise. * src/float/lfloat/elem/cl_LF_to_I.cc: Likewise. * src/float/lfloat/misc/cl_LF_decode.cc: Likewise. * src/float/lfloat/misc/cl_LF_exponent.cc: Likewise. * src/float/lfloat/misc/cl_LF_idecode.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Likewise. * src/float/misc/cl_F_decode.cc: Likewise. * src/float/misc/cl_F_exponent.cc: Likewise. * src/float/misc/cl_F_shortenrel.cc: Likewise. * src/float/misc/cl_float_format.cc: Likewise. * src/float/output/cl_F_dprint.cc: Likewise. * src/float/sfloat/misc/cl_SF_exponent.cc: Likewise. * src/float/transcendental/cl_F_atanhx.cc: Likewise. * src/float/transcendental/cl_F_atanx.cc: Likewise. * src/float/transcendental/cl_F_cosh.cc: Likewise. * src/float/transcendental/cl_F_expx.cc: Likewise. * src/float/transcendental/cl_F_lnx.cc: Likewise. * src/float/transcendental/cl_F_sinhx.cc: Likewise. * src/float/transcendental/cl_F_sinx.cc: Likewise. * src/float/transcendental/cl_LF_pi.cc: Likewise. * src/integer/cl_I.h: Likewise. * src/complex/algebraic/cl_LF_hypot.cc: Likewise. * src/complex/elem/division/cl_C_LF_recip.cc: Likewise. * src/float/dfloat/misc/cl_DF_exponent.cc: Likewise. * src/integer/conv/cl_I_from_Q2.cc: Added. * src/base/cl_low.h (isqrtC): New function, for 64 bit falls back to... * src/base/low/cl_low_isqrt.cc (isqrt): ...this new implementation. * src/base/cl_macros.h (bitc): Make sure 64 bit is used if required by exponent operations. * examples/pi.cc: Support more than 646456614 decimal digits.
18 years ago
25 years ago
Extend the exponent range from 32 bits to 64 bits on selected platforms. * include/cln/number.h: Add signatures for operations with long long. * include/cln/complex_class.h: Likewise. * include/cln/real_class.h: Likewise. * include/cln/real.h: Likewise. * include/cln/rational_class.h: Likewise. * include/cln/rational.h: Likewise. * include/cln/integer_class.h: Likewise. * include/cln/integer.h: Likewise. * include/cln/float.h: Likewise. * include/cln/lfloat.h: Likewise. * include/cln/types.h (sintE and uintE): New types for exponents. * include/cln/*float.h: Use the new types for exponents. * include/cln/floatformat.h (float_format_t): Make underlying type compatible with sintE. * doc/cln.tex: Document changed float_exponent return value. * src/float/cl_F.h: Likewise. * src/float/ffloat/misc/cl_FF_exponent.cc: Likewise. * src/float/input/cl_F_read.cc: Likewise. * src/float/lfloat/cl_LF.h: Likewise. * src/float/lfloat/cl_LF_impl.h: Likewise. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Likewise. * src/float/lfloat/elem/cl_LF_1plus.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_compare.cc: Likewise. * src/float/lfloat/elem/cl_LF_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_from_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_fround.cc: Likewise. * src/float/lfloat/elem/cl_LF_ftrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_futrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_square.cc: Likewise. * src/float/lfloat/elem/cl_LF_to_I.cc: Likewise. * src/float/lfloat/misc/cl_LF_decode.cc: Likewise. * src/float/lfloat/misc/cl_LF_exponent.cc: Likewise. * src/float/lfloat/misc/cl_LF_idecode.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Likewise. * src/float/misc/cl_F_decode.cc: Likewise. * src/float/misc/cl_F_exponent.cc: Likewise. * src/float/misc/cl_F_shortenrel.cc: Likewise. * src/float/misc/cl_float_format.cc: Likewise. * src/float/output/cl_F_dprint.cc: Likewise. * src/float/sfloat/misc/cl_SF_exponent.cc: Likewise. * src/float/transcendental/cl_F_atanhx.cc: Likewise. * src/float/transcendental/cl_F_atanx.cc: Likewise. * src/float/transcendental/cl_F_cosh.cc: Likewise. * src/float/transcendental/cl_F_expx.cc: Likewise. * src/float/transcendental/cl_F_lnx.cc: Likewise. * src/float/transcendental/cl_F_sinhx.cc: Likewise. * src/float/transcendental/cl_F_sinx.cc: Likewise. * src/float/transcendental/cl_LF_pi.cc: Likewise. * src/integer/cl_I.h: Likewise. * src/complex/algebraic/cl_LF_hypot.cc: Likewise. * src/complex/elem/division/cl_C_LF_recip.cc: Likewise. * src/float/dfloat/misc/cl_DF_exponent.cc: Likewise. * src/integer/conv/cl_I_from_Q2.cc: Added. * src/base/cl_low.h (isqrtC): New function, for 64 bit falls back to... * src/base/low/cl_low_isqrt.cc (isqrt): ...this new implementation. * src/base/cl_macros.h (bitc): Make sure 64 bit is used if required by exponent operations. * examples/pi.cc: Support more than 646456614 decimal digits.
18 years ago
25 years ago
Extend the exponent range from 32 bits to 64 bits on selected platforms. * include/cln/number.h: Add signatures for operations with long long. * include/cln/complex_class.h: Likewise. * include/cln/real_class.h: Likewise. * include/cln/real.h: Likewise. * include/cln/rational_class.h: Likewise. * include/cln/rational.h: Likewise. * include/cln/integer_class.h: Likewise. * include/cln/integer.h: Likewise. * include/cln/float.h: Likewise. * include/cln/lfloat.h: Likewise. * include/cln/types.h (sintE and uintE): New types for exponents. * include/cln/*float.h: Use the new types for exponents. * include/cln/floatformat.h (float_format_t): Make underlying type compatible with sintE. * doc/cln.tex: Document changed float_exponent return value. * src/float/cl_F.h: Likewise. * src/float/ffloat/misc/cl_FF_exponent.cc: Likewise. * src/float/input/cl_F_read.cc: Likewise. * src/float/lfloat/cl_LF.h: Likewise. * src/float/lfloat/cl_LF_impl.h: Likewise. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Likewise. * src/float/lfloat/elem/cl_LF_1plus.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_compare.cc: Likewise. * src/float/lfloat/elem/cl_LF_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_from_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_fround.cc: Likewise. * src/float/lfloat/elem/cl_LF_ftrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_futrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_square.cc: Likewise. * src/float/lfloat/elem/cl_LF_to_I.cc: Likewise. * src/float/lfloat/misc/cl_LF_decode.cc: Likewise. * src/float/lfloat/misc/cl_LF_exponent.cc: Likewise. * src/float/lfloat/misc/cl_LF_idecode.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Likewise. * src/float/misc/cl_F_decode.cc: Likewise. * src/float/misc/cl_F_exponent.cc: Likewise. * src/float/misc/cl_F_shortenrel.cc: Likewise. * src/float/misc/cl_float_format.cc: Likewise. * src/float/output/cl_F_dprint.cc: Likewise. * src/float/sfloat/misc/cl_SF_exponent.cc: Likewise. * src/float/transcendental/cl_F_atanhx.cc: Likewise. * src/float/transcendental/cl_F_atanx.cc: Likewise. * src/float/transcendental/cl_F_cosh.cc: Likewise. * src/float/transcendental/cl_F_expx.cc: Likewise. * src/float/transcendental/cl_F_lnx.cc: Likewise. * src/float/transcendental/cl_F_sinhx.cc: Likewise. * src/float/transcendental/cl_F_sinx.cc: Likewise. * src/float/transcendental/cl_LF_pi.cc: Likewise. * src/integer/cl_I.h: Likewise. * src/complex/algebraic/cl_LF_hypot.cc: Likewise. * src/complex/elem/division/cl_C_LF_recip.cc: Likewise. * src/float/dfloat/misc/cl_DF_exponent.cc: Likewise. * src/integer/conv/cl_I_from_Q2.cc: Added. * src/base/cl_low.h (isqrtC): New function, for 64 bit falls back to... * src/base/low/cl_low_isqrt.cc (isqrt): ...this new implementation. * src/base/cl_macros.h (bitc): Make sure 64 bit is used if required by exponent operations. * examples/pi.cc: Support more than 646456614 decimal digits.
18 years ago
25 years ago
Extend the exponent range from 32 bits to 64 bits on selected platforms. * include/cln/number.h: Add signatures for operations with long long. * include/cln/complex_class.h: Likewise. * include/cln/real_class.h: Likewise. * include/cln/real.h: Likewise. * include/cln/rational_class.h: Likewise. * include/cln/rational.h: Likewise. * include/cln/integer_class.h: Likewise. * include/cln/integer.h: Likewise. * include/cln/float.h: Likewise. * include/cln/lfloat.h: Likewise. * include/cln/types.h (sintE and uintE): New types for exponents. * include/cln/*float.h: Use the new types for exponents. * include/cln/floatformat.h (float_format_t): Make underlying type compatible with sintE. * doc/cln.tex: Document changed float_exponent return value. * src/float/cl_F.h: Likewise. * src/float/ffloat/misc/cl_FF_exponent.cc: Likewise. * src/float/input/cl_F_read.cc: Likewise. * src/float/lfloat/cl_LF.h: Likewise. * src/float/lfloat/cl_LF_impl.h: Likewise. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Likewise. * src/float/lfloat/elem/cl_LF_1plus.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_compare.cc: Likewise. * src/float/lfloat/elem/cl_LF_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_from_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_fround.cc: Likewise. * src/float/lfloat/elem/cl_LF_ftrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_futrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_square.cc: Likewise. * src/float/lfloat/elem/cl_LF_to_I.cc: Likewise. * src/float/lfloat/misc/cl_LF_decode.cc: Likewise. * src/float/lfloat/misc/cl_LF_exponent.cc: Likewise. * src/float/lfloat/misc/cl_LF_idecode.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Likewise. * src/float/misc/cl_F_decode.cc: Likewise. * src/float/misc/cl_F_exponent.cc: Likewise. * src/float/misc/cl_F_shortenrel.cc: Likewise. * src/float/misc/cl_float_format.cc: Likewise. * src/float/output/cl_F_dprint.cc: Likewise. * src/float/sfloat/misc/cl_SF_exponent.cc: Likewise. * src/float/transcendental/cl_F_atanhx.cc: Likewise. * src/float/transcendental/cl_F_atanx.cc: Likewise. * src/float/transcendental/cl_F_cosh.cc: Likewise. * src/float/transcendental/cl_F_expx.cc: Likewise. * src/float/transcendental/cl_F_lnx.cc: Likewise. * src/float/transcendental/cl_F_sinhx.cc: Likewise. * src/float/transcendental/cl_F_sinx.cc: Likewise. * src/float/transcendental/cl_LF_pi.cc: Likewise. * src/integer/cl_I.h: Likewise. * src/complex/algebraic/cl_LF_hypot.cc: Likewise. * src/complex/elem/division/cl_C_LF_recip.cc: Likewise. * src/float/dfloat/misc/cl_DF_exponent.cc: Likewise. * src/integer/conv/cl_I_from_Q2.cc: Added. * src/base/cl_low.h (isqrtC): New function, for 64 bit falls back to... * src/base/low/cl_low_isqrt.cc (isqrt): ...this new implementation. * src/base/cl_macros.h (bitc): Make sure 64 bit is used if required by exponent operations. * examples/pi.cc: Support more than 646456614 decimal digits.
18 years ago
25 years ago
25 years ago
25 years ago
Extend the exponent range from 32 bits to 64 bits on selected platforms. * include/cln/number.h: Add signatures for operations with long long. * include/cln/complex_class.h: Likewise. * include/cln/real_class.h: Likewise. * include/cln/real.h: Likewise. * include/cln/rational_class.h: Likewise. * include/cln/rational.h: Likewise. * include/cln/integer_class.h: Likewise. * include/cln/integer.h: Likewise. * include/cln/float.h: Likewise. * include/cln/lfloat.h: Likewise. * include/cln/types.h (sintE and uintE): New types for exponents. * include/cln/*float.h: Use the new types for exponents. * include/cln/floatformat.h (float_format_t): Make underlying type compatible with sintE. * doc/cln.tex: Document changed float_exponent return value. * src/float/cl_F.h: Likewise. * src/float/ffloat/misc/cl_FF_exponent.cc: Likewise. * src/float/input/cl_F_read.cc: Likewise. * src/float/lfloat/cl_LF.h: Likewise. * src/float/lfloat/cl_LF_impl.h: Likewise. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Likewise. * src/float/lfloat/elem/cl_LF_1plus.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_compare.cc: Likewise. * src/float/lfloat/elem/cl_LF_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_from_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_fround.cc: Likewise. * src/float/lfloat/elem/cl_LF_ftrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_futrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_square.cc: Likewise. * src/float/lfloat/elem/cl_LF_to_I.cc: Likewise. * src/float/lfloat/misc/cl_LF_decode.cc: Likewise. * src/float/lfloat/misc/cl_LF_exponent.cc: Likewise. * src/float/lfloat/misc/cl_LF_idecode.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Likewise. * src/float/misc/cl_F_decode.cc: Likewise. * src/float/misc/cl_F_exponent.cc: Likewise. * src/float/misc/cl_F_shortenrel.cc: Likewise. * src/float/misc/cl_float_format.cc: Likewise. * src/float/output/cl_F_dprint.cc: Likewise. * src/float/sfloat/misc/cl_SF_exponent.cc: Likewise. * src/float/transcendental/cl_F_atanhx.cc: Likewise. * src/float/transcendental/cl_F_atanx.cc: Likewise. * src/float/transcendental/cl_F_cosh.cc: Likewise. * src/float/transcendental/cl_F_expx.cc: Likewise. * src/float/transcendental/cl_F_lnx.cc: Likewise. * src/float/transcendental/cl_F_sinhx.cc: Likewise. * src/float/transcendental/cl_F_sinx.cc: Likewise. * src/float/transcendental/cl_LF_pi.cc: Likewise. * src/integer/cl_I.h: Likewise. * src/complex/algebraic/cl_LF_hypot.cc: Likewise. * src/complex/elem/division/cl_C_LF_recip.cc: Likewise. * src/float/dfloat/misc/cl_DF_exponent.cc: Likewise. * src/integer/conv/cl_I_from_Q2.cc: Added. * src/base/cl_low.h (isqrtC): New function, for 64 bit falls back to... * src/base/low/cl_low_isqrt.cc (isqrt): ...this new implementation. * src/base/cl_macros.h (bitc): Make sure 64 bit is used if required by exponent operations. * examples/pi.cc: Support more than 646456614 decimal digits.
18 years ago
25 years ago
Extend the exponent range from 32 bits to 64 bits on selected platforms. * include/cln/number.h: Add signatures for operations with long long. * include/cln/complex_class.h: Likewise. * include/cln/real_class.h: Likewise. * include/cln/real.h: Likewise. * include/cln/rational_class.h: Likewise. * include/cln/rational.h: Likewise. * include/cln/integer_class.h: Likewise. * include/cln/integer.h: Likewise. * include/cln/float.h: Likewise. * include/cln/lfloat.h: Likewise. * include/cln/types.h (sintE and uintE): New types for exponents. * include/cln/*float.h: Use the new types for exponents. * include/cln/floatformat.h (float_format_t): Make underlying type compatible with sintE. * doc/cln.tex: Document changed float_exponent return value. * src/float/cl_F.h: Likewise. * src/float/ffloat/misc/cl_FF_exponent.cc: Likewise. * src/float/input/cl_F_read.cc: Likewise. * src/float/lfloat/cl_LF.h: Likewise. * src/float/lfloat/cl_LF_impl.h: Likewise. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Likewise. * src/float/lfloat/elem/cl_LF_1plus.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_compare.cc: Likewise. * src/float/lfloat/elem/cl_LF_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_from_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_fround.cc: Likewise. * src/float/lfloat/elem/cl_LF_ftrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_futrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_square.cc: Likewise. * src/float/lfloat/elem/cl_LF_to_I.cc: Likewise. * src/float/lfloat/misc/cl_LF_decode.cc: Likewise. * src/float/lfloat/misc/cl_LF_exponent.cc: Likewise. * src/float/lfloat/misc/cl_LF_idecode.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Likewise. * src/float/misc/cl_F_decode.cc: Likewise. * src/float/misc/cl_F_exponent.cc: Likewise. * src/float/misc/cl_F_shortenrel.cc: Likewise. * src/float/misc/cl_float_format.cc: Likewise. * src/float/output/cl_F_dprint.cc: Likewise. * src/float/sfloat/misc/cl_SF_exponent.cc: Likewise. * src/float/transcendental/cl_F_atanhx.cc: Likewise. * src/float/transcendental/cl_F_atanx.cc: Likewise. * src/float/transcendental/cl_F_cosh.cc: Likewise. * src/float/transcendental/cl_F_expx.cc: Likewise. * src/float/transcendental/cl_F_lnx.cc: Likewise. * src/float/transcendental/cl_F_sinhx.cc: Likewise. * src/float/transcendental/cl_F_sinx.cc: Likewise. * src/float/transcendental/cl_LF_pi.cc: Likewise. * src/integer/cl_I.h: Likewise. * src/complex/algebraic/cl_LF_hypot.cc: Likewise. * src/complex/elem/division/cl_C_LF_recip.cc: Likewise. * src/float/dfloat/misc/cl_DF_exponent.cc: Likewise. * src/integer/conv/cl_I_from_Q2.cc: Added. * src/base/cl_low.h (isqrtC): New function, for 64 bit falls back to... * src/base/low/cl_low_isqrt.cc (isqrt): ...this new implementation. * src/base/cl_macros.h (bitc): Make sure 64 bit is used if required by exponent operations. * examples/pi.cc: Support more than 646456614 decimal digits.
18 years ago
25 years ago
25 years ago
25 years ago
  1. // Public rational number operations.
  2. #ifndef _CL_RATIONAL_H
  3. #define _CL_RATIONAL_H
  4. #include "cln/number.h"
  5. #include "cln/rational_class.h"
  6. #include "cln/integer_class.h"
  7. namespace cln {
  8. CL_DEFINE_AS_CONVERSION(cl_RA)
  9. // numerator(r) liefert den Z�hler der rationalen Zahl r.
  10. extern const cl_I numerator (const cl_RA& r);
  11. // denominator(r) liefert den Nenner (> 0) der rationalen Zahl r.
  12. extern const cl_I denominator (const cl_RA& r);
  13. // Liefert (- r), wo r eine rationale Zahl ist.
  14. extern const cl_RA operator- (const cl_RA& r);
  15. // (+ r s), wo r und s rationale Zahlen sind.
  16. extern const cl_RA operator+ (const cl_RA& r, const cl_RA& s);
  17. // Dem C++-Compiler mu� man auch das Folgende sagen:
  18. inline const cl_RA operator+ (const int x, const cl_RA& y)
  19. { return cl_I(x) + y; }
  20. inline const cl_RA operator+ (const unsigned int x, const cl_RA& y)
  21. { return cl_I(x) + y; }
  22. inline const cl_RA operator+ (const long x, const cl_RA& y)
  23. { return cl_I(x) + y; }
  24. inline const cl_RA operator+ (const unsigned long x, const cl_RA& y)
  25. { return cl_I(x) + y; }
  26. #ifdef HAVE_LONGLONG
  27. inline const cl_RA operator+ (const long long x, const cl_RA& y)
  28. { return cl_I(x) + y; }
  29. inline const cl_RA operator+ (const unsigned long long x, const cl_RA& y)
  30. { return cl_I(x) + y; }
  31. #endif
  32. inline const cl_RA operator+ (const cl_RA& x, const int y)
  33. { return x + cl_I(y); }
  34. inline const cl_RA operator+ (const cl_RA& x, const unsigned int y)
  35. { return x + cl_I(y); }
  36. inline const cl_RA operator+ (const cl_RA& x, const long y)
  37. { return x + cl_I(y); }
  38. inline const cl_RA operator+ (const cl_RA& x, const unsigned long y)
  39. { return x + cl_I(y); }
  40. #ifdef HAVE_LONGLONG
  41. inline const cl_RA operator+ (const cl_RA& x, const long long y)
  42. { return x + cl_I(y); }
  43. inline const cl_RA operator+ (const cl_RA& x, const unsigned long long y)
  44. { return x + cl_I(y); }
  45. #endif
  46. // (- r s), wo r und s rationale Zahlen sind.
  47. extern const cl_RA operator- (const cl_RA& r, const cl_RA& s);
  48. // Dem C++-Compiler mu� man auch das Folgende sagen:
  49. inline const cl_RA operator- (const int x, const cl_RA& y)
  50. { return cl_I(x) - y; }
  51. inline const cl_RA operator- (const unsigned int x, const cl_RA& y)
  52. { return cl_I(x) - y; }
  53. inline const cl_RA operator- (const long x, const cl_RA& y)
  54. { return cl_I(x) - y; }
  55. inline const cl_RA operator- (const unsigned long x, const cl_RA& y)
  56. { return cl_I(x) - y; }
  57. #ifdef HAVE_LONGLONG
  58. inline const cl_RA operator- (const long long x, const cl_RA& y)
  59. { return cl_I(x) - y; }
  60. inline const cl_RA operator- (const unsigned long long x, const cl_RA& y)
  61. { return cl_I(x) - y; }
  62. #endif
  63. inline const cl_RA operator- (const cl_RA& x, const int y)
  64. { return x - cl_I(y); }
  65. inline const cl_RA operator- (const cl_RA& x, const unsigned int y)
  66. { return x - cl_I(y); }
  67. inline const cl_RA operator- (const cl_RA& x, const long y)
  68. { return x - cl_I(y); }
  69. inline const cl_RA operator- (const cl_RA& x, const unsigned long y)
  70. { return x - cl_I(y); }
  71. #ifdef HAVE_LONGLONG
  72. inline const cl_RA operator- (const cl_RA& x, const long long y)
  73. { return x - cl_I(y); }
  74. inline const cl_RA operator- (const cl_RA& x, const unsigned long long y)
  75. { return x - cl_I(y); }
  76. #endif
  77. // (1+ r), wo r eine rationale Zahl ist.
  78. extern const cl_RA plus1 (const cl_RA& r);
  79. // (1- r), wo r eine rationale Zahl ist.
  80. extern const cl_RA minus1 (const cl_RA& r);
  81. // (abs r), wo r eine rationale Zahl ist.
  82. extern const cl_RA abs (const cl_RA& r);
  83. // equal(r,s) vergleicht zwei rationale Zahlen r und s auf Gleichheit.
  84. extern cl_boolean equal (const cl_RA& r, const cl_RA& s);
  85. // equal_hashcode(r) liefert einen equal-invarianten Hashcode f�r r.
  86. extern uint32 equal_hashcode (const cl_RA& r);
  87. // compare(r,s) vergleicht zwei rationale Zahlen r und s.
  88. // Ergebnis: 0 falls r=s, +1 falls r>s, -1 falls r<s.
  89. extern cl_signean compare (const cl_RA& r, const cl_RA& s);
  90. inline bool operator== (const cl_RA& x, const cl_RA& y)
  91. { return equal(x,y); }
  92. inline bool operator!= (const cl_RA& x, const cl_RA& y)
  93. { return !equal(x,y); }
  94. inline bool operator<= (const cl_RA& x, const cl_RA& y)
  95. { return compare(x,y)<=0; }
  96. inline bool operator< (const cl_RA& x, const cl_RA& y)
  97. { return compare(x,y)<0; }
  98. inline bool operator>= (const cl_RA& x, const cl_RA& y)
  99. { return compare(x,y)>=0; }
  100. inline bool operator> (const cl_RA& x, const cl_RA& y)
  101. { return compare(x,y)>0; }
  102. // minusp(x) == (< x 0)
  103. extern cl_boolean minusp (const cl_RA& x);
  104. // zerop(x) stellt fest, ob eine rationale Zahl = 0 ist.
  105. extern cl_boolean zerop (const cl_RA& x);
  106. // plusp(x) == (> x 0)
  107. extern cl_boolean plusp (const cl_RA& x);
  108. // Kehrwert (/ r), wo r eine rationale Zahl ist.
  109. extern const cl_RA recip (const cl_RA& r);
  110. // Liefert (* r s), wo r und s rationale Zahlen sind.
  111. extern const cl_RA operator* (const cl_RA& r, const cl_RA& s);
  112. // Dem C++-Compiler mu� man auch das Folgende sagen:
  113. inline const cl_RA operator* (const int x, const cl_RA& y)
  114. { return cl_I(x) * y; }
  115. inline const cl_RA operator* (const unsigned int x, const cl_RA& y)
  116. { return cl_I(x) * y; }
  117. inline const cl_RA operator* (const long x, const cl_RA& y)
  118. { return cl_I(x) * y; }
  119. inline const cl_RA operator* (const unsigned long x, const cl_RA& y)
  120. { return cl_I(x) * y; }
  121. #ifdef HAVE_LONGLONG
  122. inline const cl_RA operator* (const long long x, const cl_RA& y)
  123. { return cl_I(x) * y; }
  124. inline const cl_RA operator* (const unsigned long long x, const cl_RA& y)
  125. { return cl_I(x) * y; }
  126. #endif
  127. inline const cl_RA operator* (const cl_RA& x, const int y)
  128. { return x * cl_I(y); }
  129. inline const cl_RA operator* (const cl_RA& x, const unsigned int y)
  130. { return x * cl_I(y); }
  131. inline const cl_RA operator* (const cl_RA& x, const long y)
  132. { return x * cl_I(y); }
  133. inline const cl_RA operator* (const cl_RA& x, const unsigned long y)
  134. { return x * cl_I(y); }
  135. #ifdef HAVE_LONGLONG
  136. inline const cl_RA operator* (const cl_RA& x, const long long y)
  137. { return x * cl_I(y); }
  138. inline const cl_RA operator* (const cl_RA& x, const unsigned long long y)
  139. { return x * cl_I(y); }
  140. #endif
  141. // Quadrat (* r r), wo r eine rationale Zahl ist.
  142. extern const cl_RA square (const cl_RA& r);
  143. // Liefert (/ r s), wo r und s rationale Zahlen sind.
  144. extern const cl_RA operator/ (const cl_RA& r, const cl_RA& s);
  145. // Dem C++-Compiler mu� man auch das Folgende sagen:
  146. inline const cl_RA operator/ (const int x, const cl_RA& y)
  147. { return cl_I(x) / y; }
  148. inline const cl_RA operator/ (const unsigned int x, const cl_RA& y)
  149. { return cl_I(x) / y; }
  150. inline const cl_RA operator/ (const long x, const cl_RA& y)
  151. { return cl_I(x) / y; }
  152. inline const cl_RA operator/ (const unsigned long x, const cl_RA& y)
  153. { return cl_I(x) / y; }
  154. #ifdef HAVE_LONGLONG
  155. inline const cl_RA operator/ (const long long x, const cl_RA& y)
  156. { return cl_I(x) / y; }
  157. inline const cl_RA operator/ (const unsigned long long x, const cl_RA& y)
  158. { return cl_I(x) / y; }
  159. #endif
  160. inline const cl_RA operator/ (const cl_RA& x, const int y)
  161. { return x / cl_I(y); }
  162. inline const cl_RA operator/ (const cl_RA& x, const unsigned int y)
  163. { return x / cl_I(y); }
  164. inline const cl_RA operator/ (const cl_RA& x, const long y)
  165. { return x / cl_I(y); }
  166. inline const cl_RA operator/ (const cl_RA& x, const unsigned long y)
  167. { return x / cl_I(y); }
  168. #ifdef HAVE_LONGLONG
  169. inline const cl_RA operator/ (const cl_RA& x, const long long y)
  170. { return x / cl_I(y); }
  171. inline const cl_RA operator/ (const cl_RA& x, const unsigned long long y)
  172. { return x / cl_I(y); }
  173. #endif
  174. // Return type for rounding operators.
  175. // x / y --> (q,r) with x = y*q+r.
  176. struct cl_RA_div_t {
  177. cl_I quotient;
  178. cl_RA remainder;
  179. // Constructor.
  180. cl_RA_div_t () {}
  181. cl_RA_div_t (const cl_I& q, const cl_RA& r) : quotient(q), remainder(r) {}
  182. };
  183. // Liefert ganzzahligen und gebrochenen Anteil einer rationalen Zahl.
  184. // (q,r) := (floor x)
  185. // floor2(x)
  186. // > x: rationale Zahl
  187. // < q,r: Quotient q, ein Integer, Rest r, eine rationale Zahl
  188. extern const cl_RA_div_t floor2 (const cl_RA& x);
  189. extern const cl_I floor1 (const cl_RA& x);
  190. // Liefert ganzzahligen und gebrochenen Anteil einer rationalen Zahl.
  191. // (q,r) := (ceiling x)
  192. // ceiling2(x)
  193. // > x: rationale Zahl
  194. // < q,r: Quotient q, ein Integer, Rest r, eine rationale Zahl
  195. extern const cl_RA_div_t ceiling2 (const cl_RA& x);
  196. extern const cl_I ceiling1 (const cl_RA& x);
  197. // Liefert ganzzahligen und gebrochenen Anteil einer rationalen Zahl.
  198. // (q,r) := (truncate x)
  199. // truncate2(x)
  200. // > x: rationale Zahl
  201. // < q,r: Quotient q, ein Integer, Rest r, eine rationale Zahl
  202. extern const cl_RA_div_t truncate2 (const cl_RA& x);
  203. extern const cl_I truncate1 (const cl_RA& x);
  204. // Liefert ganzzahligen und gebrochenen Anteil einer rationalen Zahl.
  205. // (q,r) := (round x)
  206. // round2(x)
  207. // > x: rationale Zahl
  208. // < q,r: Quotient q, ein Integer, Rest r, eine rationale Zahl
  209. extern const cl_RA_div_t round2 (const cl_RA& x);
  210. extern const cl_I round1 (const cl_RA& x);
  211. // floor2(x,y) liefert (floor x y).
  212. extern const cl_RA_div_t floor2 (const cl_RA& x, const cl_RA& y);
  213. extern const cl_I floor1 (const cl_RA& x, const cl_RA& y);
  214. // ceiling2(x,y) liefert (ceiling x y).
  215. extern const cl_RA_div_t ceiling2 (const cl_RA& x, const cl_RA& y);
  216. extern const cl_I ceiling1 (const cl_RA& x, const cl_RA& y);
  217. // truncate2(x,y) liefert (truncate x y).
  218. extern const cl_RA_div_t truncate2 (const cl_RA& x, const cl_RA& y);
  219. extern const cl_I truncate1 (const cl_RA& x, const cl_RA& y);
  220. // round2(x,y) liefert (round x y).
  221. extern const cl_RA_div_t round2 (const cl_RA& x, const cl_RA& y);
  222. extern const cl_I round1 (const cl_RA& x, const cl_RA& y);
  223. // max(x,y) liefert (max x y), wo x und y rationale Zahlen sind.
  224. extern const cl_RA max (const cl_RA& x, const cl_RA& y);
  225. // min(x,y) liefert (min x y), wo x und y rationale Zahlen sind.
  226. extern const cl_RA min (const cl_RA& x, const cl_RA& y);
  227. // signum(x) liefert (signum x), wo x eine rationale Zahl ist.
  228. extern const cl_RA signum (const cl_RA& x);
  229. // (expt x y), wo x eine rationale Zahl und y ein Integer >0 ist.
  230. extern const cl_RA expt_pos (const cl_RA& x, uintL y);
  231. extern const cl_RA expt_pos (const cl_RA& x, const cl_I& y);
  232. // (expt x y), wo x eine rationale Zahl und y ein Integer ist.
  233. extern const cl_RA expt (const cl_RA& x, sintL y);
  234. extern const cl_RA expt (const cl_RA& x, const cl_I& y);
  235. // Stellt fest, ob eine rationale Zahl >=0 das Quadrat einer rationalen Zahl
  236. // ist.
  237. // sqrtp(x,&w)
  238. // > x: eine rationale Zahl >=0
  239. // < w: rationale Zahl (sqrt x) falls x Quadratzahl
  240. // < ergebnis: cl_true ..................., cl_false sonst
  241. extern cl_boolean sqrtp (const cl_RA& x, cl_RA* w);
  242. // Stellt fest, ob eine rationale Zahl >=0 die n-te Potenz einer rationalen Zahl
  243. // ist.
  244. // rootp(x,n,&w)
  245. // > x: eine rationale Zahl >=0
  246. // > n: ein Integer >0
  247. // < w: exakte n-te Wurzel (expt x (/ n)) falls x eine n-te Potenz
  248. // < ergebnis: cl_true ........................, cl_false sonst
  249. extern cl_boolean rootp (const cl_RA& x, uintL n, cl_RA* w);
  250. extern cl_boolean rootp (const cl_RA& x, const cl_I& n, cl_RA* w);
  251. // Liefert zu Integers a>0, b>1 den Logarithmus log(a,b),
  252. // falls er eine rationale Zahl ist.
  253. // logp(a,b,&l)
  254. // > a: ein Integer >0
  255. // > b: ein Integer >1
  256. // < l: log(a,b) falls er eine exakte rationale Zahl ist
  257. // < ergebnis: cl_true ......................................., cl_false sonst
  258. extern cl_boolean logp (const cl_I& a, const cl_I& b, cl_RA* l);
  259. // Liefert zu rationalen Zahlen a>0, b>0 den Logarithmus log(a,b),
  260. // falls er eine rationale Zahl ist.
  261. // logp(a,b,&l)
  262. // > a: eine rationale Zahl >0
  263. // > b: eine rationale Zahl >0, /=1
  264. // < l: log(a,b) falls er eine exakte rationale Zahl ist
  265. // < ergebnis: cl_true ......................................., cl_false sonst
  266. extern cl_boolean logp (const cl_RA& a, const cl_RA& b, cl_RA* l);
  267. // Konversion zu einem C "float".
  268. extern float float_approx (const cl_RA& x);
  269. // Konversion zu einem C "double".
  270. extern double double_approx (const cl_RA& x);
  271. #ifdef WANT_OBFUSCATING_OPERATORS
  272. // This could be optimized to use in-place operations.
  273. inline cl_RA& operator+= (cl_RA& x, const cl_RA& y) { return x = x + y; }
  274. inline cl_RA& operator+= (cl_RA& x, const int y) { return x = x + y; }
  275. inline cl_RA& operator+= (cl_RA& x, const unsigned int y) { return x = x + y; }
  276. inline cl_RA& operator+= (cl_RA& x, const long y) { return x = x + y; }
  277. inline cl_RA& operator+= (cl_RA& x, const unsigned long y) { return x = x + y; }
  278. #ifdef HAVE_LONGLONG
  279. inline cl_RA& operator+= (cl_RA& x, const long long y) { return x = x + y; }
  280. inline cl_RA& operator+= (cl_RA& x, const unsigned long long y) { return x = x + y; }
  281. #endif
  282. inline cl_RA& operator++ /* prefix */ (cl_RA& x) { return x = plus1(x); }
  283. inline void operator++ /* postfix */ (cl_RA& x, int dummy) { (void)dummy; x = plus1(x); }
  284. inline cl_RA& operator-= (cl_RA& x, const cl_RA& y) { return x = x - y; }
  285. inline cl_RA& operator-= (cl_RA& x, const int y) { return x = x - y; }
  286. inline cl_RA& operator-= (cl_RA& x, const unsigned int y) { return x = x - y; }
  287. inline cl_RA& operator-= (cl_RA& x, const long y) { return x = x - y; }
  288. inline cl_RA& operator-= (cl_RA& x, const unsigned long y) { return x = x - y; }
  289. #ifdef HAVE_LONGLONG
  290. inline cl_RA& operator-= (cl_RA& x, const long long y) { return x = x - y; }
  291. inline cl_RA& operator-= (cl_RA& x, const unsigned long long y) { return x = x - y; }
  292. #endif
  293. inline cl_RA& operator-- /* prefix */ (cl_RA& x) { return x = minus1(x); }
  294. inline void operator-- /* postfix */ (cl_RA& x, int dummy) { (void)dummy; x = minus1(x); }
  295. inline cl_RA& operator*= (cl_RA& x, const cl_RA& y) { return x = x * y; }
  296. inline cl_RA& operator/= (cl_RA& x, const cl_RA& y) { return x = x / y; }
  297. #endif
  298. // Runtime typing support.
  299. extern cl_class cl_class_ratio;
  300. // Debugging support.
  301. #ifdef CL_DEBUG
  302. extern int cl_RA_debug_module;
  303. CL_FORCE_LINK(cl_RA_debug_dummy, cl_RA_debug_module)
  304. #endif
  305. } // namespace cln
  306. #endif /* _CL_RATIONAL_H */