extra-integer
Version:
A [32-bit integer] can store values from `-2^31` to `2^31 - 1`.<br>
54 lines (53 loc) • 1.61 kB
TypeScript
/** Minimum int32 value. */ export declare const MIN_VALUE: number;
/** Maximum int32 value. */ export declare const MAX_VALUE: number;
/**
* Check if value is int32.
* @param v a value
* @returns is int32?
*/ export declare function is(v: any): boolean;
/**
* Get the absolute of an int32.
* @param x an int32
* @returns +ve value
*/ export declare function abs(x: number): number;
/**
* Check if two int32s have equal sign.
* @param x an int32
* @param y another int32
* @returns are signs equal?
*/ export declare function signEqual(x: number, y: number): boolean;
/**
* Check if int32 is a power-of-2.
* @param x an int32
* @returns is power-of-2?
*/ export declare function isPow2(x: number): boolean;
/**
* Find previous power-of-2 of an int32.
* @param x an int32
* @returns 2ᵃ | 2ᵃ < x and 2ᵃ ≥ x/2
*/ export declare function prevPow2(x: number): number;
/**
* Find next power-of-2 of an int32.
* @param x an int32
* @returns 2ᵃ | 2ᵃ > x and 2ᵃ ≤ 2x
*/ export declare function nextPow2(x: number): number;
/**
* Find the power-of-2 of an int32.
* @param x an int32
* @returns 2ˣ
*/ export declare function pow2(x: number): number;
/**
* Find the power-of-10 of an int32.
* @param x an int32
* @returns 10ˣ
*/ export declare function pow10(x: number): number;
/**
* Find the base-2 logarithm of an int32.
* @param x an int32
* @returns log₂(x)
*/ export declare function log2(x: number): number;
/**
* Find the base-10 logarithm of an int32.
* @param x an int32
* @returns log₁₀(x)
*/ export declare function log10(x: number): number;