On Mar 14, 2:10 pm, Rui Maciel <rui.mac...@gmail.com> wrote:
> Pete Becker wrote:
> > Rui Maciel wrote:
> >> Is it possible to test a given string using standard C++
> >> routines to check if it describes an integer or a floating
> >> point number?
> > Only if you say what you mean by "describes an integer or a
> > floating point number". A string means whatever you
> > interpret it to mean. "1.1" can describe the integer 1, or
> > it can describe the floating point value 1.1, or it can
> > describe the floating point value 1.0, or a host of other
> > things.
> As we are talking about a syntax used to represent numbers, I
> don't believe that there could possibly be any ambiguity in
> this subject. It is pretty clear that, in this context, the
> string "123.0" represents a floating point number while the
> string "123" represents an integer.
Why? (In most of the work I'm doing at present, "123"
represents a floating point value.)
--
James Kanze
|