Article View: comp.sys.atari.st
Article #34308Re: problem with mwc atoi(), version 2.0.1
From: Dan Wilga
Date: Fri, 30 Sep 1988 02:43
Date: Fri, 30 Sep 1988 02:43
18 lines
1010 bytes
1010 bytes
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
Technical Details
Message-ID:
<88092922342756E.BGJC@Mars.UCC.UMass.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!ucbvax!UMass.BITNET!GribnifShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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