Skip to content

Conversation

frenck
Copy link
Owner

@frenck frenck commented May 15, 2024

Updates increment and decrement services in Spook to handle floating-point arithmetic inaccuracies.

  • Replaces the strict equality check for step multiples with a tolerance-based check using math.isclose in custom_components/spook/ectoplasms/number/services/decrement.py and increment.py. This change addresses the issue of floating-point arithmetic inaccuracies when checking if an amount is a multiple of the step value.
  • Applies the same tolerance-based check for step multiples in custom_components/spook/ectoplasms/input_number/services/decrement.py and increment.py, ensuring consistency across different types of number entities within Spook.

fixes #744


For more details, open the Copilot Workspace session.

@frenck frenck added the bugfix Inconsistencies or issues which will cause a problem for users or implementors. label May 15, 2024
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
66.7% Duplication on New Code

See analysis details on SonarCloud

@frenck frenck merged commit b97febf into main May 15, 2024
@frenck frenck deleted the fix-decimal-inaccuracy branch May 15, 2024 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Inconsistencies or issues which will cause a problem for users or implementors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increment/Decrement doesn't work on step of 0.1
1 participant