On Mon, 2008-08-04 at 16:10 +0200, Julien Pauty wrote: > Hello, > > I'm facing a floating point precision problem. If you execute this > sample code: > > import clutter > r = clutter.Rectangle() > r.set_size(20,20) > r.set_scale(12.1,12.1) > print r.get_scale() > > r.get_scale() will return something like (12.100006103515625, > 12.100006103515625) instead of 12.1 > > I'm running pyclutter on an ubuntu hardy distribution (Intel 32 > bits).
that is a common issue with floating point numbers and how they are stored by a computer. if you want to clamp the actual number to an arbitrary number of decimals, then use: print "%.1f, %.1f" % r.get_scale() ciao, Emmanuele. -- Emmanuele Bassi, OpenedHand Ltd. Unit R, Homesdale Business Centre 216-218 Homesdale Rd., Bromley - BR12QZ http://www.o-hand.com -- To unsubscribe send a mail to [EMAIL PROTECTED]
