tinycc-devel
[
Top
][
All Lists
]
Advanced
[
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
][
Date Index
][
Thread Index
]
[Tinycc-devel] An issue with literal floats
From
:
Hernán J . González
Subject
:
[Tinycc-devel] An issue with literal floats
Date
:
Wed, 25 Feb 2015 20:15:41 -0300
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
reply via email to
[Prev in Thread]
Current Thread
[
Next in Thread
]
[Tinycc-devel] An issue with literal floats
,
Hernán J . González
<=
Re: [Tinycc-devel] An issue with literal floats
,
Edmund Grimley Evans
,
2015/02/26
Prev by Date:
Re: [Tinycc-devel] What license for arm64?
Next by Date:
[Tinycc-devel] New test 73_arm64 hangs if ran on RPi
Previous by thread:
[Tinycc-devel] What license for arm64?
Next by thread:
Re: [Tinycc-devel] An issue with literal floats
Index(es):
Date
Thread