nth-root ( n x -- y ) (original) (raw)

nth-root ( n x -- y )
Factor handbook » The language » Numbers » Mathematical functions » Powers and logarithms

Prev: sigmoid ( x -- y )
Next: abs ( x -- y )

Vocabulary
math.functions

Inputs

n an integer
x a number

Outputs

y a number

Word description
Calculates the nth root of a number, such that y^n=x.

Definition

USING: kernel math ;

IN: math.functions

: nth-root ( n x -- y ) swap recip ^ ; inline