Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

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

#1241

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'.

Reported by Brennan Dunn · October 20th, 2008 @ 09:44 PM

State: wontfix
Milestone: 2.x
Assigned to: Pratik Pratik
Importance: none

Activity

  1. Pratik
    Pratik
    • 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.

    January 19th, 2009 @ 08:07 PM