Home Reference Source
import {MathUtil} from 'js-joda/src/MathUtil.js'
public class | source

MathUtil

Math helper with static function for integer operations

Static Method Summary

Static Public Methods
public static

Compares two Numbers.

public static
public static
public static
public static
public static
public static
public static
public static
public static
public static
public static

convert -0 to 0 and int as string to a number ( '1' -> 1 )

public static

verifyInt(value: number)

Static Public Methods

public static compareNumbers(a: number, b: number): number source

Compares two Numbers.

Params:

NameTypeAttributeDescription
a number

the first value

b number

the second value

Return:

number

the result

public static floorDiv(x: number, y: number): number source

Params:

NameTypeAttributeDescription
x number
y number

Return:

number

public static floorMod(x: number, y: number): number source

Params:

NameTypeAttributeDescription
x number
y number

Return:

number

public static intDiv(x: number, y: number): number source

Params:

NameTypeAttributeDescription
x number
y number

Return:

number

public static intMod(x: number, y: number): number source

Params:

NameTypeAttributeDescription
x number
y number

Return:

number

public static parseInt(value: number): number source

Params:

NameTypeAttributeDescription
value number

Return:

number

public static roundDown(r: number): number source

Params:

NameTypeAttributeDescription
r number

Return:

number

public static safeAdd(x: number, y: number): number source

Params:

NameTypeAttributeDescription
x number
y number

Return:

number

public static safeMultiply(x: number, y: number): number source

Params:

NameTypeAttributeDescription
x number
y number

Return:

number

public static safeSubtract(x: number, y: number): number source

Params:

NameTypeAttributeDescription
x number
y number

Return:

number

public static safeToInt(value: number): number source

Params:

NameTypeAttributeDescription
value number

Return:

number

public static safeZero(value: number): number source

convert -0 to 0 and int as string to a number ( '1' -> 1 )

Params:

NameTypeAttributeDescription
value number

Return:

number

public static verifyInt(value: number) source

Params:

NameTypeAttributeDescription
value number