Path: utzoo!utgpu!water!watmath!clyde!att!ucbvax!UMass.BITNET!Gribnif From: Gribnif@UMass.BITNET (Dan Wilga) Newsgroups: comp.sys.atari.st Subject: Re: problem with mwc atoi(), version 2.0.1 Message-ID: <88092922342756E.BGJC@Mars.UCC.UMass.EDU> Date: 30 Sep 88 02:43:22 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 18 I believe the problem with the following: > printf("%d %d %s %d %d %d\n", > x, i, argv[i], (double) x / MAXVAL, atoi(argv[i]), > (double) x / MAXVAL * atoi(argv[i]) + 1); is not in the atoi() function, but in an incorrect printf() format spec. Since the two calculations involving "x" are typed to "(double)", the format spec must be "%f", "%e", or "%g" for these two numbers. Otherwise what happens is that printf() reads an incorrect value off the stack. In order to use floating-point printf() routines under MWC, you must also compile with the -f (or -VFLOAT) option. Dan Wilga Gribnif@UMASS.Bitnet