history.rst
1 Changes for gmpy2 releases 2 ========================== 3 4 Changes in gmpy2 2.1.0b1 5 ------------------------ 6 7 * Added cmp() and cmp_abs(). 8 * Improved compatibility with _numbers_ protocol. 9 * Many bug fixes. 10 11 Changes in gmpy2 2.1.a05 12 ------------------------ 13 14 * Fix qdiv() not returning mpz() when it should. 15 * Added root_of_unity(). 16 17 Changes in gmpy2 2.1.0a4 18 ------------------------ 19 20 * Fix issue 204; missing file for Cython. 21 * Additional support for MPFR 4 22 - Add fmma() and fmms() 23 24 Changes in gmpy2 2.1.0a3 25 ------------------------ 26 27 * Updates to setup.py. 28 * Initial support for MPFR4 29 - Add nrandom() 30 - grandom() now calls nrandom twice; may return different values versus 31 MPFR3 32 - Add rootn(); same as root() except different sign when taking even root 33 of -0.0 34 35 Changes in gmpy2 2.1.0a2 36 ------------------------ 37 38 * Revised build process. 39 * Removal of unused code/macros. 40 * Cleanup of Cython interface. 41 42 Changes in gmpy2 2.1.0a1 43 ------------------------ 44 45 * Thread-safe contexts are now supported. Properly integrating thread-safe 46 contexts required an extensive rewrite of almost all internal functions. 47 * MPFR and MPC are now required. It is no longer possible to build a version 48 of gmpy2 that only supports the GMP library. 49 * The function inverse() now raises an exception if the inverse does not 50 exist. 51 * Context methods have been added for MPFR/MPC related functions. 52 * A new context option (*rational_division*) has been added that changes the 53 behavior of integer division involving *mpz* instances to return a rational 54 result instead of a floating point result. 55 * gmpy2 types are now registered in the numeric tower. 56 * In previous versions of gmpy2, *gmpy2.mpz* was a factory function that 57 returned an *mpz* instance. *gmpy2.mpz* is now an actual type. The same 58 is true for the other gmpy2 types. 59 * If a Python object has an __mpz__ method, it will be called bye *mpz()* to 60 allow an unrecognized type to be converted to an mpz instance. The same is 61 true for the other gmpy2 types. 62 * A new C-API and Cython interface has been added. 63 64 Changes in gmpy2 2.0.4 65 ---------------------- 66 67 * Fix bit_scan0() for negative values. 68 * Changes to setup.py to allow static linking. 69 * Fix performance regression with mpmath and Python 3. 70 71 Changes in gmpy2 2.0.3 72 ---------------------- 73 74 * Fix lucas2() and atanh(); they were returning incorrect values. 75 76 Changes in gmpy2 2.0.2 77 ---------------------- 78 79 * Rebuild Windows binary installers due to MPIR 2.6.0 bug in next_prime(). 80 * Another fix for is_extra_strong_lucas_prp(). 81 82 Changes in gmpy2 2.0.1 83 ---------------------- 84 85 * Updated setup.py to work in more situations. 86 * Corrected exception handling in basic operations with mpfr type. 87 * Correct InvalidOperation exception not raised in certain circumstances. 88 * invert() now raises an exception if the modular inverse does not exist. 89 * Fixed internal exception in is_bpsw_prp() and is_strong_bpsw_prp(). 90 * Updated is_extra_strong_lucas_prp() to latest version. 91 92 Changes in gmpy2 2.0.0 93 ---------------------- 94 95 * Fix segmentation fault in _mpmath_normalize (an undocumented helper function 96 specifically for mpmath.) 97 * Improved setup.py See below for documentation on the changes. 98 * Fix issues when compiled without support for MPFR. 99 * Conversion of too large an mpz to float now raises OverflowError instead of 100 returning *inf*. 101 * Renamed min2()/max2() to minnum()/maxnum() 102 * The build and install process (i.e. setup.py) has been completely rewritten. 103 See the Installation section for more information. 104 * get_context() no longer accepts keyword arguments. 105 106 Known issues in gmpy2 2.0.0 107 ----------------------------- 108 109 * The test suite is still incomplete. 110 111 Changes in gmpy2 2.0.0b4 112 ------------------------ 113 114 * Added __ceil__, __floor__, __trunc__, and __round__ methods to mpz and mpq 115 types. 116 * Added __complex__ to mpc type. 117 * round(mpfr) now correctly returns an mpz type. 118 * If no arguments are given to mpz, mpq, mpfr, mpc, and xmpz, return 0 of the 119 appropriate type. 120 * Fix broken comparison between mpz and mpq when mpz is on the left. 121 * Added __sizeof__ to all types. *Note: sys.getsizeof() calls __sizeof__ to get 122 the memory size of a gmpy2 object. The returned value reflects the size of the 123 allocated memory which may be larger than the actual minimum memory required 124 by the object.* 125 126 Known issues in gmpy2 2.0.0b4 127 ----------------------------- 128 129 * The new test suite (test/runtest.py) is incomplete and some tests fail on 130 Python 2.x due to formatting issues. 131 132 133 Changes in gmpy2 2.0.0b3 134 ------------------------ 135 136 * mp_version(), mpc_version(), and mpfr_version() now return normal strings on 137 Python 2.x instead of Unicode strings. 138 * Faster conversion of the standard library Fraction type to mpq. 139 * Improved conversion of the Decimal type to mpfr. 140 * Consistently return OverflowError when converting "inf". 141 * Fix mpz.__format__() when the format code includes "#". 142 * Add is_infinite() and deprecate is_inf(). 143 * Add is_finite() and deprecate is_number(). 144 * Fixed the various is_XXX() tests when used with mpc. 145 * Added caching for mpc objects. 146 * Faster code path for basic operation is both operands are mpfr or mpc. 147 * Fix mpfr + float segmentation fault. 148 149 Changes in gmpy2 2.0.0b2 150 ------------------------ 151 152 * Allow xmpz slice assignment to increase length of xmpz instance by specifying 153 a value for stop. 154 * Fixed reference counting bug in several is_xxx_prp() tests. 155 * Added iter_bits(), iter_clear(), iter_set() methods to xmpz. 156 * Added powmod() for easy access to three argument pow(). 157 * Removed addmul() and submul() which were added in 2.0.0b1 since they are 158 slower than just using Python code. 159 * Bug fix in gcd_ext when both arguments are not mpz. 160 * Added ieee() to create contexts for 32, 64, or 128 bit floats. 161 * Bug fix in context() not setting emax/emin correctly if they had been changed 162 earlier. 163 * Contexts can be directly used in with statement without requiring 164 set_context()/local_context() sequence. 165 * local_context() now accepts an optional context. 166 167 Changes in gmpy2 2.0.0b1 and earlier 168 ------------------------------------ 169 170 * Renamed functions that manipulate individual bits to bit_XXX() to align with 171 bit_length(). 172 * Added caching for mpq. 173 * Added rootrem(), fib2(), lucas(), lucas2(). 174 * Support changed hash function in Python 3.2. 175 * Added is_even(), is_odd(). 176 * Add caching of the calculated hash value. 177 * Add xmpz (mutable mpz) type. 178 * Fix mpq formatting issue. 179 * Add read/write bit access using slices to xmpz. 180 * Add read-only bit access using slices to mpz. 181 * Add pack()/unpack() methods to split/join an integer into n-bit chunks. 182 * Add support for MPFR (casevh) 183 * Removed fcoform float conversion modifier. 184 * Add support for MPC. 185 * Added context manager. 186 * Allow building with just GMP/MPIR if MPFR not available. 187 * Allow building with GMP/MPIR and MPFR if MPC not available. 188 * Removed most instance methods in favor of gmpy2.function. The general guideline 189 is that *properties* of an instance can be done via instance methods but 190 *functions* that return a new result are done using gmpy2.function. 191 * Added __ceil__, __floor__, and __trunc__ methods since they are called by 192 math.ceil(), math.floor(), and math.trunc(). 193 * Removed gmpy2.pow() to avoid conflicts. 194 * Removed gmpy2._copy and added xmpz.copy. 195 * Added support for __format__. 196 * Added as_integer_ratio, as_mantissa_exp, as_simple_fraction. 197 * Updated rich_compare. 198 * Require MPFR 3.1.0+ to get divby0 support. 199 * Added fsum(), degrees(), radians(). 200 * Updated random number generation support. 201 * Changed license to LGPL 3+. 202 * Added lucasu, lucasu_mod, lucasv, and lucasv_mod. 203 *Based on code contributed by David Cleaver.* 204 * Added probable-prime tests. 205 *Based on code contributed by David Cleaver.* 206 * Added to_binary()/from_binary. 207 * Renamed numdigits() to num_digits(). 208 * Added keyword precision to constants. 209 * Added addmul() and submul(). 210 * Added __round__(), round2(), round_away() for mpfr. 211 * round() is no longer a module level function. 212 * Renamed module functions min()/max() to min2()/max2(). 213 * No longer conflicts with builtin min() and max() 214 * Removed set_debug() and related functionality. 215