|
Barbara,
-mark
"M. Lazarus" wrote: > > Bob, > > I'm not at the /400 right now, but would this work (assuming atof was > prototyped properly)? > > IntValue = AtoF( '123456E+4' ) >
It would be safer to use
eval(h) IntValue = AtoF(string)
As a rule of thumb, always use (H) when assigning from float to non-float.
The mantissa parts of the float values for 123456, 1.23456, .000123456, 1234560000 etc. are all the same, either 1.23456, or maybe .123456, I forget which. Either way, there are values after the decimal point even though the actual number may have no decimal places. Not all decimal fractions can be stored exactly in floating point, because floating point is stored in binary format.
It's possible for a number like say 12345 to be stored as .1234499999999e5. If you use EVAL to assign this to an integer value, you would get 12344. Using EVAL(H) would give you 12345. (12345 is just a made up example - I wish I had a real example to show that using EVAL without half-adjust might not give the right result sometimes.)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.