Jump to content
Sign in to follow this  
king9072

Changing A Variable To A Solid Number?

Recommended Posts

Alright, a point in my script comes where I devide a number but it spits out a really ugly number like 8.342342356168543... and it is being inserted into a tooltip, thus it is a mess.

What I want to do is have that number rounded, but the round function wont use a variable.

I also think I remember seeing something where if you put some symbol infront of a variable, it will be read as a solid number and not as a variable.

Thanks in advance for help.

Share this post


Link to post
Share on other sites

; The following works for me with the current version of AutoIt (3.0.101)

$number = 8.342342356168543

$rounded = Round($number, 2)  ;two-decimal places

MsgBox(4096,"Rounded", $rounded)

Thanks. I thought I had that the first time, but this works now :D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...