G
Guest
this problem happened after we upgrade our program from vc6.0 to vc.net2003
unmanaged code.
Following are the sample code:
float p, cpr = 3.4028234663852886e+038;
p = (1.0f - pow(1.0f-cpr/100.0f, 1.0f/12.0f));
if(p<0.0f)
p = 0.0;
==
Because the value of cpr is blow up during calculation, value p will be
-1.#IND000 after function call of the math function "pow".
In vc6.0, p<0.0f is true, and p=0.0 is executed, which is what we need. But
in vc.net 2003, p<0.0f is false.
I tried to compare p>0.0f, it is false too.
This is important because our system is big and there are many placed like
this in the program. we want the new system built under vc.net2003 behaves
the same way as it was before.
I checked the memory representation of the value of p. They are same for
version vc6.0 vs vc.net
"00 00 C0 FF"
But when it comes to the comparison statement, they behave differently.
Any feed back will be appreciated.
thanks.
Zongwen
unmanaged code.
Following are the sample code:
float p, cpr = 3.4028234663852886e+038;
p = (1.0f - pow(1.0f-cpr/100.0f, 1.0f/12.0f));
if(p<0.0f)
p = 0.0;
==
Because the value of cpr is blow up during calculation, value p will be
-1.#IND000 after function call of the math function "pow".
In vc6.0, p<0.0f is true, and p=0.0 is executed, which is what we need. But
in vc.net 2003, p<0.0f is false.
I tried to compare p>0.0f, it is false too.
This is important because our system is big and there are many placed like
this in the program. we want the new system built under vc.net2003 behaves
the same way as it was before.
I checked the memory representation of the value of p. They are same for
version vc6.0 vs vc.net
"00 00 C0 FF"
But when it comes to the comparison statement, they behave differently.
Any feed back will be appreciated.
thanks.
Zongwen