Jump to content
Sign in to follow this  
king9072

Changing A Variable To A Solid Number?

Recommended Posts

king9072

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
king9072

; 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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.