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

big Float numbers problem

edited May 2002 in General
When I set a big Float number to a Tppvariable component it displays wrong
value.

For example a variable that its datatype = dtExtended
in the Rap I wrote;
Variable1.AsExtended := 30000000 * 100;

it displays -1294967296

Any idea.

Comments

  • edited May 2002
    Hi Huseyin,

    looks like a parser bug, some calculations run fine e.g.
    Value := 3.01 * Power(10, 7) * 100.0; {tested with ReportBuilder 5.56}
    What version of ReportBuilder are you using?

    regards,
    Chris Ueberall;

  • edited May 2002
    Actually this seems to be a Delphi bug and is reproducible in regular Delphi
    calculation. That calculation produces an overflow error by the compiler
    while 30000000.0 * 100.0 and 3000000000 * 1 work fine even though they are
    the same value.


    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited May 2002
    Hi Alexander,

    30000000.0 * 100.0 doesn't works in 5.56, probably the case for Huseyin.

    regards,
    Chris Ueberall;

    "Alexander Kramnik (Digital Metaphors)" wrote
  • edited May 2002
    RB version 5.55

    if you use real numbers no problem.
    100000000 * 100.5 OK
    100000000 * 100 problem


  • edited May 2002
    I have tested it in RB 6.02 and Delphi 6.
    the problem continues.

    I have never displayed huge numbers in Tppvariable that fractional part is
    0.

    I do a calculation in detail band:
    Variable1.asextended := Variable1.asextended + myData['PRICE']

    if Price is whole number than variable1 doesn't display the correct value,
    but if price is fractional number than the result correct.




  • edited May 2002
    Try this as a temporary workaround:

    if (Variable1.AsExtended - Floor(Variable1.AsExtended) <> REALLY_SMALL_REAL)
    then
    leOffSet := 0.1
    else
    leOffset := 0.0;

    Variable1.AsExtended := (Variable1.AsExtended + (myData['PRICE'] +
    leOffset)) - leOffset;

    In theory REALLY_SMALL_REAL should be 0. In practice you might want to make
    it a really small decimal, i.e. 1e-5

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

This discussion has been closed.