I don't understand how this happens.

Notice that this is not an issue about floating point rounding, both
assignments (t2a t2b) should be exactly equivalent, but they are not.

/************************************************/
#include<stdio.h>
int main() {
    int t1 = 176401255;
    float f = 0.25f;
    int t2a = (int)(t1 * f);
    int t2b = (int)(t1 * (float)0.25f);
    printf("t2a=%d t2b=%d \n",t2a,t2b);
    return 0;
}
/************************************************/

prints

t2a=44100313 t2b=44100312

Using tcc version 0.9.26 (i386 Win32)


-- 
Hernán J. González




-- 
Hernán J. González
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to