math.functions: make float sqrt a little faster.

db4
John Benediktsson 2013-11-25 11:14:51 -08:00
parent 8aac272c58
commit fafeecb5fb
1 changed files with 4 additions and 3 deletions

View File

@ -16,9 +16,10 @@ M: ratio >fraction [ numerator ] [ denominator ] bi ; inline
GENERIC: sqrt ( x -- y ) foldable
M: real sqrt
>float dup 0.0 <
[ neg fsqrt [ 0.0 ] dip rect> ] [ fsqrt ] if ; inline
M: real sqrt >float sqrt ; inline
M: float sqrt
dup 0.0 < [ neg fsqrt [ 0.0 ] dip rect> ] [ fsqrt ] if ; inline
: factor-2s ( n -- r s )
#! factor an integer into 2^r * s