Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Values not displayed properly?

edited August 2002 in General
I have a field with display format set to: #,0.00;-#,0.00.

Could anyone explain me why number eg.
999999.345 is presented as
999999.34 while

999999.545 is presented as
999999.55
as well as
222222.345 is truncated to
222222.35

(look at the least important factor)

I have no idea how to deal with it. Any tips?

Regards,
Joanna

Comments

  • edited August 2002
    Hi Joanna,

    In #,0.00 the number of "0"s after the dot tells RB the maximum number of
    digits that you want to have after the dot. If there are more, they are
    truncated and rounded. So if you want to keep your 999999.345, you have to
    edit the display format to #,0.000;-#,0.000

    regards,

    Andreas Kr?gersen

    P.S. @DM: Is there any list that contains all types of valid display formats
    and tokens available?


  • edited August 2002
    Well, I want to have just two digits rounded :)

    Just look at the numbers - some goes up, some down, although the digit part
    of the number is the same. Do you see it? Am I missing something or it is a
    small bug?

    Joanna


    U?ytkownik "Andreas Kr?gersen" napisa? w
  • edited August 2002
    Ah yes, now I see it....
    Could be a bug although I'd be careful with that. RBuilder uses more
    significant digits for calculation than there are actually printed/shown. So
    it could be a small error while rounding somewhere deep within. But that's a
    general problem with rounding of floats. You ALWAYS have an error but you
    don't see it usually because it is somewhere around the least significant
    digits.
    But I'm not totally sure, if that's the problem so I'd like to hear an
    official statement from DM, too.

    regards

    Andreas Kr?gersen

  • edited August 2002
    > But I'm not totally sure, if that's the problem so I'd like to hear an

    Thanks Andreas, I also hope DM will somehow react to the matter presented in
    above posts.

    Have a nice weekend,
    Joanna

    PS. I wouldn't say it is somewhere deeper since these numbers don't come
    from my calculations... I've checked double variable with two digit format
    directly set to the numbers mentioned and it works the same.
  • edited August 2002
    We've seen this behavior before. It is caused by Delphi: we call
    FloatToStrF. You can replace the display formatting as shown in a demo I
    can email to you, in order to not call this function and perform your own
    formatting routine.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.