Not much better, however:

array = np.ceil(1000*array)/1000

On 1 June 2012 08:45, Bharath M R <[email protected]> wrote:
> Hi,
> I was trying to implement interval arithmetic using numpy for plotting. I
> could not possibly find a way
> to **round up** a floating point value. ie sin(<1, 1>) = <0.841, 0.842>
> rounded to 3 decimals. I would like
> to have this functionality because I will always want that a particular
> value lies in between the intervals.
>
> One way to do this is to convert it into Decimal, quantize with rounding up.
> ie
> Decimal(0.8413).quantize(Decimal('.001'), rounding = 'ROUND_UP'). and
> convert
> back to floating point. The rounding will be used quite regularly, hence
> converting to
> Decimal and converting back will be quite ugly and also inefficient.
>
> Is there any other way to do this?
>
> Thanks,
> Bharath M R
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sympy/-/k3ijfwq9CL0J.
> 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.

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