about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--408print-float.mu12
1 files changed, 5 insertions, 7 deletions
diff --git a/408print-float.mu b/408print-float.mu
index d98880ac..e1c916f6 100644
--- a/408print-float.mu
+++ b/408print-float.mu
@@ -90,32 +90,31 @@ fn test-print-float-not-a-number {
 }
 
 fn print-float screen: (addr screen), n: float {
-$print-float:body: {
   # - special names
   var bits/eax: int <- reinterpret n
   compare bits, 0
   {
     break-if-!=
     print-string screen, "0"
-    break $print-float:body
+    return
   }
   compare bits, 0x80000000
   {
     break-if-!=
     print-string screen, "-0"
-    break $print-float:body
+    return
   }
   compare bits, 0x7f800000
   {
     break-if-!=
     print-string screen, "Inf"
-    break $print-float:body
+    return
   }
   compare bits, 0xff800000
   {
     break-if-!=
     print-string screen, "-Inf"
-    break $print-float:body
+    return
   }
   var exponent/ecx: int <- copy bits
   exponent <- shift-right 0x17  # 23 bits of mantissa
@@ -124,7 +123,7 @@ $print-float:body: {
   {
     break-if-!=
     print-string screen, "Nan"
-    break $print-float:body
+    return
   }
   # - regular numbers
   var sign/edx: int <- copy bits
@@ -160,7 +159,6 @@ $print-float:body: {
   var exp-magnitude/eax: int <- abs exponent
   print-int32-hex-bits screen, exp-magnitude, 8
 }
-}
 
 #? fn main -> _/ebx: int {
 #?   run-tests
pol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# imported by other modules, unlike helpers.nim which is included

template formatErrorIndexBound*[T](i, a, b: T): string =
  when defined(standalone):
    "indexOutOfBounds"
  else:
    if b < a: "index out of bounds, the container is empty"
    else: "index " & $i & " not in " & $a & " .. " & $b

template formatErrorIndexBound*[T](i, n: T): string =
  formatErrorIndexBound(i, 0, n)