From 1b6004bce5f1b9fca1eaa4edf213d70a178f66c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Tue, 7 Jun 2022 00:28:57 +0200 Subject: [PATCH] Numbers --- README.md | 2 +- index.html | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index fb50f15..9054b86 100644 --- a/README.md +++ b/README.md @@ -484,7 +484,6 @@ Format Numbers ------- -### Types ```python = int() # Or: math.floor() = float() # Or: @@ -494,6 +493,7 @@ Numbers ``` * **`'int()'` and `'float()'` raise ValueError on malformed strings.** * **Decimal numbers are stored exactly, unlike most floats where `'1.1 + 2.2 != 3.3'`.** +* **Floats can be compared with: `'math.isclose(, )'`.** * **Precision of decimal operations is set with: `'decimal.getcontext().prec = '`.** ### Basic Functions diff --git a/index.html b/index.html index 300fbd6..1ec7470 100644 --- a/index.html +++ b/index.html @@ -54,7 +54,7 @@
- +
@@ -444,17 +444,17 @@ to_exclusive = <range>.stop {90:X} # '5A' -

#Numbers

Types

<int>      = int(<float/str/bool>)       # Or: math.floor(<float>)
+

#Numbers

<int>      = int(<float/str/bool>)       # Or: math.floor(<float>)
 <float>    = float(<int/str/bool>)       # Or: <real>e±<int>
 <complex>  = complex(real=0, imag=0)     # Or: <real> ± <real>j
 <Fraction> = fractions.Fraction(0, 1)    # Or: Fraction(numerator=0, denominator=1)
 <Decimal>  = decimal.Decimal(<str/int>)  # Or: Decimal((sign, digits, exponent))
-
- +
  • 'int(<str>)' and 'float(<str>)' raise ValueError on malformed strings.
  • Decimal numbers are stored exactly, unlike most floats where '1.1 + 2.2 != 3.3'.
  • +
  • Floats can be compared with: 'math.isclose(<float>, <float>)'.
  • Precision of decimal operations is set with: 'decimal.getcontext().prec = <int>'.

Basic Functions

<num> = pow(<num>, <num>)                # Or: <num> ** <num>
@@ -2898,7 +2898,7 @@ $ pyinstaller script.py --add-data '<path>:.'