我正在创建一个二进制文件。文件的内容是双精度值。当我使用二进制读取器提取双精度值时,小数点后的某些值不匹配
例如:写入文件的值。-0.0139519833028316
从文件中提取的值。-0.0139519833028317
我怎样才能避免这种不一致?
aStreamWriter.WriteLine(double values);
//to read the data ,
BinaryReader aBinaryReader = new BinaryReader();
int points_length = CurveCount * VectorLength * 2 * VoxelIndex.Length * 2;
double[] points = new double[points_length];
for (int i = 0; i < points_length; i++)
points[i] = aBinaryReader.ReadDouble();
for(int i =0; i < points_length; i++) {
// then write the points values to a file
}