Last Modified
2010-06-15 17:57:47 +0200
Requires
  • flt/float
  • flt/bigdecimal
  • flt/d
  • flt/b

Description

Optional (and intrusive) shortcuts for numeric types

   require 'flt/sugar'

   puts 0.1.split.inspect
   puts 0.1.sqrt
   puts 0.1.next_plus

   puts 11.odd?
   puts 11.even?
   puts 11.sign
   puts 0.sign
   puts (-11).sign

   puts 11.0.odd?
   puts 11.0.even?
   puts 11.0.sign
   puts 0.0.sign
   puts (-0.0).sign
   puts (-11.0).sign

   puts Rational(11,3).split.inspect

   puts BigDecimal::Math.sin(BigDecimal('0.1'), 20)
   include BigDecimal::Math
   puts sin(BigDecimal('0.1'), 20)