# Revision history [back]

### Is it possible to get fortran code for an expression?

Hello, is it possible to get the fortran code for expressions in SageMath?

Here's what I mean:

sage: var('a b x y')
( a, b, x, y )
sage: eq = x^a + 3/2*y^b
sage: get_fortran(eq)
x**a + 3.0/2.0*y**b


Right now the best I can do as a workaround is:

sage: eq.__str__().replace('^', '**')
x**a + 3/2*y**b


but the numbers appear as integers, which makes the division be performed as integer division in Fortran, which forces me to manually change that. Is there a function I can use to get what I want?

Cheers