1# Release 0.2.19 (2024-05-03) 2 3- [Upgrade to 2021 edition, **MSRV 1.60**][310] 4- [The new `Float::clamp` limits values by minimum and maximum][305] 5 6**Contributors**: @cuviper, @michaelciraci 7 8[305]: https://github.com/rust-num/num-traits/pull/305 9[310]: https://github.com/rust-num/num-traits/pull/310 10 11# Release 0.2.18 (2024-02-07) 12 13- [The new `Euclid::div_rem_euclid` and `CheckedEuclid::checked_div_rem_euclid` methods][291] 14 compute and return the quotient and remainder at the same time. 15- [The new `TotalOrder` trait implements the IEEE 754 `totalOrder` predicate.][295] 16- [The new `ConstZero` and `ConstOne` traits offered associated constants][303], 17 extending the non-const `Zero` and `One` traits for types that have constant values. 18 19**Contributors**: @andrewjradcliffe, @cuviper, @tarcieri, @tdelabro, @waywardmonkeys 20 21[291]: https://github.com/rust-num/num-traits/pull/291 22[295]: https://github.com/rust-num/num-traits/pull/295 23[303]: https://github.com/rust-num/num-traits/pull/303 24 25# Release 0.2.17 (2023-10-07) 26 27- [Fix a doc warning about custom classes with newer rustdoc.][286] 28 29**Contributors**: @robamu 30 31[286]: https://github.com/rust-num/num-traits/pull/286 32 33# Release 0.2.16 (2023-07-20) 34 35- [Upgrade to 2018 edition, **MSRV 1.31**][240] 36- [The new `ToBytes` and `FromBytes` traits][224] convert to and from byte 37 representations of a value, with little, big, and native-endian options. 38- [The new `Float::is_subnormal` method checks for subnormal values][279], with 39 a non-zero magnitude that is less than the normal minimum positive value. 40- Several other improvements to documentation and testing. 41 42**Contributors**: @ctrlcctrlv, @cuviper, @flier, @GuillaumeGomez, @kaidokert, 43@rs017991, @vicsn 44 45[224]: https://github.com/rust-num/num-traits/pull/224 46[240]: https://github.com/rust-num/num-traits/pull/240 47[279]: https://github.com/rust-num/num-traits/pull/279 48 49# Release 0.2.15 (2022-05-02) 50 51- [The new `Euclid` trait calculates Euclidean division][195], where the 52 remainder is always positive or zero. 53- [The new `LowerBounded` and `UpperBounded` traits][210] separately describe 54 types with lower and upper bounds. These traits are automatically implemented 55 for all fully-`Bounded` types. 56- [The new `Float::copysign` method copies the sign of the argument][207] to 57 to the magnitude of `self`. 58- [The new `PrimInt::leading_ones` and `trailing_ones` methods][205] are the 59 complement of the existing methods that count zero bits. 60- [The new `PrimInt::reverse_bits` method reverses the order of all bits][202] 61 of a primitive integer. 62- [Improved `Num::from_str_radix` for floats][201], also [ignoring case][214]. 63- [`Float` and `FloatCore` use more from `libm`][196] when that is enabled. 64 65**Contributors**: @alion02, @clarfonthey, @cuviper, @ElectronicRU, 66@ibraheemdev, @SparrowLii, @sshilovsky, @tspiteri, @XAMPPRocky, @Xiretza 67 68[195]: https://github.com/rust-num/num-traits/pull/195 69[196]: https://github.com/rust-num/num-traits/pull/196 70[201]: https://github.com/rust-num/num-traits/pull/201 71[202]: https://github.com/rust-num/num-traits/pull/202 72[205]: https://github.com/rust-num/num-traits/pull/205 73[207]: https://github.com/rust-num/num-traits/pull/207 74[210]: https://github.com/rust-num/num-traits/pull/210 75[214]: https://github.com/rust-num/num-traits/pull/214 76 77# Release 0.2.14 (2020-10-29) 78 79- Clarify the license specification as "MIT OR Apache-2.0". 80 81**Contributors**: @cuviper 82 83# Release 0.2.13 (2020-10-29) 84 85- [The new `OverflowingAdd`, `OverflowingSub`, and `OverflowingMul` traits][180] 86 return a tuple with the operation result and a `bool` indicating overflow. 87- [The "i128" feature now overrides compiler probes for that support][185]. 88 This may fix scenarios where `autocfg` probing doesn't work properly. 89- [Casts from large `f64` values to `f32` now saturate to infinity][186]. They 90 previously returned `None` because that was once thought to be undefined 91 behavior, but [rust#15536] resolved that such casts are fine. 92- [`Num::from_str_radix` documents requirements for radix support][192], which 93 are now more relaxed than previously implied. It is suggested to accept at 94 least `2..=36` without panicking, but `Err` may be returned otherwise. 95 96**Contributors**: @cuviper, @Enet4, @KaczuH, @martin-t, @newpavlov 97 98[180]: https://github.com/rust-num/num-traits/pull/180 99[185]: https://github.com/rust-num/num-traits/pull/185 100[186]: https://github.com/rust-num/num-traits/pull/186 101[192]: https://github.com/rust-num/num-traits/issues/192 102[rust#15536]: https://github.com/rust-lang/rust/issues/15536 103 104# Release 0.2.12 (2020-06-11) 105 106- [The new `WrappingNeg` trait][153] will wrap the result if it exceeds the 107 boundary of the type, e.g. `i32::MIN.wrapping_neg() == i32::MIN`. 108- [The new `SaturatingAdd`, `SaturatingSub`, and `SaturatingMul` traits][165] 109 will saturate at the numeric bounds if the operation would overflow. These 110 soft-deprecate the existing `Saturating` trait that only has addition and 111 subtraction methods. 112- [Added new constants for logarithms, `FloatConst::{LOG10_2, LOG2_10}`][171]. 113 114**Contributors**: @cuviper, @ocstl, @trepetti, @vallentin 115 116[153]: https://github.com/rust-num/num-traits/pull/153 117[165]: https://github.com/rust-num/num-traits/pull/165 118[171]: https://github.com/rust-num/num-traits/pull/171 119 120# Release 0.2.11 (2020-01-09) 121 122- [Added the full circle constant τ as `FloatConst::TAU`][145]. 123- [Updated the `autocfg` build dependency to 1.0][148]. 124 125**Contributors**: @cuviper, @m-ou-se 126 127[145]: https://github.com/rust-num/num-traits/pull/145 128[148]: https://github.com/rust-num/num-traits/pull/148 129 130# Release 0.2.10 (2019-11-22) 131 132- [Updated the `libm` dependency to 0.2][144]. 133 134**Contributors**: @CryZe 135 136[144]: https://github.com/rust-num/num-traits/pull/144 137 138# Release 0.2.9 (2019-11-12) 139 140- [A new optional `libm` dependency][99] enables the `Float` and `Real` traits 141 in `no_std` builds. 142- [The new `clamp_min` and `clamp_max`][122] limit minimum and maximum values 143 while preserving input `NAN`s. 144- [Fixed a panic in floating point `from_str_radix` on invalid signs][126]. 145- Miscellaneous documentation updates. 146 147**Contributors**: @cuviper, @dingelish, @HeroicKatora, @jturner314, @ocstl, 148@Shnatsel, @termoshtt, @waywardmonkeys, @yoanlcq 149 150[99]: https://github.com/rust-num/num-traits/pull/99 151[122]: https://github.com/rust-num/num-traits/pull/122 152[126]: https://github.com/rust-num/num-traits/pull/126 153 154# Release 0.2.8 (2019-05-21) 155 156- [Fixed feature detection on `no_std` targets][116]. 157 158**Contributors**: @cuviper 159 160[116]: https://github.com/rust-num/num-traits/pull/116 161 162# Release 0.2.7 (2019-05-20) 163 164- [Documented when `CheckedShl` and `CheckedShr` return `None`][90]. 165- [The new `Zero::set_zero` and `One::set_one`][104] will set values to their 166 identities in place, possibly optimized better than direct assignment. 167- [Documented general features and intentions of `PrimInt`][108]. 168 169**Contributors**: @cuviper, @dvdhrm, @ignatenkobrain, @lcnr, @samueltardieu 170 171[90]: https://github.com/rust-num/num-traits/pull/90 172[104]: https://github.com/rust-num/num-traits/pull/104 173[108]: https://github.com/rust-num/num-traits/pull/108 174 175# Release 0.2.6 (2018-09-13) 176 177- [Documented that `pow(0, 0)` returns `1`][79]. Mathematically, this is not 178 strictly defined, but the current behavior is a pragmatic choice that has 179 precedent in Rust `core` for the primitives and in many other languages. 180- [The new `WrappingShl` and `WrappingShr` traits][81] will wrap the shift count 181 if it exceeds the bit size of the type. 182 183**Contributors**: @cuviper, @edmccard, @meltinglava 184 185[79]: https://github.com/rust-num/num-traits/pull/79 186[81]: https://github.com/rust-num/num-traits/pull/81 187 188# Release 0.2.5 (2018-06-20) 189 190- [Documentation for `mul_add` now clarifies that it's not always faster.][70] 191- [The default methods in `FromPrimitive` and `ToPrimitive` are more robust.][73] 192 193**Contributors**: @cuviper, @frewsxcv 194 195[70]: https://github.com/rust-num/num-traits/pull/70 196[73]: https://github.com/rust-num/num-traits/pull/73 197 198# Release 0.2.4 (2018-05-11) 199 200- [Support for 128-bit integers is now automatically detected and enabled.][69] 201 Setting the `i128` crate feature now causes the build script to panic if such 202 support is not detected. 203 204**Contributors**: @cuviper 205 206[69]: https://github.com/rust-num/num-traits/pull/69 207 208# Release 0.2.3 (2018-05-10) 209 210- [The new `CheckedNeg` and `CheckedRem` traits][63] perform checked `Neg` and 211 `Rem`, returning `Some(output)` or `None` on overflow. 212- [The `no_std` implementation of `FloatCore::to_degrees` for `f32`][61] now 213 uses a constant for greater accuracy, mirroring [rust#47919]. (With `std` it 214 just calls the inherent `f32::to_degrees` in the standard library.) 215- [The new `MulAdd` and `MulAddAssign` traits][59] perform a fused multiply- 216 add. For integer types this is just a convenience, but for floating point 217 types this produces a more accurate result than the separate operations. 218- [All applicable traits are now implemented for 128-bit integers][60] starting 219 with Rust 1.26, enabled by the new `i128` crate feature. The `FromPrimitive` 220 and `ToPrimitive` traits now also have corresponding 128-bit methods, which 221 default to converting via 64-bit integers for compatibility. 222 223**Contributors**: @cuviper, @LEXUGE, @regexident, @vks 224 225[59]: https://github.com/rust-num/num-traits/pull/59 226[60]: https://github.com/rust-num/num-traits/pull/60 227[61]: https://github.com/rust-num/num-traits/pull/61 228[63]: https://github.com/rust-num/num-traits/pull/63 229[rust#47919]: https://github.com/rust-lang/rust/pull/47919 230 231# Release 0.2.2 (2018-03-18) 232 233- [Casting from floating point to integers now returns `None` on overflow][52], 234 avoiding [rustc's undefined behavior][rust-10184]. This applies to the `cast` 235 function and the traits `NumCast`, `FromPrimitive`, and `ToPrimitive`. 236 237**Contributors**: @apopiak, @cuviper, @dbarella 238 239[52]: https://github.com/rust-num/num-traits/pull/52 240[rust-10184]: https://github.com/rust-lang/rust/issues/10184 241 242 243# Release 0.2.1 (2018-03-01) 244 245- [The new `FloatCore` trait][32] offers a subset of `Float` for `#![no_std]` use. 246 [This includes everything][41] except the transcendental functions and FMA. 247- [The new `Inv` trait][37] returns the multiplicative inverse, or reciprocal. 248- [The new `Pow` trait][37] performs exponentiation, much like the existing `pow` 249 function, but with generic exponent types. 250- [The new `One::is_one` method][39] tests if a value equals 1. Implementers 251 should override this method if there's a more efficient way to check for 1, 252 rather than comparing with a temporary `one()`. 253 254**Contributors**: @clarcharr, @cuviper, @vks 255 256[32]: https://github.com/rust-num/num-traits/pull/32 257[37]: https://github.com/rust-num/num-traits/pull/37 258[39]: https://github.com/rust-num/num-traits/pull/39 259[41]: https://github.com/rust-num/num-traits/pull/41 260 261 262# Release 0.2.0 (2018-02-06) 263 264- **breaking change**: [There is now a `std` feature][30], enabled by default, along 265 with the implication that building *without* this feature makes this a 266 `#![no_std]` crate. 267 - The `Float` and `Real` traits are only available when `std` is enabled. 268 - Otherwise, the API is unchanged, and num-traits 0.1.43 now re-exports its 269 items from num-traits 0.2 for compatibility (the [semver-trick]). 270 271**Contributors**: @cuviper, @termoshtt, @vks 272 273[semver-trick]: https://github.com/dtolnay/semver-trick 274[30]: https://github.com/rust-num/num-traits/pull/30 275 276 277# Release 0.1.43 (2018-02-06) 278 279- All items are now [re-exported from num-traits 0.2][31] for compatibility. 280 281[31]: https://github.com/rust-num/num-traits/pull/31 282 283 284# Release 0.1.42 (2018-01-22) 285 286- [num-traits now has its own source repository][num-356] at [rust-num/num-traits][home]. 287- [`ParseFloatError` now implements `Display`][22]. 288- [The new `AsPrimitive` trait][17] implements generic casting with the `as` operator. 289- [The new `CheckedShl` and `CheckedShr` traits][21] implement generic 290 support for the `checked_shl` and `checked_shr` methods on primitive integers. 291- [The new `Real` trait][23] offers a subset of `Float` functionality that may be applicable to more 292 types, with a blanket implementation for all existing `T: Float` types. 293 294Thanks to @cuviper, @Enet4, @fabianschuiki, @svartalf, and @yoanlcq for their contributions! 295 296[home]: https://github.com/rust-num/num-traits 297[num-356]: https://github.com/rust-num/num/pull/356 298[17]: https://github.com/rust-num/num-traits/pull/17 299[21]: https://github.com/rust-num/num-traits/pull/21 300[22]: https://github.com/rust-num/num-traits/pull/22 301[23]: https://github.com/rust-num/num-traits/pull/23 302 303 304# Prior releases 305 306No prior release notes were kept. Thanks all the same to the many 307contributors that have made this crate what it is! 308