# Class: ExtendedMath

## coreutils. ExtendedMath

#### new ExtendedMath()

  Static helper class with math operations

### Methods

#### <static> abs(value)

  Convert number to absolute value

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | number |

  ##### Returns:

  Type
    number

#### <static> clamp(value, min, max)

  Clamp number between max and min value

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | number | current value
  `min` | number | minimal value
  `max` | number | maximal value

  ##### Returns:

  clamped value
  Type
    number

#### <static> formatNumber(number, precision, separator)

  Format number

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `number` | number | value
  `precision` | number | precision
  `separator` | string | separator

  ##### Returns:

  formated number
  Type
    string

#### <static> getPercent(value, total)

  Calculate percent 0-100

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | number | current value
  `total` | number | total value

  ##### Returns:

  percent
  Type
    number

  ##### Example

      10,20 = 50%

#### <static> getSign(value)

  Get sign of number. Returns 1,-1,0

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | number |

  ##### Returns:

  sign
  Type
    number

#### <static> isInOffsetRange(startValue, currentValue, offset)

  Check if current value is in max aloved offset from start value

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `startValue` | number | start value
  `currentValue` | number | current value
  `offset` | number | offset

  ##### Returns:

  is / is not
  Type
    boolean

#### <static> isInRange(startValue, currentValue, endValue)

  Check if value is between max, min value, including max, min

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `startValue` | number | minimal value
  `currentValue` | number | current value
  `endValue` | number | maximal value

  ##### Returns:

  is / is not
  Type
    boolean

#### <static> isNumber(n)

  Check if object is number

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `n` | object | object to check

  ##### Returns:

  is / is not
  Type
    boolean

#### <static> numberOfDecimals(n)

  Get number of decimals

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `n` | number | value

  ##### Returns:

  count
  Type
    number

#### <static> parseToFloat(value, defaultValue)

  Convert value to float. If value can't be converted to number, than default value will be used

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | * |
  `defaultValue` | number |

  ##### Returns:

  Type
    number

#### <static> parseToInt(value, defaultValue)

  Convert value to int. If value can't be converted to number, than default value will be used

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | * |
  `defaultValue` | number |

  ##### Returns:

  Type
    number

#### <static> random(min, max)

  Generate random number between min and max. Max is not included

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `min` | number | minimal value
  `max` | number | maximal value

  ##### Returns:

  generated number
  Type
    number

#### <static> round(value, precision)

  Round number with precision

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | number |
  `precision` | number | undefined |

  ##### Returns:

  rounded number
  Type
    number

#### Search results