[comp.sys.next] Problem reading float with %g

kirchner@umn-cs.cs.umn.edu (Roger B. Kirchner) (04/11/91)

Can anyone explain why I can't seem to read in a float value using %g?

localhost> cat test.c
main()
{
  double x, y, z;

  printf("Enter three floats: ");
  scanf("%le %lf %lg", &x, &y, &z);
  getchar();
  printf("%e %e %e\n", x, y, z);
}

localhost> cc test.c
localhost> a.out
Enter three floats: 3.14 3.14 3.14
3.140000e+00 3.140000e+00 6.366020e-314
localhost> 

Thanks.
Roger Kirchner rkirchne@mathcs.carleton.edu