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

Replies

  • Kaustubh Katdare
    Kaustubh Katdare
    Marking #-Link-Snipped-# & #-Link-Snipped-# . Can you guys help?
  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    I think its returning the correct value only.
  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    If it is 16.956 then Round(16.956,2) will give you 16.96.
  • ilga gracy
    ilga gracy
    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
  • Anil Jain
    Anil Jain
    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
    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
    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.
  • Anil Jain
    Anil Jain
    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

You are reading an archived discussion.

Related Posts

I found some questions from their logic assessment test. Check them here:
According to today's reports in TOI, Amazon Offices in Bangalore, Hyderabad and Chennai, that create solutions for the ecommerce operations are all hiring (despite a slowdown) Amazon is going to...
Name: Ilga Gracy *Engineering Trade: IT Location: Chennai *Occupation: Analyst Programmer Work Experience: 4 yrs *Hobbies & Interests: Singing and reading spiritual books *Aim in life: To become CEO *I...
Hi all, I am thinking of buying a new laptop. My range is 30-35k. Please suggest. I've used Dell Vostro 1040. It's good till now but i had faced problem...
Hello everyone, I am a final year Computer Science student, can you please suggest me a topic for my final year project. Please.