>when it gets too big to store, throw an error.
Holy shit, I knew math fags were terrible at programming but not THAT terrible
3 weeks ago
Anonymous
[...]
>durr id rather have silent errors (overflow) and vulnerabilities resulting from that
Lisp solved this in the 60s with fixnums and bignums.
3 weeks ago
Anonymous
lisp also has even more dogshit performance than jabbascript
3 weeks ago
Anonymous
javascript is reasonably fast if you are careful to avoid calling functions and avoid allocating memory
but at that point it's easier to use C and C is still several times faster plus you can use SIMD intrinsics in C
3 weeks ago
Anonymous
SBCL is actually very fast, despite not having JS's insane funding.
Both fast-enough and fucking-garbage code can be written in any language, maybe if you stopped arguing about pointless shit online and did some actual work you could get a job and see this for yourself.
yep i just figured it out on the console. the number becomes infinity literally if you change the last 1 to 2
2**1023*1.99999999999999988897769753748434595763683319091 and infinity isn't greater than infinity. still thanks for the answer.
It makes sense because that's how you implement min/max without an extra flag or condition check.
Eg:
float min = +Infinity;
for(el in arr) if(el < min) min = el;
the honest answer is because javascript was designed in 7 days and they thought handling everything like shell scripting would be good enough
the practical answer is because when obtaining values from HTML DOM elements they are most often strings, which means that you can often times just use them as regular numbers and it will "just work" (except when it doesn't). x == null/undefined also carries the exact same semantics as ?? and ?.
brendan eich wrote a twitter post about it, that the users, like the project managers or some shit asked him to implement it that way. later someone else added ===. language design is a tough task, if you don't make it right on the first try you will have those flaws forever in your language. in your own software you can always fix the shit later.
>The web should have been built on Java instead
Imagine the smell
At least the OG jeetware was strongly typed
what went wrong here? did it cast both of them to pointers?
No instead of overflowing, floating points clamp at infinity. Infinity is not greater than Infinity. So it's correct.
>if something gets bigger and bigger it will eventually become infinity when we can't store the value anymore
what absolute mathlet designed this?
well then smartass, how would a genius like you represent the entire number line in a finite number of bits?
when it gets too big to store, throw an error. Making it equal to infinity is just wrong and doesn't, solve any problem. It just creates more.
>when it gets too big to store, throw an error.
Holy shit, I knew math fags were terrible at programming but not THAT terrible
>durr id rather have silent errors (overflow) and vulnerabilities resulting from that
Lisp solved this in the 60s with fixnums and bignums.
lisp also has even more dogshit performance than jabbascript
javascript is reasonably fast if you are careful to avoid calling functions and avoid allocating memory
but at that point it's easier to use C and C is still several times faster plus you can use SIMD intrinsics in C
SBCL is actually very fast, despite not having JS's insane funding.
>number becomes too big
>throw exception
simple as that
>what is ieee754
They really should have gone with the original LISP idea, so that they could take advantage of the arbitrary size ints
Both fast-enough and fucking-garbage code can be written in any language, maybe if you stopped arguing about pointless shit online and did some actual work you could get a job and see this for yourself.
Why is it that 90% of criticisms of js are just criticism of ieee fp, which is shared by every major programming language?
Because hating on js is a meme at this point.
I always assumed the math.min business made sense, like taking the infimum of an empty set in math.
yep i just figured it out on the console. the number becomes infinity literally if you change the last 1 to 2
2**1023*1.99999999999999988897769753748434595763683319091 and infinity isn't greater than infinity. still thanks for the answer.
It makes sense because that's how you implement min/max without an extra flag or condition check.
Eg:
float min = +Infinity;
for(el in arr) if(el < min) min = el;
>always use '==='
Then why even have '=='?
So you can tell the retards from the real ones
it's actually very useful, say something sends back "true" or 1, and you have var == true, it will still work.
Abusing JavaScripts dynamic typing is it's strength.
my bad, it only works for 1, still useful for bools though.
>my bad, it only works for 1
it works for all non-empty strings and all non-zero numbers
the honest answer is because javascript was designed in 7 days and they thought handling everything like shell scripting would be good enough
the practical answer is because when obtaining values from HTML DOM elements they are most often strings, which means that you can often times just use them as regular numbers and it will "just work" (except when it doesn't). x == null/undefined also carries the exact same semantics as ?? and ?.
brendan eich wrote a twitter post about it, that the users, like the project managers or some shit asked him to implement it that way. later someone else added ===. language design is a tough task, if you don't make it right on the first try you will have those flaws forever in your language. in your own software you can always fix the shit later.
I swear 90% of LULZ does not even have basic knowledge of how computers work.
if we genocided all so called programmers who don't understand IEEE 754 floats the world would be an objectively better place
>nocoder discovers IEEE-754
gm sers!
The web should have stayed as static html pages. Web apps are the greatest cancer ever unleashed on society.
>The web should have been built on Java instead
seriously jump off the highest roof anon
> Writes retarded code
> Gets retarded result
wow!