mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-03 14:37:05 +03:00
Merge branch 'master' of https://github.com/urbit/urbit
This commit is contained in:
commit
32b98ba0e5
@ -1548,51 +1548,55 @@
|
||||
++ rd :: core for @rd
|
||||
~% %rd + ~
|
||||
|%
|
||||
++ mlen 52 :: mantissa bits
|
||||
++ elen 11 :: exponent bits
|
||||
++ bias 1.023 :: exponent bias
|
||||
++ dlen 14 :: ~=log_10(2^mlen)
|
||||
:: Convert a sign/exp/ari cell into 64 bit atom
|
||||
++ bit |= a=[s=? e=@s a=@u]
|
||||
=+ a2=(lia:fl 52 a.a)
|
||||
=+ a2=(lia:fl mlen a.a)
|
||||
=+ b=(ira:fl a2)
|
||||
::=+ c=(lsh 0 (^sub 52 (met 0 b)) b)
|
||||
%+ can 0
|
||||
[[52 b] [[11 (abs:si (sum:si (sun:si 1.023) e.a))] [[1 `@`s.a] ~]]]
|
||||
[[mlen b] [[elen (abs:si (sum:si (sun:si bias) e.a))] [[1 `@`s.a] ~]]]
|
||||
:: Sign of an @rd
|
||||
++ sig |= [a=@rd] ^- ?
|
||||
=(0 (rsh 0 63 a))
|
||||
=(0 (rsh 0 (^add mlen elen) a))
|
||||
:: Exponent of an @rd
|
||||
++ exp |= [a=@rd] ^- @s
|
||||
(dif:si (sun:si (rsh 0 52 (end 0 63 a))) (sun:si 1.023))
|
||||
(dif:si (sun:si (rsh 0 mlen (end 0 (^add elen mlen) a))) (sun:si bias))
|
||||
:: Fraction of an @rd (binary)
|
||||
++ fac |= [a=@rd] ^- @u
|
||||
(fre:fl 14 (sea a))
|
||||
(fre:fl dlen (sea a))
|
||||
:: Whole
|
||||
++ hol |= [a=@rd] ^- @u
|
||||
(hol:fl 52 (sea a))
|
||||
(hol:fl mlen (sea a))
|
||||
:: Convert to sign/exp/ari form
|
||||
++ sea |= a=@rd ^- [s=? e=@s a=@u]
|
||||
(pro:te:fl 1.023 52 [s=(sig a) e=(exp a) a=(ari:fl 52 (end 0 52 a))])
|
||||
(pro:te:fl bias mlen [s=(sig a) e=(exp a) a=(ari:fl mlen (end 0 mlen a))])
|
||||
++ err |= a=@rd ^- (unit tape)
|
||||
(err:te:fl 1.023 52 (sea a))
|
||||
(err:te:fl bias mlen (sea a))
|
||||
|
||||
::::::::::::
|
||||
++ sun ~/ %sun
|
||||
|= a=@u ^- @rd
|
||||
(bit (cof:fl 52 1.023 %.y a 0 0 ~))
|
||||
(bit (cof:fl mlen bias %.y a 0 0 ~))
|
||||
|
||||
++ add ~/ %add
|
||||
|= [a=@rd b=@rd] ^- @rd
|
||||
(bit (add:fl 1.023 52 (sea a) (sea b)))
|
||||
(bit (add:fl bias mlen (sea a) (sea b)))
|
||||
|
||||
++ sub ~/ %sub
|
||||
|= [a=@rd b=@rd] ^- @rd
|
||||
(bit (sub:fl 1.023 52 (sea a) (sea b)))
|
||||
(bit (sub:fl bias mlen (sea a) (sea b)))
|
||||
|
||||
++ mul ~/ %mul
|
||||
|= [a=@rd b=@rd] ^- @rd
|
||||
(bit (mul:fl 1.023 52 (sea a) (sea b)))
|
||||
(bit (mul:fl bias mlen (sea a) (sea b)))
|
||||
|
||||
++ div ~/ %div
|
||||
|= [a=@rd b=@rd] ^- @rd
|
||||
(bit (div:fl 1.023 52 (sea a) (sea b)))
|
||||
(bit (div:fl bias mlen (sea a) (sea b)))
|
||||
|
||||
++ lte ~/ %lte
|
||||
|= [a=@rd b=@rd] ^- ?
|
||||
@ -1621,7 +1625,7 @@
|
||||
b
|
||||
|
||||
++ bex |= a=@s ^- @rd
|
||||
(bit [s=%.y e=a a=(ari:fl 52 0)])
|
||||
(bit [s=%.y e=a a=(ari:fl mlen 0)])
|
||||
|
||||
++ ipow |= [exp=@s n=@rd]
|
||||
^- @rd
|
||||
|
Loading…
Reference in New Issue
Block a user