gcvt() gives inconsistent values in linux and windows, and is deprecated.
Example:
char no[100];
double x = 0.00949999999998;
gcvt(x, 16, no);
printf("%s", no);
In windows it gives – 9.4999999998e-003
In linux it gives – 0.0094999999998
In linux, it gives the output string in exponent format when the value is very small.
I’m unable to find a function that gives consistent output (closely mimicking gcvt() in linux) irrespective of platform.
I tried using snprintf() and some other functions, but although it gives consistent output across windows and linux, it doesn’t mimic gcvt(). I wanted the newer function to closely mimic the linux behaviour.