Skip to content

Conversation

@tdelmas
Copy link
Owner

@tdelmas tdelmas commented May 10, 2024

New API to restrict a type:

use typed_floats::*;

let a: Positive<f32> = 0.0.try_into().unwrap();
let b: PositiveFinite<f32> = match a.exclude_inf() {
  Ok(x) => x,
  Err(x) => panic!("{} is infinite", x),
}

Signed-off-by: GitHub <[email protected]>
@netlify
Copy link

netlify bot commented May 10, 2024

Deploy Preview for typed-floats-crate-preview ready!

Name Link
🔨 Latest commit 42acfe8
🔍 Latest deploy log https://app.netlify.com/projects/typed-floats-crate-preview/deploys/6875316a862a510008076bbb
😎 Deploy Preview https://deploy-preview-136--typed-floats-crate-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Signed-off-by: GitHub <[email protected]>
@tdelmas tdelmas added the help wanted Extra attention is needed label May 10, 2024
@github-actions
Copy link

Benchmark for da72775

Click to view benchmark
Test Base PR %
eq_non_zero_non_nan_f32 126.5±1.80ns 126.9±3.60ns +0.32%
signum 11.8±0.12ns 11.8±0.13ns 0.00%
sort_nonnan 151.8±0.91µs 148.0±3.65µs -2.50%
sort_nonzero 147.0±1.04µs 136.2±0.67µs -7.35%
sort_positive 63.2±0.65µs 59.7±0.43µs -5.54%

@github-actions
Copy link

Benchmark for 74fb31b

Click to view benchmark
Test Base PR %
eq_non_zero_non_nan_f32 126.0±1.21ns 126.3±2.18ns +0.24%
signum 13.7±0.18ns 13.8±0.29ns +0.73%
sort_nonnan 142.3±0.86µs 148.5±0.93µs +4.36%
sort_nonzero 141.6±0.87µs 142.6±0.58µs +0.71%
sort_positive 59.7±0.28µs 63.3±0.36µs +6.03%

@github-actions
Copy link

Benchmark for 9be9343

Click to view benchmark
Test Base PR %
eq_non_zero_non_nan_f32 126.5±3.26ns 126.6±4.75ns +0.08%
signum 13.7±0.22ns 13.7±0.26ns 0.00%
sort_nonnan 138.9±1.71µs 144.5±1.45µs +4.03%
sort_nonzero 139.1±1.85µs 143.7±1.51µs +3.31%
sort_positive 59.6±0.68µs 59.4±0.76µs -0.34%

@github-actions
Copy link

Benchmark for 0f664f3

Click to view benchmark
Test Base PR %
eq_non_zero_non_nan_f32 126.2±1.86ns 126.5±2.08ns +0.24%
signum 13.8±0.45ns 13.8±0.36ns 0.00%
sort_nonnan 145.3±1.38µs 144.3±3.92µs -0.69%
sort_nonzero 141.0±1.42µs 138.0±0.87µs -2.13%
sort_positive 59.5±0.43µs 59.8±0.62µs +0.50%

@tdelmas
Copy link
Owner Author

tdelmas commented Jul 13, 2025

@raimundomartins do you have an opinion on this latest version?

@raimundomartins
Copy link
Contributor

Besides the filename being restrict.rs instead of exclude.rs, everything else looks good to me!

@github-actions
Copy link

Benchmark for 3933e85

Click to view benchmark
Test Base PR %
eq_non_zero_non_nan_f32 126.0±0.65ns 126.4±2.30ns +0.32%
signum 13.7±0.21ns 13.8±0.26ns +0.73%
sort_nonnan 142.9±0.83µs 142.9±7.12µs 0.00%
sort_nonzero 137.7±1.98µs 140.4±1.43µs +1.96%
sort_positive 60.3±1.41µs 60.2±0.94µs -0.17%

@github-actions
Copy link

Benchmark for 6e8446c

Click to view benchmark
Test Base PR %
eq_non_zero_non_nan_f32 126.0±0.84ns 126.3±2.35ns +0.24%
signum 13.7±0.28ns 13.7±0.13ns 0.00%
sort_nonnan 143.0±1.45µs 143.2±2.11µs +0.14%
sort_nonzero 135.4±1.50µs 137.3±1.26µs +1.40%
sort_positive 60.3±0.31µs 61.8±0.64µs +2.49%

@github-actions
Copy link

Benchmark for 77eb9c9

Click to view benchmark
Test Base PR %
eq_non_zero_non_nan_f32 126.3±2.59ns 127.5±8.57ns +0.95%
signum 13.7±0.24ns 13.8±0.37ns +0.73%
sort_nonnan 142.5±1.58µs 142.2±1.43µs -0.21%
sort_nonzero 137.0±1.24µs 139.3±4.66µs +1.68%
sort_positive 59.4±0.66µs 61.0±1.38µs +2.69%

Signed-off-by: GitHub <[email protected]>
@github-actions
Copy link

Benchmark for 18f2d80

Click to view benchmark
Test Base PR %
eq_non_zero_non_nan_f32 126.0±1.13ns 126.8±3.44ns +0.63%
signum 13.7±0.20ns 13.7±0.24ns 0.00%
sort_nonnan 141.4±1.27µs 142.2±0.96µs +0.57%
sort_nonzero 137.0±0.88µs 138.0±1.36µs +0.73%
sort_positive 60.8±0.85µs 61.2±0.63µs +0.66%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants