Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More robust non-integer conversions for %d Printf specifier (#37554)
* More robust non-integer conversions for %d Printf specifier Fixes #37552. As pointed out by Jameson, the non-integer conversion code for the `%d` specifier handling code wasn't super robust; I wasn't sure how robust it really needed to be, since it seems a bit sketchy to me for users to be relying on Printf conversion behavior of non-integers with `%d` anyway; C even throws a really scary warning if you pass non-integer for `%d`. But anyways, this isn't that much more machinery and puts back support for printf formatting of `Rational` with `%d` anyway. But a note to users, I'd strongly suggest doing your own conversion, `trunc`, `round`, whatever yourself to ensure you fully understand what's going on if you really need to use the `%d` with non-integer arguments. As for the issue reported, it's note quite as severe a use-case since they're just trying to represent a _huge_ integer via `Float64`, which seems decently reasonable. * Add test for Rational
- Loading branch information