shithub: mc

Download patch

ref: 21b5fb876c5f1e6188a3a6b0e9e77311f06525f0
parent: 5e93d7d5973263c91da1dd085c0564b4516f11d3
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Oct 26 18:23:20 EDT 2016

Fix floating point printing.

	Right, we actually need to fill the trailing zeros.

--- a/lib/std/fltfmt.myr
+++ b/lib/std/fltfmt.myr
@@ -223,6 +223,11 @@
 		| `After:	format(sb, udig + 1, k)
 		;;
 	;;
+	k--
+
+	while k >= -1
+		format(sb, 0, k--)
+	;;
 }
 
 const lowdig = {u
--- a/lib/std/test/fmt.myr
+++ b/lib/std/test/fmt.myr
@@ -62,6 +62,8 @@
 	check("0x7b", "0x{x}", 123)
 	check("0.0", "{}", 0.0)
 	check("0.3", "{}", 0.3)
+	check("1.0", "{}", 1.0)
+	check("100.0", "{}", 100.0)
 	check("666.91972", "{}", 666.91972)
 	check("1.0001", "{}", 1.0001)
 	check("0.000101323461002", "{}", 0.000101323461002)