diff --git a/src/isql/isql.epp b/src/isql/isql.epp index a26b936c1a..6befbaee9e 100644 --- a/src/isql/isql.epp +++ b/src/isql/isql.epp @@ -64,6 +64,10 @@ #include "../common/classes/ClumpletWriter.h" #include "../common/classes/TempFile.h" +#ifdef SOLARIS +#include +#endif + #ifdef HAVE_UNISTD_H #include #endif @@ -7066,6 +7070,39 @@ static processing_state passthrough(const char* cmd) } #endif +static bool checkSpecial(TEXT* const p, const int length, const double value) +{ +/************************************** + * + * c h e c k S p e c i a l + * + ************************************** + * + * Functional description + * Special case - Nan and Infinity. + * Some libraries (SFIO) work wrong with them. + * + **************************************/ + const TEXT* t = NULL; +#ifdef SOLARIS + if (IsNANorINF(value)) + { + t = IsINF(value) ? "Infinity" : "NaN"; + } +#endif + if (! t) + { + return false; + } + + if (List) { + isqlGlob.printf("%s%s", t, NEWLINE); + } + sprintf(p, "%*.*s ", length, length, t); + + return true; +} + static SSHORT print_item(TEXT** s, XSQLVAR* var, @@ -7215,6 +7252,12 @@ static SSHORT print_item(TEXT** s, // The bug appears in TCS DSQL_DOMAIN_12 and 13 // const double value = (double) *(float*) var->sqldata; + + if (checkSpecial(p, length, value)) + { + break; + } + #if defined(MINGW) if (value == 0) { sprintf(p, "% #*.*g ", length, @@ -7248,6 +7291,12 @@ static SSHORT print_item(TEXT** s, case SQL_DOUBLE: { const double value = *(double*) var->sqldata; + + if (checkSpecial(p, length, value)) + { + break; + } + // Don't let numeric/decimal doubles overflow print length // Special handling for 0 -- don't test log for length int rounded = 0; diff --git a/src/qli/picstr.cpp b/src/qli/picstr.cpp index ba5a5c03e2..f412ebf5c5 100644 --- a/src/qli/picstr.cpp +++ b/src/qli/picstr.cpp @@ -24,6 +24,11 @@ #include "firebird.h" #include #include + +#ifdef SOLARIS +#include +#endif + #include "../qli/dtr.h" #include "../qli/exe.h" #include "../qli/format.h" @@ -717,6 +722,14 @@ static void edit_float( const dsc* desc, pics* picture, TEXT** output) number = -number; } +#ifdef SOLARIS + if (IsNANorINF(number)) + { + sprintf(temp, IsINF(number) ? "Infinity" : "NaN"); + } + else +#endif + /* If exponents are explicitly requested (E-format edit_string), generate them. Otherwise, the rules are: if the number in f-format will fit into the allotted space, print it in f-format; otherwise print it in e-format.