summaryrefslogtreecommitdiffstatshomepage
path: root/tests/float/float_format.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/float/float_format.py')
-rw-r--r--tests/float/float_format.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/float/float_format.py b/tests/float/float_format.py
new file mode 100644
index 0000000000..4d5ad1d693
--- /dev/null
+++ b/tests/float/float_format.py
@@ -0,0 +1,11 @@
+# test float formatting
+
+# general rounding
+for val in (116, 1111, 1234, 5010, 11111):
+ print('%.0f' % val)
+ print('%.1f' % val)
+ print('%.3f' % val)
+
+# make sure rounding is done at the correct precision
+for prec in range(8):
+ print(('%%.%df' % prec) % 6e-5)