menu

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.

Reported

1declare const radius: number;2const circumference = 2.0 * 3.14 * radius;

Accepted

1declare const radius: number;2const circumference = 2.0 * Math.PI * radius;