From: "Brian Schröder" Date: 2005-04-20T00:10:21+09:00 Subject: Re: String<->float conversion headaches On 19/04/05, pmak@aaanime.net wrote: > The corresponding column in the MySQL database is of type DECIMAL(7,2), > but the corresponding Ruby structure came out as a String instead of a > decimal type. I haven't updated my database driver in a few years, > though; perhaps I'll look into that. Thanks. > > DECIMAL(7.2) should not be converted to a float value, as floats can't represent all instances of DECIMAL(7.2). For example 0.1 can not be represented as a float. irb(main):010:0> "%.18f" % 0.1 => "0.100000000000000006" regards, Brian -- http://ruby.brian-schroeder.de/ multilingual _non rails_ ruby based vocabulary trainer: http://www.vocabulaire.org/ | http://www.gloser.org/ | http://www.vokabeln.net/