#include <stdio.h>
#include <float.h>
#include <math.h>

static inline int gdigits(double d, int precision)
{
    return precision - (int) log10(d) - 1;
}

static void test_scanf(const char *s)
{
    double x1, x2;

    if ((sscanf(s, "%lf %lf", &x1, &x2)) == 2)
    {
        printf("Input: %s\n", s);
        printf("Exponential form: %e, %e\n", x1, x2);
        printf("Digits for default precision (6): %d %d\n", gdigits(x1, 6), gdigits(x2, 6));
        printf("With default precision (6): %g %g\n", x1, x2);
        printf("Digits for precision (7): %d %d\n", gdigits(x1, 7), gdigits(x2, 7));
        printf("With custom precision (7): %#.7g %#.7g\n", x1, x2);
        printf("With even more precision (32): %.32g %.32g\n", x1, x2);
        puts("");
    }
    else
    {
        printf("%s: invalid input.\n", s);
    }
}
 
int main(void)
{
    test_scanf("1495.952 934.023");
    test_scanf("6369.015 66159.129");
}
 