小编jef*_*eff的帖子

计算 [-1, 1] 中 c 的 sqrt((b²*c²) / (1-c²)) 的数值稳定方法

对于一些实际价值bcin [-1, 1],我需要计算

sqrt( (b²*c²) / (1-c²) ) = (|b|*|c|) / sqrt((1-c)*(1+c))

c接近 1 或 -1时,分母中出现灾难性抵消。平方根可能也无济于事。

我想知道是否有一个聪明的技巧可以在这里应用来避免 c=1 和 c=-1 周围的困难区域?

c++ math floating-point numerical-stability

58
推荐指数
2
解决办法
3350
查看次数

标签 统计

c++ ×1

floating-point ×1

math ×1

numerical-stability ×1