|
-
Nov 12th, 2001, 09:33 PM
#1
Thread Starter
PowerPoster
What is nearest 10th of 25?
-
Nov 12th, 2001, 09:36 PM
#2
PowerPoster
-
Nov 12th, 2001, 09:37 PM
#3
Maybe this should go in the Math forum
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Nov 12th, 2001, 09:41 PM
#4
Thread Starter
PowerPoster
Thanks, I was just curious about 5...I always have that confusion.
-
Nov 12th, 2001, 11:22 PM
#5
PowerPoster
Here's a simple little rule:
Everything from 0-4 is rounded down (eg.: 4 becomes 0)
Everything from 5-9 is rounded up (eg.: 5 becomes 10)
That's just your everyday basic rounding rule. There's other types of rounding too.
-
Nov 12th, 2001, 11:59 PM
#6
Registered User
Arithmetic Rounding
When rounding always down or up, the resulting number is not necessarily
the closest to the original number. For example, if you round 1.9 down to 1,
the difference is a lot larger than if you round it up to 2. It is easy to see
that numbers from 1.6 to 2.4 should be rounded to 2.
However, what about 1.5, which is equidistant between 1 and 2? By convention,
the half-way number is rounded up.
You can implement rounding half-way numbers in a symmetric fashion,
such that -.5 is rounded down to -1, or in an asymmetric fashion, where -.5 is
rounded up to 0.
Banker's Rounding
When you add rounded values together, always rounding .5 in the same
direction results in a bias that grows with the more numbers you add together.
One way to minimize the bias is with banker's rounding.
Banker's rounding rounds .5 up sometimes and down sometimes. The convention is to round to the nearest even number,
so that both 1.5 and 2.5 round to 2, and 3.5 and 4.5 both round to 4. Banker's rounding is symmetric.
-
Nov 13th, 2001, 09:00 AM
#7
Thread Starter
PowerPoster
it is just rounding to the nearest 10th. I am writing a function that does that.
-
Nov 13th, 2001, 09:10 AM
#8
VB has a rounding function named Round that uses banker's rounding (rounding .5 to nearest even number).
You can use that:
VB Code:
Public Function RoundToTen(num As Single) As Single
RoundToTen=Round(num / 10) * 10
End Function
Best regards
-
Nov 13th, 2001, 09:12 AM
#9
Or if you want to use arithmetic rounding:
VB Code:
Public Function RoundToTen(num As Single) As Integer
RoundToTen=Int(num / 10 + .5) * 10
End Function
Best regards
-
Nov 13th, 2001, 09:22 AM
#10
Thread Starter
PowerPoster
I am doing it in Turing, not vb
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|