strtod() and sprintf() inconsistency under GCC and MSVC
Posted
by Dmitry Sapelnikov
on Stack Overflow
See other posts from Stack Overflow
or by Dmitry Sapelnikov
Published on 2010-03-23T11:10:43Z
Indexed on
2010/03/23
12:03 UTC
Read the original article
Hit count: 267
I'm working on a cross-platform app for Windows and Mac OS X, and I have a problem with two standard C library functions:
strtod()
- string-to-double conversionsprintf()
- when used for outputting double-precision floating point numbers)
Their GCC and MSVC versions return different results.
I'm looking for a well-tested cross-platform open-source implementation of those functions, or just for a pair of functions that would correctly and consistently convert double to string and back.
I've already tried the clib GCC implementation, but the code is too long and too dependent on other source files, so I expect the adaptation to be difficult.
What implementations of string-to-double and double-to-string functions would you recommend?
© Stack Overflow or respective owner