Carl Witty wrote: > On Wed, May 13, 2009 at 1:31 PM, Dag Sverre Seljebotn > <[email protected]> wrote: >> But that means there's still a real problem even if I fix #303; if we >> don't know the exact type for external types then e.g. temporaries from >> expressions of those could loose precision. >> >> Would it work to always allocate temps at the widest possible precision? > > That doesn't sound like a good idea. The widest possible precisions > would presumably be "long long" (for integer) or "long double" (for > float) types; but on many platforms, "long long" is much slower than > "int" and "long double" is much slower than "double".
Yes, but these are only used in temporaries which are presumably read just after. Wouldn't the compiler be able to optimize it? E.g. short a = ..., b = ..., c; long long long long int temp; temp = a + b; c = temp; It seems plausible that the compiler could decide that temp could be made a short (?). But it definitely needs investigation to see exactly which sort of situations the knowledge about the size is used in. The alternative (which doesn't make everything mixed up and confusing, anyway) seems to be to require pxd's to be exact; which means that Cython would pretty much require #ifdef and being passed defines from makefiles etc. Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
