menu
suboptimal-float-operation
Prefer faster floating-point operations when their precision is sufficient
General floating-point formulas can require extra instructions or rounding steps when a dedicated operation exists. Instead, you SHOULD call the dedicated floating-point method.
Reported
1function root(value: float64): float64 {2 return value ** 0.5;3}Accepted
1function root(value: float64): float64 {2 return value.sqrt();3}