mathn serves to make mathematical operations more precise in Ruby and to integrate other mathematical standard libraries. Requiring mathn causes changes to the behavior (and even the types) of operations on classes like Integer and it applies to the entire process, not just the file or gem which includes mathn. Therefore, we recommend that instead of requiring mathn, you instead explicitly specify rational values as desired. Before ruby 2.5, mathn was part of the ruby standard library. It was deprecated in ruby 2.2.0, and removed from ruby 2.5.0. In order to use the library with a current version of ruby, you must install it as a gem.