Subject Re: negative floating point
Author anthpjc
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 06:16 AM 18/07/2003 +0000, you wrote:
> >Hi there,
> >I use IBO4_h.
> >I have a TIB_Cursor which sums a float field, for some reason the
> >field returned is incorrect if it is a negative, e.g. the field
> >is '.-4' rather than '-0.04', no matter what display format or
> >editmask I set on the cursor, I have tried the same with TIB_Query
> >with the same result. Any suggestions why this is happening and
how
> >it can be solved?
>
> I can't reproduce this in an ib_grid. Can you provide an example
of the
> SQL involved and also a) what mask you have tried for its
DisplayFormat
> property and b) what control you are displaying it in?
>
> Helen

Hi Helen,
The sql query is:

SELECT SUM(U.PAYTOTAL) AS TOTAL FROM MBUSERPAYMENT U
LEFT JOIN MBPAYMENT P ON P.PAYMENTKEY=U.PAYMENTKEY
LEFT JOIN MBPAYMENTDATA D ON D.PAYMENTKEY=P.PAYMENTKEY
WHERE U.USERKEY=:ukey AND D.PROVIDERITEMKEY=:pkey AND P.STATUS=1
AND D.PAYFORYEAR=2003 AND D.PAYFORMONTH=5

The values that are summed are four -0.01's. The masks don't matter
as the '.-4' result is the raw result. I think it may be the joins
that are confusing it somehow as tests without the joins show
correct results. Although it should only be concerned with data
values while summing, not how it gets them. It can't be the
variables as I've tested it with real values substituted. I'm
stumped, maybe you can make some sense of it.
You help is appreciated.

anth