我有Java的算法/计算和单元测试.单元测试期望结果具有一定的精度/ delta.现在我将算法移植到.NET中,并希望使用相同的单元测试.我使用双数据类型.
问题是Java对Math类中的某些操作使用strictfp(64位)..NET使用FPU/CPU总是(80位)..NET更精确,更快捷.Java更具可预测性.
Because my algo is cyclic and reuses the results from previous round, the error/difference/more-precision accumulates too big. I don't rely on speed (for unit test). And I'm happy to use .NET precision in production, but I would like to validate the implementation.
Consider this from JDK
public final class Math {
public static double atan2(double y, double x) {
return StrictMath.atan2(y, x); // default impl. delegates to StrictMath
}
}
Run Code Online (Sandbox Code Playgroud)
I'm looking for library or technique to …