对于一些实际价值b和cin [-1, 1],我需要计算
b
c
[-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
c++ ×1
floating-point ×1
math ×1
numerical-stability ×1