Handbook Glossary
factorcode.org
sqrt ( x -- y )
Factor handbook » The language » Numbers » Mathematical functions » Powers and logarithms

Prev:sq ( x -- y )
Next:e^ ( x -- e^x )


Vocabulary
math.functions

Inputs
xa number


Outputs
ya number


Word description
Square root function.

Definition
IN: math.functions

GENERIC: sqrt ( x -- y ) foldable flushable


Methods
USING: kernel math math.functions ;

M: complex sqrt >polar [ sqrt ] [ 2.0 / ] bi* polar> ; inline


USING: kernel math math.functions math.libm ;

M: real sqrt
>float dup 0.0 <
[ neg fsqrt [ 0.0 ] dip rect> ] [ fsqrt ] if ; inline