diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-01-27 06:03:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-26 23:03:59 +0100 |
commit | fc068ee06d058b35d2d5890cf1fa3c356e549d1f (patch) | |
tree | 89dd50f106db8f5165b305af6fcf3cafef5efa06 /compiler | |
parent | 23bd812b0c531dbb6a9854a81030468bbae29cd8 (diff) | |
download | Nim-fc068ee06d058b35d2d5890cf1fa3c356e549d1f.tar.gz |
fixes #18134; registers `formatBiggestFloat` in VM (#21299)
fixes #18134; registers formatBiggestFloat in vmops strformat supports float format in VM
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/vmops.nim | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/vmops.nim b/compiler/vmops.nim index bb943b8a0..2b5b2c938 100644 --- a/compiler/vmops.nim +++ b/compiler/vmops.nim @@ -36,7 +36,9 @@ from std/osproc import nil when defined(nimPreviewSlimSystem): import std/syncio else: - from std/formatfloat import addFloatRoundtrip, addFloatSprintf + from std/formatfloat import addFloatRoundtrip, addFloatSprintf + +from std/strutils import formatBiggestFloat, FloatFormatMode # There are some useful procs in vmconv. import vmconv, vmmarshal @@ -374,6 +376,10 @@ proc registerAdditionalOps*(c: PCtx) = let x = a.getFloat(1) addFloatSprintf(p.strVal, x) + registerCallback c, "stdlib.strutils.formatBiggestFloat", proc(a: VmArgs) = + setResult(a, formatBiggestFloat(a.getFloat(0), FloatFormatMode(a.getInt(1)), + a.getInt(2), chr(a.getInt(3)))) + wrapIterator("stdlib.envvars.envPairsImplSeq"): envPairs() registerCallback c, "stdlib.marshal.toVM", proc(a: VmArgs) = |