UNPKG

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.

26 lines 842 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._F32 = void 0; const range2d_js_1 = require("../../array/typed-array/2d/range2d/range2d.js"); /** * @public * Utilities relating to single precision floats. * * @remarks * See {@link _F64}. */ class _F32 { static getPrecision(value) { return value * _F32.mantissaPrecision; } static isEqual(a, b, delta = _F32.mantissaPrecision) { return Math.abs(a - b) < delta; } } exports._F32 = _F32; _F32.MAX_VALUE = (2 - Math.pow(2, -23)) * Math.pow(2, 127); _F32.MIN_POSITIVE_VALUE = Math.pow(2, -126); _F32.bounds = range2d_js_1.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