These docs are for v2.0. Click to read the latest docs for v3.0.

Compute the nth root of an XFL

Concepts

Behaviour

  • Compute a the nth root of an XFL number
  • Return the new XFL

❗️

Warning

Due to speed constraints,float_root converts the argument to an IEEE base-2 double precision floating point before applying n-th root. Therefore the returned result will often contain less precision than expected. If you need better precision you should consider dividing your XFL into a high and a low product then individually take the square roots of those products and multiply the results together.

Definition

int64_t float_root (
    int64_t float1,
    uint32_t n
);

Example

int64_t three =
    float_root(nine, 2);

🚧

Warning

If a negative number is passed the function will return COMPLEX_NOT_SUPPORTED if the root is an even root.

Parameters

NameTypeDescription
float1int64_tAn XFL floating point enclosing number representing the floating point number to take the square root of
nuint32_tThe root to compute, for example 2 is a square root.

Return Code

TypeDescription
int64_tThe computed nth root

If negative, an error:
INVALID_FLOAT
- the supplied parameter was not a valid XFL enclosing number

COMPLEX_NOT_SUPPORTED
- the supplied parameter was a negative number which would result in a complex root.