nothings / stb

stb single-file public domain libraries for C/C++

Home Page:https://twitter.com/nothings

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Long double support

martinlicht opened this issue · comments

Citing from the in source documentation:

This is a full sprintf replacement that supports everything that
the C runtime sprintfs support, including float/double, 64-bit integers,
hex floats, field parameters (%*.*d stuff), length reads backs, etc.

This should include formatted output of long double, which is part of the C standard (at least the current one) usually indicated by the length specififer L. For example, %Le. However, the allowed length do not include L:

// allowed types:  sc uidBboXx p AaGgEef n
// lengths      :  hh h ll j z t I64 I32 I

The C99 working draft defines printf with support for such floating-point numbers, see also 7.19.6:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
However, I don't know whether that feature was present in C pre-C99.

Another possibly relevant SO thread, regarding MSVC:
https://stackoverflow.com/questions/4089174/printf-and-long-double

I am wondering whether that is a conscious omission or any support for long double is planned, or whether it is practically feasible at all.