On Mon, Nov 22, 2010 at 3:58 AM, Chris Smith <[email protected]> wrote: > Øyvind Jensen wrote: >> fr., 19.11.2010 kl. 10.24 -0800, skrev Julien Rioux: >>> Hi all, >>> >>> How can I tell the fcode printer to print integers and rationals as >>> reals? >>> > >> Thanks for spotting this. >> >> I think the code printers should by default assume floating point >> division, as the generated code would then match more closely the >> rational numbers in the corresponding SymPy expression. >> >> I'd say you should file a bug. Are you sure there is really need for >> an option flag? Unless there is a known case where integer truncation is >> the correct thing, I think we should prefer to keep the interface >> simple, and use floating point division indiscriminately. > > Since an integer division would never show up in a sympy expression, this is > probably a good way to handle things. Integer division is supported in > fortran (at least F90) in a way that is different than python: it truncates > toward zero rather than rounding down to the integer in the -oo direction: > (-9)/2 = -4 in F90 but -5 in python. But, again, I don't think you would ever > be translating a sympy expression that would require this.
Oops, I didn't even know this. I think that by default, we should use floating point division for sure. Ondrej -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
