Commit Graph

1047 Commits

Author SHA1 Message Date
bors[bot] 9b364693e6 Merge #207
207: Add copysign r=cuviper a=XAMPPRocky

Resolves #152
Closes #155

Co-authored-by: Erin Power <erin.power@embark-studios.com>
Co-authored-by: XAMPPRocky <4464295+XAMPPRocky@users.noreply.github.com>
Co-authored-by: Josh Stone <cuviper@gmail.com>
2022-05-02 23:58:51 +00:00
Josh Stone e1361fe3e0 Fix copysign tests for 1.8.0 2022-04-29 18:37:16 -07:00
Josh Stone a682d93880 Don't use an explicit copysign feature 2022-04-29 18:37:16 -07:00
Josh Stone 2fe191843c Make sure test_copysignf uses Float 2022-04-29 18:37:16 -07:00
XAMPPRocky 1b04b78740 Update float.rs 2022-04-29 18:10:11 -07:00
XAMPPRocky fdd43fad3d Update float.rs 2022-04-29 18:10:11 -07:00
XAMPPRocky fac306842a Update float.rs 2022-04-29 18:10:11 -07:00
Erin Power 37575361a6 Add copysign 2022-04-29 18:10:11 -07:00
bors[bot] dae9bc13d2 Merge #195
195: Add support for euclidean division and modulation r=cuviper a=SparrowLii

Fixes #159 
Add support for euclidean division and modulation. 

Co-authored-by: SparrowLii <liyuancylx@gmail.com>
Co-authored-by: SparrowLii <liyuan179@huawei.com>
Co-authored-by: Josh Stone <cuviper@gmail.com>
2022-04-30 01:03:28 +00:00
Josh Stone 05fd16d2a0 Forward euclid methods when possible 2022-04-29 17:53:50 -07:00
Josh Stone 039fb91251 tweak euclid tests 2022-04-29 17:22:07 -07:00
SparrowLii d68870321f take references as parameters 2022-04-29 17:22:07 -07:00
SparrowLii 7ece7edabf fixes codes structure etc. 2022-04-29 17:22:07 -07:00
SparrowLii a0a6154a75 Fixes epsilon 2022-04-29 17:22:07 -07:00
SparrowLii e4b037c2c0 fixes MIN 2022-04-29 17:22:07 -07:00
SparrowLii 59a72a8fb9 Fixes methods 2022-04-29 17:22:07 -07:00
SparrowLii f09717c82b fixes method impl 2022-04-29 17:22:07 -07:00
SparrowLii d4191d236c Fixes use core::float 2022-04-29 17:22:07 -07:00
SparrowLii dde1bdda60 fixes example 2022-04-29 17:22:07 -07:00
SparrowLii 4533ad7bb0 fixes ::Float 2022-04-29 17:22:07 -07:00
SparrowLii 6f778fafdf fixes float::Float and fmt 2022-04-29 17:22:07 -07:00
SparrowLii b3ba355daa Add support for euclidean division and modulation 2022-04-29 17:22:07 -07:00
bors[bot] 6496b21596 Merge #203
203: A few small patches r=cuviper a=sshilovsky



Co-authored-by: Sergei Shilovsky <sshilovsky@gmail.com>
2022-04-30 00:04:32 +00:00
Sergei Shilovsky da62ee51e6 Skip check_numassignref_ops test for old rustc 2022-04-29 16:58:43 -07:00
Sergei Shilovsky 527da0fa21 Highlight difference in traits' abstraction level
Short descriptions for NumOps sort of blended in with NumRef and RefNum.
This suggests to clarify the difference a little bit more.
2022-04-29 16:57:11 -07:00
Sergei Shilovsky ad307574de add test: check_numassignref_ops 2022-04-29 16:57:11 -07:00
Sergei Shilovsky 7220b0bcd3 impl Num Wrapping<T> can rely on NumOps instead 2022-04-29 16:57:11 -07:00
bors[bot] 291e30a06a Merge #231
231: Fix cfg typo r=cuviper a=alion02



Co-authored-by: alion02 <alojczek@gmail.com>
2022-04-29 23:46:08 +00:00
alion02 78aae4c700 Fix cfg typo 2022-01-21 02:23:32 +01:00
bors[bot] c749a7263c Merge #218
218: Implement is_sign_* and signum methods in terms of bitcasts. r=cuviper a=ElectronicRU

# Rationale

[rust-gpu](/EmbarkStudios/rust-gpu) project uses num-traits directly and via glam. However, integer_decode() function is a bit poisonous for it - it immediately requires both Int16 and Int64 capabilities.

