This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I am searching for a function that rounds my float values to the nearest integer. Unfortunately I could only find a floor() and ceil() function in the math.h.
I am using a F28335.
Thank you in advance.
~ Brian
Hi Brian,
You may find this thread helpful: http://e2e.ti.com/support/microcontrollers/c2000/f/171/t/360075
Regards,
Richard
Hi Richard,
thank you for the answer. It didn't really help me, but as I only want to round positive floats to the nearest integer, for example
29.6 -> 30
30.4 -> 30
I will try it like this:
float x = 29.6; Uint16 y; x += 0.5; y = x;
~Brian