This project is archived and is in readonly mode.
NaN inputs to ActionView's NumberHelper methods will become 0.0 in order to standardize output
Reported by Brennan Dunn | October 20th, 2008 @ 09:44 PM | in 2.x
When writing some reporting code that ended up dividing 0.0 by
0.0 (while generating a ratio), number helpers weren't performing
as expected as they didn't have any handling in place for
NaN
values.
I'm assuming that anytime a NaN
Float value comes
into a number helper, the expected return should be as if the input
number was 0.0.
For example, number_to_percentage(0.0 / 0.0)
should
result with '0.00%', rather than 'NaN'.
Comments and changes to this ticket
-
Pratik January 19th, 2009 @ 08:07 PM
- State changed from new to wontfix
- Assigned user set to Pratik
I don't think NaN should be normalized as 0 as it could hide real errors/code smells too.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>