Re: Rescale scales lower bound wrong
- To: mathgroup at smc.vnet.net
- Subject: [mg74336] Re: Rescale scales lower bound wrong
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Mon, 19 Mar 2007 02:00:29 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <etijg2$is4$1@smc.vnet.net>
zac wrote:
> Dear Group,
>
> is there anything smart to be said concerning the following code?
>
> In[1]:= Rescale[0.09090909090909091,{0.09090909090909091,1.},{0,100}]
>
> Out[1]= -1.7763568394002505`*^-15
>
> In[2]:= myRescale[y_,{minY_, maxY_},{minX_,maxX_}]:=N[(maxX-minX)/
> (maxY-minY)*(y- minY)+minX];
>
> In[3]:= myRescale[0.09090909090909091,{0.09090909090909091,1.},
> {0,100}]
>
> Out[3]= 0.
>
> In my intention, the first result is wrong (apart from the actual
> value, it is a negative number!), and the second one is correct. Is
> the first result due to the internal number-representation?
Yes.
In[1]:=
Chop[Rescale[0.09090909090909091, {0.09090909090909091, 1.}, {0, 100}]]
Out[1]=
0
Regards,
Jean-Marc