[comp.sys.mac.hypercard] Do integers stop at 2^30?

ns@cat.cmu.edu (Nicholas Spies) (09/19/88)

Somewhere between 2^29 and 2^30 the integer divide 'div' in HyperTalk quits,
at least in V1.2, with a dialog saying "Can't understand 1073741824."

I find this rather odd, because floating divide '/' seems to have no trouble
with numbers this big, and much bigger, and 'div' can be synthesized with
trunc(n1 / n2). For consistancy, div should work for big numbers, too.

Another oddity is that a leading '+' as in '+1234' causes HyperCard to gag,
so it you have to do extra string stuff if you want to display, and then use,
a table of numbers with leading plus as well as minus signs.

The "HyperCard Script Language Guide: The HyperTalk Language" is definitely
a pleasure to use, but it looks as if you have to get the Standard Apple
Numerics Environment manual to hear the full dope on the way numbers are
handled in HyperTalk (see p. 44). Future editions of the Guide should at
least publish numeric limits, in an Appendix like "HyperCard Limits".

HyperTalk would profit from having some more functions for parsing,
particularly since numbers are represented as strings... for instance:

IsADigit(c) -- return true if c is a digit
IsALetter(c) -- returns true if c is A-Z, a-z
...and even better...
ParseNum(text) -- extract first number in text e.g. "fd234dfd" -> 234
ParseTo(text,string) -- return text up to any character in string
ParseFrom(text,string) -- return text from any character in string



-- 
Nicholas Spies			ns@cat.cmu.edu.arpa
Center for Design of Educational Computing
Carnegie Mellon University

dan@Apple.COM (Dan Allen) (09/21/88)

In article <3047@pt.cs.cmu.edu> ns@cat.cmu.edu (Nicholas Spies) writes:
>Somewhere between 2^29 and 2^30 the integer divide 'div' in HyperTalk quits,
>at least in V1.2, with a dialog saying "Can't understand 1073741824."
I believe this bug has been fixed, but I thought it was fixed in 1.2.
Perhaps it is in a later version that it is fixed.  Could you send a one
line test case?

>IsADigit(c) -- return true if c is a digit
>IsALetter(c) -- returns true if c is A-Z, a-z
>...and even better...
>ParseNum(text) -- extract first number in text e.g. "fd234dfd" -> 234
>ParseTo(text,string) -- return text up to any character in string
>ParseFrom(text,string) -- return text from any character in string

Good ideas.  We'll see what we can do for 2.0...

Dan Allen
Apple