Skip to content

Releases: dnsl48/fraction

0.15.3

12 May 06:40
Compare
Choose a tag to compare
  • num crate min required version is now 0.4.2 (The one where ConstOne and ConstZero were introduced)

0.15.2

27 Apr 21:09
Compare
Choose a tag to compare

[0.15.2] - 2024-04-28

Added

  • GenericFraction ConstOne and ConstZero trait implementations (special thanks to Raimundo Saona, aka @saona-raimundo)

0.15.1

11 Feb 02:51
Compare
Choose a tag to compare

Added

  • "with-unicode" feature implementation to format (and parse) floats with Unicode characters (special thanks to @feefladder)

0.15.0 / 2024-01-01

01 Jan 02:23
Compare
Choose a tag to compare

Added

  • GenericFraction try_from/try_into implementations for primitive types (u8, i8, u16, i16, u32, i32, u64, i64, u128, i128, usize, isize, f32, f64)
  • GenericFraction try_from/try_into implementations for BigInt/BigUint ("with-bigint" feature)
  • GenericDecimal try_from/try_into implementations for primitive types (u8, i8, u16, i16, u32, i32, u64, i64, u128, i128, usize, isize, f32, f64)
  • GenericDecimal try_from/try_into implementations for BigInt/BigUint ("with-bigint" feature)
  • Tests for all GenericDecimal ops (overloadable operators - std::ops)

Changed

  • GenericDecimal ops (overloadable operators) refactoring. Each operator is now implemented separately in its own module, allowing decoupled code with its own optimisations and tests.

Fixed

  • PartialOrd will now reuse Ord implementation where possible (refactor to make clippy happier)
  • Fixed logic in sub_assign and checked_sub that could sometimes produce incorrect results for a couple of edge cases with a negative zero (-0) as an operand.

0.14.0

27 Sep 03:22
Compare
Choose a tag to compare

Added

  • approx module with "Approximate mathematical operations", fn sqrt (special thanks to @squ1dd13 for the contribution!)
  • with-approx feature, enabling the approx module

0.13.1

24 Feb 20:35
Compare
Choose a tag to compare

[0.13.1] - 2023-02-25

Added

  • Clippy hint to allow manual filtering in GenericFraction::to_i64 implementation
  • A couple of tests for floor/ceil functions

Fixed

  • ceil & floor incorrect behaviour for negative numbers (special thanks to Morris Hansing aka morri2)

0.13.0

01 Jan 04:37
Compare
Choose a tag to compare

[0.13.0] - 2023-01-01

Changed

  • PartialCmp now compares NaN with the other values and returns it as the smallest possible value. Thus, NaN < -Inf.

Fixed

  • partial_cmp now behaves exactly the same as cmp (PartialOrd is now consistent with Ord).
    This fixes an issue introduced in 0.12.2 with the implementation of Ord,
    where Ord would behave differently from PartialOrd with NaN values.
    Special thanks to Hsingai Tigris Altaica aka DrAlta for fixing this.

0.12.2

04 Dec 00:02
38f3962
Compare
Choose a tag to compare

[0.12.2] - 2022-12-04

Added

  • Ord trait implementation for GenericFraction and GenericDecimal (special thanks to Hsingai Tigris Altaica aka DrAlta)

0.12.1

18 Oct 07:40
Compare
Choose a tag to compare

Added

  • Support to add castable values (e.g. f + 1u8, 1u8 will be transparently casted to Fraction with .into())
  • Support to sub castable values (e.g. f - 1u8, 1u8 will be transparently casted to Fraction with .into())
  • Support to div castable values (e.g. f / 1u8, 1u8 will be transparently casted to Fraction with .into())
  • Support to mul castable values (e.g. f * 1u8, 1u8 will be transparently casted to Fraction with .into())
  • Support to add_assign castable values (e.g. f += 1u8, 1u8 will be transparently casted to Fraction with .into())
  • Support to sub_assign castable values (e.g. f -= 1u8, 1u8 will be transparently casted to Fraction with .into())
  • Support to div_assign castable values (e.g. f /= 1u8, 1u8 will be transparently casted to Fraction with .into())
  • Support to mul_assign castable values (e.g. f *= 1u8, 1u8 will be transparently casted to Fraction with .into())

Changed

  • Refactoring of the fraction module. std::ops implementations moved into separate submodules.
  • generic::read_generic_integer performance improved for when target type matches source (~83% improvement, which is 5 times faster).
    As the result this can affect GenericFraction::from performance for non-float types.
  • From<(A, B)> implementation is migrated to GenericFraction::new_generic (~85% performance improvement and with no heap allocations, which is ~7 times faster).

0.12.0

13 Oct 00:43
Compare
Choose a tag to compare

See CHANGELOG.md for the details