rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
22 lines • 709 B
JavaScript
import { Range2d } from "../../array/typed-array/2d/range2d/range2d.js";
/**
* @public
* Utilities relating to single precision floats.
*
* @remarks
* See {@link _F64}.
*/
export class _F32 {
static getPrecision(value) {
return value * _F32.mantissaPrecision;
}
static isEqual(a, b, delta = _F32.mantissaPrecision) {
return Math.abs(a - b) < delta;
}
}
_F32.MAX_VALUE = (2 - Math.pow(2, -23)) * Math.pow(2, 127);
_F32.MIN_POSITIVE_VALUE = Math.pow(2, -126);
_F32.bounds = Range2d.f32.factory.createOne(-_F32.MAX_VALUE, -_F32.MAX_VALUE, _F32.MAX_VALUE, _F32.MAX_VALUE);
_F32.mantissaBits = 23;
_F32.mantissaPrecision = 1 / Math.pow(2, 23);
//# sourceMappingURL=_f32.js.map