DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

Punya Purba Pattnaik
Punya Purba Pattnaik

Posted on

-1 * 0 = -0

Yes you heard it right. It seems javascript evaluates -1 * 0 equals to -0. You can see the below screenshot:
Image description

Top comments (1)

Collapse
 
lukeshiru profile image
Luke Shiru • Edited on

JavaScript uses the IEEE Standard for Floating-Point Arithmetic (IEEE 754), which has signed zeroes. FYI:

0 === -0; // true
Object.is(0, -0); // false ๐ŸŽ‰
Enter fullscreen mode Exit fullscreen mode

Cheers!

PS: Please, remove the react tag of your post, this doesn't have to do with react. Thanks!

Take Your Github Repository To The Next Level

Take Your Github Repository To The Next Level ๐Ÿš€๏ธ: A step-by-step guide on creating the perfect Github repository.