From: Konrad Meyer Date: 2007-10-27T05:06:34+09:00 Subject: Re: Rounding to the nearest 0.05 --nextPart1250230.5gGxXYnGQu Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Quoth Peter Roome: > > Just off-hand, my initial reaction would be: > >=20 > > (a * 20).round.to_f/20 > >=20 > > where "a" is your variable. Some quick tests with irb seems to show > > this as working. > >=20 > > Coey >=20 > Cheers for the quick response guys, much appreciated. What difference > would the .to_f make between these solutions? > --=20 > Posted via http://www.ruby-forum.com/. One solution used (expr).to_f/20, the other used (expr)/20.0. Both of these ensure floating point division is used instead of integer=20 division, that's all. =2D-=20 Konrad Meyer http://konrad.sobertillnoon.com/ --nextPart1250230.5gGxXYnGQu Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQBHIkjLCHB0oCiR2cwRAnUUAJ4gq8/7rPgpiPsVOHaePg+ZQtVv4ACbBLvB Oqz8l9veI8ZV85bS60VfsPA= =w8/k -----END PGP SIGNATURE----- --nextPart1250230.5gGxXYnGQu--