This PR reimplements corresponding functions in terms of libm's copysign. (For some reason, rust's libm is missing signbit - it can be done with a bitcast though, maybe that's actually a better implementation avenue).

Co-authored-by: Alex S <alex0player@gmail.com>
2021-07-08 23:20:05 +00:00
Alex S c24991f3f3 Reimplement is_sign_negative as a bitcast, libm not necessary. 2021-07-01 00:39:26 +03:00
Alex S 622263ab9f Implement is_sign_* and signum methods in terms of libm. 2021-06-24 19:40:54 +03:00
bors[bot] 72f88d7700 Merge #202
202: PrimInt: add reverse_bits() method r=cuviper a=Xiretza



Co-authored-by: Xiretza <xiretza@xiretza.xyz>
Co-authored-by: Josh Stone <cuviper@gmail.com>
2021-06-16 00:41:55 +00:00
Josh Stone 5bf2599fef Merge branch 'master' into reverse-bits 2021-06-15 17:30:17 -07:00
bors[bot] 89cf792ed1 Merge #214
214: Ignore case for float parsing of text special values r=cuviper a=tspiteri

This copies some of the standard library fixes of <https://github.com/rust-lang/rust/pull/78618>.

Co-authored-by: Trevor Spiteri <tspiteri@ieee.org>
2021-06-16 00:18:05 +00:00
bors[bot] 13be1fbb31 Merge #205
205: Add leading_ones and trailing_ones to PrimInt r=cuviper a=clarfonthey

Since this was only stabilised in 1.46.0, it falls back to a naïve version on older versions.

It seems unlikely that the version in libstd will ever be different from calling the zeros versions on !self, but for future-proofing, this defers to the libstd versions anyway.

Co-authored-by: ltdk <usr@ltdk.xyz>
2021-06-15 23:44:43 +00:00
Trevor Spiteri 4154fb5af9 Ignore case for float parsing of text special values
This copies some of the standard library fixes of
<https://github.com/rust-lang/rust/pull/78618>.
2021-04-15 20:15:46 +02:00
Xiretza 9b9d0ef5d7 PrimInt: add unit tests for reverse_bits 2021-04-13 22:30:09 +02:00
ltdk d989634fda Add leading_ones and trailing_ones to PrimInt 2021-04-09 21:43:48 -04:00
bors[bot] 00d3cdcac0 Merge #210
210: Add LowerBounded/UpperBounded traits r=cuviper a=clarfonthey

Potential solution for #208. With a breaking change, these could simply become supertraits of `Bounded`, but until then, we have to deal with blanket implementations.

I added both simply because it was easy to do so, although we could opt to not require both. I don't see it being that negative to include both, however.

Co-authored-by: ltdk <usr@ltdk.xyz>
2021-04-10 00:22:56 +00:00
bors[bot] 7870893568 Merge #211
211: update readme for rust 2018 edition r=cuviper a=ibraheemdev



Co-authored-by: Ibraheem Ahmed <ibrah1440@gmail.com>
2021-04-10 00:08:19 +00:00
Ibraheem Ahmed 0196ef37dd update readme for rust 2018 edition 2021-03-24 11:52:06 -04:00
ltdk c235ad63f0 Add LowerBounded/UpperBounded traits 2021-03-22 15:23:51 -04:00
Xiretza 54a371e00c PrimInt: add fallback for reverse_bits on rustc<1.37 2021-03-02 14:41:28 +01:00
bors[bot] 534a8170b6 Merge #196
196: Use libm in Float::{min,max} and in FloatCore r=cuviper a=cuviper



Co-authored-by: Josh Stone <cuviper@gmail.com>
2021-03-02 00:01:34 +00:00
bors[bot] 352836c315 Merge #201
201: Use standard library for float from_str_radix with radix 10 r=cuviper a=tspiteri

Fixes #198.

While at it, also make parsing of the `"-NaN"` string match the standard library.

Co-authored-by: Trevor Spiteri <tspiteri@ieee.org>
2021-03-01 23:55:50 +00:00
Xiretza 235f67cd6f PrimInt: add reverse_bits() method 2021-02-12 14:27:18 +01:00
Trevor Spiteri 3b7fd3af79 match standard library float parsing of "-NaN" 2021-02-05 19:18:57 +01:00
Trevor Spiteri 00b5a1d41e use standard library for float from_str_radix with radix 10 2021-02-05 19:03:58 +01:00
Josh Stone c54841995a Use libm in Float::{min,max} and in FloatCore 2020-11-13 18:26:06 -08:00