Skip to content

Commit 5749d51

Browse files
Update docs/Secure-Coding-Guide-for-Python/CWE-682/CWE-1339/README.md
Co-authored-by: myteron <[email protected]> Signed-off-by: BartyBoi1128 <[email protected]>
1 parent 6de3282 commit 5749d51

File tree

1 file changed

+1
-1
lines changed
  • docs/Secure-Coding-Guide-for-Python/CWE-682/CWE-1339

1 file changed

+1
-1
lines changed

docs/Secure-Coding-Guide-for-Python/CWE-682/CWE-1339/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Avoid floating-point and use integers or the `decimal` module to ensure precision in applications that require high accuracy, such as in financial or banking computations.
44

5-
In Python, floating-point types are constrained by a fixed number of binary mantissa bits, typically allowing for around seven decimal digits of precision (24-bit values). Consequently, they are not well-suited for representing surds, such as `√7` or `π` with full accuracy. Additionally, due to their binary nature, floating-point types are incapable of exactly terminating decimals in base 10, such as 0.3, which has a repeating binary representation.
5+
In Python, floating-point types are constrained by a fixed number of binary mantissa bits, typically allowing for around seven decimal digits of precision (24-bit values). Consequently, they are not well-suited for representing surds, such as `√7` or `π` with full accuracy. Additionally, due to their binary nature, floating-point types are incapable of exactly terminating decimals in `base 10`, such as `0.3`, which has a repeating binary representation.
66

77
To ensure precision in applications requiring high accuracy, such as in financial or banking computations, it is recommended to avoid using floating-point types. Instead, integers or more precise data types like the `Decimal` class should be employed.
88

0 commit comments

Comments
 (0)