Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!boulder!tramp!hartkopf
From: hartkopf@tramp.Colorado.EDU (Jeff Hartkopf)
Newsgroups: comp.sys.apple
Subject: problem with calculations in an NDA
Message-ID: <10862@boulder.Colorado.EDU>
Date: 18 Aug 89 20:24:28 GMT
Sender: news@boulder.Colorado.EDU
Reply-To: hartkopf@tramp.Colorado.EDU (Jeff Hartkopf)
Organization: University of Colorado, Boulder
Lines: 30

I have a question about an NDA I am programming.  It is a calculator
NDA, and so far it can do the basic calculations on any numbers (integers
or floating point).  I'm writing it in TML Pascal, but have tried it in
Orca/C and have had the same problem.  Everything works fine when I use
the NDA from most programs (including AppleWorks GS, Vaccine II, Advanced
Disk Utilites, Sound Studio, TML Pascal); however, in a few programs including
the Finder, Installer, and SHRConvert, the calculations don't work right.  The
correct behavior, which works in most programs, is when I enter ".3 =" on the
calculator, ".3" appears on the display, and whenever I press "=" thereafter,
a ".3" remains on the display.  However, in the programs with which the NDA
does not work, when I enter ".3 =", a ".299999999" appears on the display,
and when I continue to press "=" the number decrements by .000000001 each
time; i.e. it goes from ".299999999" to ".299999998" to ".299999997", etc.
Entering integer numbers works fine from all programs.

Now what could possibly be causing this?  I'm only using the standard TML
Pascal operations (+, -, *, and /) on variables of type real (extended), and
then converting them to strings via the RealToString() call to display on the
calculator disply.  What is going wrong when I run the NDA under the Finder
and some other programs?  Every program I've tried that I know is written
with TML Pascal works with it.  Also, in AWGS (which I don't think is
written in Pascal :-)) it works fine.  Is there some toolset which I'm
supposed to start up for just basic operations like that, which happens
to be loaded by the programs it works under, and not by the others?
Any insights into this problem would be greatly appreciated.

Jeff Hartkopf

Internet:
hartkopf@tramp.Colorado.EDU