So, that might explain why division of an extremely large number may follow a bit shift.
Still, we are stuck with just 32bits in Javascript.
From #1 'the max safe integer is 231-1, or 2147483647'
Still stuck. This solution needs a workaround for nineteen left shifts. Original value is one third of max safe integer for bit manipulation.
2147483647
911000000
Shifting left will force MSB bits to drop off, as we have way larger than 32 bits. There would be 52 after the shift. See #1 hilight in red bit pattern.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Fri 2019.07.26
While I am unable to verify if the methods are acceptable, these authors have solutions:
It appears (x).toString(2); may be acceptable
https://codeburst.io/using-javascript-bitwise-operators-in-real-life-f551a731ff5
as is parseInt('100001', 2);
Getting/Setting bits using arrow functions
https://lucasfcosta.com/2018/12/25/bitwise-operations.html
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
ES6 spec
http://www.ecma-international.org/ecma-262/6.0/#sec-literals-numeric-literals
Good beginner article
https://medium.com/techtrument/a-comprehensive-primer-on-binary-computation-and-bitwise-operators-in-javascript-81acf8341f04
Division of a 2's complement value appears to be iterative and not a conversion to floating point.
https://www.electrical4u.com/2s-complement-arithmetic/
Nicely done visual on 2's complement division
http://www.weigu.lu/tutorials/microcontroller/01_numbers_codes/index.html
So, that might explain why division of an extremely large number may follow a bit shift.
Still, we are stuck with just 32bits in Javascript.
Still stuck. This solution needs a workaround for nineteen left shifts. Original value is one third of max safe integer for bit manipulation.
2147483647
911000000
Shifting left will force MSB bits to drop off, as we have way larger than 32 bits. There would be 52 after the shift. See #1 hilight in red bit pattern.