News for hackers. Stuff that matters.
Re:Russhian Roulette: 1/6 chance of posting your SSH private... by ordu on Saturday January 28, 2023 @08:37AM (#34557461)
I'm not a javascript guru, but I see two ways how it may work.

1. The right part of equation converted into integer because the left part is integer. Conversion is done by rounding to nearest integer, and it will work this way.

2. The other way it may work is to convert 0 into floating point. Math.floor would make some canonical floating point representation of 0 from numbers in a range [0..1), and so do conversion of (int)0 into float.

One needs to really know his language of choice to master such subtleties.

Re:Russhian Roulette: 1/6 chance of posting your SSH private... by wincy on Saturday January 28, 2023 @08:40AM (#34557482)
There are no integers in JavaScript, only double precision floating point numbers.
Re:Russhian Roulette: 1/6 chance of posting your SSH private... by ordu on Saturday January 28, 2023 @10:15AM (#34558191)
So the second scenario is at play. 0 is converted into floating point.