fix Ruby 1.8.7 compatibility

8e58b6663a0 has some bugs.

* Dividing by 100 and 1000. These should by 100.0 and 1000.0.
* Ruby 1.8.7 hash is not orderd.
Merge pull request #9 from marutosi/fix-ruby-187

fix Ruby 1.8.7 compatibility