[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Correct way to build .deb with -mieee

Adam C Powell IV wrote:
> Of course, if it's possible to avoid divides by zero without performance
> penalty, I would love to.

Yep, that would be something I'd love, too. The only way I know
of (generally spoken) is to move such tests for potential divisions
by zero *as far as possible* out of the innermost loops of an impl
of performance critical loops (but do such tests, somewhere).
Well, if possible.

> The offending code [...]

Thanks for posting this, without your excpicit hint most likely I
never noticed what PETScGraphics is (or does). And (of course) I
must admit, that I do not understand your sources fully without
even having used (or debugged) your program. But you catched my

> [...]
> I could trap for these conditions with an if statement around them, but
> wouldn't that slow things down?

Might be true.

> Note that it is possible to have one of
> these three divisions by zero and still produce a triangle or two; one
> can even have C1=C2<q and C0=C3>q and get two triangles, so we can't
> just test for any zeroes and skip the whole thing.  It just seems easier
> to do it this way, and because it's just for graphics, I don't really
> care about the divide by zero.

In this case (and without deeper knowlegde), I would say
"go with -mieee" (for that specific function).

> [...]
> I don't know whether this algorithm is optimal, nor whether my
> implementation can be improved, just that it worked right the first
> time, with lots and lots of code in DrawTetWithPlane(), and I haven't
> touched it since.  If you have the interest and time to try to lose the
> SIGFPE without -mieee, or even speed things up, feel free to apt-get
> source petscgraphics and look at petscgraphics.c.

As I told before, you catched my interest. Should I prefer apt-get
over http://lyre.mit.edu/~powell/petscgraphics.html? 

> Share and enjoy, thanks in advance for any help you can provide.

Thanks for your insight,

Reply to: