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


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

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




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)






References: