News for hackers. Stuff that matters.
Re:SetBigTimeout by blixt on Friday October 18, 2024 @01:38PM (#41881685)
JS numbers technically have 53 bits for integers (mantissa) but all binary operators turns it into a 32-bit signed integer. Maybe this is related somehow to the setTimeout limitation. JavaScript also has the >>> unsigned bit shift operator so you can squeeze that last bit out of it if you only care about positive values: ((2*32-1)>>>0).toString(2).length === 32
Re:SetBigTimeout by tubs on Friday October 18, 2024 @02:42PM (#41882267)
I assume by binary you mean logical? A + b certainly does not treat either side as 32bit.
Re:SetBigTimeout by blixt on Friday October 18, 2024 @03:41PM (#41882779)
Sorry, I meant bitwise operators, such as: ~ >> << >>> | &