diff options
| author | Jeff Epler <jepler@unpythonic.net> | 2025-09-17 15:19:20 -0500 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-10-06 15:11:04 +1100 |
| commit | 4963ae72bf7a30aa7d0268383c49ce2ae68f3157 (patch) | |
| tree | a772d61c5f74fdc3b7353c21ef5e6f42bf89dcad | |
| parent | 5552fbe17240aedcada2ce3a5fbb5136a3087f65 (diff) | |
tests/cpydiff: Document unsupported float format with grouping char.
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
| -rw-r--r-- | tests/cpydiff/types_str_formatsep_float.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/cpydiff/types_str_formatsep_float.py b/tests/cpydiff/types_str_formatsep_float.py new file mode 100644 index 000000000..b487cd375 --- /dev/null +++ b/tests/cpydiff/types_str_formatsep_float.py @@ -0,0 +1,11 @@ +""" +categories: Types,str +description: MicroPython accepts but does not properly implement the "," or "_" grouping character for float values +cause: To reduce code size, MicroPython does not implement this combination. Grouping characters will not appear in the number's significant digits and will appear at incorrect locations in leading zeros. +workaround: Do not use a format string like ``{:,f}`` if exact CPython compatibility is required. +""" + +print("{:,f}".format(3141.159)) +print("{:_f}".format(3141.159)) +print("{:011,.2f}".format(3141.159)) +print("{:011_.2f}".format(3141.159)) |
