On 15/08/2009, at 4:46 PM, Adil Saleem wrote:
On calling this, the variable aFloat in setMyvar method gets value 863.599976. I also tried giving it 6.600000 but still didn't work correctly. I don't understand why is it changing the value. Why doesn't it get 863.6 ?
This is a classic misunderstanding of floats. Look up "floating point precision". Basically, a float is 32 bits - it can only represent 2^32 different values, not the infinity of numbers that exist. So quite often certain values are rounded off, truncated or represent by something "close". If you need exact values, use integers.
--Graham _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com