[comp.sys.apple] problem with calculations in an NDA

hartkopf@tramp.Colorado.EDU (Jeff Hartkopf) (08/19/89)

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

jazzman@claris.com (Sydney R. Polk) (08/19/89)

From article <10862@boulder.Colorado.EDU>, by hartkopf@tramp.Colorado.EDU (Jeff Hartkopf):
> 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.

You probably have to start up SANE yourself since that is most certainly
how your complier deals with extended.  AWGS starts SANE up for the
Spreadsheet and the Database.


-- 
Syd Polk           | Wherever you go, there you are.
jazzman@claris.com | Let the music be your light.
GO 'STROS!         | These opinions are mine.  Any resemblence to other
GO RICE!           |  opinions, real or fictitious, is purely coincidence.