I tried simple arithmetic on the console, where I tried to multiply 0 by -1. Interestingly, I got -0 as the answer, not 0.
Screenshot:
Can anyone explain these results?
Javascript uses IEEE 754 as mentioned above as well
The IEEE 754 standard for floating point arithmetic (most computers and programming languages ββthat support floating point numbers are currently used) requires both +0 and -0. Real arithmetic with signed zeros can be considered as a variant of the extended line of real numbers, so 1 / -0 = -β and 1 / + 0 = + β; division is only undefined for Β± 0 / Β± 0 and Β± β / Β± β.A negatively signed zero echoes the concept of mathematical analysis approaching 0 from the bottom as a one-way limit, which can be denoted by x β 0-, x β 0- or x β β 0. The notation β-0β can be used informally to denote a small negative number, rounded to zero. The concept of negative zero also has some theoretical applications in statistical mechanics and other disciplines.It is argued that the inclusion of signed zero in IEEE 754 makes it much easier to achieve numerical accuracy in some critical problems ( http://people.freebsd.org/~das/kahan86branch.pdf ), in particular when calculating with complex elementary functions.
The IEEE 754 standard for floating point arithmetic (most computers and programming languages ββthat support floating point numbers are currently used) requires both +0 and -0. Real arithmetic with signed zeros can be considered as a variant of the extended line of real numbers, so 1 / -0 = -β and 1 / + 0 = + β; division is only undefined for Β± 0 / Β± 0 and Β± β / Β± β.
A negatively signed zero echoes the concept of mathematical analysis approaching 0 from the bottom as a one-way limit, which can be denoted by x β 0-, x β 0- or x β β 0. The notation β-0β can be used informally to denote a small negative number, rounded to zero. The concept of negative zero also has some theoretical applications in statistical mechanics and other disciplines.
It is argued that the inclusion of signed zero in IEEE 754 makes it much easier to achieve numerical accuracy in some critical problems ( http://people.freebsd.org/~das/kahan86branch.pdf ), in particular when calculating with complex elementary functions.
http://www.johndcook.com/blog/2010/06/15/why-computers-have-signed-zero/
In accordance with the IEEE standard .
The signed zero is zero with a sign. In ordinary arithmetic, -0 = +0 = 0. However, when calculating, some representations of numbers allow two zeros to exist, often denoted by -0 (negative zero) and +0 (positive zero). This happens in some signed representation number for integers, and in most floating point numbers, representations. The number 0 is usually encoded as +0, but can be represented by either +0 or -0.
JavaScript uses IEEE-754, which has both positive and negative zeros.
JavaScript uses the standard IEEE 754 floating point system. This system has positive and negative zeros , although they are equal in comparison. It also has positive and negative infinity and meanings of "not numbers."
Source: https://habr.com/ru/post/1243024/More articles:EventBus 3.0 registerSticky deprecated - androidgreenrobot EventBus event in Android - androidConcatenation of 2-dimensional arrays along the 2nd axis - arraysThe width of the vertical strip of the width of the sub-cursor is constantly displayed in the Safari / textarea tab - htmlFirefox getBoundingClientRect () ignores conversions - htmlReact router, transfer details using Link - javascriptWhy isn't the large image path set in this? - javascriptChanges in the structure of the object - c #how to read json file using accessible - ansibleAngular 2 promises / observable chain of two events? - angularAll Articles