summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/ccgexprs.nim4
-rw-r--r--compiler/rodutils.nim6
-rw-r--r--lib/pure/asyncmacro.nim3
-rw-r--r--tests/float/tissue5821.nim13
4 files changed, 19 insertions, 7 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim
index b03f7c5aa..d244153db 100644
--- a/compiler/ccgexprs.nim
+++ b/compiler/ccgexprs.nim
@@ -78,8 +78,10 @@ proc genLiteral(p: BProc, n: PNode, ty: PType): Rope =
                         [p.module.tmpBase, rope(id)])
     else:
       result = makeCString(n.strVal)
-  of nkFloatLit..nkFloat64Lit:
+  of nkFloatLit, nkFloat64Lit:
     result = rope(n.floatVal.toStrMaxPrecision)
+  of nkFloat32Lit:
+    result = rope(n.floatVal.toStrMaxPrecision("f"))
   else:
     internalError(n.info, "genLiteral(" & $n.kind & ')')
     result = nil
diff --git a/compiler/rodutils.nim b/compiler/rodutils.nim
index d24e8f560..77f7c844f 100644
--- a/compiler/rodutils.nim
+++ b/compiler/rodutils.nim
@@ -12,17 +12,17 @@ import strutils
 
 proc c_sprintf(buf, frmt: cstring) {.importc: "sprintf", header: "<stdio.h>", nodecl, varargs.}
 
-proc toStrMaxPrecision*(f: BiggestFloat): string =
+proc toStrMaxPrecision*(f: BiggestFloat, literalPostfix = ""): string =
   if f != f:
     result = "NAN"
   elif f == 0.0:
-    result = "0.0"
+    result = "0.0" & literalPostfix
   elif f == 0.5 * f:
     if f > 0.0: result = "INF"
     else: result = "-INF"
   else:
     var buf: array[0..80, char]
-    c_sprintf(buf, "%#.16e", f)
+    c_sprintf(buf, "%#.16e" & literalPostfix, f)
     result = $buf
 
 proc encodeStr*(s: string, result: var string) =
diff --git a/lib/pure/asyncmacro.nim b/lib/pure/asyncmacro.nim
index fccda3bfb..9a9bef8c0 100644
--- a/lib/pure/asyncmacro.nim
+++ b/lib/pure/asyncmacro.nim
@@ -306,7 +306,6 @@ proc asyncSingleProc(prc: NimNode): NimNode {.compileTime.} =
             " proc/method definition or lambda node expected.")
 
   let prcName = prc.name.getName
-  hint("Processing " & prcName & " as an async proc.")
 
   let returnType = prc.params[0]
   var baseType: NimNode
@@ -527,8 +526,6 @@ macro multisync*(prc: untyped): untyped =
   ##
   ## The generated async procedures use the ``async`` macro, whereas the
   ## generated synchronous procedures simply strip off the ``await`` calls.
-  hint("Processing " & prc[0].getName & " as a multisync proc.")
-
   let (sync, asyncPrc) = splitProc(prc)
   result = newStmtList()
   result.add(asyncSingleProc(asyncPrc))
diff --git a/tests/float/tissue5821.nim b/tests/float/tissue5821.nim
new file mode 100644
index 000000000..e8aa4a1d9
--- /dev/null
+++ b/tests/float/tissue5821.nim
@@ -0,0 +1,13 @@
+discard """
+  file: "tissue5821.nim"
+  output: ''''''
+"""
+proc main(): void =
+  let a: float32 = 47.11'f32
+  doAssert a == 47.11'f32
+
+  let b: float64 = 10.234402823e+38'f64
+  doAssert b != 10.123402823e+38'f64
+  doAssert b == 10.234402823e+38'f64
+
+main()
\ No newline at end of file