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.

637 lines
26 KiB

25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
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
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
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
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
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
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
  1. // Public real number operations.
  2. #ifndef _CL_REAL_H
  3. #define _CL_REAL_H
  4. #include "cln/number.h"
  5. #include "cln/real_class.h"
  6. #include "cln/rational_class.h"
  7. #include "cln/integer_class.h"
  8. #include "cln/float.h"
  9. #include "cln/floatformat.h"
  10. #include "cln/random.h"
  11. namespace cln {
  12. CL_DEFINE_AS_CONVERSION(cl_R)
  13. // zerop(x) testet, ob (= x 0).
  14. extern bool zerop (const cl_R& x);
  15. // minusp(x) testet, ob (< x 0).
  16. extern bool minusp (const cl_R& x);
  17. // plusp(x) testet, ob (> x 0).
  18. extern bool plusp (const cl_R& x);
  19. // R_to_SF(x) wandelt eine reelle Zahl x in ein Short-Float um.
  20. // < ergebnis: (coerce x 'short-float)
  21. extern const cl_SF cl_R_to_SF (const cl_R& x);
  22. // R_to_FF(x) wandelt eine reelle Zahl x in ein Single-Float um.
  23. // < ergebnis: (coerce x 'single-float)
  24. extern const cl_FF cl_R_to_FF (const cl_R& x);
  25. // R_to_DF(x) wandelt eine reelle Zahl x in ein Double-Float um.
  26. // < ergebnis: (coerce x 'double-float)
  27. extern const cl_DF cl_R_to_DF (const cl_R& x);
  28. // R_to_LF(x,len) wandelt eine reelle Zahl x in ein Long-Float mit len Digits um.
  29. // > uintC len: gewünschte Anzahl Digits, >=LF_minlen
  30. // < ergebnis: (coerce x `(long-float ,len))
  31. extern const cl_LF cl_R_to_LF (const cl_R& x, uintC len);
  32. // cl_float(x,y) wandelt eine reelle Zahl x in das Float-Format des
  33. // Floats y um und rundet dabei nötigenfalls.
  34. // > x: eine reelle Zahl
  35. // > y: ein Float
  36. // < ergebnis: (float x y)
  37. extern const cl_F cl_float (const cl_R& x, const cl_F& y);
  38. // cl_float(x,f) wandelt eine reelle Zahl x in das Float-Format f um
  39. // und rundet dabei nötigenfalls.
  40. // > x: eine reelle Zahl
  41. // > f: eine Float-Format-Spezifikation
  42. // < ergebnis: (float x f)
  43. extern const cl_F cl_float (const cl_R& x, float_format_t f);
  44. // cl_float(x) wandelt eine reelle Zahl x in ein Float um
  45. // und rundet dabei nötigenfalls.
  46. // > x: eine reelle Zahl
  47. // < ergebnis: (float x)
  48. // Abhängig von default_float_format.
  49. extern const cl_F cl_float (const cl_R& x);
  50. // Liefert (- x), wo x eine reelle Zahl ist.
  51. extern const cl_R operator- (const cl_R& x);
  52. // Liefert (+ x y), wo x und y reelle Zahlen sind.
  53. extern const cl_R operator+ (const cl_R& x, const cl_R& y);
  54. // Spezialfall: x oder y Float -> Ergebnis Float
  55. inline const cl_F operator+ (const cl_R& x, const cl_F& y)
  56. { return The(cl_F)(x + The(cl_R)(y)); }
  57. inline const cl_F operator+ (const cl_F& x, const cl_R& y)
  58. { return The(cl_F)(The(cl_R)(x) + y); }
  59. // Dem C++-Compiler muß man nun auch das Folgende sagen:
  60. inline const cl_R operator+ (const int x, const cl_R& y)
  61. { return cl_I(x) + y; }
  62. inline const cl_R operator+ (const unsigned int x, const cl_R& y)
  63. { return cl_I(x) + y; }
  64. inline const cl_R operator+ (const long x, const cl_R& y)
  65. { return cl_I(x) + y; }
  66. inline const cl_R operator+ (const unsigned long x, const cl_R& y)
  67. { return cl_I(x) + y; }
  68. #ifdef HAVE_LONGLONG
  69. inline const cl_R operator+ (const long long x, const cl_R& y)
  70. { return cl_I(x) + y; }
  71. inline const cl_R operator+ (const unsigned long long x, const cl_R& y)
  72. { return cl_I(x) + y; }
  73. #endif
  74. inline const cl_F operator+ (const float x, const cl_R& y)
  75. { return The(cl_F)(cl_R(x) + y); }
  76. inline const cl_F operator+ (const double x, const cl_R& y)
  77. { return The(cl_F)(cl_R(x) + y); }
  78. inline const cl_R operator+ (const cl_R& x, const int y)
  79. { return x + cl_I(y); }
  80. inline const cl_R operator+ (const cl_R& x, const unsigned int y)
  81. { return x + cl_I(y); }
  82. inline const cl_R operator+ (const cl_R& x, const long y)
  83. { return x + cl_I(y); }
  84. inline const cl_R operator+ (const cl_R& x, const unsigned long y)
  85. { return x + cl_I(y); }
  86. #ifdef HAVE_LONGLONG
  87. inline const cl_R operator+ (const cl_R& x, const long long y)
  88. { return x + cl_I(y); }
  89. inline const cl_R operator+ (const cl_R& x, const unsigned long long y)
  90. { return x + cl_I(y); }
  91. #endif
  92. inline const cl_F operator+ (const cl_R& x, const float y)
  93. { return The(cl_F)(x + cl_R(y)); }
  94. inline const cl_F operator+ (const cl_R& x, const double y)
  95. { return The(cl_F)(x + cl_R(y)); }
  96. // Liefert (- x y), wo x und y reelle Zahlen sind.
  97. extern const cl_R operator- (const cl_R& x, const cl_R& y);
  98. // Spezialfall: x oder y Float -> Ergebnis Float
  99. inline const cl_F operator- (const cl_R& x, const cl_F& y)
  100. { return The(cl_F)(x - The(cl_R)(y)); }
  101. inline const cl_F operator- (const cl_F& x, const cl_R& y)
  102. { return The(cl_F)(The(cl_R)(x) - y); }
  103. // Dem C++-Compiler muß man nun auch das Folgende sagen:
  104. inline const cl_R operator- (const int x, const cl_R& y)
  105. { return cl_I(x) - y; }
  106. inline const cl_R operator- (const unsigned int x, const cl_R& y)
  107. { return cl_I(x) - y; }
  108. inline const cl_R operator- (const long x, const cl_R& y)
  109. { return cl_I(x) - y; }
  110. inline const cl_R operator- (const unsigned long x, const cl_R& y)
  111. { return cl_I(x) - y; }
  112. #ifdef HAVE_LONGLONG
  113. inline const cl_R operator- (const long long x, const cl_R& y)
  114. { return cl_I(x) - y; }
  115. inline const cl_R operator- (const unsigned long long x, const cl_R& y)
  116. { return cl_I(x) - y; }
  117. #endif
  118. inline const cl_F operator- (const float x, const cl_R& y)
  119. { return The(cl_F)(cl_R(x) - y); }
  120. inline const cl_F operator- (const double x, const cl_R& y)
  121. { return The(cl_F)(cl_R(x) - y); }
  122. inline const cl_R operator- (const cl_R& x, const int y)
  123. { return x - cl_I(y); }
  124. inline const cl_R operator- (const cl_R& x, const unsigned int y)
  125. { return x - cl_I(y); }
  126. inline const cl_R operator- (const cl_R& x, const long y)
  127. { return x - cl_I(y); }
  128. inline const cl_R operator- (const cl_R& x, const unsigned long y)
  129. { return x - cl_I(y); }
  130. #ifdef HAVE_LONGLONG
  131. inline const cl_R operator- (const cl_R& x, const long long y)
  132. { return x - cl_I(y); }
  133. inline const cl_R operator- (const cl_R& x, const unsigned long long y)
  134. { return x - cl_I(y); }
  135. #endif
  136. inline const cl_F operator- (const cl_R& x, const float y)
  137. { return The(cl_F)(x - cl_R(y)); }
  138. inline const cl_F operator- (const cl_R& x, const double y)
  139. { return The(cl_F)(x - cl_R(y)); }
  140. // Liefert (* x y), wo x und y reelle Zahlen sind.
  141. extern const cl_R operator* (const cl_R& x, const cl_R& y);
  142. // Dem C++-Compiler muß man auch das Folgende sagen (wg. `int * cl_F' u.ä.):
  143. inline const cl_R operator* (const int x, const cl_R& y)
  144. { return cl_I(x) * y; }
  145. inline const cl_R operator* (const unsigned int x, const cl_R& y)
  146. { return cl_I(x) * y; }
  147. inline const cl_R operator* (const long x, const cl_R& y)
  148. { return cl_I(x) * y; }
  149. inline const cl_R operator* (const unsigned long x, const cl_R& y)
  150. { return cl_I(x) * y; }
  151. #ifdef HAVE_LONGLONG
  152. inline const cl_R operator* (const long long x, const cl_R& y)
  153. { return cl_I(x) * y; }
  154. inline const cl_R operator* (const unsigned long long x, const cl_R& y)
  155. { return cl_I(x) * y; }
  156. #endif
  157. inline const cl_R operator* (const float x, const cl_R& y)
  158. { return cl_R(x) * y; }
  159. inline const cl_R operator* (const double x, const cl_R& y)
  160. { return cl_R(x) * y; }
  161. inline const cl_R operator* (const cl_R& x, const int y)
  162. { return x * cl_I(y); }
  163. inline const cl_R operator* (const cl_R& x, const unsigned int y)
  164. { return x * cl_I(y); }
  165. inline const cl_R operator* (const cl_R& x, const long y)
  166. { return x * cl_I(y); }
  167. inline const cl_R operator* (const cl_R& x, const unsigned long y)
  168. { return x * cl_I(y); }
  169. #ifdef HAVE_LONGLONG
  170. inline const cl_R operator* (const cl_R& x, const long long y)
  171. { return x * cl_I(y); }
  172. inline const cl_R operator* (const cl_R& x, const unsigned long long y)
  173. { return x * cl_I(y); }
  174. #endif
  175. inline const cl_R operator* (const cl_R& x, const float y)
  176. { return x * cl_R(y); }
  177. inline const cl_R operator* (const cl_R& x, const double y)
  178. { return x * cl_R(y); }
  179. // Liefert (* x x), wo x eine reelle Zahl ist.
  180. extern const cl_R square (const cl_R& x);
  181. // Liefert (/ x y), wo x und y reelle Zahlen sind.
  182. extern const cl_R operator/ (const cl_R& x, const cl_R& y);
  183. // Spezialfall: x Float -> Ergebnis Float
  184. inline const cl_F operator/ (const cl_F& x, const cl_R& y)
  185. { return The(cl_F)(The(cl_R)(x) / y); }
  186. // Dem C++-Compiler muß man auch das Folgende sagen (wg. `int / cl_F' u.ä.):
  187. inline const cl_R operator/ (const int x, const cl_R& y)
  188. { return cl_I(x) / y; }
  189. inline const cl_R operator/ (const unsigned int x, const cl_R& y)
  190. { return cl_I(x) / y; }
  191. inline const cl_R operator/ (const long x, const cl_R& y)
  192. { return cl_I(x) / y; }
  193. inline const cl_R operator/ (const unsigned long x, const cl_R& y)
  194. { return cl_I(x) / y; }
  195. #ifdef HAVE_LONGLONG
  196. inline const cl_R operator/ (const long long x, const cl_R& y)
  197. { return cl_I(x) / y; }
  198. inline const cl_R operator/ (const unsigned long long x, const cl_R& y)
  199. { return cl_I(x) / y; }
  200. #endif
  201. inline const cl_F operator/ (const float x, const cl_R& y)
  202. { return The(cl_F)(cl_R(x) / y); }
  203. inline const cl_F operator/ (const double x, const cl_R& y)
  204. { return The(cl_F)(cl_R(x) / y); }
  205. inline const cl_R operator/ (const cl_R& x, const int y)
  206. { return x / cl_I(y); }
  207. inline const cl_R operator/ (const cl_R& x, const unsigned int y)
  208. { return x / cl_I(y); }
  209. inline const cl_R operator/ (const cl_R& x, const long y)
  210. { return x / cl_I(y); }
  211. inline const cl_R operator/ (const cl_R& x, const unsigned long y)
  212. { return x / cl_I(y); }
  213. #ifdef HAVE_LONGLONG
  214. inline const cl_R operator/ (const cl_R& x, const long long y)
  215. { return x / cl_I(y); }
  216. inline const cl_R operator/ (const cl_R& x, const unsigned long long y)
  217. { return x / cl_I(y); }
  218. #endif
  219. inline const cl_R operator/ (const cl_R& x, const float y)
  220. { return x / cl_R(y); }
  221. inline const cl_R operator/ (const cl_R& x, const double y)
  222. { return x / cl_R(y); }
  223. // Liefert (abs x), wo x eine reelle Zahl ist.
  224. extern const cl_R abs (const cl_R& x);
  225. // recip(x) liefert (/ x), wo x eine reelle Zahl ist.
  226. extern const cl_R recip (const cl_R& x);
  227. // (1+ x), wo x eine reelle Zahl ist.
  228. extern const cl_R plus1 (const cl_R& x);
  229. // (1- x), wo x eine reelle Zahl ist.
  230. extern const cl_R minus1 (const cl_R& x);
  231. // Return type for rounding operators.
  232. // x / y --> (q,r) with x = y*q+r.
  233. struct cl_R_div_t {
  234. cl_I quotient;
  235. cl_R remainder;
  236. // Constructor.
  237. cl_R_div_t () {}
  238. cl_R_div_t (const cl_I& q, const cl_R& r) : quotient(q), remainder(r) {}
  239. cl_R_div_t (const struct cl_I_div_t &);
  240. cl_R_div_t (const struct cl_RA_div_t &);
  241. cl_R_div_t (const struct cl_F_div_t &);
  242. };
  243. // floor2(x) liefert (floor x), wo x eine reelle Zahl ist.
  244. extern const cl_R_div_t floor2 (const cl_R& x);
  245. extern const cl_I floor1 (const cl_R& x);
  246. // ceiling2(x) liefert (ceiling x), wo x eine reelle Zahl ist.
  247. extern const cl_R_div_t ceiling2 (const cl_R& x);
  248. extern const cl_I ceiling1 (const cl_R& x);
  249. // truncate2(x) liefert (truncate x), wo x eine reelle Zahl ist.
  250. extern const cl_R_div_t truncate2 (const cl_R& x);
  251. extern const cl_I truncate1 (const cl_R& x);
  252. // round2(x) liefert (round x), wo x eine reelle Zahl ist.
  253. extern const cl_R_div_t round2 (const cl_R& x);
  254. extern const cl_I round1 (const cl_R& x);
  255. // floor2(x,y) liefert (floor x y), wo x und y reelle Zahlen sind.
  256. extern const cl_R_div_t floor2 (const cl_R& x, const cl_R& y);
  257. extern const cl_I floor1 (const cl_R& x, const cl_R& y);
  258. // ceiling2(x,y) liefert (ceiling x y), wo x und y reelle Zahlen sind.
  259. extern const cl_R_div_t ceiling2 (const cl_R& x, const cl_R& y);
  260. extern const cl_I ceiling1 (const cl_R& x, const cl_R& y);
  261. // truncate2(x,y) liefert (truncate x y), wo x und y reelle Zahlen sind.
  262. extern const cl_R_div_t truncate2 (const cl_R& x, const cl_R& y);
  263. extern const cl_I truncate1 (const cl_R& x, const cl_R& y);
  264. // round2(x,y) liefert (round x y), wo x und y reelle Zahlen sind.
  265. extern const cl_R_div_t round2 (const cl_R& x, const cl_R& y);
  266. extern const cl_I round1 (const cl_R& x, const cl_R& y);
  267. // Return type for frounding operators.
  268. // x / y --> (q,r) with x = y*q+r.
  269. struct cl_R_fdiv_t {
  270. cl_F quotient;
  271. cl_R remainder;
  272. // Constructor.
  273. cl_R_fdiv_t () {}
  274. cl_R_fdiv_t (const cl_F& q, const cl_R& r) : quotient(q), remainder(r) {}
  275. cl_R_fdiv_t (const struct cl_F_fdiv_t &);
  276. };
  277. // ffloor2(x) liefert (ffloor x), wo x eine reelle Zahl ist.
  278. extern const cl_R_fdiv_t ffloor2 (const cl_R& x);
  279. extern const cl_F ffloor (const cl_R& x);
  280. // fceiling2(x) liefert (fceiling x), wo x eine reelle Zahl ist.
  281. extern const cl_R_fdiv_t fceiling2 (const cl_R& x);
  282. extern const cl_F fceiling (const cl_R& x);
  283. // ftruncate2(x) liefert (ftruncate x), wo x eine reelle Zahl ist.
  284. extern const cl_R_fdiv_t ftruncate2 (const cl_R& x);
  285. extern const cl_F ftruncate (const cl_R& x);
  286. // fround2(x) liefert (fround x), wo x eine reelle Zahl ist.
  287. extern const cl_R_fdiv_t fround2 (const cl_R& x);
  288. extern const cl_F fround (const cl_R& x);
  289. // ffloor2(x,y) liefert (ffloor x y), wo x und y reelle Zahlen sind.
  290. extern const cl_R_fdiv_t ffloor2 (const cl_R& x, const cl_R& y);
  291. extern const cl_F ffloor (const cl_R& x, const cl_R& y);
  292. // fceiling2(x,y) liefert (fceiling x y), wo x und y reelle Zahlen sind.
  293. extern const cl_R_fdiv_t fceiling2 (const cl_R& x, const cl_R& y);
  294. extern const cl_F fceiling (const cl_R& x, const cl_R& y);
  295. // ftruncate2(x,y) liefert (ftruncate x y), wo x und y reelle Zahlen sind.
  296. extern const cl_R_fdiv_t ftruncate2 (const cl_R& x, const cl_R& y);
  297. extern const cl_F ftruncate (const cl_R& x, const cl_R& y);
  298. // fround2(x,y) liefert (fround x y), wo x und y reelle Zahlen sind.
  299. extern const cl_R_fdiv_t fround2 (const cl_R& x, const cl_R& y);
  300. extern const cl_F fround (const cl_R& x, const cl_R& y);
  301. // mod(x,y) = (mod x y), wo x und y reelle Zahlen sind.
  302. extern const cl_R mod (const cl_R& x, const cl_R& y);
  303. // rem(x,y) = (rem x y), wo x und y reelle Zahlen sind.
  304. extern const cl_R rem (const cl_R& x, const cl_R& y);
  305. // rational(x) liefert (rational x), wo x eine reelle Zahl ist.
  306. extern const cl_RA rational (const cl_R& x);
  307. // Spezialfall:
  308. inline const cl_RA rational (const cl_RA& x) { return x; }
  309. // equal(x,y) vergleicht zwei reelle Zahlen x und y auf Gleichheit.
  310. extern bool equal (const cl_R& x, const cl_R& y);
  311. // equal_hashcode(x) liefert einen equal-invarianten Hashcode für x.
  312. extern uint32 equal_hashcode (const cl_R& x);
  313. // compare(x,y) vergleicht zwei reelle Zahlen x und y.
  314. // Ergebnis: 0 falls x=y, +1 falls x>y, -1 falls x<y.
  315. extern cl_signean compare (const cl_R& x, const cl_R& y);
  316. inline bool operator== (const cl_R& x, const cl_R& y)
  317. { return equal(x,y); }
  318. inline bool operator!= (const cl_R& x, const cl_R& y)
  319. { return !equal(x,y); }
  320. inline bool operator<= (const cl_R& x, const cl_R& y)
  321. { return compare(x,y)<=0; }
  322. inline bool operator< (const cl_R& x, const cl_R& y)
  323. { return compare(x,y)<0; }
  324. inline bool operator>= (const cl_R& x, const cl_R& y)
  325. { return compare(x,y)>=0; }
  326. inline bool operator> (const cl_R& x, const cl_R& y)
  327. { return compare(x,y)>0; }
  328. // max(x,y) liefert (max x y), wo x und y reelle Zahlen sind.
  329. extern const cl_R max (const cl_R& x, const cl_R& y);
  330. // min(x,y) liefert (min x y), wo x und y reelle Zahlen sind.
  331. extern const cl_R min (const cl_R& x, const cl_R& y);
  332. // signum(x) liefert (signum x), wo x eine reelle Zahl ist.
  333. extern const cl_R signum (const cl_R& x);
  334. // sqrt(x) = (sqrt x) zieht die Wurzel aus einer reellen Zahl x >=0.
  335. extern const cl_R sqrt (const cl_R& x);
  336. // sqrt(x) = (sqrt x) zieht die Wurzel aus einer rationalen Zahl x >=0.
  337. extern const cl_R sqrt (const cl_RA& x);
  338. // (expt x y), wo x eine reelle Zahl und y ein Integer ist.
  339. extern const cl_R expt (const cl_R& x, sintL y);
  340. extern const cl_R expt (const cl_R& x, const cl_I& y);
  341. // rationalize(x) liefert (rationalize x), wo x eine reelle Zahl ist.
  342. extern const cl_RA rationalize (const cl_R& x);
  343. // Konversion zu einem C "float".
  344. extern float float_approx (const cl_R& x);
  345. // Konversion zu einem C "double".
  346. extern double double_approx (const cl_R& x);
  347. // Transcendental functions
  348. // atan(x,y) liefert zu zwei reellen Zahlen x, y den Winkel von (x,y)
  349. // in Polarkoordinaten. Ergebnis rational nur, wenn x>0 und y=0.
  350. extern const cl_R atan (const cl_R& x, const cl_R& y);
  351. // Spezialfall: y Float -> Ergebnis Float
  352. inline const cl_F atan (const cl_R& x, const cl_F& y)
  353. { return The(cl_F)(atan(x,The(cl_R)(y))); }
  354. // Dem C++-Compiler muß man nun auch das Folgende sagen:
  355. inline const cl_R atan (const cl_R& x, const int y)
  356. { return atan(x,cl_I(y)); }
  357. inline const cl_R atan (const cl_R& x, const unsigned int y)
  358. { return atan(x,cl_I(y)); }
  359. inline const cl_R atan (const cl_R& x, const long y)
  360. { return atan(x,cl_I(y)); }
  361. inline const cl_R atan (const cl_R& x, const unsigned long y)
  362. { return atan(x,cl_I(y)); }
  363. // atan(x) liefert den Arctan einer reellen Zahl x.
  364. // Ergebnis rational nur, wenn x=0.
  365. extern const cl_R atan (const cl_R& x);
  366. // Spezialfall: x Float -> Ergebnis Float
  367. inline const cl_F atan (const cl_F& x) { return The(cl_F)(atan(The(cl_R)(x))); }
  368. // Dem C++-Compiler muß man nun auch das Folgende sagen:
  369. inline const cl_R atan (const int x) { return atan(cl_I(x)); }
  370. inline const cl_R atan (const unsigned int x) { return atan(cl_I(x)); }
  371. inline const cl_R atan (const long x) { return atan(cl_I(x)); }
  372. inline const cl_R atan (const unsigned long x) { return atan(cl_I(x)); }
  373. // sin(x) liefert den Sinus (sin x) einer reellen Zahl x.
  374. extern const cl_R sin (const cl_R& x);
  375. // Dem C++-Compiler muß man nun auch das Folgende sagen:
  376. inline const cl_R sin (const int x) { return sin(cl_I(x)); }
  377. inline const cl_R sin (const unsigned int x) { return sin(cl_I(x)); }
  378. inline const cl_R sin (const long x) { return sin(cl_I(x)); }
  379. inline const cl_R sin (const unsigned long x) { return sin(cl_I(x)); }
  380. // cos(x) liefert den Cosinus (cos x) einer reellen Zahl x.
  381. extern const cl_R cos (const cl_R& x);
  382. // Dem C++-Compiler muß man nun auch das Folgende sagen:
  383. inline const cl_R cos (const int x) { return cos(cl_I(x)); }
  384. inline const cl_R cos (const unsigned int x) { return cos(cl_I(x)); }
  385. inline const cl_R cos (const long x) { return cos(cl_I(x)); }
  386. inline const cl_R cos (const unsigned long x) { return cos(cl_I(x)); }
  387. // cos_sin(x) liefert ((cos x),(sin x)), beide Werte.
  388. extern const cos_sin_t cos_sin (const cl_R& x);
  389. // tan(x) liefert den Tangens (tan x) einer reellen Zahl x.
  390. extern const cl_R tan (const cl_R& x);
  391. // Dem C++-Compiler muß man nun auch das Folgende sagen:
  392. inline const cl_R tan (const int x) { return tan(cl_I(x)); }
  393. inline const cl_R tan (const unsigned int x) { return tan(cl_I(x)); }
  394. inline const cl_R tan (const long x) { return tan(cl_I(x)); }
  395. inline const cl_R tan (const unsigned long x) { return tan(cl_I(x)); }
  396. // ln(x) liefert zu einer reellen Zahl x>0 die Zahl ln(x).
  397. extern const cl_R ln (const cl_R& x);
  398. // Dem C++-Compiler muß man nun auch das Folgende sagen:
  399. inline const cl_R ln (const int x) { return ln(cl_I(x)); }
  400. inline const cl_R ln (const unsigned int x) { return ln(cl_I(x)); }
  401. inline const cl_R ln (const long x) { return ln(cl_I(x)); }
  402. inline const cl_R ln (const unsigned long x) { return ln(cl_I(x)); }
  403. // log(a,b) liefert zu reellen Zahlen a>0, b>0 die Zahl
  404. // log(a,b)=ln(a)/ln(b).
  405. // Ergebnis rational nur, wenn a=1 oder a und b rational.
  406. extern const cl_R log (const cl_R& a, const cl_R& b);
  407. // exp(x) liefert zu einer reellen Zahl x die Zahl exp(x).
  408. extern const cl_R exp (const cl_R& x);
  409. // Dem C++-Compiler muß man nun auch das Folgende sagen:
  410. inline const cl_R exp (const int x) { return exp(cl_I(x)); }
  411. inline const cl_R exp (const unsigned int x) { return exp(cl_I(x)); }
  412. inline const cl_R exp (const long x) { return exp(cl_I(x)); }
  413. inline const cl_R exp (const unsigned long x) { return exp(cl_I(x)); }
  414. // sinh(x) liefert zu einer reellen Zahl x die Zahl sinh(x).
  415. extern const cl_R sinh (const cl_R& x);
  416. // Dem C++-Compiler muß man nun auch das Folgende sagen:
  417. inline const cl_R sinh (const int x) { return sinh(cl_I(x)); }
  418. inline const cl_R sinh (const unsigned int x) { return sinh(cl_I(x)); }
  419. inline const cl_R sinh (const long x) { return sinh(cl_I(x)); }
  420. inline const cl_R sinh (const unsigned long x) { return sinh(cl_I(x)); }
  421. // cosh(x) liefert zu einer reellen Zahl x die Zahl cosh(x).
  422. extern const cl_R cosh (const cl_R& x);
  423. // Dem C++-Compiler muß man nun auch das Folgende sagen:
  424. inline const cl_R cosh (const int x) { return cosh(cl_I(x)); }
  425. inline const cl_R cosh (const unsigned int x) { return cosh(cl_I(x)); }
  426. inline const cl_R cosh (const long x) { return cosh(cl_I(x)); }
  427. inline const cl_R cosh (const unsigned long x) { return cosh(cl_I(x)); }
  428. // cosh_sinh(x) liefert ((cosh x),(sinh x)), beide Werte.
  429. extern const cosh_sinh_t cosh_sinh (const cl_R& x);
  430. // tanh(x) liefert zu einer reellen Zahl x die Zahl tanh(x).
  431. extern const cl_R tanh (const cl_R& x);
  432. // Dem C++-Compiler muß man nun auch das Folgende sagen:
  433. inline const cl_R tanh (const int x) { return tanh(cl_I(x)); }
  434. inline const cl_R tanh (const unsigned int x) { return tanh(cl_I(x)); }
  435. inline const cl_R tanh (const long x) { return tanh(cl_I(x)); }
  436. inline const cl_R tanh (const unsigned long x) { return tanh(cl_I(x)); }
  437. // random_R(randomstate,n) liefert zu einer reellen Zahl n>0 eine Zufallszahl
  438. // x mit 0 <= x < n.
  439. extern const cl_R random_R (random_state& randomstate, const cl_R& n);
  440. inline const cl_R random_R (const cl_R& n)
  441. { return random_R(default_random_state,n); }
  442. // This could be optimized to use in-place operations.
  443. inline cl_R& operator+= (cl_R& x, const cl_R& y) { return x = x + y; }
  444. inline cl_F& operator+= (cl_F& x, const cl_R& y) { return x = x + y; }
  445. inline cl_F& operator+= (cl_F& x, const cl_RA& y) { return x = x + y; }
  446. inline cl_F& operator+= (cl_F& x, const cl_I& y) { return x = x + y; }
  447. inline cl_R& operator+= (cl_R& x, const int y) { return x = x + y; }
  448. inline cl_R& operator+= (cl_R& x, const unsigned int y) { return x = x + y; }
  449. inline cl_R& operator+= (cl_R& x, const long y) { return x = x + y; }
  450. inline cl_R& operator+= (cl_R& x, const unsigned long y) { return x = x + y; }
  451. #ifdef HAVE_LONGLONG
  452. inline cl_R& operator+= (cl_R& x, const long long y) { return x = x + y; }
  453. inline cl_R& operator+= (cl_R& x, const unsigned long long y) { return x = x + y; }
  454. #endif
  455. inline cl_F& operator+= (cl_R& x, const float y) { return static_cast<cl_F&>(x = x + y); }
  456. inline cl_F& operator+= (cl_R& x, const double y) { return static_cast<cl_F&>(x = x + y); }
  457. inline cl_F& operator+= (cl_F& x, const int y) { return x = x + y; }
  458. inline cl_F& operator+= (cl_F& x, const unsigned int y) { return x = x + y; }
  459. inline cl_F& operator+= (cl_F& x, const long y) { return x = x + y; }
  460. inline cl_F& operator+= (cl_F& x, const unsigned long y) { return x = x + y; }
  461. #ifdef HAVE_LONGLONG
  462. inline cl_F& operator+= (cl_F& x, const long long y) { return x = x + y; }
  463. inline cl_F& operator+= (cl_F& x, const unsigned long long y) { return x = x + y; }
  464. #endif
  465. inline cl_R& operator++ /* prefix */ (cl_R& x) { return x = plus1(x); }
  466. inline void operator++ /* postfix */ (cl_R& x, int dummy) { (void)dummy; x = plus1(x); }
  467. inline cl_R& operator-= (cl_R& x, const cl_R& y) { return x = x - y; }
  468. inline cl_F& operator-= (cl_F& x, const cl_R& y) { return x = x - y; }
  469. inline cl_F& operator-= (cl_F& x, const cl_RA& y) { return x = x - y; }
  470. inline cl_F& operator-= (cl_F& x, const cl_I& y) { return x = x - y; }
  471. inline cl_R& operator-= (cl_R& x, const int y) { return x = x - y; }
  472. inline cl_R& operator-= (cl_R& x, const unsigned int y) { return x = x - y; }
  473. inline cl_R& operator-= (cl_R& x, const long y) { return x = x - y; }
  474. inline cl_R& operator-= (cl_R& x, const unsigned long y) { return x = x - y; }
  475. #ifdef HAVE_LONGLONG
  476. inline cl_R& operator-= (cl_R& x, const long long y) { return x = x - y; }
  477. inline cl_R& operator-= (cl_R& x, const unsigned long long y) { return x = x - y; }
  478. #endif
  479. inline cl_F& operator-= (cl_R& x, const float y) { return static_cast<cl_F&>(x = x - y); }
  480. inline cl_F& operator-= (cl_R& x, const double y) { return static_cast<cl_F&>(x = x - y); }
  481. inline cl_F& operator-= (cl_F& x, const int y) { return x = x - y; }
  482. inline cl_F& operator-= (cl_F& x, const unsigned int y) { return x = x - y; }
  483. inline cl_F& operator-= (cl_F& x, const long y) { return x = x - y; }
  484. inline cl_F& operator-= (cl_F& x, const unsigned long y) { return x = x - y; }
  485. #ifdef HAVE_LONGLONG
  486. inline cl_F& operator-= (cl_F& x, const long long y) { return x = x - y; }
  487. inline cl_F& operator-= (cl_F& x, const unsigned long long y) { return x = x - y; }
  488. #endif
  489. inline cl_R& operator-- /* prefix */ (cl_R& x) { return x = minus1(x); }
  490. inline void operator-- /* postfix */ (cl_R& x, int dummy) { (void)dummy; x = minus1(x); }
  491. inline cl_R& operator*= (cl_R& x, const cl_R& y) { return x = x * y; }
  492. inline cl_R& operator*= (cl_R& x, const int y) { return x = x * y; }
  493. inline cl_R& operator*= (cl_R& x, const unsigned int y) { return x = x * y; }
  494. inline cl_R& operator*= (cl_R& x, const long y) { return x = x * y; }
  495. inline cl_R& operator*= (cl_R& x, const unsigned long y) { return x = x * y; }
  496. #ifdef HAVE_LONGLONG
  497. inline cl_R& operator*= (cl_R& x, const long long y) { return x = x * y; }
  498. inline cl_R& operator*= (cl_R& x, const unsigned long long y) { return x = x * y; }
  499. #endif
  500. inline cl_R& operator*= (cl_R& x, const float y) { return x = x * y; }
  501. inline cl_R& operator*= (cl_R& x, const double y) { return x = x * y; }
  502. inline cl_R& operator/= (cl_R& x, const cl_R& y) { return x = x / y; }
  503. inline cl_F& operator/= (cl_F& x, const cl_R& y) { return x = x / y; }
  504. inline cl_F& operator/= (cl_F& x, const cl_RA& y) { return x = x / y; }
  505. inline cl_F& operator/= (cl_F& x, const cl_I& y) { return x = x / y; }
  506. inline cl_R& operator/= (cl_R& x, const int y) { return x = x / y; }
  507. inline cl_R& operator/= (cl_R& x, const unsigned int y) { return x = x / y; }
  508. inline cl_R& operator/= (cl_R& x, const long y) { return x = x / y; }
  509. inline cl_R& operator/= (cl_R& x, const unsigned long y) { return x = x / y; }
  510. #ifdef HAVE_LONGLONG
  511. inline cl_R& operator/= (cl_R& x, const long long y) { return x = x / y; }
  512. inline cl_R& operator/= (cl_R& x, const unsigned long long y) { return x = x / y; }
  513. #endif
  514. inline cl_R& operator/= (cl_R& x, const float y) { return x = x / y; }
  515. inline cl_R& operator/= (cl_R& x, const double y) { return x = x / y; }
  516. inline cl_F& operator/= (cl_F& x, const int y) { return x = x / y; }
  517. inline cl_F& operator/= (cl_F& x, const unsigned int y) { return x = x / y; }
  518. inline cl_F& operator/= (cl_F& x, const long y) { return x = x / y; }
  519. inline cl_F& operator/= (cl_F& x, const unsigned long y) { return x = x / y; }
  520. #ifdef HAVE_LONGLONG
  521. inline cl_F& operator/= (cl_F& x, const long long y) { return x = x / y; }
  522. inline cl_F& operator/= (cl_F& x, const unsigned long long y) { return x = x / y; }
  523. #endif
  524. // Complex operations, trivial for reals
  525. inline const cl_R realpart (const cl_R& x)
  526. {
  527. return x;
  528. }
  529. inline const cl_R imagpart (const cl_R& x)
  530. {
  531. (void)x; // unused x
  532. return 0;
  533. }
  534. inline const cl_R conjugate (const cl_R& x)
  535. {
  536. return x;
  537. }
  538. // Debugging support.
  539. #ifdef CL_DEBUG
  540. extern int cl_R_debug_module;
  541. CL_FORCE_LINK(cl_R_debug_dummy, cl_R_debug_module)
  542. #endif
  543. } // namespace cln
  544. #endif /* _CL_REAL_H */