Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
bioDan56298y@DivByZerocouldnt I can't get it around my head in the philosophical level from:
Infinity << 1 == 0
..
down to the end.
Why feeding Infity 1 or true equals 0 or false? -
@bioDan That no feeding, its the logical shift command. All bits of a number a shifted left or right by that command.
Example 1 << 3 returns 8 because
1 == 0000 0001 (== 1 Dezimal)
1<<1 == 0000 0010 (== 2 Dezimal)
1<<2 == 0000 0100 (== 4 Dezimal)
1<<3 == 0000 1000 (== 8 Dezimal) -
@olback IEEE 754, it specifies that infinity / infinity, 0 x infinty and infinity - infinity should be NaN.
Most languages either stick to IEEE 754 or just use whatever the CPU is using (which will still be IEEE 754 unless you're running on some old mainframe) -
nocgod17558y@olback any number x dividing it self will give you 1.
However, infinity is not a number it is a concept of infinitesimal calculus -
Why some of you are amazed by this? Who the fuck does this anyway? Every line of that can be easily and in an non confusing matter be explained. There's no spooky action at a distance, nothing. Just that jerks/elitists like to pick on javascript just because they have the superiority syndrome.
Related Rants
How Javascript handles Infinity:
Infinity * 1 == Infinity
Infinity * 0 == NaN
Infinity / 0 == Infinity
0 / Infinity == 0
Infinity + Infinity == Infinity
Infinity - Infinity == NaN
Infinity / Infinity == NaN
NaN & Infinity == 0
NaN && Infinity == NaN
NaN || Infinity == Infinity
1 % Infinity == 1
Infinity << 1 == 0
Infinity >> 0 == 0
Infinity | 0 == 0
Infinity | Infinity == 0
That's kinda philosophical, isn't it?
undefined
infinity