I used to teach numerical calculus, so I cannot resist :-) The current implementation of complex division for the struct case is the dangerous one, it uses:
2 divides 6 multiplies 3 additions A safer way, far less sensible to roundoff/overflow (looks at core CPython's complexobject.c, and skip the checks for dividing by zero), would likely require: 2 comparison 3 divides 3 multiplies 3 additions So the key question is (having a serious headache right now, hope I got the number above and below right): Are 2 comparison and 1 divide SLOWER than 3 multiplies ?? If the answer is NO, we should clearly use the SAFER implementation. If the answer is YES, should we trade SPEED over roundoff/overflow issues? -- Lisandro Dalcín --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594 _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
