You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2002/03/28 08:09:49 UTC
cvs commit: xml-xalan/c/src/PlatformSupport DoubleSupport.cpp
dbertoni 02/03/27 23:09:49
Modified: c/src/PlatformSupport DoubleSupport.cpp
Log:
Make sure we do floating-point modulus when necessary.
Revision Changes Path
1.30 +13 -1 xml-xalan/c/src/PlatformSupport/DoubleSupport.cpp
Index: DoubleSupport.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/DoubleSupport.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- DoubleSupport.cpp 26 Sep 2001 21:44:05 -0000 1.29
+++ DoubleSupport.cpp 28 Mar 2002 07:09:49 -0000 1.30
@@ -340,9 +340,21 @@
{
return theRHS;
}
- else
+ else if (theRHS == 0.0)
+ {
+ return getNaN();
+ }
+ else if (long(theLHS) == theLHS && long(theRHS) == theRHS)
{
return long(theLHS) % long(theRHS);
+ }
+ else
+ {
+ double theDummy;
+
+ double theResult = divide(theLHS, theRHS);
+
+ return modf(theResult, &theDummy) * theRHS;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org