Alice Community rounding

 rounding
 brunkdaddy Guest   Status: Posts: n/a rounding - 05-09-2010, 07:56 PM Hey guys, I want to round a distance between two objects and have one say it. I have the object say 'what as a string' (distance) the only problem is it rounds to a whole number eg 7.0. I have to get it to round to one decimal place eg 7.4. Any tips?
 Niteshifter Guest   Status: Posts: n/a 05-10-2010, 04:56 PM let x be the number in question: round(x * 10) / 10 You would round the value multiplied by 10, so that you now have the number rounded to one decimal place, next you would put it back to normal by dividing the result by 10.
 brunkdaddy Guest   Status: Posts: n/a 05-10-2010, 05:53 PM it didnt work - it still just rounds to whole number. my code is: dist2Hole set value to square root of ((xDist * xDist) + (zDist * zDist)) ball say round dist2Hole as a string

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops General Discussion     Questions and Comments     The Lounge