Am 01.06.2012 09:58, schrieb Bharath M R:
Exactly my problem. Multiplying and using ceil might cause inaccuracy.
Is it possible to round to the nearest floating point value, but rounding
up.
Something like `round`, but which always rounds up or rounds down.

You seem to be assuming that round(n) is accurate, but is it?
IEEE does not define that function AFAIK.
If that's correct, Python is pretty much forced to do the multiply-round-divide routine, and may have errors.

It's not even easy to test whether Python is accurate. You'd need some way to make sure that you test with both the lower and higher machine number that's around your 0.05-like test value. I know of no way to reliably produce these from a programming language (since these produce their constants from a decimal representations and programming languages usually don't define the conversion rules very well). You'd probably have to start with a hexadecimal representation of the double that you want to test. Or construct your test values algorithmically (that will eliminate coding errors in the hex values, I'd suggest doing that).

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