|
From: Ethan M. <merritt@u.washington.edu> - 2007-06-13 15:54:40
|
On Wednesday 13 June 2007 00:19, Petr Mikulik wrote:
> > > > I think you can use simply
> > > > if (isanumber(c_token)) {
> > > > act on integer
> > > > }
> >
> > Unfortunately not.
> > "isanumber" is mis-named. It really acts as "isapositivenumber".
> > The reason is that the tokensiser places the - sign into its
> > own separate token. So isanumber(c_token) sees only the '-' sign,
> > no number.
> >
> > This has annoyed me many times, but never sufficiently to
> > replace isanumber() with something better.
>
> Does this mean that it is not possible to add a function "isaninteger()"
> that woul work for negative numbers as well?
Better to fix "isanumber()" to do what it claims.
But then you would have to check and clean up all the call sites.
Not hard, just tedious.
--
Ethan A Merritt
|