K
kingkong
Hi,
I am porting some code from VC6 to .net 2003 VC7.1. The code is to do
yield curve interpolation, therefore precision is important. I have
found some strange behavior in the VC7.1 environment. Allow me to show
the problem:
....
double_v strikes;
strikes.reserve(11);
strikes.push_back(0.00750);
strikes.push_back(0.01965);
strikes.push_back(0.02000);
strikes.push_back(0.02076);
strikes.push_back(0.05000);
strikes.push_back(0.09000);
....
When I examine the values in strikes in the VC6 debugger, I can see the
exact number that I inserted. In the VC7.1 debugger, some of the
numbers in strikes are different by a very small fraction. The numbers
shown in the VC71 debugger are:
strikes._M_start,6
[0] 0.0074999999999999997
[1] 0.019650000000000001
[2] 0.020000000000000000
[3] 0.020760000000000001
[4] 0.050000000000000003
[5] 0.089999999999999997
I am using stlport4.6.2 which I don't think it is the cause of the
problem. I am new to the MS environment, even newer to the VC71 world.
My question is why these 2 environments are different and how to work
around it.
Any advice will be greatly appreciated.
MK
I am porting some code from VC6 to .net 2003 VC7.1. The code is to do
yield curve interpolation, therefore precision is important. I have
found some strange behavior in the VC7.1 environment. Allow me to show
the problem:
....
double_v strikes;
strikes.reserve(11);
strikes.push_back(0.00750);
strikes.push_back(0.01965);
strikes.push_back(0.02000);
strikes.push_back(0.02076);
strikes.push_back(0.05000);
strikes.push_back(0.09000);
....
When I examine the values in strikes in the VC6 debugger, I can see the
exact number that I inserted. In the VC7.1 debugger, some of the
numbers in strikes are different by a very small fraction. The numbers
shown in the VC71 debugger are:
strikes._M_start,6
[0] 0.0074999999999999997
[1] 0.019650000000000001
[2] 0.020000000000000000
[3] 0.020760000000000001
[4] 0.050000000000000003
[5] 0.089999999999999997
I am using stlport4.6.2 which I don't think it is the cause of the
problem. I am new to the MS environment, even newer to the VC71 world.
My question is why these 2 environments are different and how to work
around it.
Any advice will be greatly appreciated.
MK