IsNumeric question

  • Thread starter Thread starter Ronald
  • Start date Start date
R

Ronald

Hi all.

When I use IsNumeric on "113D2", I get True.
When I do Val("113D2"), I get 11300 as a result.
I cannot find anything about this in Help.
Please help me.

Thanks.
 
Ronald said:
Hi all.

When I use IsNumeric on "113D2", I get True.
When I do Val("113D2"), I get 11300 as a result.
I cannot find anything about this in Help.


As noted in the Help file topic for the Val() function, "The Val function
stops reading the string at the first character it can't recognize as part
of a number. Symbols and characters that are often considered parts of
numeric values, such as dollar signs and commas, are not recognized."

However, the IsNumeric function is more flexible (or flawed, depending on
your point of view), and accepts a variety of different forms of numeric
expressions that, so far as the function is concerned, "can be evaluated as
a number." In particular, suffixes of the form "D#" or "E#" (where # is one
or more numeric digits) are used in scientific (or "exponential") notation
to indicate powers of 10: 1E2 and 1D2 are both equivalent to "1 times 10 to
the 2nd power", or 100.
 
Here is a function that will evaluate each character in the string and return
True if each is a numeric value or False if it contains any nonnumeric
character. It also returns False if you pass it a Null value.

The problems with the D or E as Dirk pointed out do not happen if you
evaluate just the one character.
 
Ronald said:
When I use IsNumeric on "113D2", I get True.
When I do Val("113D2"), I get 11300 as a result.
I cannot find anything about this in Help.


As noted ny everyone else, the D indicates a (double)
floating point number in scientific notation.

Instead of using IsNumeric, try using:

Not field Like "*[!0-9]*"

to test for all numeric digits. It will also reject numbers
with a + or -
 
Hi all.

When I use IsNumeric on "113D2", I get True.
When I do Val("113D2"), I get 11300 as a result.
I cannot find anything about this in Help.
Please help me.

Thanks.

Those of us old enough to remember Fortran IV or PL/I will recognize
"Scientific Notation": 113E2 would be notation for 113 times 10 to the power
of 2 ("E" being "Exponent"), as a Floating Point Single number. 113D2 is
exactly the same, except that it's a Double Precision Floating Point number.

Try 113D56 just for kicks...
 
Back
Top