Floats : out of range
NotSqrt opened this issue · 4 comments
Hi,
What is missing exactly to support double
numbers ?
I see the message in the tests :
Lines 1016 to 1017 in 21a282a
Maybe for the moment, a message can be added to the caveats in the README :
Double precision is not supported and will result in an empty string.
Thanks !
Is that due to this ?
Lines 322 to 326 in c235b5c
This is the only missing feature I found compared to xprintfc
(which is a bit smaller but not compliant with the standard, and not really tested).
They use this code to handle floats : https://github.com/MarioViara/xprintfc/blob/8f07c7c0d76370cdb44dbaee81f1f4201b1e7561/src/xformatc.c#L773
and their tests use printf("Floating > 32 bit %f",pow(2.0,32.0)+1.0);
I think, FP support is not completely and satisfying implemented by now. Exponential representation is missing, too.
I didn't support the double
type in the fist way, just because it's not so common in embedded systems and you can always cast a float
down to a double
.
Have you seen this? https://github.com/ulfjack/ryu
It seems like it might still be experimental for C, but looks very promising...
This is closed by 4.0.0