Page 2 of 2
Re: [NXC] floor function not working!!!!
Posted: 01 Jun 2011, 17:37
by nxtboyiii
what round() function???
And I am using floor because I want it to round to the floor! Not just to nearest integer, but to floor because,lets say, 0.75 has to be 0, not 1, and the floor of 0.75 is 0, not 1.
Re: [NXC] floor function not working!!!!
Posted: 01 Jun 2011, 18:26
by HaWe
it's because you wrote something about "rounding", not about fractional cut. The term "rounding" means always up or down to the nearest integer, "floor" doesn't round but cuts off the frac part.
nxtboyiii wrote:EDIT: Is there a round function?(round to the nearest tenth, hundredth,etc)
If not, can someone show me how?
I think it was simply a misunderstanding of what you actually want or need.
Re: [NXC] floor function not working!!!!
Posted: 01 Jun 2011, 19:16
by nxtboyiii
Yes. About that. I asked for a round function so when I use floor I can round the integer to the nearest tenth because of floating-point arithmetics.
Re: [NXC] floor function not working!!!!
Posted: 01 Jun 2011, 19:44
by HaWe
and do you want to round the float or truncate to 1 decimal fixed point and cut off the rest?
1.111 => 1.1 (is trivial)
but:
8.888 => 8.8 or 8.9?
Re: [NXC] floor function not working!!!!
Posted: 01 Jun 2011, 21:36
by nxtboyiii
I want to round I guess.
Re: [NXC] floor function not working!!!!
Posted: 01 Jun 2011, 22:16
by nxtboyiii
I got it to work!!
I just did what linusa said:
It didn't get messed up!!
Thanks doc-helmut and linusa!