From: Daniel Bretoi Date: 2002-09-14T04:41:52+09:00 Subject: Re: float precision Isn't that a dangerous pitfall? irb(main):001:0> a = 20020912.194220 20020912.19 irb(main):002:0> a = a.to_s "20020912.19" if it's all storered, shouldn't the whole number end up in the string? On Sat, Sep 14, 2002 at 04:03:19AM +0900, Paul Brannan wrote: > On Sat, Sep 14, 2002 at 02:54:56AM +0900, Daniel Bretoi wrote: > > Sorry if this has been answered before. > > I'll demonstrate my question with irb. > > > > irb(main):001:0> a = 20020912.194220 > > 20020912.19 > > > > Why do I miss the last 5 digits when I try to assign a? > > It's not missing; it's just not printed: > > irb(main):001:0> class Float; def inspect; "%.10f" % self; end; end > nil > irb(main):002:0> a = 20020912.194220 > 20020912.1942199990 -- You don't exist, go away!