> >Is there a way I can determine how many decimal
> >positions that float value has?
yes.. dont use the "float" or "double" type :)
store you numbers in integer variables only :) when you want
2 decimal places, divide everything by 100 :)
ie: 1.00 is represented as 100
2.00 is
"John Marshall" <[EMAIL PROTECTED]> wrote in message
news:41474@palm-dev-forum...
>
> Ben Combee <[EMAIL PROTECTED]> wrote:
> > Huh? CW honors the \0 escape for both character literals and strings.
I
> > should know -- I rewrote a lot of that escape parsing code.
> [...]
> > The problem here is a
Ben Combee <[EMAIL PROTECTED]> wrote:
> Huh? CW honors the \0 escape for both character literals and strings. I
> should know -- I rewrote a lot of that escape parsing code.
[...]
> The problem here is actually that the user is specifying a string of 11
> characters -- even with the escaped NULs
> From: Ben Combee
>
> Huh? CW honors the \0 escape for both character literals and strings. I
> should know -- I rewrote a lot of that escape parsing code. You might be
> confused by the debugger display. When the CW debugger shows a string, it
> will show it in escaped C string format, altho
>Is there a way I can determine how many decimal
>positions that float value has?
Not as far as I know. Floating point numbers may have infinite
precision. For instance, a number like 1.56 may be actually stored as
1.5999. Using simple arithmetic means, you have no way of
determining i
hi all.
A while back I also ran into the problem of how to convert floats to strings
and back. I was *astounded* to discover the permitted impreciseness
required of float in order to be standards conforming (according to "the C
language", 2nd edition). FLT_EPSILON = 1e-5 and
DBL_EPSILON =
"Richard Burmeister" <[EMAIL PROTECTED]> wrote in message
news:41361@palm-dev-forum...
>
> > From: HowY
> >
> > Char mantissaStr[10]="\0\0\0\0\0\0\0\0\0\0";
> > Char dispMantissaStr[10]="\0\0\0\0\0\0\0\0\0\0";
> >
>
> HowY,
>
> I don't know about GCC, but with CW the above statements are not cor
> > Char mantissaStr[10]="\0\0\0\0\0\0\0\0\0\0";
> > Char dispMantissaStr[10]="\0\0\0\0\0\0\0\0\0\0";
>
> HowY,
>
> I don't know about GCC, but with CW the above statements are not correct.
> You allocate 10 bytes for each string, then assign 21 bytes to each. '\0'
> is the char which == 0. "
> From: HowY
>
> Char mantissaStr[10]="\0\0\0\0\0\0\0\0\0\0";
> Char dispMantissaStr[10]="\0\0\0\0\0\0\0\0\0\0";
>
HowY,
I don't know about GCC, but with CW the above statements are not correct.
You allocate 10 bytes for each string, then assign 21 bytes to each. '\0'
is the char which == 0.
Hi David
I'll chime in here but I'm often on the wrong track compared to the talent
you'll find on this list. My float experience is from older os'es ie pre
3.5
using newfloatmgr.h. not knowing what is passed to your .prc i'll toss
you this incase it's a FloatType.
This function snippit retur
Unfortunately, I don't have that luxury. My App is a plug-in to another and
I'm being passed a float value so I can't control that side of it.
Dave
Peter Epstein <[EMAIL PROTECTED]> wrote in message
news:41307@palm-dev-forum...
>
> This may be one of those situations where you should use a fixe
This may be one of those situations where you should use a fixed point representation
rather than floating point. The problem with floating point binary representations is
that they can't exactly represent simply values like 8.95, introducing the possibility
of round-off errors. For example, th
sible to base it on the number itself.
Mike
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of David
Leland
Sent: Thursday, March 01, 2001 11:21 AM
To: Palm Developer Forum
Subject: Re: Determining number of decimal positions
But that's what my prob
e force, but it works.
>
> Mike
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of David
> Leland
> Sent: Thursday, March 01, 2001 10:00 AM
> To: Palm Developer Forum
> Subject: Re: Determining number of decimal positi
ng
I know it is kind of brute force, but it works.
Mike
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of David
Leland
Sent: Thursday, March 01, 2001 10:00 AM
To: Palm Developer Forum
Subject: Re: Determining number of decimal positions
I was afraid tha
I was afraid that might be the case. So let me ask hypothetically, if the
Palm OS supported the "%f" formatting modifier on the StrPrintF function
(e.g. returnedString = StrPrintF("%f", floatValue);), what value would be
placed into returnedString if the float values were:
12.3450
123.400
1234.5
By "number of decimal places" do you mean the number before the decimal, the
number after, or both?
1) For the number before the decimal place: I don't know of a built-in
function, but you could use a small piece of code like the following to
count the number of places:
int CountDigits (float
17 matches
Mail list logo