]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/ryu/ryu.factor
stomp.cli: simplify
[factor.git] / extra / ryu / ryu.factor
index 079d6d8ed1379f4e38be1dee4cd29f2760e4768e..918e74c42a7fdc2373be96d68279101e04d44f8c 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2018 Alexander Ilin.
-! See http://factorcode.org/license.txt for BSD license.
-USING: combinators.smart kernel locals math math.bitwise
+! See https://factorcode.org/license.txt for BSD license.
+USING: combinators.smart kernel math math.bitwise
 math.functions math.order math.parser ryu.data sequences
 sequences.private ;
 
@@ -132,9 +132,9 @@ CONSTANT: offset 1023 ! (1 << (exponentBits - 1)) - 1
 PRIVATE>
 
 :: print-float ( value -- string )
-    value >float unpack-bits [
-        [ 5drop ] dip
-    ] [| e2 m2 acceptBounds ieeeExponent<=1 sign |
+    value >float unpack-bits
+    :> ( e2 m2 acceptBounds ieeeExponent<=1 sign output )
+    output [
         m2 4 * :> mv
         mantissaBits 2^ m2 = not ieeeExponent<=1 or 1 0 ? :> mmShift
         f f 0 0 0 :> ( vmIsTrailingZeros! vrIsTrailingZeros! e10! vr! vm! )
@@ -177,6 +177,6 @@ PRIVATE>
         [ decimal-length e10 + 1 - sign ] keep ! exp sign vp
         acceptBounds vmIsTrailingZeros vrIsTrailingZeros vr vm
         prepare-output produce-output
-    ] if* ;
+    ] unless* ;
 
 ALIAS: d2s print-float