C / C ++中的80位浮点运算

时间:2011-08-10 19:15:22

标签: c compiler-construction floating-point-precision

假设a,b_int64变量。 需要在高精度80位浮点中计算sqrt((long double)a)*sqrt((long double)b)

实施例。 (__int64)(sqrt((long double)a)*sqrt((long double)a) + 0.5) != a在许多情况下都应该如此。

哪个win32 C / C ++编译器可以管理80位浮点运算?

3 个答案:

答案 0 :(得分:3)

你可能不应该使用浮点来取整数的平方根,特别是long double,它支持得很差,并且在某些系统上可能有一个近似(不准确)sqrtl。而是查找整数平方根算法。

答案 1 :(得分:2)

你确定sqrt()对长双打有效吗?

至少在某些环境中,sqrt()用于双精度,sqrtf()用于浮点数,sqrtl()用于长双精度。

答案 2 :(得分:1)

Embarcadero的C ++ Builder将处理80位浮点。使用long double类型,或(从Delphi导入)Extnded类型。他们是一样的。

相关问题