Christopher Blue Posted January 2, 2005 Share 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? Link to comment Share on other sites More sharing options...
Christopher Blue Posted January 2, 2005 Author Share Posted January 2, 2005 Crap...thread title should say "floating" instead of "leading". Link to comment Share on other sites More sharing options...
CyberSlug Posted January 2, 2005 Share 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! Link to comment Share on other sites More sharing options...
Christopher Blue Posted January 2, 2005 Author Share Posted January 2, 2005 Yes but Round doesn't pad a zero. I need to pad a zero. Link to comment Share on other sites More sharing options...
CyberSlug Posted January 2, 2005 Share 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! Link to comment Share on other sites More sharing options...
Christopher Blue Posted January 2, 2005 Author Share Posted January 2, 2005 That's a good way of doing it! Thanks CyberSlug! Link to comment Share on other sites More sharing options...
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