Qt 4.8
Classes | Namespaces | Functions
qdecimal_p.h File Reference
#include "qschemanumeric_p.h"

Go to the source code of this file.

Classes

class  QPatternist::Decimal
 Implements the value instance of the xs:decimal type. More...
 

Namespaces

 QPatternist
 The namespace for the internal API of QtXmlPatterns.
 

Functions

Q_CORE_EXPORT char * qdtoa (double d, int mode, int ndigits, int *decpt, int *sign, char **rve, char **resultp)
 

Function Documentation

◆ qdtoa()

Q_CORE_EXPORT char* qdtoa ( double  d,
int  mode,
int  ndigits,
int *  decpt,
int *  sign,
char **  rve,
char **  resultp 
)

Defined in QtCore's qlocale.cpp.

Definition at line 2271 of file qlocale_tools.cpp.

Referenced by _qdtoa(), QLocalePrivate::doubleToString(), QPatternist::AbstractFloat< isDouble >::stringValue(), and QPatternist::Decimal::toString().

2272 {
2273  // Some values of the floating-point control word can cause _qdtoa to crash with an underflow.
2274  // We set a safe value here.
2275 #ifdef Q_OS_WIN
2276  _clear87();
2277  unsigned int oldbits = _control87(0, 0);
2278 #ifndef MCW_EM
2279 # ifdef _MCW_EM
2280 # define MCW_EM _MCW_EM
2281 # else
2282 # define MCW_EM 0x0008001F
2283 # endif
2284 #endif
2286 #endif
2287 
2288 #if defined(Q_OS_LINUX) && !defined(__UCLIBC__)
2289  fenv_t envp;
2290  feholdexcept(&envp);
2291 #endif
2292 
2293  char *s = _qdtoa(d, mode, ndigits, decpt, sign, rve, resultp);
2294 
2295 #ifdef Q_OS_WIN
2296  _clear87();
2297 #ifndef _M_X64
2298  _control87(oldbits, 0xFFFFF);
2299 #else
2300  _control87(oldbits, _MCW_EM|_MCW_DN|_MCW_RC);
2301 #endif //_M_X64
2302 #endif //Q_OS_WIN
2303 
2304 #if defined(Q_OS_LINUX) && !defined(__UCLIBC__)
2305  fesetenv(&envp);
2306 #endif
2307 
2308  return s;
2309 }
double d
Definition: qnumeric_p.h:62
#define _control87
static char * _qdtoa(NEEDS_VOLATILE double d, int mode, int ndigits, int *decpt, int *sign, char **rve, char **digits_str)
static int sign(int x)
#define MCW_EM