Subject | [IBO] Re: DisplayFormat Problem |
---|---|
Author | stanw1950 |
Post date | 2002-07-19T01:06:22Z |
Geoff,
You bring up an point that has bothered me for a long time, one that
I asked in the ib newsgroup a while back and never got an answer. As
you say, the manual says that floats only have 7 significant digits.
But if I look at the values of float fields in our database I
see .0979999974370003 and 165.440002441406 (as examples). Both of
these numbers have, by the mathematical definition of significant
digits, 15, not 7, significant digits. What definition of significant
digits is the manual using? It's not the mathematical one.
As to my problem, could you (or anybody) give me an example of an
edit mask that displays 3 decimal positions? Our database only has
float fields for numbers that have decimal positions. It was a
decision that was made 5 years ago and seemed like a good idea at the
time.
Thanks for the response.
Stan Walker
You bring up an point that has bothered me for a long time, one that
I asked in the ib newsgroup a while back and never got an answer. As
you say, the manual says that floats only have 7 significant digits.
But if I look at the values of float fields in our database I
see .0979999974370003 and 165.440002441406 (as examples). Both of
these numbers have, by the mathematical definition of significant
digits, 15, not 7, significant digits. What definition of significant
digits is the manual using? It's not the mathematical one.
As to my problem, could you (or anybody) give me an example of an
edit mask that displays 3 decimal positions? Our database only has
float fields for numbers that have decimal positions. It was a
decision that was made 5 years ago and seemed like a good idea at the
time.
Thanks for the response.
Stan Walker
--- In IBObjects@y..., Geoff Worboys <geoff@t...> wrote:
> > I guess the native ibo components don't work that way and I need
an
> > editmask. When the float field is displayed, I want to show (for
> > example) 4 decimal positions. When the user tabs into the field in
> > edit mode I want only 4 decimal positions to display, but the user
> > can type in more. When the user tabs to the next field, I want 4
> > decimal positions to display again. I can't come up with the
proper
> > editmask That's my problem. I've tried '0.0000' and '#.###' and
only
> > get weird results. I can't find any samples of editmasks. Thanks
> > again.
>
> You want the user to be able to type in more than 4 decimal places,
> but do you want that additional information to be relevant? (That
> is; do you want that additional information stored?) I must say
that
> I do not approve of having more that 4 places stored but only
showing
> 4 places to the user.
>
> You keep mentioning "float". In my experience the float data type
is
> next to useless. If I need floating point I always using double,
even
> when the number of digits required is only 4 or 5 (such as
percentages
> etc). float only supports up to 7 digits of significance and you
> quickly run into round issues that show up even before that number
of
> digits. (The "significance" is still OK because explicit rounding
> should still give you the desired result, but from the user/visual
> side of things it tends to be very ugly.)
>
> You may find the ib_currency control gives you better management of
> this sort of input. Alternatively you may find the enhanced mask
> processing of my enhanced component collection useful - but that
> will partly depend on your requirements. Contact me privately I
> can provide you with access to evaluate whether Enh can help.
>
>
> --
> Geoff Worboys
> Telesis Computing