+ 1

What do we mean by the expression that JavaScript numbers are always stored as double precision floating point?

9th Aug 2020, 10:04 PM
Chukwuemeka Onyenze
Chukwuemeka Onyenze - avatar
10 Antworten
+ 2
It’s in the lesson Ipang. In languages like Java, C, C++ etc., there are three main types of numbers: ints, floats, and doubles. A double is more precise than a float, meaning it can store more decimal points. So, JS numbers are doubles.
9th Aug 2020, 10:27 PM
Rowsej
Rowsej - avatar
+ 2
Because computers only understand binary, numbers are stored in base 2 (binary), which is made up of 0’s and 1’s. An integer (int) is a whole number, and in most programming languages, if you try to put a decimal place in an int, it will raise an error. A float is a floating-point number, which means that it can have decimal places. A double (double-precision number) has more bits, so it can store more precise numbers - e.g. more than 10 decimal places. In JavaScript, numbers are doubles by default
9th Aug 2020, 11:18 PM
Rowsej
Rowsej - avatar
+ 2
That's gr8! Thanks so much 4 being there.
9th Aug 2020, 11:21 PM
Chukwuemeka Onyenze
Chukwuemeka Onyenze - avatar
+ 2
Nice of you, Ipang. True, like minds work alike.
10th Aug 2020, 12:02 AM
Chukwuemeka Onyenze
Chukwuemeka Onyenze - avatar
+ 2
++b will increase b by 1 then return the value. Example: var b = 5; var x = ++b; // b: 6 // x: 6 However, b++ will return the value THEN increase b by 1. Example: var b = 5; var x = b++; // b: 6 // x: 5
10th Aug 2020, 5:53 AM
Rowsej
Rowsej - avatar
+ 1
In the lesson of course. Thanks
9th Aug 2020, 10:27 PM
Chukwuemeka Onyenze
Chukwuemeka Onyenze - avatar
+ 1
Can someone clarify further on the 'increment operator': if placed after an operand, returns the original value and then increments the operand. For clarity: var x = 0, b= 10, var x = ++b. // increment operator before. document.write(b); // outputs ? again var x = b++ // increment operator after. (document.write (b); // outputs ? Please bear with me, I am a beginer in JavaScript.
10th Aug 2020, 5:08 AM
Chukwuemeka Onyenze
Chukwuemeka Onyenze - avatar
0
Where did you read this can you tell? is it in the lesson or somewhere else?
9th Aug 2020, 10:26 PM
Ipang
0
Dear, give illustration please.
9th Aug 2020, 10:29 PM
Chukwuemeka Onyenze
Chukwuemeka Onyenze - avatar