# _CP_sr_

_CP_sr_ converts a CPSTR into a double-float
number. The precision of the conversion can be changed with the _CP_precision() function.

## Syntax

```
double _CP_sr_(CPSTR * string)
```

## Example(s)

```
/* 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](https://d3codex.com/cfunctions/c-functions-overview/)
- [_CP_precision](https://d3codex.com/cfunctions/cp-precision/)
- [_CP_rs_](https://d3codex.com/cfunctions/cp-rs/)

---
Source: https://d3codex.com/cfunctions/cp-sr/ - part of the D3Codex reference.
