Testing for numerics

Mark Smith mark at maseurope.net
Wed Oct 4 22:11:17 EDT 2006

I think this can be simpler:

return (pValue is an integer) AND (pValue >= 0)

Obviously, if it's an integer, it's also a number, and in this  
context it might be better to avoid 'trunc' since in some  
circumstances, (there is a thread from a while back about this) trunc  
returns a non-integer result.

I'm still not clear on whether zero is positive, though, especially  
since we can have -0 and +0 apparently, though being mathematically  
unsophisticated I'd have thought them equal, except to a dumb computer!



On 5 Oct 2006, at 01:13, FlexibleLearning at aol.com wrote:

> function  isPositiveInteger pValue
> return (pValue is a number) AND (pValue  >=0) AND (trunc(pValue) 
> =pValue)
> end isPositiveInteger

More information about the use-livecode mailing list