Hacker News new | ask | show | jobs
by proyb2 3624 days ago
This code doesn't make sense.

    123.digits                  # => [3, 2, 1]
2 comments

Usually when I've seen digits indexed in a number it occurs from right to left (certainly in binary contexts--bit 0 is the least significant bit and bit 31 is the the most significant bit in a 32 bit integer). So, 123.digits[0] means the least significant digit, 3, whereas 123.digits[2] would give you 1, the most significant digit.
The importance of the parts of a number matter in order of https://en.wikipedia.org/wiki/Significant_figures

So this ordering is least to most significant.