Fun with Unicode Math in Ruby √

So we started having some fun with Ruby yesterday:

# Get the square root of 5
√ 5  #  => 2.23606797749979 

# or see if infinity + 1 is still in the infinite range
(-∞..∞).cover? ∞ + 1  # => true

# or get the sine of pi / 2
∿ π/2  # => 1.0

# or do math with fractions
⅞ * ⅔ # => 0.5833333333333333

Now you can do all of this and more with the unicode_math gem!

Simply install the gem and you’re off and running.

gem install unicode_math

Check out the source code on GitHub. We’d love to see your ideas for more fun, so get those pull requests coming!

Finally, why would we do this‽ Because it was fun, and Ruby has great support for unicode. Enjoy!

Daniel Morrison

Comments:


Post a Comment

(optional)
(optional — will be included as a link.)
  1. Very fun, I picked a great day to stop by the office, and to see the geekery unfold!

    October 16, 2012 at 12:39 PM
  2. シャネルは、フランスでシャネル帝国を作成したクラスと洗練された女性だった

    April 30, 2013 at 21:33 PM