git.iko.soy
/
luau
readme
files
commits
refs
on
master
help
sign in
Got hex floats working
3813023
iko
2 years ago
zod/luau/lib/lua.hoon
+50
−1
compare with master
unified
split
@@ -319,7 +319,10 @@
319
;~ pose
319
;~ pose
320
%+ cook
320
%+ cook
321
|= x=@rd [%float x]
321
|= x=@rd [%float x]
322
+
;~ pose
323
+
parse-float
322
−
parse-float
324
+
parse-
hex-
float
325
+
==
323
::
326
::
324
%+ cook
327
%+ cook
325
|= x=@u [%int x]
328
|= x=@u [%int x]
@@ -585,6 +588,52 @@
585
==
588
==
586
==
589
==
587
==
590
==
591
+
++ parse-hex-float
592
+
%+ knee *@rd
593
+
|.
594
+
=<
595
+
%+ sear
596
+
|= [* * int=tape frac=(unit tape) exp=(unit [exp-sign=? exp=@])]
597
+
?: ?=([~ ~] [frac exp]) ~
598
+
%- some
599
+
=/ frac (fall frac "")
600
+
=/ whole=@rd (sun:rd (scan (weld int frac) hex))
601
+
=/ frac-exp=@rd (sun:rd (pow 16 (lent frac)))
602
+
=/ without-exp (div:rd whole frac-exp)
603
+
?~ exp without-exp
604
+
=/ exp-exp (sun:rd (pow 2 exp.u.exp))
605
+
?: exp-sign.u.exp
606
+
(mul:rd without-exp exp-exp)
607
+
(div:rd without-exp exp-exp)
608
+
;~ plug
609
+
(just '0')
610
+
::
611
+
(mask "xX")
612
+
::
613
+
(plus hex-digit)
614
+
::
615
+
%- punt
616
+
;~ pfix
617
+
dot
618
+
(plus hex-digit)
619
+
==
620
+
::
621
+
%- punt
622
+
;~ pfix
623
+
(mask "pP")
624
+
;~(plug ;~(pose (cold | hep) (cold & lus) (easy &)) dim:ag)
625
+
==
626
+
==
627
+
|%
628
+
++ hex-digit
629
+
%+ knee *char
630
+
|.
631
+
;~ pose
632
+
(shim '0' '9')
633
+
(shim 'a' 'f')
634
+
(shim 'A' 'F')
635
+
==
636
+
--
588
++ show-float
637
++ show-float
589
|= x=@rd
638
|= x=@rd
590
^- tape
639
^- tape
zod/luau/tests/foo.lua
+1
−1
@@ -40,5 +40,5 @@ test_cases = {
40
40
41
foo = {
41
foo = {
42
3.0
,
3.1416
,
314.16e-2
,
0.31416E1
,
34e1
,
42
3.0
,
3.1416
,
314.16e-2
,
0.31416E1
,
34e1
,
43
−
0x0.1E
,
0xA23p-4
,
0X1.921FB54442D18P+1
43
+
0x0.1E
,
0xA23p-4
,
0xA23p-4
,
0X1.921FB54442D18P+1
,
0x1.fp10
44
}
44
}
keys
esc to close
j k
move down, up
enter
open
esc
back, or up a level
1 2 3 4
readme, files, commits, refs
/
filter
y
copy the clone command
c
compare the chosen commit with another (or shift-click both)
?
show or hide this list