[A89] Re: what is wrong with atof()?!


[Prev][Next][Index][Thread]

[A89] Re: what is wrong with atof()?!




That's exactly what was wrong.  Thanks so much.  

Programming IS fun.  This is part of my first real (large) program, and
although it really doesn't do anything of practical importance, it's been
very fullfilling to write.

jon.k


On Sat, 8 Dec 2001 00:21:22 +0100 "Niklas Brunlid" <e96nbr@efd.lth.se>
writes:
> 
> I might have something here...
> 
> --- CODE ---
>         while(buffer[buffer_index] != '\0')
>         {
>          printf("%d ", (int)buffer[buffer_index++]);
>         }
> HERE==> temp[temp_index++] = atof(buffer);
>         //is_nan() returns true iff its argument is NAN 
> (Not_a_Number)
>         //if(is_nan(temp[temp_index]))
>         {
>          //puts("error reading number\n");
> HERE==>    printf("\n%s  %f\n", buffer, temp[temp_index]);
>         }
>        }
>       }
> --- CODE ---
> 
> 'temp_index' is incremented _after_ the atof() value is inserted, 
> but
> the value you print out is from 'temp' at the incremented index.
> 
> Programming is a lot of fun, but the hard and boring part is
> debugging, as we all learn at some point (I've learned it several
> times myself)... =)
> 
> --
>  / Niklas Brunlid
> Check out Prosit for the TI-89 / TI-92+ at http://prosit.ticalc.org
> Random PQF v5.1 Quote follows:
> 
> You can't remember the plot of the Dr Who movie because it didn't 
> have one,
> just a lot of plot holes strung together.
> 
> It did have a lot of flashing lights, though.   
>         -- (Terry Pratchett, alt.fan.pratchett)
> 
> 
> 
> 
> 
________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
http://dl.www.juno.com/get/web/.