Code: Select all
Math.Sqrt (1. - u * u - v * v)
My application has the line:
Code: Select all
IF u * u + v * v <= 1. THEN w := Foo (u, v) ELSE ...
My first guess was it was due to some operations being 64 bit, and others leaving 80-bit partial results on the floating point stack.
However the first experiment I tried was to rewrite Foo as
Code: Select all
Math.Sqrt (1 - (u * u + v * v))
That change stopped the TRAP with yesterday's data, however I am not sure if the code is now completely reliable, or even if this change will cause some pairs of values that did work to now fail, ie it may have made the problem worse!
Does anyone have any useful insight?
Incidentally I have reasons to not to like the obvious 'hacks':
Code: Select all
IF u * u + v * v <= 1. - 1.E-15
Code: Select all
Math.Sqrt (MAX (1. - u * u - v * v), 0.)
Robert
PS - Ivan: Please don't answer this, give someone else a chance to get involved with the forum!