Thanks for your help.. For your information, and others who read the group,
I found this routine in a search through the archives. I have modified it
slightly to make it a bit tighter. Original credits go to Steve Mann
[EMAIL PROTECTED] - thanks Steve!
FlpFloat GetFloatFromString(Char* s)
{
Char leftstr[12], rightstr[12];
FlpCompFloat leftval, rightval, result;
Int16 j=0, k=0;
// strip off LHS of number
for(j = 0; (s[j] != '\0') && (s[j] != '.'); j++) leftstr[j] = s[j];
leftstr[j] = '\0'; // done, terminate it
// strip off RHS of number
if(s[j] == '.') j++;
while(s[j] != '\0') rightstr[k++] = s[j++]; // get RHS
rightstr[k] = '\0'; // done, terminate it
// convert the two parts to floating point #s
leftval.f = (float) StrAToI(leftstr);
rightval.f = (float) StrAToI(rightstr);
// convert RHS to proper fraction
for(j = 1;j <= StrLen(rightstr); j++) rightval.f /= 10.0;
// combine and return results
result.f = leftval.f + rightval.f;
return result.ff;
}
Regards,
Alan Ingleby
Systems Developer
ProfitLink Consulting Pty Ltd
309 Burwood Road
Hawthorn
Victoria 3122
"Peter Epstein" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> At 01:11 PM 11/2/2000, Alan Ingleby wrote:
> >I think I know what you mean. I have dug a bit deeper into my code, and
> >noticed that FlpAToF("88888888") works fine, it's just when you add the
> >".00" on the end it doesn't work.
> >
> >I don't suppose anyone knows of a simple function to do this conversion
> >manually?? I'd really appreciate the help here, thanks!
>
> I don't know of any simple way to do this if you need to handle more than
8 (or whatever the limit is) non-zero digits. You can easily parse the
digits yourself to generate an integer, but the integer needs to be big
enough to hold all the digits, and that's going to require 64 bit math. Or,
you can break your string in half and convert each half to floating point.
If you adjust the exponents properly, you should be able to make this work.
> --
> Peter Epstein
> Palm Inc. Developer
>
>
>
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/