Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix small float formatting #290

Merged
merged 5 commits into from
Mar 9, 2025

Conversation

OceanNuclear
Copy link
Contributor

Fixed the edge case of having super-small (but non-zero) AffineFunc expressed as str.

@newville newville self-requested a review March 8, 2025 14:06
Copy link

codecov bot commented Mar 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.55%. Comparing base (1975a4d) to head (90e811e).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #290      +/-   ##
==========================================
- Coverage   96.55%   96.55%   -0.01%     
==========================================
  Files          17       17              
  Lines        1947     1946       -1     
==========================================
- Hits         1880     1879       -1     
  Misses         67       67              
Flag Coverage Δ
macos-latest-3.10 95.01% <100.00%> (-0.01%) ⬇️
macos-latest-3.11 95.01% <100.00%> (-0.01%) ⬇️
macos-latest-3.12 95.01% <100.00%> (-0.01%) ⬇️
macos-latest-3.8 95.00% <100.00%> (-0.01%) ⬇️
macos-latest-3.9 95.00% <100.00%> (-0.01%) ⬇️
no-numpy 75.12% <100.00%> (-0.02%) ⬇️
ubuntu-latest-3.10 95.01% <100.00%> (-0.01%) ⬇️
ubuntu-latest-3.11 95.01% <100.00%> (-0.01%) ⬇️
ubuntu-latest-3.12 95.01% <100.00%> (-0.01%) ⬇️
ubuntu-latest-3.8 95.00% <100.00%> (-0.01%) ⬇️
ubuntu-latest-3.9 95.00% <100.00%> (-0.01%) ⬇️
windows-latest-3.10 95.01% <100.00%> (-0.01%) ⬇️
windows-latest-3.11 95.01% <100.00%> (-0.01%) ⬇️
windows-latest-3.12 95.01% <100.00%> (-0.01%) ⬇️
windows-latest-3.8 95.00% <100.00%> (-0.01%) ⬇️
windows-latest-3.9 95.00% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

codspeed-hq bot commented Mar 8, 2025

CodSpeed Performance Report

Merging #290 will not alter performance

Comparing OceanNuclear:fix-small_float_formatting (90e811e) with master (1975a4d)

Summary

✅ 5 untouched benchmarks

Copy link
Member

@newville newville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @OceanNuclear, I think this is all okay.
I will also say that UFloats with a stderr of zero (or less that 2e-16*nominal_value) basically make no sense and will likely cause problems. A value with a (finite) uncertainty can be represented as a UFloat. A value with an infinitesimal uncertainty is a Float. I find it odd how much attention UFloats with stderr=0 get.
I will also say that all of the formatting code in uncertainties is a distraction from the main point of the library.

And yet, I'll go with a bit of a shrug and hearty thanks @OceanNuclear for the fix to this very warty part of the code.

@newville
Copy link
Member

newville commented Mar 9, 2025

@OceanNuclear merging... thanks!

@newville newville merged commit 19865cc into lmfit:master Mar 9, 2025
22 checks passed
@OceanNuclear
Copy link
Contributor Author

Glad to be of help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ZeroDivisionError when getting the __repr__ if nominal value is too small
2 participants