sympy/sympy — pull request #1770 by skirpichev (2013-02-11 15:55:37+00:00)
Title: codeprinters: fix Rational's printing for code (as fractions of doubles)

S(4)/3 * x -> (4.0/3.0)*x for ccode, not 4*x/3

See also:
https://github.com/sympy/sympy/pull/1763

@jrioux:
> As to the printing of Rational(2, 3)*x, I agree that it should use doubles, just like printing Rational(2, 3) on its own does; looks like a dedicated _print_Mul should be implemented for CCodePrinter (maybe even for the parent class CodePrinter).

That's done. Looks a bit ugly: _print_Mul() method copy-pasted from StrPrinter with minimal changes. This code was omitted:
```
elif item.is_Rational and item is not S.Infinity:
if item.p != 1:
a.append(Rational(item.p))
if item.q != 1:
b.append(Rational(item.q))
```
(n.b: why Rationals are here, not Integers?)

Second. C99 says:
> An unsuffixed floating constant has type double.

May be we should change _print_Rational?