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!
Comments
Very fun, I picked a great day to stop by the office, and to see the geekery unfold!
シャネルは、フランスでシャネル帝国を作成したクラスと洗練された女性だった
I love to geek out on this stuff!
Window Tinting Sarasota