View Feed
group-icon
Coffee Room
Discuss anything here - everything that you wish to discuss with fellow engineers.
12892 Members
Join this group to post and comment.
ilga gracy
ilga gracy • Jul 26, 2012

Round function In QTP Not Working

Its a great pleasure to join in this community to get involved with more engineers and sharing knowledge among us. I am working as an Analyst Programmer in Syntel. This is a good moment to share about me in this community. Moreover i am married.. i need some details in qtp..

If anybody knows qtp, help me... Round function is not working for the numbers 16.955, 17.955, 18.955 and 19.955 with 2 decimal places. it is giving the answer as 16.95, 17.95, 18.95 and 19.95 instead of 16.96, 17.96, 18.96 and 19.96.

Could anyone help me why is it showing like this?

Thanks,
Gracy
Kaustubh Katdare
Kaustubh Katdare • Jul 26, 2012
Marking English-Scared & crazyboy . Can you guys help?
I think its returning the correct value only.
If it is 16.956 then Round(16.956,2) will give you 16.96.
ilga gracy
ilga gracy • Jul 27, 2012
English-Scared
I think its returning the correct value only.
no its not for 16.955. check it for 6.955. it will return the value as 6.96. but it is not returning for 16.955, 17.955, 18.955 and 19.955
Which operating system are you using?
Also, how you are using the Round Function?

I vaguely remember that on Windows 7, Round Function works with both. decimal as well as , comma and that depends on the regional setting of the system. Check your regional setting at Control panel; check a little more around that.

i meant if 16.955 is not working for you probably you have comma settings
Try with,
A = Round(16,955, 2)
If you have settings that accept decimal than
A = Round (16.955, 2) should return 16.96

Let me know.

-CB
KenJackson
KenJackson • Jul 28, 2012
Did you type in 16.955 and 17.955? Or are they the results of prior calculations?

If a prior calculation returned 16.9547,
then it will be correctly displayed as 16.955 when rounded to 3 places,
but will also be correctly displayed as 16.95 when the rounding is changed to 2 places.

Otherwise, I don't know qtp, but you should make sure the Round function is documented to work the way you think. I've found various counterintuitive surprises in function documentation before.
ilga gracy
ilga gracy • Jul 29, 2012
crazyboy
Which operating system are you using?
Also, how you are using the Round Function?

I vaguely remember that on Windows 7, Round Function works with both. decimal as well as , comma and that depends on the regional setting of the system. Check your regional setting at Control panel; check a little more around that.

i meant if 16.955 is not working for you probably you have comma settings
Try with,
A = Round(16,955, 2)
If you have settings that accept decimal than
A = Round (16.955, 2) should return 16.96

Let me know.

-CB
I am using windows xp. it supports only decimal point. Even Though i am not getting the result only for those values 16,17,18 and 19. Check the uploaded file. It is showing proper result for 15 and 20. but not for the above mentioned values.
ilga gracy
I am using windows xp. it supports only decimal point. Even Though i am not getting the result only for those values 16,17,18 and 19. Check the uploaded file. It is showing proper result for 15 and 20. but not for the above mentioned values.
Very Peculiar problem 😔
I will research more on this and update the thread.

-CB

Share this content on your social channels -