Number overview
A simple extension to the Effect Number module
Table of contents
Constants
EPSILON
Alias to javascript Number.EPSILON
Signature
export declare const EPSILON: number
Constructors
unsafeFromString
Constructs a number from a string. Does not check input format and can return NaN
Signature
export declare const unsafeFromString: (s: string) => number
unsafeIntFromString
Constructs an integer from a string expressed in base radix
. Does not check input format and can return NaN
Signature
export declare const unsafeIntFromString: (radix?: number) => (s: string) => number
Utils
decAndFracParts
Returns the decimal and fractional parts of a number.
Signature
export declare const decAndFracParts: (self: number) => [decPart: number, fracPart: number]
intModulo
Modulo - Use only with integers - Unlike javascript remainder operator (%), this function always returns a positive integer even if self
or divisor
is negative
Signature
export declare const intModulo: (divisor: number) => (self: number) => number
isFinite
Returns true if the provided number is not NaN, Infinity, +Infinity or -Infinity
Signature
export declare const isFinite: (self: number) => boolean
isInt
Returns true if the provided number is an integer
Signature
export declare const isInt: (self: number) => boolean
isNotFinite
Returns true if the provided number is NaN, Infinity, +Infinity or -Infinity
Signature
export declare const isNotFinite: (self: number) => boolean
isNotInt
Returns true if the provided number is not an integer
Signature
export declare const isNotInt: (self: number) => boolean
quotientAndRemainder
Returns the quotient
and remainder
of the division of self
by divisor
. remainder
always has the sign of divisor
.
Signature
export declare const quotientAndRemainder: (divisor: number) => (self: number) => [quotient: number, remainder: number]
shift
Returns self
multiplied by 10^n
Signature
export declare const shift: (n: number) => (self: number) => number