diff --git a/tests/float/string_format_modulo.py b/tests/float/string_format_modulo.py index 681e9eb8067e2ae266a6c931e05d38f0e2871f39..03c8dd00aaaa52111252886f951acb7de9fd19f7 100644 --- a/tests/float/string_format_modulo.py +++ b/tests/float/string_format_modulo.py @@ -42,3 +42,5 @@ print(('%.40g' % 1e-1)[:2]) print(('%.40g' % 1e-2)[:2]) print(('%.40g' % 1e-3)[:2]) print(('%.40g' % 1e-4)[:2]) + +print("%.0g" % 1) # 0 precision 'g' diff --git a/tests/float/string_format_modulo3.py b/tests/float/string_format_modulo3.py new file mode 100644 index 0000000000000000000000000000000000000000..563964786502b4bc49f86905f6e4194afd9eea05 --- /dev/null +++ b/tests/float/string_format_modulo3.py @@ -0,0 +1,4 @@ +# uPy and CPython outputs differ for the following +print("%.1g" % -9.9) # round up 'g' with '-' sign +print("%.1e" % 9.99) # round up with positive exponent +print("%.1e" % 0.999) # round up with negative exponent diff --git a/tests/float/string_format_modulo3.py.exp b/tests/float/string_format_modulo3.py.exp new file mode 100644 index 0000000000000000000000000000000000000000..b158c7d7f38cecebb2b0fd1c42cb2c750bc978d9 --- /dev/null +++ b/tests/float/string_format_modulo3.py.exp @@ -0,0 +1,3 @@ +-10 +1.00e+01 +1.00e-00