PackageTrack
Sign in Get early access

rug

Arbitrary-precision integers, rational, floating-point and complex numbers based on GMP, MPFR and MPC.

1.30.0 5.4M downloads/mo #4366 most downloaded on crates.io source

What this package is like to depend on

Last release 3 months ago

27 Apr 2026

Ships fairly regularly

a new release about every 2 months

Nearly every release is documented

notes for 55 of 58 stable releases

Nothing withdrawn

no release was ever pulled

9 years old

58 releases · first in 2017

3 releases in the last 12 months

see the full history below

Release timeline

58 releases · Jun 2017 to Apr 2026
2018 2019 2020 2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 58
  1. 1.30.0 27 Apr 2026
    Release notes
    Open source →
  2. 1.29.0 20 Mar 2026
    Release notes
    Open source →
  3. 1.28.1 21 Jan 2026
    Release notes
    • Bug fix: incorrect underflow when dividing Rational by [Float][flo-1-28] (issue 85).
    Open source →
  4. 1.28.0 21 Aug 2025
    Release notes
    Open source →
  5. 1.27.0 24 Jan 2025
    Release notes

    Compatibility note

    Open source →
  6. 1.26.1 11 Sep 2024
    Release notes
    Open source →
  7. 1.26.0 30 Aug 2024
    Release notes
    Open source →
  8. 1.25.1 11 Sep 2024
    Release notes
    Open source →
  9. 1.25.0 18 Jul 2024
    Release notes
    Open source →
  10. 1.24.1 31 Mar 2024
    Release notes
    • Bug fix: a precondition for slice::from_raw_parts was being violated (issue 63).
    Open source →
  11. 1.24.0 25 Jan 2024
    Release notes

    Compatibility notes

    • The following methods no longer set the MPFR NaN flag if a NaN is encountered:
    • Functionality that depends on std now requires the std feature to be enabled. While the std feature is enabled by default, it is now disabled if the crate’s default features are disabled in [Cargo.toml]. In this case, std must be added to the list of features to reenable the functionality.
    • The implementation of the deprecated SmallInteger, SmallRational, SmallFloat and SmallComplex was changed to remove [their soundness issue][issue 52]. They now allocate memory for the digits, though their whole point was to be non-allocating.
    Open source →
  12. 1.23.0 18 Jan 2024
    Release notes
    • MiniInteger, MiniRational, MiniFloat and MiniComplex were added to replace SmallInteger, SmallRational, SmallFloat and SmallComplex, which are now deprecated. * The new structs do not implement [Deref] directly, as this causes issues with the current Rust memory models (issue 52). * Borrowing requires the use of the borrow methods, which return an object that implements [Deref]. * The new borrow_excl methods were also added; they require exclusive access in order to save on some housekeeping and to return references directly without the need of [Deref]. * The new structs implement [Copy] and [Sync].
    Open source →
  13. 1.22.0 11 Sep 2023
    Release notes

    Compatibility note

    The implementations of [PartialOrd] and [PartialEq] between Rational numbers and tuples of two primitive integers were breaking the transitivity property of the two traits in question. Since the implementations necessarily break the trait guarantees, having the traits implemented is considered a bug (see issue 58 for more details). These buggy implementations were removed. To fix code that used these comparisons without adding extra allocations, SmallRational can be used. For example rational == (1, 3) can be replaced with rational == SmallRational::from((1, 3)).

    Open source →
  14. 1.21.0 28 Aug 2023
    Release notes
    Open source →
  15. 1.20.1 03 Aug 2023
    Release notes
    • Bug fix: <code>[Float][flo-1-20]::[to_f32_round][flo-tfr-1-20]</code> was rounding some numbers in the subnormal range incorrectly ([issue 56]).
    Open source →
  16. 1.20.0 31 Jul 2023
    Release notes
    Open source →
  17. 1.19.2 23 Mar 2023
    Release notes
    • Bug fix: a zero denominator could be left after catching a panic from <code>[Rational][rat-1-19]::[mutate_numer_denom][rat-mnd-1-19]</code> ([issue 49]).
    Open source →
  18. 1.19.1 14 Feb 2023
    Release notes
    • Bug fix: <code>[Rational][rat-1-19]::[mutate_numer_denom][rat-mnd-1-19]</code> and <code>[Complex][com-1-19]::[mutate_real_imag][com-mri-1-19]</code> were not unwind-safe ([issue 47]).
    Open source →
  19. 1.19.0 06 Jan 2023
    Release notes
    Open source →
  20. 1.18.0 17 Nov 2022
    Release notes
    Open source →
  21. 1.17.0 06 Aug 2022
    Release notes
    Open source →
  22. 1.16.0 28 Apr 2022
    Release notes
    Open source →
  23. 1.15.0 03 Feb 2022
    Release notes
    • Now Integer, Rational, Float and Complex implement [Shl], [Shr], [ShlAssign] and [ShrAssign] with [isize] and [usize] as the type of the right-hand side, in addition to the previously supported [i32] and [u32].
      • The new experimental feature num-traits was added to implement some traits from the [num-traits crate] and the [num-integer crate] (issue 30).
    Open source →
  24. 1.14.1 23 Jan 2022
    Release notes
    • Bug fix: <code>[Rational][rat-1-14]::[to_f32][rat-tf-1-14]</code> was rounding away from zero in some cases when the rational number should be converted to a subnormal number ([issue 36]).
    Open source →
  25. 1.14.0 24 Nov 2021
    Release notes
    Open source →
  26. 1.13.0 29 Jul 2021
    Release notes
    Open source →
  27. 1.12.0 25 Mar 2021
    Release notes
    Open source →
  28. 1.11.0 03 Sep 2020
    Release notes
    • The [gmp-mpfr-sys] dependency was updated to version 1.4.
      • Now it is possible to display Float numbers with only one siginificant digit.
    Open source →
  29. 1.10.0 23 Jul 2020
    Release notes
    Open source →
  30. 1.9.0 01 Jun 2020
    Release notes
    • Displaying Float and Complex numbers, and converting them to strings, now avoids outputting an exponent term if the radix point can be moved to the correct place without inserting any extra digits. For example "42.0" will be produced rather than "4.20e1" (issue 18). This change does not affect output when [LowerExp] ("{:e}" format) or [UpperExp] ("{:E}" format) is used.

    Compatibility note

    The output of Float and Complex numbers was changed as specified above.

    Open source →
  31. 1.8.0 08 Apr 2020
    Release notes
    Open source →
  32. 1.7.0 21 Jan 2020
    Release notes

    Compatibility note

    Open source →
  33. 1.6.0 03 Sep 2019
    Release notes
    • Arithmetic operator implementations for [i8], [i16], [i64], [i128], [u8], [u16], [u64] and [u128] were added to the existing implementations for [i32] and [u32].

    Compatibility note

    • The numeric type methods which took <code>&mut RandState</code> were changed to take <code>&mut dyn MutRandState</code> instead. Under normal use, this does not have any affect apart from allowing the use of <code>&mut ThreadRandState</code> as well. With function inlining and optimization, the generated code should have the same performance.
    Open source →
  34. 1.5.2 26 Jul 2019
    Release notes
    • Bug fix: <code>[Pow][pow-1-5]<[i32][i32]> for [Rational][rat-1-5]</code> was returning the reciprocal of the correct result.
    Open source →
  35. 1.5.1 10 Jul 2019
    Release notes
    • Bug fix: a memory leak in conversions of [Float][flo-1-5] to string was fixed (https://gitlab.com/tspiteri/rug/-/issues/11).
    Open source →
  36. 1.5.0 04 Jul 2019
    Release notes
    • A new method <code>Integer::assign_digits_unaligned</code> was added to enable reading digits from unaligned memory.
      • A new method <code>Integer::write_digits_unaligned</code> was added to enable writing digits to unaligned and uninitialized memory.
      • New methods <code>Float::u_exp</code> and <code>Float::i_exp</code> were added.
      • A new method <code>Complex::abs_round</code> was added.
      • The documentation examples on from_raw methods now use [MaybeUninit] instead of <code>[mem][mem]::[uninitialized][uninitialized]</code>.
    Open source →
  37. 1.4.0 24 Apr 2019
    Release notes
    Open source →
  38. 1.3.0 26 Jan 2019
    Release notes
    Open source →
  39. 1.2.3 21 Jan 2019
    Release notes
    • Fixed bug in <code>[Integer][int-1-2]::[assign_digits][int-ad-1-2]</code>. (Thanks: Eric Scrivner)
    Open source →
  40. 1.2.2 18 Oct 2018
    Release notes
    • The [NotAssign][noa-1-2], [BitAndFrom][baf-1-2], [BitOrFrom][bof-1-2] and [BitXorFrom][bxf-1-2] traits were implemented for [bool].
      • The [NegAssign][nea-1-2] trait was implemented for [f32] and [f64].
    Open source →
  41. 1.2.1 16 Aug 2018
    Release notes
    • The [Integer][int-1-2] methods [from_digits][int-fd-1-2], [assign_digits][int-ad-1-2], [significant_digits][int-sd-1-2], [to_digits][int-td-1-2] and [write_digits][int-wd-1-2] now support [bool] [slices][slice].
    Open source →
  42. 1.2.0 30 Jun 2018
    Release notes
    Open source →
  43. 1.1.1 19 May 2018
    Release notes
    • Support for unstable [i128], [u128] and [TryFrom] was added in nightly.
    Open source →
  44. 1.1.0 23 Apr 2018
    Release notes
    Open source →
  45. 1.0.2 09 Apr 2018
    Release notes
    • A bug in <code>[Integer][int-1-0]::[reserve][int-r-1-0]</code>, which was shrinking the capacity in some cases, was fixed.
      • The [gmp-mpfr-sys] dependency in [Cargo.toml] was fixed to use tilde instead of caret, since Rug uses internal implementation details.
    Open source →
  46. 1.0.1 10 Mar 2018
    Release notes
    • A new method <code>[Integer][int-1-0]::[is_power_of_two][int-ipot-1-0]</code> was added.
      • A new method <code>[Integer][int-1-0]::[signed_bits][int-sb-1-0]</code> was added.
      • New methods <code>[Integer][int-1-0]::[secure_pow_mod][int-spm-1-0]</code>, <code>[Integer][int-1-0]::[secure_pow_mod_mut][int-spmm-1-0]</code> and <code>[Integer][int-1-0]::[secure_pow_mod_ref][int-spmr-1-0]</code> were added.
      • New methods <code>[Integer][int-1-0]::[div_rem_round][int-drr-1-0]</code>, <code>[Integer][int-1-0]::[div_rem_round_mut][int-drrm-1-0]</code> and <code>[Integer][int-1-0]::[div_rem_round_ref][int-drrr-1-0]</code> were added.
      • A new method <code>[Complex][com-1-0]::[eq0][com-e-1-0]</code> was added.
      • Documentation was improved.
    Open source →
  47. 1.0.0 03 Mar 2018
    Release notes
    Open source →
  48. 0.10.0 17 Feb 2018
    Release notes
    • Integer::invert_ref and Integer::pow_mod_ref now return an Option, not an object that is assignable to Result.
      • Float::random_bits and Complex::random_bits are now assignable to the number values, not to Result objects.
      • Rational::signum, Rational::trunc, Rational::ceil, Rational::floor and Rational::round now return Rational.
      • Complex::abs, Complex::arg and Complex::norm now return Complex.
      • Remove Default implementations from all types of Float and Complex; now the precision always has to be specified.
      • Remove Sum and Product implementations for Float and Complex.
      • Remove Clone and Copy implementations from all incomplete computation types.
      • Revamp top-level crate documentation.
      • Add Integer::parse and Rational::parse, and deprecate ValidInteger, ValidRational, valid_str_radix methods, and assign_str* methods.
      • Add Float::parse and Complex::parse, and deprecate ValidFloat, ValidComplex, from_str* methods, valid_str_radix methods, and assign_str* methods.
      • Rename Integer::gcd_coeffs* methods to Integer::gcd_cofactors*.
      • Integer::gcd_cofactors_ref now supports computing only one cofactor.
      • Deprecate Rational::to_integer and Rational::as_numer_denom.
      • Deprecate Rational::as_mut_numer_denom and replace with Rational::mutate_numer_denom.
      • Deprecate Complex::as_real_imag.
    Open source →
  49. 0.9.3 09 Feb 2018
    Release notes
    • Add Integer::square and Rational::square methods.
      • Add Rational::cmp_abs method.
      • Add Float::sum and Complex::sum methods.
      • Add from_raw, into_raw, as_raw and as_raw_mut to RandState.
      • Add RandGen::boxed_clone and RandState::new_custom_boxed, and thus support for cloning custom random generators.
      • Fix Float::PartialOrd<f32> (and <f64>) to return None when the primitive is NaN.
    Open source →
  50. 0.9.2 12 Jan 2018
    Release notes
    • Require rustc version 1.18.0.
      • Require gmp-mpfr-sys version 1.1.0.
      • Deprecate most assign_* methods, and replace with static methods that return an assignable object.
      • Deprecate Rational::copy_to_integer method.
      • Add Rational::assign_canonical and Rational::from_canonical methods.
      • Add Float::ln_u method.
      • Add Float::round_even methods.
      • Add Float::gamma_inc methods.
      • Add Float::random_normal and Float::random_exp methods.
      • Deprecate Float::assign_random_gaussian methods.
      • Add Complex::cmp_abs method.
      • Add Complex::root_of_unity method.
      • Deprecate SmallRational::from_canonicalized_* methods and replace with SmallRational::from_canonical method.
      • Deprecate SmallRational::assign_canonicalized_* methods.
      • Add as_nonreallocating_* methods to SmallInteger, SmallRational, SmallFloat and SmallComplex.
      • Fix SmallFloat::new and SmallComplex::new to produce numbers with a precision of 53.
      • Deprecate and hide float::Round::AwayFromZero.
      • Add Integer::signum, Rational::signum and Float::signum methods.
      • Add missing conversion to/from and comparisons to primitive types.
      • Add from_raw, into_raw, as_raw and as_raw_mut to Integer, Rational, Float and Complex.
      • Add Float::classify method.
      • Add Float::mul_add, Float::mul_sub, Float::mul_add_mul and Float::mul_sub_mul methods.
      • Add Complex::mul_add and Complex::mul_sub methods.
    Open source →
  51. 0.9.1 27 Nov 2017
    Release notes
    • Implement mathematical operations where operands include references to primitives.
      • Remove undefined behaviour: replace mem::swap(&mut src, &mut uninitialized) with ptr::copy_nonoverlapping(&src, &mut uninitialized, 1).
    Open source →
  52. 0.9.0 16 Nov 2017
    Release notes
    • Move rug::float::AssignRound to rug::ops::AssignRound.
      • OrdFloat now orders +NaN above +∞, while −NaN is still below −∞.
      • Change Float::subnormalize methods to require explicit minimum normal exponent.
      • Add Float::subnormalize_ieee methods to deduce exponent range from precision, like old Float::subnormalize. The new method also supports all IEEE 754-2008 precisions corresponding to k storage bits where k ≥ 128 and k is a multiple of 32.
      • Deprecate Rational::fract methods and replace with Rational::rem_trunc methods.
      • Add Rational::rem_ceil and Rational::rem_floor methods.
      • Add Rational::rem_round and Rational::fract_round methods.
      • Add Float::next_toward, Float::next_up and Float::next_down.
      • Add optional serde support.
    Open source →
  53. 0.8.0 26 Oct 2017
    Release notes
    • Rename Integer::sign, Rational::sign and Float::sign methods as Integer::cmp0, Rational::cmp0 and Float::cmp0.
      • Rename Float::pos_diff as Float::positive_diff.
      • Move rug::AssignRound to rug::float::AssignRound.
      • Add Integer::clamp, Rational::clamp and Float::clamp methods.
      • Add Integer::div_rem_ceil, Integer::div_rem_floor and Integer::div_rem_euc methods.
      • Add DivRounding, DivRoundingAssign and DivRoundingFrom traits, and their Rem counterparts, and implement them for Integer, and for combinations of Integer with i32 or u32.
      • Add Rational::fract_floor and Rational::fract_ceil methods.
    Open source →
  54. 0.7.0 30 Sep 2017
    Release notes
    • Fix swapped Float::sin_cos_mut and Float::sin_cos_round, Float::sinh_cosh_mut and Float::sinh_cosh_round, and Float::trunc_fract_mut and Float::trunc_fract_round.
      • Fix Float::to_f32_round.
      • Now Float::subnormalize only works for precisions defined in IEEE 754.
      • Add Integer::gcd_coeffs methods.
    Open source →
  55. 0.6.0 09 Aug 2017
    Release notes
    • Requires rustc version 1.17.0.
      • Rename Float::abs_diff as Float::pos_diff.
      • Replace Float::get_sign with Float::is_sign_positive and Float::is_sign_negative.
      • Add various as_neg, as_abs and as_conj methods.
      • Add OrdFloat and OrdComplex for complete ordering.
    Open source →
  56. 0.5.0 27 Jun 2017

    Nothing published for this version

  57. 0.4.0 20 Jun 2017

    Nothing published for this version

  58. 0.0.0 13 Jun 2017

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive