Rounding Floats (0.1 Rounds)
#7

Alright, took a little time to do a bit more testing with your function, but it failed to round value 7 (0.699999 to 0.700000), but values 0 to 6 work just fine...

Using the value 9 does the same thing, it comes out as 0.899999

The following is how I used your function though

pawn Код:
valueA=7;
floatA=valueA;
// floatA is now: 7.000000
floatA/=10.0;
// floatA is now: 0.699999 (It's not 0.700000 like it should be after the divide...)
RoundToNearestTenth(floatA);
// floatA is still: 0.699999
I tested the number you used, 13.29 -> 13.3 which works just fine, but try with using 0.69 & you'll see what my problem is...

Conclusion: This must be a Pawn Bug of some sort, 7.000000 / 10.000000 = 0.699999 (Pawn) because 7.000000 / 10.000000 = 0.700000 (Caculator)

So does anyone know a way around this bug maybe?
Reply


Messages In This Thread
Rounding Floats (0.1 Rounds) - by XGh0stz - 22.03.2010, 17:11
Re: Rounding Floats (0.1 Rounds) - by Joe Staff - 22.03.2010, 17:22
Re: Rounding Floats (0.1 Rounds) - by XGh0stz - 22.03.2010, 17:26
Re: Rounding Floats (0.1 Rounds) - by XGh0stz - 22.03.2010, 17:42
Re: Rounding Floats (0.1 Rounds) - by Joe Staff - 22.03.2010, 17:58
Re: Rounding Floats (0.1 Rounds) - by XGh0stz - 22.03.2010, 18:20
Re: Rounding Floats (0.1 Rounds) - by XGh0stz - 22.03.2010, 21:08

Forum Jump:


Users browsing this thread: 1 Guest(s)