MathGroup Archive 2007

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

Search the Archive

Re: Rescale scales lower bound wrong


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


  • Prev by Date: Re: Two successive FindMinimum -> Bug?
  • Next by Date: Re: Keyboard shortcut to select the entire cell
  • Previous by thread: Rescale scales lower bound wrong
  • Next by thread: Keyboard shortcut to select the entire cell