On Jun 18, 2007, at 2:27 PM, Bradley Lucier wrote:

But even if sqrt is corrected for 0.0 * inf, there would still be a lot of problems with the combinations of NR-enhanced rsqrt and rcp. Consider for example:

1.0/sqrt(a/b) alias rsqrt(a/b)

Having a=0, b != 0, the result is inf.

As already stated, -ffast-math turns on -ffinite-math-only, which allows the compiler to assume that a result of inf cannot happen, so gcc is allowed to ignore this possiblity. Producing NaN instead of inf seems to be allowed.

Let me restate this.

If -ffinite-math-only is specified, then producing NaN instead of inf should be allowed.

If -fno-finite-math-only is specified, then the generated code should "do the right thing" if an argument or result is inf or NaN.

In any case, I would consider it an error if the argument is finite, the result is supposed to be finite, and inf or NaN is produced.

Brad

Reply via email to