nan vs. -nan fix to make inf-tests work under Linux

felipesanches-svg
Marius Kintel 2012-02-18 18:37:26 +01:00
parent a232426798
commit 6652ede2c2
1 changed files with 4 additions and 0 deletions

View File

@ -426,6 +426,10 @@ std::string Value::toString() const
// Quick and dirty hack to work around floating point rounding differences
// across platforms for testing purposes.
{
if (this->num != this->num) { // Fix for avoiding nan vs. -nan across platforms
stream << "nan";
break;
}
std::stringstream tmp;
tmp.precision(12);
tmp.setf(std::ios_base::fixed);