Skip to content

Commit

Permalink
Merge pull request #1610 from python-discord/fix/float-tag-typo
Browse files Browse the repository at this point in the history
Remove the extra 'as' in the floats tag
  • Loading branch information
ChrisLovering committed May 23, 2021
2 parents 9098d4c + d16df79 commit a830935
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bot/resources/tags/floats.md
Expand Up @@ -5,7 +5,7 @@ You may have noticed that when doing arithmetic with floats in Python you someti
0.30000000000000004
```
**Why this happens**
Internally your computer stores floats as as binary fractions. Many decimal values cannot be stored as exact binary fractions, which means an approximation has to be used.
Internally your computer stores floats as binary fractions. Many decimal values cannot be stored as exact binary fractions, which means an approximation has to be used.

**How you can avoid this**
You can use [math.isclose](https://docs.python.org/3/library/math.html#math.isclose) to check if two floats are close, or to get an exact decimal representation, you can use the [decimal](https://docs.python.org/3/library/decimal.html) or [fractions](https://docs.python.org/3/library/fractions.html) module. Here are some examples:
Expand Down

0 comments on commit a830935

Please sign in to comment.