Andreas Klein wrote:

... but notice that this issue is tricky: there are computational issues
(we are adding
at least a branch for each division) and correctness issues (what about
C99?)


As I see it the naive formula needs

6 multipications, 2 divisions and 3 additions/subtractions

and the improved formua needs

1 comparision, 3 multipactions, 3 divisions and 3 additions/subtractions

This look like a good deal. However for floting point computations I
prevere good results over fast results.


Thanks for the summary: I just sent a message to the gcc list, let's see what comes
out... Maybe you may want to reply something there.


What do you meen with "correctness issues"?


Have a look to the implementation: it looks like that even if we switch to the
better algorithm, still we don't get fully right C99. Of course this last point
must be better investigate (I'm not a floating point expert) but I expect someone
replying: "let's implement C99 division right instead".


Paolo.

Reply via email to