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.

CLA negative float to int value conversion is incorrect

Genius 5910 points


Hi,

I have the following problem with CLA math. converting a positive float to int value works correctly. But converting a negative floating value to int is incorrect.

This is the code:

    int i;
    if (float_value <= -1) {
        i=(int)float_value;
        long_value+=(long)i;
        float_value+= (float)i;
    }

So  how do I solve this?

 Thanks!