Can a floating point really represent 53,944,552 accurately?

Remember, it only has 24 bits dedicated to the mantissa.

2^24 is 16,777,216


On Tuesday, October 16, 2012 10:09:23 AM UTC-5, FBondarenko wrote:
>
> Hi.
>
> I am using a Matrix that contains only a translation set by 
> setTranslation() to map integer coordinates. Although casting the integers 
> to floats for Matrix.mapPoints() does not seem to be a problem, all mapped 
> points are multiples of 4, even if the translation does contain arbitrary 
> values.
>
> Example:
> Point p = new Point(34968612, 53944552);
> float[] pts = new float[] { (int)p.x, (int)p.y};
> matrix,setTranslate(11.916667, 5.9583335);
> matrix.mapPoints(pts);
>
> produces
>
> pts = {34968624, 53944556}
>
> I don't get my error, as the addition of p and the values 
>
> float[] vals = new float[9];
> matrix.getValues(vals);
> p.add((int)vals[2], (int)vals[5]);
>
> returns the expected value of
>
> p = {34968622, 53944557}.
>
> Does anyone has a clue? Thanks!
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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/android-developers?hl=en

Reply via email to