Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!agate!jif!lippin From: lippin@jif.berkeley.edu (The Apathist) Newsgroups: comp.sys.mac.programmer Subject: Re: Who has hacked numeric TEdit?. Message-ID: <25190@agate.BERKELEY.EDU> Date: 2 Jun 89 07:43:22 GMT References: <1076@mailrus.cc.umich.edu> <11722@well.UUCP> <16413@paris.ics.uci.edu> Sender: usenet@agate.BERKELEY.EDU Reply-To: lippin@math.berkeley.edu Organization: Authorized Service, Incorporated Lines: 29 Recently Alastair Milne wrote: [...] > Now for the nasty part. I assuming we've been thinking so far about the > entry of integers. What about real numbers? I may just have missed it, but > I don't recall seeing any standards in I-M for real number format (beyond > the settings of components that differ between countries.) Having worked > on CAI material for some years, where such entry has to be made very > tolerant for students who've never used a computer before, I can attest the > number of difficulties to consider. Are there any standards for this? If you use the SANE routines (Str2Dec and a call to fp68k) to convert strings to numbers, you get error codes if the input isn't right. I haven't seen much documentation on how to use SANE, but it's not too hard to figure out from the Apple Numerics Manual (which I've only seen the preliminary edition of), and from looking through the files and the math libraries (in LSC; your development system may vary.) I found it worth knowing -- the routines are very versatile, and they make your code more internationally compatible. I even use the SANE routines to check the validity of integer input. In addition to using the SANE checks, you should, of course, check the range of your input, and also check that it is not a NAN (that is, a not-a-number). --Tom Lippincott lippin@math.berkeley.edu "Ask a fish head anything you want to. It won't answer you; they can't talk."