Hi,
I get the following output :
I dont understand why after the decimal point, the values start changing from 0.13223.
The line in the code is
temp = temp - 0.001;
For the file0 the value of temp is 0.14623
For the file0 the value of temp is 0.14523
For the file0 the value of temp is 0.14423
For the file0 the value of temp is 0.14323
For the file0 the value of temp is 0.14223
For the file0 the value of temp is 0.14123
For the file0 the value of temp is 0.14023
For the file0 the value of temp is 0.13923
For the file0 the value of temp is 0.13823
For the file0 the value of temp is 0.13723
For the file0 the value of temp is 0.13623
For the file0 the value of temp is 0.13523
For the file0 the value of temp is 0.13423
For the file0 the value of temp is 0.13323
For the file0 the value of temp is 0.13223
For the file0 the value of temp is 0.13122999999999999
For the file0 the value of temp is 0.13022999999999998
For the file0 the value of temp is 0.12922999999999998
For the file0 the value of temp is 0.12822999999999998
For the file0 the value of temp is 0.12722999999999998
For the file0 the value of temp is 0.12622999999999998
For the file0 the value of temp is 0.12522999999999998
For the file0 the value of temp is 0.12422999999999998
For the file0 the value of temp is 0.12322999999999998
For the file0 the value of temp is 0.12222999999999998

The representation of base 10 numbers in a double is not precise to the number of decimal places you are looking at.
How close is 0.13122999999999999 to 0.13123?
There are classes you can use if you need precision to more decimal places.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.