evanphx / benchmark-ips

Provides iteration per second benchmarking for Ruby
MIT License
1.72k stars 97 forks source link

FloatDomainError: NaN #1

Closed tarcieri closed 12 years ago

tarcieri commented 12 years ago

I'm getting this consistently across multiple Ruby implementations benchmarking Celluloid's UUID implementation. I hope that means it's roflscale.

Repro:

clone git://github.com/celluloid/celluloid.git
bundle
ruby benchmarks/uuid.rb

I get:

Calculating -------------------------------------
                uuid     22819 i/100ms
-------------------------------------------------
                uuidI, [2012-03-24T16:45:12.456314 #66670]  INFO -- : Shutdown completed cleanly
/Users/tony/.rvm/gems/ruby-1.9.3-p125/gems/benchmark-ips-1.1.0/lib/benchmark/ips.rb:239:in `round': NaN (FloatDomainError)
    from /Users/tony/.rvm/gems/ruby-1.9.3-p125/gems/benchmark-ips-1.1.0/lib/benchmark/ips.rb:239:in `block in ips'
    from /Users/tony/.rvm/gems/ruby-1.9.3-p125/gems/benchmark-ips-1.1.0/lib/benchmark/ips.rb:201:in `each'
    from /Users/tony/.rvm/gems/ruby-1.9.3-p125/gems/benchmark-ips-1.1.0/lib/benchmark/ips.rb:201:in `ips'
    from benchmarks/uuid.rb:8:in `<main>'

Or on rbx:

An exception occurred running benchmarks/uuid.rb
    Numerical argument out of domain - sqrt (Errno::EDOM)

Or on JRuby:

Math::DomainError: Numerical argument is out of domain - "sqrt"
    sqrt at org/jruby/RubyMath.java:494
tarcieri commented 12 years ago

Just found the root cause of this, if you're curious:

https://github.com/celluloid/celluloid/commit/d5ff2e2de0b01cab7867f219f4deb2a6f7959494