From: Aldric Giacomoni <"aldric[removeme]"@...> Date: 2009-04-11T05:10:09+09:00 Subject: Re: Float.finite ? I see. Thank you..I misunderstood what the function did :) Jeff Schwab wrote: > ITYM Float#finite? > > Aldric Giacomoni wrote: >> How does one use .finite? effectively? > >> I tried with (1.0/3).finite? => true... >> I tried with BigDecimal.. Still true. I'm pretty sure these numbers >> aren't >> finite. > > They are finite. > >> How do I make this work? > > #finite? doesn't tell you whether the decimal (or any other) > representation of a number requires finite space. #finite? tells you > only whether the value is finite, i.e. not infinite. > > irb(main):002:0> 1.0/3.0 > => 0.333333333333333 > irb(main):003:0> _.finite? > => true > irb(main):004:0> 1.0/0 > => Infinity > irb(main):005:0> _.finite? > => false > irb(main):006:0> -- Aldric Giacomoni
One meets his destiny often on the road he takes to avoid it.