[llvm-commits] CVS: llvm/test/Programs/MultiSource/Benchmarks/McCat/08-main/object.c
Reid Spencer
reid at x10sys.com
Thu Aug 5 00:23:58 PDT 2004
Changes in directory llvm/test/Programs/MultiSource/Benchmarks/McCat/08-main:
object.c updated: 1.3 -> 1.4
---
Log message:
Use an epsilon test when comparing floating point values so that points
that are "really close" will be counted as the same point. This fixes a
problem with this test that caused the CBE to insert extra points that the
other test modes did not.
---
Diffs of the changes: (+10 -3)
Index: llvm/test/Programs/MultiSource/Benchmarks/McCat/08-main/object.c
diff -u llvm/test/Programs/MultiSource/Benchmarks/McCat/08-main/object.c:1.3 llvm/test/Programs/MultiSource/Benchmarks/McCat/08-main/object.c:1.4
--- llvm/test/Programs/MultiSource/Benchmarks/McCat/08-main/object.c:1.3 Wed Aug 13 15:42:47 2003
+++ llvm/test/Programs/MultiSource/Benchmarks/McCat/08-main/object.c Thu Aug 5 02:23:48 2004
@@ -50,6 +50,11 @@
o->Origin.z = 0;
return (ObjPtr)o;
}
+
+int FPEqual(double d1, double d2) {
+ return fabs(d1-d2) < 0.000001L;
+}
+
ObjPointPtr
InsertPoint(ObjPtr o, double x, double y, double z)
{
@@ -82,7 +87,9 @@
tmp = o->Points;
/*Iterative search through the pointlist, as long as p==NULL point not found*/
while( ((tmp) != NULL) && (p == NULL) ){
- if( (tmp->P->x == x) && (tmp->P->y == y) && (tmp->P->z == z) )
+ if( FPEqual(tmp->P->x,x) &&
+ FPEqual(tmp->P->y,y) &&
+ FPEqual(tmp->P->z,z) )
{ /* We found the point in the list */
#ifdef DEBUG_OSYS
printf("Found (%2.2f,%2.2f,%2.2f,)\n",x,y,z);
@@ -248,8 +255,8 @@
if(o->Points != NULL)
tmp = o->Points;
while(tmp != NULL) {
- printf("Point[%i] = (%.2f, %.2f, %.2f)",i,tmp->P->x,tmp->P->y,tmp->P->z);
- printf(" -> (%.2f, %.2f, %.2f)\n",tmp->P->tx,tmp->P->ty,tmp->P->tz);
+ printf("Point[%i] = (%.2lf, %.2lf, %.2lf)",i,tmp->P->x,tmp->P->y,tmp->P->z);
+ printf(" -> (%.2lf, %.2lf, %.2lf)\n",tmp->P->tx,tmp->P->ty,tmp->P->tz);
++i;
tmp = tmp->NextPoint;
}return;
More information about the llvm-commits
mailing list