# rat

Version:

Approximates real or complex numbers using rational fractions.

## Syntax

s = rat(x)
s = rat(x, tol)
[n, d] = rat(x)
[n, d] = rat(x, tol)

## x

Real or complex scalar, vector, or matrix.

## tol

Tolerance of the approximation. tol is a positive real number. If tol is less than or equal to 0, MathScript uses the default value.

Default: 1e-6*max(abs(x))

## s

Approximation result as a string.

## n

Numerators of the approximation. n is a scalar, vector, or matrix whose length is the same as that of x.

## d

Denominators of the approximation. d is a scalar, vector, or matrix whose length is the same as that of x.

[N, D] = rat(pi, 1e-8)

Where This Node Can Run:

Desktop OS: Windows

FPGA: This product does not support FPGA devices