Subject: Re: truncate float to 2 decimals
From: James Gray <james grayproductions.net>
Date: Thu, 14 Aug 2008 01:05:53 +0900
References: 311141
In-reply-to: 311141
On Aug 13, 2008, at 10:47 AM, Junkone wrote:
> how do i truncate the float to 2 decimals
>
> irb(#<Object:0x3d95578>):001:0> f=0.911501706632285
> => 0.911501706632285
>> "%0.2f" % 0.911501706632285
=> "0.91"
James Edward Gray II