Ruby division infinity/NaN should return 0 -


I am making an application on Ruby on Rail I

In the application I will call I want to override the guardian class of the learning class .

To deal with the exceptions

I googled everywhere I want to override the Ruby Division method in the application.

So for the results below it should be returned to zero.

  0.0 / 0 = & gt; NaN 1.0 / 0 = & gt; Infinity Zero Division is divided by: 0  

I can handle it by changing the code everywhere during splitting it. But I want to save myself time by overriding the method myself.

very similar:

  class float surname: old_dive ,: / DF / (Y) Returns NAN if itself == y & amp; Amp; Y == 0.0 Return Infinity If Self == 1.0 & amp; Amp; Y == 0.0 self .old_div (y) end of end  

I know that the code above can not be what you really want. Feel free to customize it the way you want =)


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -