Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Do not use mp directly in mpz_class | Marc Glisse | 2022-04-18 | 1 | -7/+10 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is the difference between f and g in the following, where gcc generates "return 1;" for f and not for g. The aliasing is caused by the functions get_num and get_den in mpq_class. struct mpz_struct { int i; }; typedef mpz_struct mpz_t[1]; struct mpq_struct { mpz_struct num, den; }; typedef mpq_struct mpq_t[1]; struct mpz_class { mpz_t mp; }; struct mpq_class { mpq_t mp; }; int f(mpq_class*q, mpz_class*z){ q->mp->num.i = 1; z->mp->i = 2; return q->mp->num.i; } int g(mpq_class*q, mpz_class*z){ q->mp->num.i = 1; int*p=&z->mp->i; *p = 2; return q->mp->num.i; } | ||||
* | Add constructor mpq_class(mpz_class&&) | Marc Glisse | 2021-06-20 | 1 | -0/+6 |
| | | | | Surprisingly, the corresponding test was already present. | ||||
* | gmpxx.h: Special handling for mpq==0 | Marco Bodrato | 2018-03-03 | 1 | -3/+8 |
| | |||||
* | gmpxx.h (__gmp_binary_equal): Optimised comparison mpq == integer. | Marco Bodrato | 2018-02-28 | 1 | -3/+3 |
| | |||||
* | gmpxx.h (__gmp_binary_{min,pl}us): Special case for mpq -/+ 1. | Marco Bodrato | 2018-02-28 | 1 | -0/+10 |
| | |||||
* | Use mpf_sgn to access _mp_size in gmpxx.h. | Marc Glisse | 2017-06-02 | 1 | -1/+1 |
| | | | | This helps mpf2mpfr.h without changing the generated code (at least with gcc). | ||||
* | Optimize 1/q to call mpq_inv. | Marc Glisse | 2016-10-28 | 1 | -2/+27 |
| | | | | Also handle (-1)/q and 0/q. We could test for l == 1 at runtime and not just with __builtin_constant_p, it might be worth it, especially for non-gcc compilers. | ||||
* | mpz_init cannot throw. | Marc Glisse | 2016-04-07 | 1 | -2/+2 |
| | |||||
* | New C++ function fibonacci. | Marc Glisse | 2015-11-12 | 1 | -8/+39 |
| | |||||
* | Reject negative operands for primorial, after Marco's suggestion. | Marc Glisse | 2015-11-10 | 1 | -7/+5 |
| | |||||
* | New C++ function primorial. | Marc Glisse | 2015-11-08 | 1 | -0/+27 |
| | |||||
* | Update copyright years on gmpxx.h. | Marc Glisse | 2015-11-08 | 1 | -1/+1 |
| | |||||
* | Mark the static member function inline. | Marc Glisse | 2015-11-08 | 1 | -2/+2 |
| | |||||
* | factorial in C++. | Marc Glisse | 2015-11-08 | 1 | -0/+97 |
| | |||||
* | Nicer failure mode for C++ binary functions. | Marc Glisse | 2015-11-07 | 1 | -7/+70 |
| | | | | | Restrict the overloads to the types that are actually supported. It would be possible to share some more generic macros with __GMP_DEFINE_BINARY_FUNCTION but I am afraid it would become completely unreadable. | ||||
* | Nicer failure mode for C++ unary function. | Marc Glisse | 2015-11-07 | 1 | -5/+18 |
| | | | | Restrict the overloads to the types that are actually supported. | ||||
* | Use the new mpq_cmp_z in gmpxx.h. | Marc Glisse | 2015-10-13 | 1 | -51/+93 |
| | |||||
* | Prepare for expressions like factorial(int). | Marc Glisse | 2014-12-27 | 1 | -2/+20 |
| | |||||
* | Add C++ functions gcd and lcm. | Marc Glisse | 2014-06-17 | 1 | -0/+38 |
| | |||||
* | The C++ standard was modified so common_type now decays. | Marc Glisse | 2014-05-08 | 1 | -2/+2 |
| | |||||
* | Update library files license to use LGPL3+ and GPL2+. | Torbjorn Granlund | 2014-01-27 | 1 | -7/+18 |
| | |||||
* | Canonicalise copyright headers. | Torbjorn Granlund | 2014-01-19 | 1 | -3/+3 |
| | |||||
* | Use https to link to GNU license. | Torbjorn Granlund | 2013-12-02 | 1 | -1/+1 |
| | |||||
* | Collapse copyright years. | Torbjorn Granlund | 2013-11-28 | 1 | -2/+1 |
| | |||||
* | Update some old uses of __GMPXX_CONSTANT to bring them in line with the new ↵ | Marc Glisse | 2013-02-17 | 1 | -26/+17 |
| | | | | ones. | ||||
* | Construct temporary mpq from double on the stack, as is already the case for ↵ | Marc Glisse | 2013-02-17 | 1 | -93/+28 |
| | | | | mpz. | ||||
* | gmpxx.h (mpq_class, mpf_class): Some more SI->UI optimisations. | Marco Bodrato | 2013-02-17 | 1 | -18/+33 |
| | |||||
* | #include <algorithm> for std::swap. | Marc Glisse | 2013-02-16 | 1 | -0/+1 |
| | |||||
* | Use __builtin_constant_p in mpz_class::init_* and mpz_class::assign_*. | Marc Glisse | 2013-02-15 | 1 | -6/+48 |
| | | | | | Introduce macro __GMPXX_CONSTANT_TRUE (to be removed if it makes its way into gmp.h). | ||||
* | Refactor the C++ code to convert from builtin types so we have a single | Marc Glisse | 2013-02-15 | 1 | -103/+62 |
| | | | | place to optimize. | ||||
* | Reduce the number of worker functions in __gmp_binary_equal (forward | Marc Glisse | 2013-02-14 | 1 | -8/+8 |
| | | | | instead of duplicating the code). | ||||
* | Remove code duplication between __gmp_binary_greater and __gmp_binary_less. | Marc Glisse | 2013-02-14 | 1 | -60/+2 |
| | |||||
* | Specialize std::common_type for expressions with builtin types. | Marc Glisse | 2012-07-28 | 1 | -0/+25 |
| | |||||
* | Disable __builtin_constant_p for g++34. | Marc Glisse | 2012-07-21 | 1 | -1/+3 |
| | |||||
* | specializing numeric_limits is useless if the content is private... | Marc Glisse | 2012-06-23 | 1 | -0/+3 |
| | | | | I'll add some tests later to make sure I don't accidentally revert it some day. | ||||
* | Unify handling of mpf with mpz/mpq. Function eval had 2 arguments for mpf: | Marc Glisse | 2012-06-09 | 1 | -75/+43 |
| | | | | p and prec, but prec was always equal to mpf_get_prec(p), so I am removing it. | ||||
* | Handle mpq_class(0,1) | Marc Glisse | 2012-05-31 | 1 | -1/+8 |
| | |||||
* | explicit conversion to bool | Marc Glisse | 2012-05-11 | 1 | -0/+12 |
| | |||||
* | C++11 user-defined literals | Marc Glisse | 2012-03-08 | 1 | -2/+22 |
| | |||||
* | Specialize std::numeric_limits for mp*_class types. It is mostly ↵ | Marc Glisse | 2012-02-29 | 1 | -0/+114 |
| | | | | meaningless, but that's normal. | ||||
* | Use macros like NUM, ALLOC, SIZ, etc in mpq/*. | Marc Glisse | 2012-02-24 | 1 | -0/+5 |
| | | | | | Test some mpq functions that were not used in the testsuite. Implement q=z (in gmpxx) with mpq_set_z. | ||||
* | Remove a temporary in expressions like q=q*q+z*z: tmp=z*z, q=q*q, q+=tmp. | Marc Glisse | 2012-02-18 | 1 | -12/+12 |
| | | | | Note that we could do the same for q=q*q+z, but that would require checking if z is the numerator or denominator of q. | ||||
* | Comment out long double function declarations. Half of them were already ↵ | Marc Glisse | 2012-02-18 | 1 | -3/+3 |
| | | | | commented out, and the other half had declarations but no definitions. | ||||
* | Specialize std::common_type in C++11. | Marc Glisse | 2012-02-18 | 1 | -2/+24 |
| | |||||
* | Replace e=a*b-c*d with tmp=c*d, e=a*b, e-=tmp, which uses one less temporary. | Marc Glisse | 2012-02-16 | 1 | -6/+9 |
| | |||||
* | Remove test for compilosaurus. | Marc Glisse | 2012-02-01 | 1 | -13/+2 |
| | |||||
* | Initial C++11 support. | Marc Glisse | 2012-01-30 | 1 | -6/+45 |
| | |||||
* | Replace d=a+b+c with (d=a+b)+=c when c!=d. | Marc Glisse | 2012-01-30 | 1 | -8/+40 |
| | | | | | | TODO: * same thing for the mixed mpq/mpz operations * finish the generic code I have that generalizes all these small optimizations (may not be ready for 5.1) | ||||
* | Make sure we never compute -LONG_MIN. | Marc Glisse | 2012-01-28 | 1 | -19/+24 |
| | |||||
* | more mp_bitcnt_t... | Marc Glisse | 2012-01-28 | 1 | -10/+11 |
| |