Conversation
2cfe087 to
9a5e148
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #325 +/- ##
==========================================
- Coverage 95.27% 95.07% -0.21%
==========================================
Files 60 60
Lines 14291 13518 -773
==========================================
- Hits 13616 12852 -764
+ Misses 675 666 -9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9a5e148 to
15486c5
Compare
|
@FreezyLemon would you be willing to provide some feedback on the following?
Footnotes
|
|
Of course. It might be a few days until I can take a look though. |
FreezyLemon
left a comment
There was a problem hiding this comment.
Hm.. are these new macros in prec.rs intended to be part of the public crate API, or are they just there as helpers for testing? It's not obvious to me at first glance.
Regarding the ergonomics, I think the wrapper macros are probably as useful as the original approx macros (they seem to just emulate their API if I read it correctly).
But why do we need a macro to set module-level defaults? Wouldn't it be way easier (to write and read) to just create a one-line wrapper function?
// local wrapper to change default epsilon
fn ulps_eq(a: f64, b: f64) -> bool {
crate::prec::ulps_eq!(a, b, epsilon = 1e-14)
}Macros can be useful, but I suggest preferring normal functions over macros if possible. It may also make sense to introduce functions for some things that are macros at the moment. E.g. ulps_eq is almost always called with the default epsilon/max_ulps values.
| since = "0.19.0", | ||
| note = "phasing this macro out from internal testing for consistency" | ||
| )] | ||
| macro_rules! assert_almost_eq { |
There was a problem hiding this comment.
Note: The commit (8ad4eed) introducing this/moving this from lib.rs should be marked as breaking. It is currently part of the public API and this PR makes it effectively pub(crate).
README.md
Outdated
|
|
||
| If you're new to floating-point precision, and wish to understand what kind of precision checking to use, these resources provide helpful introductions: | ||
|
|
||
| - [Comparing Floating Point Numbers, 2012 Edition](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/) |
There was a problem hiding this comment.
After seeing that AI was used to create some of this paragraph: Have you checked that these sources exist and are useful for the stated purpose?
There was a problem hiding this comment.
I think these sources are valuable, and not all were generated, but I'd be open to changing to those selected by the numerics community, perhaps from Julialang.
It was encouraging to see that they also link to Bruce Dawson's blog, which I chose to link to since I've found it in many places.
c11fa83 to
efa8982
Compare
36f6819 to
71afe0a
Compare
|
Let me know what you think. The intent of |
FreezyLemon
left a comment
There was a problem hiding this comment.
Sorry, it took me a while to get back to this. This is a bit daunting to review because of the number of changes all across the crate (which to me is a sign that this consolidation definitely needs to happen!). There is a real possibility I missed something, but these changes are important so I'll just go ahead with it.
I'm still not thrilled about the amount of macros in prec.rs, but it's not a big problem.
I like this change a lot, and it will probably be a nice improvement in the long term.
| @@ -9,20 +53,128 @@ pub const F64_PREC: f64 = 0.00000000000000011102230246251565; | |||
| /// Default accuracy for `f64`, equivalent to `0.0 * F64_PREC` | |||
There was a problem hiding this comment.
This has not been changed in this PR, but I just realized that this is incorrect. would you mind including a fix for this here?
|
Alright. Since the API is to use the bottom level macros we can always reimplement those explicitly when someone inevitably finds a better way to express module level defaults. Should be able to get through the conflict today and merge. |
|
github isn't able to check auto merge but has Below I'm running what of the CI I could do myself, ~/p/statrs master• ↑11 10.7s ❱ cargo test --doc
# output removed for brevity
test result: ok. 189 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 10.22s
~/p/statrs master• ↑11 2.5s ❱ cargo nextest run
# output removed for brevity
Summary [ 2.048s] 703 tests run: 703 passed, 4 skipped
info: --no-dev-deps modifies real `Cargo.toml` while cargo-hack is running and restores it when finished
info: running `cargo check --no-default-features` on statrs (1/7)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.02s
info: running `cargo check --no-default-features --features rand,std` on statrs (2/7)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
info: running `cargo check --no-default-features --features default` on statrs (3/7)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.04s
info: running `cargo check --no-default-features --features nalgebra` on statrs (4/7)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
info: running `cargo check --no-default-features --features rand` on statrs (5/7)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.02s
info: running `cargo check --no-default-features --features nalgebra,rand` on statrs (6/7)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
info: running `cargo check --no-default-features --features std` on statrs (7/7)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.02sI'll wait to see if it's ephemeral. Footnotes
|
this is breaking since mod consts is pub
…irectly feat: deprecate and remove last usages of `assert_almost_eq` doc: ensure doc tests use accessible macros
updated in README updated in module doc for function::beta
refactor: treat macro visibility like other items
…nstants removes public const ACC which is intended for internal use
|
Will merge this since the wrapper for |
Implements wrapper for
approxcrate so that we can more easily set defaults across the crate. Should lead to better understanding of "overall" precision, there's also a fairly reasonable way to redefine default precision at the module level, I included this as a sample infunction::beta.I'd be open to any feedback to make it a little more ergonomic, the usage is added in f3fbf98