sevenalive Posted September 20, 2005 Share Posted September 20, 2005 (edited) how do i take a long numberex. 40.344644and make it to40.3basically round it.any ideas Edited September 20, 2005 by Seven Alive Link to comment Share on other sites More sharing options...
aussiecanuck46 Posted September 21, 2005 Share Posted September 21, 2005 I'd suggest using the round() method. It rounds a double value to an integer. But if you first multiply that double value by 10 and then round it you could then divide the rounded value by 10 into a double value. Link to comment Share on other sites More sharing options...
matthewk Posted September 30, 2005 Share Posted September 30, 2005 You could take your value float/double num:num = (int)num + (int)((num - (int)num)*10) 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