void TestMain()
{
int i;
char c;
short s;
float f;
c = -1;
f = (float)c;
LOGE("1. c:0x%x\n", c);
LOGE("1. f:%lf\n", f);
c = 0;
f = c;
LOGE("2. c:0x%x\n", c);
LOGE("2. f:%lf\n", f);
c = -1;
f = c;
for (int i = 0; i < 1000; i++){
f = f + c;
}
LOGI("3. f + c:%lf\n", f);
i = -1;
f = i;
for (int idx = 0; idx < 1000; idx ++){
f = f + i;
}
LOGI("3. f + i:%lf\n", f);
c = 0;
i = 1;
f = (!c)*(i);
for (int idx = 0; idx < 5; idx++){
f = f + f;
}
LOGE("4. f:%lf\n", f);
s = -1;
f = s;
LOGE("5. f:%lf\n", f);
}
===============android=====================
04-10 22:40:30.108 27946-27946/com.example.myapplication E/DYZ: 1. c:0xff
04-10 22:40:30.108 27946-27946/com.example.myapplication E/DYZ: 1. f:255.000000
04-10 22:40:30.108 27946-27946/com.example.myapplication E/DYZ: 2. c:0x0
04-10 22:40:30.109 27946-27946/com.example.myapplication E/DYZ: 2. f:0.000000
04-10 22:40:30.109 27946-27946/com.example.myapplication I/DYZ: 3. f + c:255255.000000
04-10 22:40:30.109 27946-27946/com.example.myapplication I/DYZ: 3. f + i:-1001.000000
04-10 22:40:30.109 27946-27946/com.example.myapplication E/DYZ: 4. f:32.000000
04-10 22:40:30.109 27946-27946/com.example.myapplication E/DYZ: 5. f:-1.000000
=================windows====================
1. c:0xffffffff
1. f:-1.000000
2. c:0x0
2. f:0.000000
3. f + c:-1001.000000
3. f + i:-1001.000000
4. f:32.000000
5. f:-1.000000