I would consider this a bug if the fcode printer is assuming that /
means floating point division and it really means integer division.
Does the C printer do the same thing?

Aaron Meurer

On Fri, Nov 19, 2010 at 11:24 AM, Julien Rioux <[email protected]> wrote:
> Hi all,
>
> How can I tell the fcode printer to print integers and rationals as
> reals?
>
> For example I would like the following output:
>>>> expr = sqrt(1-x**2).series(x,n=20).removeO()
>>>> print fcode(expr)
>      1 - x**2/2 - x**4/8 - x**6/16 - 5*x**8/128 - 7*x**10/256 -
> 21*x**
>     @ 12/1024 - 33*x**14/2048 - 429*x**16/32768 - 715*x**18/65536
>
> (taken from http://docs.sympy.org/dev/modules/printing.html)
>
> this is wrong in most cases since in in Fortran "/2" is integer
> division and it should be replaced by "/2.d0", etc.
>
> a flag fcode(expr,assign_as="real") would be most useful
>
> thanks,
> Julien
>
> --
> 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.
>
>

-- 
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.

Reply via email to