3.5.2.1.56 Prec

Description

The prec(x, p) function returns a value (or a dataset) x with n significant figures.

Syntax

double prec(double x, int n)

Parameter

x

can be any numeric value.

n

is the significant figure you want to get of x.

Return

Returns a value (or a dataset) x with n significant figures.

Examples

Single Number

// This script returns the value 1.23E6 for n.
x = 1234567;
n = prec(x, 3);

Dataset

// In this example, the values in data1_C are assigned 
// to data1_B to 3 significant figures.
Col(B) = prec(Col(C), 3);

See Also

nint, round