extra-integer.web
Version:
A 32-bit integer can store values from -2^31 to 2^31 - 1 {web}.
84 lines (82 loc) โข 2.38 kB
TypeScript
/**
* Minimum int32 value.
* [๐](https://github.com/nodef/extra-integer/wiki/MIN_VALUE)
*/
declare const MIN_VALUE: number;
/**
* Maximum int32 value.
* [๐](https://github.com/nodef/extra-integer/wiki/MAX_VALUE)
*/
declare const MAX_VALUE: number;
/**
* Check if value is int32.
* [๐](https://github.com/nodef/extra-integer/wiki/is)
* @param v a value
* @returns is int32?
*/
declare function is(v: any): boolean;
/**
* Get the absolute of an int32.
* [๐](https://github.com/nodef/extra-integer/wiki/abs)
* @param x an int32
* @returns +ve value
*/
declare function abs(x: number): number;
/**
* Check if two int32s have equal sign.
* [๐](https://github.com/nodef/extra-integer/wiki/signEqual)
* @param x an int32
* @param y another int32
* @returns are signs equal?
*/
declare function signEqual(x: number, y: number): boolean;
/**
* Check if int32 is a power-of-2.
* [๐](https://github.com/nodef/extra-integer/wiki/isPow2)
* @param x an int32
* @returns is power-of-2?
*/
declare function isPow2(x: number): boolean;
/**
* Find previous power-of-2 of an int32.
* [๐](https://github.com/nodef/extra-integer/wiki/prevPow2)
* @param x an int32
* @returns 2แต | 2แต < x and 2แต โฅ x/2
*/
declare function prevPow2(x: number): number;
/**
* Find next power-of-2 of an int32.
* [๐](https://github.com/nodef/extra-integer/wiki/nextPow2)
* @param x an int32
* @returns 2แต | 2แต > x and 2แต โค 2x
*/
declare function nextPow2(x: number): number;
/**
* Find the power-of-2 of an int32.
* [๐](https://github.com/nodef/extra-integer/wiki/pow2)
* @param x an int32
* @returns 2หฃ
*/
declare function pow2(x: number): number;
/**
* Find the power-of-10 of an int32.
* [๐](https://github.com/nodef/extra-integer/wiki/pow10)
* @param x an int32
* @returns 10หฃ
*/
declare function pow10(x: number): number;
/**
* Find the base-2 logarithm of an int32.
* [๐](https://github.com/nodef/extra-integer/wiki/log2)
* @param x an int32
* @returns logโ(x)
*/
declare function log2(x: number): number;
/**
* Find the base-10 logarithm of an int32.
* [๐](https://github.com/nodef/extra-integer/wiki/log10)
* @param x an int32
* @returns logโโ(x)
*/
declare function log10(x: number): number;
export { MAX_VALUE, MIN_VALUE, abs, is, isPow2, log10, log2, nextPow2, pow10, pow2, prevPow2, signEqual };