Am 01.06.2012 09:45, schrieb Chris Smith:
On Fri, Jun 1, 2012 at 1:25 PM, Joachim Durchholz<[email protected]>  wrote:
Am 01.06.2012 09:25, schrieb Chris Smith:

How about round down and then add your interval width?

You'll add a rounding unit if the input value happens to be exact.


Can the interval have zero width?

It could, but that doesn't affect the outcome - you're working on the upper bound.

> If so then, yes, and b could then be
calculated as

b=(a+10**-3).round(3) if a!=n else a

Not sure what n is here.
Also, you'd want to add half of the step size to cover the round-down case.

I'm not sure what Python's rounding mode is. IEEE defines some rounding modes that won't do what you expect (such as rounding up or down depending on the parity of the mantissa - I heard that's helpful to improve the stability of some numeric algorithm, that's why IEEE defines it). The scary thing here is that C code might actually have changed the rounding mode. And if you're doing numeric work, I'd expect that some people will indeed use a C module that does exactly this together with SymPy.

So my proposal would be to stick with floor() and ceil(). These are well-defined operations.

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