Jump to content
Changes to the Jaspersoft community edition download ×

precise calculations


Recommended Posts

By: Bernd Proissl - berndproissl

precise calculations

2002-05-27 05:48

I am evaluating JR and wonder how one can do precise calculations:

 

in class JRCalculator there is.

 

case JRVariable.CALCULATION_SUM :

{

...

newValue = new Double(value.doubleValue() + newValue.doubleValue());// FIXME work with double

...

 

So two Doubles are added here which will produce rounding errors.

 

Is there a way to have JR sum up something like java.math.BigDecimal?

 

Do I have to hack the code to get this done?

 

Bernd

 

 

By: Teodor Danciu - teodord

RE: precise calculations

2002-05-27 06:37

 

Hi,

 

You don't have to hack the code.

:)

 

Instead, you could propose a patch and I'll take

care of integrating it into the main version.

 

Now that you mentioned BigDecimal, I'll see what

we could do about it.

 

Thank you,

Teodor

 

 

 

By: Bernd Proissl - berndproissl

RE: precise calculations

2002-05-27 06:52

Thanks for your fast answer!

 

"Instead, you could propose a patch and I'll take

care of integrating it into the main version. " for me is the same as hacking the code ;)

 

Do you have a suggestion of how to make the patch?

 

- is compatibility necessary (we are still ways from 1.0 ;) ) or can I replace the Double stuff with BigDecimal?

 

- should I introduce something like CALCULATION_SUM_PRECISE and leave CALCULATION_SUM untouched?

 

is there CVS access?

 

Thanks Bernd

 

 

By: Teodor Danciu - teodord

RE2: precise calculations

2002-05-27 07:12

 

Hi,

 

I have another idea.

 

We can add a flag at variable level (isPrecisionRequired)

to indicate that for the specified calculations we

need maximum precision, so the engine should

use BigDecimal.

 

By default, this flag would be "false", for performance reasons.

 

In addition to this, we have to allow the creation

of java.math.BigDecimal data source fields.

 

I'll dig into this and come up with a solution maybe

for the 0.3.2 version which I'm preparing right now.

 

Thank you,

Teodor

 

 

 

By: Bernd Proissl - berndproissl

RE3: precise calculations

2002-05-27 07:27

let me know if you need someone for testing.

 

Bernd

 

 

 

By: Bernd Proissl - berndproissl

RE4: precise calculations

2002-05-27 22:45

FYI

http://developer.java.sun.com/developer/bugParade/bugs/4018937.html

 

 

 

By: Bernd Proissl - berndproissl

RE5: precise calculations

2002-06-03 07:24

Teodor,

 

> I'll dig into this and come up with a solution maybe

> for the 0.3.2 version which I'm preparing right now.

 

can you give as your expected time frame for 0.3.2 and if BigDecimal functionality will be included :)

 

Bernd

 

 

 

By: Teodor Danciu - teodord

RE: RE5: precise calculations

2002-06-03 08:16

 

Hi,

 

I have already introduced calculations

with BigDecimal in the main version.

I just wanted to add also hyperlinks and

delayed the release of 0.3.2.

 

It will be available before the end of this week.

 

Thank you,

Teodor

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...