summaryrefslogtreecommitdiff
path: root/lib/std/fmt.myr
diff options
context:
space:
mode:
authorS. Gilles <sgilles@math.umd.edu>2019-09-09 07:10:55 -0400
committerS. Gilles <sgilles@math.umd.edu>2019-09-09 07:10:55 -0400
commitb5ddbc86346fddc60360a817ee62bc8ca938973e (patch)
tree477576269e15cbe8535c7fcced83a7d008bdc9be /lib/std/fmt.myr
parentd58df01f3ea2de8d41e10d5387445027e59a6c4e (diff)
downloadmc-b5ddbc86346fddc60360a817ee62bc8ca938973e.tar.gz
Specify sigfigs (cutoff + Relative mode) for fltXY formatting
Diffstat (limited to 'lib/std/fmt.myr')
-rw-r--r--lib/std/fmt.myr5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/std/fmt.myr b/lib/std/fmt.myr
index 51dc36e..5dc3ba3 100644
--- a/lib/std/fmt.myr
+++ b/lib/std/fmt.myr
@@ -453,7 +453,7 @@ const fltparams = {params
fp = [
.mode = MNormal,
- .prec = 0,
+ .cutoff = 0,
.padfill = ' ',
.padto = 0,
]
@@ -462,6 +462,9 @@ const fltparams = {params
match p
| ("w", wid): fp.padto = getint(wid, "fmt: width must be integer")
| ("p", pad): fp.padfill = decode(pad)
+ | ("s", sig):
+ fp.mode = MRelative
+ fp.cutoff = getint(sig, "fmt: significant figures must be integer")
| (opt, arg):
std.write(2, "fmt: ")
std.write(2, opt)