G
Guest
Hi,
I am working in the project where VC6 code is ported to VC8 (VC++ .Net 2005)
I got a problem when I cast a double value to unsigned int. Problem is I
couldn’t get the proper value after casting (explicitly / implicitly).
Code looks as below :
const double d_a = 100e-9; // 100ns
const double d_b = 20e-9; // 20ns
const unsigned __int32 ui_c = (unsigned __int32) (d_a / d_b)
It is giving ui_c output as 4, which should be 5.
It is working perfectly in VC6. If I create a new console project containing
those 3 lines of code in VC8, it is working and I am getting proper value.
But in PORTED VC8 project which is a DLL I am NOT getting the proper value.
I want to know whether any settings should be applied to get the proper value.
Please reply to this query as soon as possible.
Thanks in advance,
Vinod
I am working in the project where VC6 code is ported to VC8 (VC++ .Net 2005)
I got a problem when I cast a double value to unsigned int. Problem is I
couldn’t get the proper value after casting (explicitly / implicitly).
Code looks as below :
const double d_a = 100e-9; // 100ns
const double d_b = 20e-9; // 20ns
const unsigned __int32 ui_c = (unsigned __int32) (d_a / d_b)
It is giving ui_c output as 4, which should be 5.
It is working perfectly in VC6. If I create a new console project containing
those 3 lines of code in VC8, it is working and I am getting proper value.
But in PORTED VC8 project which is a DLL I am NOT getting the proper value.
I want to know whether any settings should be applied to get the proper value.
Please reply to this query as soon as possible.
Thanks in advance,
Vinod