News for hackers. Stuff that matters.
Re:Edsger Dijkstra's note on starting array indices at 0 (pd... by chalst on Wednesday June 22, 2011 @02:55AM (#2682057)
Right.

A convenient property to have that is held by the Python version is (for nonzero n)

        x==n*floor(x/n)+x%n
This property isn't held by the Javascript variant, where there is a somewhat more complex property

        x==n*sign(x/n)*floor(abs(x/n))+x%n
Re:Edsger Dijkstra's note on starting array indices at 0 (pd... by jacobolus on Wednesday June 22, 2011 @03:12AM (#2682098)
In python, math.floor(x / n) can be written x // n, so:

  x == n * (x // n) + x % n
Re:Edsger Dijkstra's note on starting array indices at 0 (pd... by dagw on Wednesday June 22, 2011 @04:22AM (#2682249)
math.floor(x / n) can be written x // n

It's worth noting that x//n returns an int and math.floor returns a float, so the statements aren't equivalent.

Re:Edsger Dijkstra's note on starting array indices at 0 (pd... by jacobolus on Wednesday June 22, 2011 @12:49PM (#2683939)
If you pass a float in as x or n, x // n will be a float.