What numerical algorithm is simplified by defining sqrt(-0.0) as -0.0?

后端 未结 2 1946
眼角桃花
眼角桃花 2021-02-19 21:56

The IEEE 754 standard defines the square root of negative zero as negative zero. This choice is easy enough to rationalize, but other choices, such as defining sqrt(-0.0)<

2条回答
  •  执念已碎
    2021-02-19 22:38

    The only mathematically reasonable result is 0. There is a reasonable question of whether it should be +0 or -0. For most computations it makes no difference at all, but there are some specific complex expressions for which the result makes more sense under the -0 convention. The exact details are outside the scope of this site, but that's the gist of it.

    I may explain some more when I'm not on vacation, if someone else doesn't beat me to it.

提交回复
热议问题