MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Clip[] doesn't work as expected

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115428] Re: Clip[] doesn't work as expected
  • From: Leonid Shifrin <lshifr at gmail.com>
  • Date: Tue, 11 Jan 2011 00:32:24 -0500 (EST)

I agree with this. This part of Clip's behavior looks like a bug indeed.
Seems to have been fixed in Mathematica 8.

On Mon, Jan 10, 2011 at 10:33 AM, Alexey Popkov <lehin.p at gmail.com> wrote:

> "Leonid Shifrin" <lshifr at gmail.com> news:igbnil$hi0$1 at smc.vnet.net...
> > This behavior is correct, and there is nothing to warn about. You use
> > machine-precision arithmetic,
> > and your result is within machine epsilon of 1:
> >
> > In[1]:=Chop[Clip[1.00000000000000036,{0,1}]-1]
> >
> > Out[1] = 0
> >
> > If you want exact result, you need fixed higher  precision, and exact
> bounds
> > in Clip, such as:
> >
> > In[2]:= Clip[N[1+36*10^(-17),20],{0,1}]
> >
> > Out[2]= 1
> >
> >
> > Regards,
> > Leonid
>


  • Prev by Date: Re: curve fitting question
  • Next by Date: Re: PDE system solving
  • Previous by thread: Re: Clip[] doesn't work as expected
  • Next by thread: Mathematica code for change of variable