Make "%u" an alias of "%d" on 1.9 #2265

merged 2 commits into from Apr 10, 2013


None yet

2 participants

Rubinius member

Fix the last remaining failing RubySpec for String#% by turning the %u format into an alias of %d.

In the process of implementing this, I found out that in both 1.8 and 1.9 mode, certain format strings such as %024.30d (zero padding + fixed width + precision) were ignoring the precision specifier, producing strings that had fewer padding zeros than on MRI.

This was because the "fast, common case" branch in IntegerAtom was being executed even when the format string had a precision, even though the special optimised method that was later invoked only took the width into account. This was fixed by making sure the optimised branch isn't executed when a precision is given.

This pull request also contains a commit adding a RubySpec for the aforementioned behaviour of %d (and, consequently, %u under 1.9).

@dbussink dbussink merged commit 3378d5b into rubinius:master Apr 10, 2013

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment