Skip to content

Conversation

@ntBre
Copy link
Contributor

@ntBre ntBre commented Jun 10, 2025

Summary

Updates the rule docs to explicitly state how cases like Decimal("0.1") are handled (not affected) because the discussion of "float casts" referring to values like nan and inf is otherwise a bit confusing.

These changes are based on suggestions from @AlexWaygood on Notion, with a slight adjustment to use 0.1 instead of 0.5 since it causes a more immediate issue in the REPL:

>>> from decimal import Decimal
>>> Decimal(0.5) == Decimal("0.5")
True
>>> Decimal(0.1) == Decimal("0.1")
False

Test plan

N/a

Summary
--

Updates the rule docs to explicitly state how cases like `Decimal("0.1")` are
handled (not affected) because the discussion of "float casts" referring to
values like `nan` and `inf` are otherwise a bit confusing.

These changes are based on suggestions from @AlexWaygood on Notion, with a
slight adjustment to use 0.1 instead of 0.5 since it causes a more immediate
issue in the REPL:

```pycon
>>> from decimal import Decimal
>>> Decimal(0.5) == Decimal("0.5")
True
>>> Decimal(0.1) == Decimal("0.1")
False
```

Test plan
--

N/a

Co-authored-by: Alex Waygood <[email protected]>
@ntBre ntBre added the documentation Improvements or additions to documentation label Jun 10, 2025
@ntBre ntBre requested a review from AlexWaygood June 10, 2025 19:54
@github-actions
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre merged commit b21ac56 into main Jun 10, 2025
34 checks passed
@ntBre ntBre deleted the brent/furb157-docs branch June 10, 2025 20:09
dcreager added a commit that referenced this pull request Jun 10, 2025
* main:
  [ty] implement disjointness of Callable vs SpecialForm (#18503)
  [ty] more simplification of infer_parameterized_legacy_typing_alias (#18526)
  [`refurb`] Add a note about float literal handling (`FURB157`) (#18615)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants