_CP_precision

_CP_precision is equivalent to the precision number BASIC statement.

Syntax

void _CP_precision(int number)

Description

This function affects the precision of the _CP_rs_ and the _CP_sr_ functions.

Example(s)

This example displays "1.12" since the conversion is truncated to the precision of 2.

CPSTR * s = _CP_mkstr("1.12345");

double r;

_CP_precision(2);

r = _CP_sr_(s);

_CP_unix_env();

printf("%g\n", r);

_CP_str_free(s);

See Also

C Functions Overview, _CP_rs_, _CP_sr_