[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] An issue with literal floats
From: |
Edmund Grimley Evans |
Subject: |
Re: [Tinycc-devel] An issue with literal floats |
Date: |
Thu, 26 Feb 2015 20:03:46 +0000 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
> /************************************************/
> #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)
Yes, that's weird. I can confirm that 0.9.26 does that, but the latest
TCC (git clone git://repo.or.cz/tinycc.git) doesn't. It says:
t2a=44100312 t2b=44100312
If you're curious you could look through the commit messages or do a
bisection search to find out which commit changed that behaviour.
Edmund