Google Группы больше не поддерживают новые публикации и подписки в сети Usenet. Опубликованный ранее контент останется доступен.

Clip[] doesn't work as expected

12 просмотров
Перейти к первому непрочитанному сообщению

Yen Lee Loh

не прочитано,
7 янв. 2011 г., 04:11:5007.01.2011
On Mathematica v7.0.1 on Mac OS X,


Clip[1.00000000000000036, {0., 1.}]


gives


1.0000000000000004


upon close examination of the output. The documentation does not warn of
this behavior.
I have not checked if the same thing happens in Mathematica v8.
Just thought I would let you know.

Yen Lee


Alexey

не прочитано,
8 янв. 2011 г., 03:40:4008.01.2011
Hello,
I confirm this bug in Mathematica 5.2 and 7.0.1 under Windows.

Yen Lee Loh <yenleel...@gmail.com> wrote:
> On Mathematica v7.0.1 on Mac OS X,
>
> Clip[1.00000000000000036, {0., 1.}]
>
> gives
>
> 1.0000000000000004
>

> upon close examination of the output. The documentation does not warn =

István Zachar

не прочитано,
9 янв. 2011 г., 02:20:5309.01.2011
Hi,

the bug seems to be handled in v8.0:

In[1]:= Clip[1.00000000000000036, {0., 1.}]

Out[1]= 1.

But comes back if I add one more zero before 36:

In[2]:= Clip[1.000000000000000036, {0., 1.}]

Out[2]= 1.00000000000000004

Istvan

On Jan 8, 9:40 am, Alexey <lehi...@gmail.com> wrote:
> Hello,
> I confirm this bug in Mathematica 5.2 and 7.0.1 under Windows.
>
> Yen Lee Loh <yenleel...@gmail.com> wrote:
>
> > On Mathematica v7.0.1 on Mac OS X,
>
> > Clip[1.00000000000000036, {0., 1.}]
>
> > gives
>
> > 1.0000000000000004
>

> > upon close examination of the output. The documentation does not warn of

Sjoerd C. de Vries

не прочитано,
10 янв. 2011 г., 02:35:5910.01.2011
I don't think this is a bug. I all depends on the accuracy of the
upper bound, 1.0. Since it is specified as machine precision the
outcome and the upper limit are the same

In[86]:= 1.0 == 1.00000000000001

Out[86]= True

One zero less:

In[87]:= 1.0 == 1.0000000000001

Out[87]= False

Try using the exact number 1 as the upper limit (wihout decimal
point).

In[88]:= Clip[1.00000000000000036, {0., 1}]

Out[88]= 1

Cheers -- Sjoerd

0 новых сообщений