support Ruby 1.8.7

* Changed ruby 1.9 specific syntax to 1.8 compatible.
* Ignore narray for JRuby platform in gemspec, as NArray does not support JRuby
* Added Math::log2 for Ruby version that removed the method, so that we can use this for ruby 1.8.7.