c++ – Ask for suggestion: data type for parsing stringified fractional numbers


I am the author of a C library for parsing INI files. So far I have delegated the task of parsing values as numbers to the standard atoi() family of functions. However I think time has come that I provide my specific functions for parsing numbers, since in INI files a number can be notated in octal, hexadecimal, etc., and there are a few more things in which I would like to specialize my own code.

Everything good so far. I have written two functions that are nearly-identical except for the data type. One parses integers, the other one parses fractional numbers. I have no doubts that the one that parses integers should return an intmax_t type. But what about the one that parses fractional numbers? Should that return a double or a long double?

Mine is a very general purpose library, it can be used in all kind of contexts, from embedded systems to desktop applications, and the INI files can be of all kinds. Whatever I choose now I will have to stick to it for a while, since changing the data type will break the binary compatibility.

So the question is: double or long double for parsing fractional INI values?