lang-javascript

JavaScript: Number.EPSILON and Number.MAX_SAFE_INTEGER

EPSILON The Number.EPSILON property represents the difference between 1 and the smallest floating point number greater than 1 > Number.EPSILON == Math.pow(2, -52) true Use Number.EPSILON to test floating point number equality. x = 0.2; y = 0.3; z = 0.1; equal = (Math.abs(x – y + z) < Number.EPSILON); https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON MAX_SAFE_INTEGER & MIN_SAFE_INTEGER The MAX_SAFE_INTEGER constant has a …

JavaScript: Number.EPSILON and Number.MAX_SAFE_INTEGER Read More »

JavaScript: ArrayBuffer and TypedArray

JavaScript typed arrays split the implementation into buffers and views. A buffer (implemented by the ArrayBuffer object) is an object representing a chunk of data; it has no format to speak of and offers no mechanism for accessing its contents. In order to access the memory contained in a buffer, you need to use a view. A view provides a …

JavaScript: ArrayBuffer and TypedArray Read More »