From: "Martin J. Dürst" Date: 2013-02-27T17:17:25+09:00 Subject: [ruby-core:52986] Re: [ruby-trunk - Feature #4897] Define Math::TAU and BigMath.TAU. The "true" circle constant, Tau=2*Pi. See http://tauday.com/ Hello Eric, I'm confused by the code below. First, it uses Math::PI with the 'tau' option, and Math::TAU with the '2pi' option. Second, even when using Math::TAU, it includes a multiplication by 2. Regards, Martin. On 2013/02/27 14:08, drbrain (Eric Hodel) wrote: > Benchmarks: > > $ cat bm.rb > require 'benchmark' > > module Math > TAU = 2*Math::PI > end > > range = Float::EPSILON..10.0 > > N = Integer ARGV.shift > > case ARGV.shift > when 'tau' then > puts Benchmark.measure { > N.times do > 2 * Math::PI * rand(range) > end > }.real > when '2pi' then > puts Benchmark.measure { > N.times do > 2 * Math::TAU * rand(range) > end > }.real > else > abort "#{$0} N tau|2pi" > end