mirror of
https://github.com/urbit/shrub.git
synced 2024-12-12 10:29:01 +03:00
++toi
This commit is contained in:
parent
032e7d7dcf
commit
f78f794d42
@ -1,4 +1,4 @@
|
|||||||
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
!::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
:::::: :::::: Preface ::::::
|
:::::: :::::: Preface ::::::
|
||||||
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
?> ?=(@ .) :: atom subject
|
?> ?=(@ .) :: atom subject
|
||||||
@ -1523,6 +1523,18 @@
|
|||||||
=. o (^add (^mul o 10) ?:(q +(u) u))
|
=. o (^add (^mul o 10) ?:(q +(u) u))
|
||||||
[k o]
|
[k o]
|
||||||
::
|
::
|
||||||
|
++ toi
|
||||||
|
|= [a=[e=@s a=@u]] ^- fn
|
||||||
|
?. =((cmp:si e.a --0) -1) [%f & a]
|
||||||
|
=+ x=(abs:si e.a)
|
||||||
|
=+ y=(rsh 0 x a.a)
|
||||||
|
?: |(=(r %d) =(r %z)) [%f & --0 y]
|
||||||
|
=+ z=(end 0 x a.a)
|
||||||
|
?: |(=(r %u) =(r %a)) [%f & --0 ?~(z y +(y))]
|
||||||
|
=+ i=(bex (dec x))
|
||||||
|
?: &(=(z i) =((dis y 1) 0)) [%f & --0 y]
|
||||||
|
?: (^lth z i) [%f & --0 y] [%f & --0 +(y)]
|
||||||
|
::
|
||||||
++ ned
|
++ ned
|
||||||
|= [a=fn] ^- [%f s=? e=@s a=@u]
|
|= [a=fn] ^- [%f s=? e=@s a=@u]
|
||||||
?: ?=([%f *] a) a
|
?: ?=([%f *] a) a
|
||||||
@ -1717,6 +1729,13 @@
|
|||||||
?: (syn:si e.a)
|
?: (syn:si e.a)
|
||||||
(mul [%f s.a --0 a.a] [%f & e.a (pow 5 q)])
|
(mul [%f s.a --0 a.a] [%f & e.a (pow 5 q)])
|
||||||
(div [%f s.a --0 a.a] [%f & (sun:si q) (pow 5 q)])
|
(div [%f s.a --0 a.a] [%f & (sun:si q) (pow 5 q)])
|
||||||
|
::
|
||||||
|
++ toi :: round to integer
|
||||||
|
|= [a=fn] ^- fn
|
||||||
|
?. ?=([%f *] a) a
|
||||||
|
?~ a.a [%f s.a zer]
|
||||||
|
?: s.a (^toi +>.a)
|
||||||
|
(fli =.(r swr (^toi +>.a)))
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ ff :: ieee754 format
|
++ ff :: ieee754 format
|
||||||
|
Loading…
Reference in New Issue
Block a user