Page 1 of 1
Problem in Calculation
Posted: Wed Apr 13, 2016 5:25 am
by G.hammad
Hello,
I have problem in subtraction of any decimal number and integer number for example in my report :
Quantity Before = 12.3
Quantity After = 12.3 - 12 = 0.30000001 (this is wrong value it must give me 0.3)
and i don't want to apply any custom format
so my question is there any way to solve this problem ?!
Re: Problem in Calculation
Posted: Wed Apr 13, 2016 11:45 am
by HighAley
Hello.
Could you specify which our component do you use? What version?
Could you describe step-by-step how to reproduce your issue?
Thank you.
Re: Problem in Calculation
Posted: Wed Apr 13, 2016 12:41 pm
by G.hammad
Hello,
version number :2014.3.17.0
i'm just used Stitext component and make calculation on veriable of type decimal = (12.3 - 12)
and this problem also exist if type of variable is double
Re: Problem in Calculation
Posted: Thu Apr 14, 2016 6:32 am
by Alex K.
Hello,
We couldn't reproduce this bug.
Please check the last build and let us know about the result.
Also, please clarify which component do you use - .NET, HTML5, Flash?
Thank you.
Re: Problem in Calculation
Posted: Thu Apr 14, 2016 8:18 am
by G.hammad
Hello,
this is sample MRT for what happen can you check it please and tell me.
by the way I'm using .Net
thanks alot.
Re: Problem in Calculation
Posted: Thu Apr 14, 2016 11:47 am
by Alex K.
Hello,
This is rounding accuracy in the .NET:
http://stackoverflow.com/questions/1533 ... in-c-sharp
In this case, please try to use the following code:
Code: Select all
decimal PreviousQuantity = 12.3m;
decimal NewQuantity = (-1m * 12m);
decimal TotalQuantity = PreviousQuantity + NewQuantity;
Thank you.
Re: Problem in Calculation
Posted: Mon Apr 18, 2016 6:34 am
by G.hammad
Hello,
thanks for your help

but i try to do this by VB language nested of C sharp language but it give me error can't write : decimal or double beforeQuantity
so how i can write same code in vb language nestead of c sharp language?
Re: Problem in Calculation
Posted: Mon Apr 18, 2016 7:45 am
by Alex K.
Hello,
Please try to use the following code:
Code: Select all
Dim PreviousQuantity As Decimal = 12.3D
Dim NewQuantity As Decimal = (-1D * 12D)
Dim TotalQuantity As Decimal = PreviousQuantity + NewQuantity
Thank you.
Re: Problem in Calculation
Posted: Mon Apr 18, 2016 12:19 pm
by G.hammad
Thanks so much it works in correct way right now

Re: Problem in Calculation
Posted: Mon Apr 18, 2016 1:06 pm
by Alex K.
Hello,
We are always glad to help you!
Let us know if you need any additional help.
Thank you.