Christopher Blue Posted January 2, 2005 Posted January 2, 2005 I wish to round a floating point off to one decimal place but I wish to have a floating zero. What is the best way to do this?
Christopher Blue Posted January 2, 2005 Author Posted January 2, 2005 Crap...thread title should say "floating" instead of "leading".
CyberSlug Posted January 2, 2005 Posted January 2, 2005 Seems to work... $float = .71828 $rounded = Round($float, 1) MsgBox(4096, "Answer", $rounded) Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Christopher Blue Posted January 2, 2005 Author Posted January 2, 2005 Yes but Round doesn't pad a zero. I need to pad a zero.
CyberSlug Posted January 2, 2005 Posted January 2, 2005 Ohhh, is this what you want?: $float = 1.00001 $rounded = Round($float, 1) If Not StringInStr($rounded, ".") Then $rounded = $rounded & ".0" MsgBox(4096, "Answer", $rounded) Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Christopher Blue Posted January 2, 2005 Author Posted January 2, 2005 That's a good way of doing it! Thanks CyberSlug!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now