Index: xpath.c
===================================================================
RCS file: /cvs/gnome/libxml2/xpath.c,v
retrieving revision 1.302
diff -u -r1.302 xpath.c
--- xpath.c	10 Mar 2006 13:40:16 -0000	1.302
+++ xpath.c	7 Apr 2006 08:43:35 -0000
@@ -1391,6 +1391,8 @@
 static void
 xmlXPathFormatNumber(double number, char buffer[], int buffersize)
 {
+    double fraction, integer;
+	    
     switch (xmlXPathIsInf(number)) {
     case 1:
 	if (buffersize > (int)sizeof("Infinity"))
@@ -1406,16 +1408,15 @@
 		snprintf(buffer, buffersize, "NaN");
 	} else if (number == 0 && xmlXPathGetSign(number) != 0) {
 	    snprintf(buffer, buffersize, "0");
-	} else if (number == ((int) number)) {
+	} else if ((fraction = modf(number, &integer)) == 0) {
 	    char work[30];
 	    char *ptr, *cur;
-	    int value = (int) number;
 
             ptr = &buffer[0];
-	    if (value == 0) {
+	    if (integer == 0) {
 		*ptr++ = '0';
 	    } else {
-		snprintf(work, 29, "%d", value);
+		snprintf(work, 29, "%.0f", integer);
 		cur = &work[0];
 		while ((*cur) && (ptr - buffer < buffersize)) {
 		    *ptr++ = *cur++;
