July 21, 2004 long and double | ||||
---|---|---|---|---|
| ||||
What's wrong with my code? #include <stdio.h> #include <stdlib.h> #include <string.h> void main(void) { double db; long lg; lg = 316; db = lg+1; printf("lg=%d db=%f\n",lg,db); printf("db=%f\n",db); } dmc -ml test.cpp When execute it show lg=316 db=-23158417847463241000000000000000000000000000000000000000000000000000 0000000000.000000 db=317.000000 |
July 21, 2004 Re: long and double | ||||
---|---|---|---|---|
| ||||
Posted in reply to TpW | TpW wrote: > What's wrong with my code? > > #include <stdio.h> > #include <stdlib.h> > #include <string.h> > > void main(void) > { > double db; > long lg; > lg = 316; > db = lg+1; > printf("lg=%d db=%f\n",lg,db); try: printf ( "lg=%ld db=%f\n", lg, db ); > printf("db=%f\n",db); > } > > dmc -ml test.cpp > > When execute it show > lg=316 db=-23158417847463241000000000000000000000000000000000000000000000000000 > 0000000000.000000 > db=317.000000 > > -- ManiaC++ Jan Knepper But as for me and my household, we shall use Mozilla... www.mozilla.org |
Copyright © 1999-2021 by the D Language Foundation