From: ptkwt@... (Phil Tomson) Date: 2004-04-23T15:54:10+09:00 Subject: log base 2 and floats that don't look it 2 things: 1) Why isn't there a log base 2 function in the standard Math library? Seems pretty essential. ....which leads to: 2) I found a log2 function in the Extmath lib from the RAA, but it seems to return a Float that looks like a Fixnum: irb(main):004:0> require 'extmath' => true irb(main):005:0> Extmath.log2 8 => 3 irb(main):006:0> x = Extmath.log2 8 => 3 irb(main):007:0> x.class => Float #if it were a float, I would expect to see 3.0 not 3 ! irb(main):008:0> x.to_i => 2 So Extmath.log2 8 returns 3, but it's really a Float so it should be 3.0, how can 3 be a Float? I'm confused, but at least now I know why my code which was using this log2 function isn't working. And to add insult to injury, to_i appears to turn 3 into 2. What gives? Phil