i am a newbie and i have a problem with the following code.
I am running it on a PIC18F8722 using CCS and an ICD ..
output is 2.309e03..looks like the exponential part is not being considered or discarded...how can i correct the code?
float x;
char s = "2309.12e15";
x = atof(s);
printf("x = %e\n",x);
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
Posted: Mon Jul 29, 2013 3:52 pm
are you sure your char array input , correctly terminates with an ASCII Z??
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Mon Jul 29, 2013 4:17 pm
Where's your array ? Make 's' into an array by adding the brackets
shown in bold below and see what happens.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum