Skip to content

NaN FloatDomainError after upgrading to 0.14.0 #563

Closed

Description

@stevehanson

After upgrading to 0.14.0, I receive the following error after my tests run, presumably while the SimpleCov report is being generated:

vendor/bundle/gems/simplecov-0.14.0/lib/simplecov/source_file.rb:193:in `round': NaN (FloatDomainError)
  from vendor/bundle/gems/simplecov-0.14.0/lib/simplecov/source_file.rb:193:in `round_float'
  from vendor/bundle/gems/simplecov-0.14.0/lib/simplecov/source_file.rb:130:in `covered_strength'
  from vendor/bundle/gems/simplecov-0.14.0/lib/simplecov/file_list.rb:56:in `block in covered_strength'
  from vendor/bundle/gems/simplecov-0.14.0/lib/simplecov/file_list.rb:56:in `map'
  from vendor/bundle/gems/simplecov-0.14.0/lib/simplecov/file_list.rb:56:in `covered_strength'
  from (erb):7:in `formatted_file_list'
  from ~/.rbenv/versions/2.3.0/lib/ruby/2.3.0/erb.rb:864:in `eval'
  from ~/.rbenv/versions/2.3.0/lib/ruby/2.3.0/erb.rb:864:in `result'
  from vendor/bundle/gems/simplecov-html-0.10.0/lib/simplecov-html.rb:66:in `formatted_file_list'
  from (erb):21:in `block in format'

Downgrading to 0.13.0 resolved the issue for me. I'm on Ruby 2.3.0, Rails 4.2.5.

Activity

  1. PragTob commented on Mar 17, 2017

    @PragTob
    Collaborator

    Argh jeez, I knew this was gonna happen some day! Thanks for the report ❤️

    So this error happens here - if you could give me the values of float and places in that part (by inserting a puts on your end there) that'd be amazing and helpful in tracking down the error source.

    If you had something that reproduces, even better but that'll help get me started :)

    I won't get to it today (am at work and have evening plans) but will try to make and publish a fix over the weekend.

    Sorry for the inconvenience!

  2. chief commented on Mar 17, 2017

    @chief

    Same here (got Infinity error)

    ruby-2.4.0/gems/simplecov-0.14.0/lib/simplecov/source_file.rb:193:in `round': Infinity (FloatDomainError)
    
  3. stevehanson commented on Mar 17, 2017

    @stevehanson
    Author

    @PragTob No worries! It took me all of a couple minutes to downgrade the gem and move on, so no big deal.

    Here is the puts output for float, places when I run a test. Let me know if I can do anything else to help, but no urgency on my end.

    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    0.0, 1
    NaN, 1
    
  4. PragTob commented on Mar 17, 2017

    @PragTob
    Collaborator

    @stevehanson I'm on fixing this right now. No idea how NaN gets there... I identified the commit that is likely responsible (b35f569) and am cooking up a fix right now. It catches the 0.0 case, not the NaN one but I'll see... opening a PR soon

  5. stevehanson commented on Mar 17, 2017

    @stevehanson
    Author

    @PragTob cool. Feel free to ping me when you get the PR up, and I can test it out if you'd like.

  6. PragTob commented on Mar 17, 2017

    @PragTob
    Collaborator

    @stevehanson that's the idea, hope and intention. Thanks :)

  7. added a commit that references this issue on Mar 17, 2017
    fe29f29
  8. PragTob commented on Mar 18, 2017

    @PragTob
    Collaborator

    Fixed in 0.14.1 - thanks everyone

  9. added a commit that references this issue on Mar 20, 2017
  10. added theissue type on May 6, 2026
  11. added a commit that references this issue on May 11, 2026
  12. added a commit that references this issue on May 14, 2026
  13. added a commit that references this issue on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions