Fast answer:
1. You can compile apps with float and double in them because the desktop
operating system and Codewarrior's app knows them from ANSII programming.
If you try to run it on the device, it should crash.
2. Don't read the header file -- it is confusing. The functions listed are
OS traps and other intermediate functions that make it work. You are
looking into this too deeply.
It is simple:
double y, x, z;
y = 2.5
x = 1.25;
z = y + z;
To convert to a string using Palm's notation, you have to use FlpCompDouble.
For instance,
FlpCompDouble item;
Char blah[ ];
item.d = x;
StrFToA(blah, item.fd);
Elia
-----Original Message-----
From: Michael S. Davis [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 12, 1999 3:55 PM
To: [EMAIL PROTECTED]
Subject: Re: NewFloatMgr: Never Got Answer
On Mon, 12 Apr 1999, Dave Lippincott wrote:
> I believe you need to use the NewFloatMgr if you wish to use doubles and
> floats. The old way used structures and function calls to do floating
point
> math.
Now I'm more confused than ever. I thought I knew HOW to use NewFloatMgr
but I was confused by why it was necessary but...
This does not seem right. That IS what I thought the reason was but
there are float and double types available without using NewFloatMgr. And
MathLib library uses doubles and floats to provide functions and it does
not use NewFloatMgr.
So, that is what is confusing to me.
> Old way to add two floats:
> FloatType Answer,a,b;
>
> Answer = FplAdd(a, b);
>
> New way:
> float answer,a,b;
>
> answer = a + b;
I don't think this uses NewFloatMgr at all does it? The header for the
NewFloatMgr says to use _f_add(). NewFloatMgr uses structures same as
old way.
Maybe I need float 101 class.
Anyone else want to take a stab at explaining why NewFloatMgr is needed?
Maybe examples of what you can and cannot do? Aren't double and float
available already in gcc. I created a new project with NO NewFloatMgr.h
included and declared two variable types of float and double. It compiled
fine and I did not need NewFloatMgr.
I'm sure there is a good reason to use it but I don't see why it is
necessary. Detailed explanation anyone? I have also looked at apps
that don't use NewFloatMgr that do use float and double types.
> I'd use the NewFloatMgr simply because it is the way I'm use to working
with
> floating point numbers. The only drawback is there are no direct routines
or
> support to format and convert floats to strings.
>
> -----Original Message-----
> From: Michael S. Davis <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Date: Monday, April 12, 1999 4:40 PM
> Subject: NewFloatMgr: Never Got Answer
>
>
> >I asked this question a while back and never got an answer.
> >
> >"Why would/should one use NewFloatMgr instead of double, float,
> >etc?" Can someone list all the resons to use NewFloatMgr.
> >
> >Case in point, I also notice that MathLib, that everyone uses,
> >does not use NewFloatMgr and seems to do just fine.
> >
> >I know this has something to do with code size but are there
> >other reasons to use it?
> >
> >Thanks
> >
> >----------------------------------------------------
> >Shoot-to-Win
> >
> >Protect the 2nd Amendment
> >----------------------------------------------------
> >
> >
> >
>
>
>
>
----------------------------------------------------
Shoot-to-Win
Protect the 2nd Amendment
----------------------------------------------------