Welcome! Log In Create A New Profile

Advanced

Rounding (WDXI and WDXII)

Posted by Frans 
Frans
Rounding (WDXI and WDXII)
August 24, 2008 09:38PM
Hello to you all,

We have discussed rounding a few times. But check this out:
CoResult is a static.

CoResult=0.75 * 283.90 (gives 212.925 which is correct)
CoResult=Round(0.75 * 283.90,2) (gives 212.93 which is correct)

CoResult=0.75 * 22.58 (gives 16.935 which is correct)
CoResult=Round(0.75 * 22.58,2) (gives 16.93 which is NOT correct)

The problem is that one time .xx5 is rounded correctly and another time wrong.
Rounding 0.75 * 22.58 is always wrong and rounding 0.75*283.90 is always right.

I can handle it with something like Round(0.75 * 22.58,2+ 0.00001)
Shouldn't Rounding alone do the job? Is this a bug?
Please your comments.

Regards,

Frans
Al
Re: Rounding (WDXI and WDXII)
August 25, 2008 12:49AM
Hello Frans

I played around with your numbers and the only way I could reproduce your results was if one of the numbers was not designated as currency and the help on rounding has always specified that it only works with currency.

You say that "CoResult is a static" if you mean a static control then try changing it to a currency control or use an intermediate currency control to collect the result and then pass it on to the static, which will work.

X is currency = Round(0.75 * 22.58,2)
CoResult = X //this will display the correct answer

Regards
Al
Frans
Re: Rounding (WDXI and WDXII)
August 26, 2008 09:42PM
Hello All,

You are right.
Thanks for the explanation.
Good workaround.

Regards,

Frans
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: