If you want to store 3.14 (and no more), then you need a different data type than a float.
You're always going to end up with either 3.139999999 or 3.140000001, depending on which is the nearest representable form to the value 3.14
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
Its simple as this
float a = 3.1234567;
float b = int (a * 1000 ) / 1000.0f // now b = 3.123
firstPerson
Senior Poster
3,923 posts since Dec 2008
Reputation Points: 841
Solved Threads: 608