# no-approx-constant

Disallow numeric literals that approximate well-known constants

A decimal approximation can contain fewer significant digits than the corresponding standard-library constant.
Instead, you SHOULD use the corresponding `Math` member.

- Category: correctness
- Level: warning
- Fix: suggestion
- Scope: module

## Reported

```ds title="main.ds"
declare const radius: number;
const circumference = 2.0 * 3.14 * radius;
```

## Accepted

```ds title="main.ds"
declare const radius: number;
const circumference = 2.0 * Math.PI * radius;
```

## Prior art

- [Clippy · approx_constant](https://rust-lang.github.io/rust-clippy/master/index.html#approx_constant)

[language/linter/src/rules/correctness/no_approx_constant.rs:52](https://github.com/destack-sh/destack/blob/main/language/linter/src/rules/correctness/no_approx_constant.rs#L52)
