Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to keep my real numbers rounded

The following code:

var('t')
test(x) = e^(x * t)
test(0.326)

gives:

e^(0.326000000000000*t)

For some reason, Sage converted my "0.326" to "0.326000000000000".

I want to keep the number rounded. i.e:

e^(0.326*t)

I don't even care if Sage rounds it like this:

e^(0.33*t)

How can I do this?

I know it is possible to use fractions, E.g, I can use "326/1000" instead of "0.326", but this doesn't look good. All I want is that the floating point numbers remain rounded.