Problem with floating point

Stéphane MOREAU moreau at adersa.asso.fr
Tue Jul 13 03:16:03 EDT 1999


    Hi vtk users

I've got problems with floating point. I'm working with vtk2.3, win NT
and java. Let's see :

vtkFloatPoints points = new vtkFloatPoints();
double [] foo = new double[3];
foo[1] = 0.35;
foo[2] = 0.48;
foo[3] = 0.1;
points.InsertPoint(0,foo[0],foo[1],foo[2]);
double []bar = new double[3];
bar = point.GetPoint(0);
System.out.println("foo[0] = " + foo[0] + "    bar[0] = "+ bar[0]);
System.out.println("foo[1] = " + foo[1] + "    bar[1] = "+ bar[1]);
System.out.println("foo[2] = " + foo[2] + "    bar[2] = "+ bar[2]);

This program returns :
foo[0] = 0.35    bar[0] = 0.3499999940395355
foo[1] = 0.48    bar[1] = 0.47999998927116394
foo[2] = 0.1      bar[2] = 0.10000000149011612

What's wrong ? Why vtk doesn't return the exact number ?
Is it a java fault, or a vtk fault ?
Any suggestions will be appreciated...

    Thank you.


--
============================
Stéphane MOREAU
Ingénieur de recherche
ADERSA
Tél : 01-60-13-53-47
Fax : 01-69-20-05-63
mailto:moreau at adersa.asso.fr
http://www.adersa.asso.fr




-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list