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

RAP calculations on 4 bytes only!

edited September 2002 in RAP
Hi List!

I have the folloving problem with RAP from RB 6.03 and 7.0, using Delphi 6.0
Enterprise SP2:

In user report I have the following procedure:

Procedure Variable1OnCalc(var Value: Variant);
var
DB, CR: Currency;
begin
SomeUserFunction(DB, CR)
Value := DB;
end;

The value is printed correctly, even if DB is larger than MaxInt
(2147483647).

But, if I change the second line in:

Value := DB - 1;

And the value of DB is larger than MaxInt, the result is trunc to 32 bits!
If, for example, DB is 5000000000, then after
Value := DB - 1
the Value is 703032703 and not 4999999999 as it should be!
As I see all 4 basic operations (+, -, *, /) are made in 32 bits.
Also, if I add:
DB := 5000000000;
I get Error: "Parser Error" if the number is greater than MaxInt.
I can't find in documentation that the operators are limited to 32 bits, and
since Currency and Double are allowed types, it shouldn't be.
Is there any way to make calculations on Currency values, except writing a
User Function for that?

Thank you and sorry for my english!
A

Comments

  • edited September 2002
    Thanks for reporting the issue. Unitl the we get this fixed in a future
    release, you can workaround the issue by using decimals, such as setting the
    value to be 5000000000.0


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited September 2002
    Thank you for answer and hint that solves the second part of my problem.
    For the first part (+, -, *, / operators) I guess that until a future
    release, I have to write a user function that makes basic calculations on
    Currency variables.

    A

This discussion has been closed.