Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Force calculated numbers to have 2 decimal places
#1
Not Solved
I need to be able to use a captured and calculated number as a basis of comparison for a checkpoint. The problem is when a number ends with a 0, it's left off of the calculated number.
This causes the checkpoint to fail.... 11.80 isn't the same 11.8

How can I force the calculated number to keep 2 placed to the right of the decimal, even if it's rounded to end with a 0?
Reply
#2
Not Solved
You can use the Abs() function of VBScript, which return you absolute value .For example abs(11.80)=11.8 and abs(11.8)=11.8 .After doing this you can compare easily .




Yo can use the Abs() function of VBScript, which return you absolute value .For example abs(11.80) =11.8 and abs(11.8)=11.8 ,So now if you want to force the calculated number to keep 2 placed to the right of the decimal ,You can easily concatenate 0 with the returned values as
x=Abs(11.8)
y=x&"0"
Now if you will see y is assigned with 11.80 . Please tell if you need further clarification .
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How import final calculated values by cell formula from Excel not the formula itself. qtped 1 4,861 01-17-2017, 04:05 PM
Last Post: sagar.raythatha
  Get numbers inside all webelements in webtable and sort them pradeep537 1 2,821 08-04-2016, 01:24 AM
Last Post: Ankur
  GCD of N numbers Venkat`s 1 2,047 10-17-2013, 08:58 PM
Last Post: Parke
  How to convert integer to decimal automation2012 2 5,470 03-25-2013, 04:44 PM
Last Post: automation2012
  Why do I see strange signs by the line numbers? sqadri 2 2,997 04-05-2012, 04:36 AM
Last Post: sqadri

Forum Jump:


Users browsing this thread: 3 Guest(s)