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