Index: trunk/psLib/src/db/psDB.c
===================================================================
--- trunk/psLib/src/db/psDB.c	(revision 8112)
+++ trunk/psLib/src/db/psDB.c	(revision 8113)
@@ -12,6 +12,6 @@
  *  @author Joshua Hoblitt
  *
- *  @version $Revision: 1.74 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-08-04 02:01:56 $
+ *  @version $Revision: 1.75 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-08-04 02:16:58 $
  *
  *  Copyright (C) 2005-2006  Joshua Hoblitt, University of Hawaii
@@ -23,4 +23,5 @@
 #include <stdarg.h>
 #include <string.h>
+#include <float.h>
 #undef __STRICT_ANSI__
 #include <stdlib.h>
@@ -1581,10 +1582,16 @@
 
     // stringify the psMetadataItem into a SQL search specification
+    // XXX we're making a big assumption here that the MySQL server handles
+    // floating point in the exact same way as the client.  This is a bit scary
+    // as MySQL uses native types on the server end.  In theory all IEEE754
+    // math is the same but know that isn't always the case.  At least forcing
+    // the comparison to be done on the server provides some consistency
+    // between clients on different archs.
     if ((item->type == PS_DATA_S32) || (item->type == PS_TYPE_S32)) {
         psStringAppend(&query, "%s=%d", item->name, (int)(item->data.S32));
     } else if ((item->type == PS_DATA_F32) || (item->type == PS_TYPE_F32)) {
-        psStringAppend(&query, "%s=%g", item->name, (double)(item->data.F32));
+        psStringAppend(&query, "ABS(%s - %d) < %f.6", item->name, (int)(item->data.S32), FLT_EPSILON);
     } else if ((item->type == PS_DATA_F64) || (item->type == PS_TYPE_F64)) {
-        psStringAppend(&query, "%s=%g", item->name, (double)(item->data.F64));
+        psStringAppend(&query, "ABS(%s - %d) < %f.10", item->name, (int)(item->data.S32), DBL_EPSILON);
     } else if ((item->type == PS_DATA_BOOL) || (item->type == PS_TYPE_BOOL)) {
         psStringAppend(&query, "%s=%d", item->name, (int)(item->data.B));
