Closed IsmailM closed 8 years ago
this is really petty but I've always preferred 1.fdiv(2)
over 1.to_f/2
and it's faster too.
require 'benchmark/ips'
Benchmark.ips do |x|
x.report('fdiv') { 1.fdiv(2) }
x.report('to_f') { 1.to_f/2 }
x.compare!
end
Calculating -------------------------------------
fdiv 65.294k i/100ms
to_f 64.008k i/100ms
-------------------------------------------------
fdiv 5.545M (± 7.3%) i/s - 27.554M
to_f 4.186M (± 6.0%) i/s - 20.867M
Comparison:
fdiv: 5545234.9 i/s
to_f: 4186422.3 i/s - 1.32x slower
shrugs :neckbeard: :grin:
Thanks @mikecmpbll - I’ve never come across fdiv before…
Anyways. Done.
@mikecmpbll
Using fdiv
makes travis sad… Any idea why?
to_f
= https://travis-ci.org/SciRuby/statsample/builds/86715122 (passing)
fdiv
= https://travis-ci.org/SciRuby/statsample/builds/86722385 (failing)
Shall I change back to to_f
weird?? :/ didn't mean to cause an issue here. i can look into why this fails tomorrow, but up to you guys.
Thanks
Could just be a hiccup from Travis; Can someone (with the permissions) restart this build - perhaps it will ‘automagically’ fix things.
Okay, the build now passes...
:+1: :wink:
Could you please rebase this feature into a single commit?
@v0dro, as requested, this has now been rebased into a single commit.
Thanks @IsmailM!
Fixes #44