Radix or precision arguments of Number-related functions should not exceed the limit

  • NUMBER_ARG_OUT_OF_RANGE
  • Error
  • High
  • No tags

This rule applies when radix or precision arguments of Number-related functions, e.g. toString(), are not in the permitted range.

It can be applied to the following functions:

  1. Number.prototype.toString(): 2~36
  2. Number.prototype.toFixed(): 0~20
  3. Number.prototype.toExponential(): 0~20
  4. Number.prototype.toPrecision(): 1~21

Noncompliant Code Example

View with compliant examples side by side
var x = 42;
var s_radix_64 = x.toString(64); // NUMBER_ARG_OUT_OF_RANGE alarm

Compliant Code Example

View with noncompliant examples side by side
var x = 42;
var s_radix_16 = x.toString(16);

Version

This rule was introduced in DeepScan 1.0.0-alpha.

See