Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit 64dc925

Browse files
flowergrassdpgeorge
authored andcommitted
tests/float: Improve formatfloat.c test coverage using Python.
1 parent ec72db8 commit 64dc925

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

tests/float/string_format_modulo.py

+2
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@
4242
print(('%.40g' % 1e-2)[:2])
4343
print(('%.40g' % 1e-3)[:2])
4444
print(('%.40g' % 1e-4)[:2])
45+
46+
print("%.0g" % 1) # 0 precision 'g'

tests/float/string_format_modulo3.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# uPy and CPython outputs differ for the following
2+
print("%.1g" % -9.9) # round up 'g' with '-' sign
3+
print("%.1e" % 9.99) # round up with positive exponent
4+
print("%.1e" % 0.999) # round up with negative exponent
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-10
2+
1.00e+01
3+
1.00e-00

0 commit comments

Comments
 (0)