Posted by Jim Guerber (66.8.131.115) on December 04, 2004 at 08:40:24:
In Reply to: MTB NUM FUNCTION posted by Bruce Jordan on October 01, 2004 at 11:34:53:
The problem with the num function is that it does not have the information about how its result is to be used. It can appear as a term in an expression such as i = j * num(a$,err)+3.
So, if x is 16.2,
x = num(a$,err)
Might not work depending on the size of the value of a$.
But,
Print(#)a$ & input(#)x will always work because the input statement DOES know the specs of x.
We could make a new function called convert which would result in a success or failure indicator and be supplied with the string to convert and the numeric variable to convert to. Is that what you want?
Err=convert(a$,x)
Would be the syntax. This function would put the numeric result into x and result in either a 0 for success or a 1 for failure -- kind of like the num function turned inside out.