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