-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This repository is part of a larger project!
One interesting feature in JavaScript is that it has no several types of numeric data. It has only one and that is "number". This can be viewed with operator typeof.
All numbers are doubles and with them integers can be represented perfectly with up to 53 bits of precision.
Even though most arithmetic operations work with integers, real numbers, or a combination of the two, it is to say that the bitwise arithmetic operators work differently.
If there is a bitwise operator e.g. between two numbers than the system changes the numbers to 32-bit integers(two´s complement, big endian) by itself.
Floating-point numbers lack accuracy to an extend, because of a performance trade-off.
Starting "index.html" in a web browser should show a content as seen below.
The first half of the picture above gives the options to calculate user defined integer into bits and vice versa.
The second half calculates some examples regarding the lack of accuracy of Floating-point number.
The results could be displayed as shown in the picture below.
The colored areas are just for a better readability in the wiki and are not part of the content.
To use the project just download the files and execute "index.html". Note that all files should be placed in the same folder so that the functionality of the code is guaranteed.
This knowledge was gained:
Effective JavaScript "68 Specific Ways to Harness the Power of JavaScript" by David Herman