Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Mathematical rounding
Message
From
31/01/2005 15:02:34
 
 
To
31/01/2005 14:13:55
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00982326
Message ID:
00982412
Views:
58
I used differnt numbers as base, but you came to the conclusion that 12.345 rounded to one decimal is 12.4, because 12.345 rounded to two decimals is 12.35. I say that 12.345 rounded to one decimal is 12.4!

And by the way, I did NOT round in two steps, the middle columns only show the value rounded to two decimals, column three shows the value rounded to one value, but there is no correspondance between column two and three.

>well now, isn't that exactly what i said only in different words? you round in 2 steps, thats 2 what i am doing, you start at the end (rounding the last digit/decimal), then you round the 2nd last digit of the result from the first rounding, etc etc.
>
>and the magic number is 5 - i also explained that in my original post.
>
>thats exactly what i described - only in different words. so, you wanna explain to me again where i was wrong? <s>
>
>
>
>>Last digit < 5 means round down, digit >= 5 round up. And you do it only once, if you understand what I mean. You always look at the base, not an intermediate answer.
>>
>>Base 2 digit 1 digit
>>1.344 1.34 1.3
>>1.345 1.35 1.3
>>1.346 1.35 1.3
>>1.347 1.35 1.3
>>1.348 1.35 1.3
>>1.349 1.35 1.3
>>1.350 1.35 1.4
>>
>>>ok, but you still havn't given me your version of the 'correct' answer - you implied my answer is incorrect - so you got to correct me.
>>>
>>>
>>>
>>>>It's thirty years since I graduated, so I may be wrong, but I really doubt it. Your trickery of rounding one digit at a time backwards, reminds me very much about the story of the turtle and the rabbit. The rabbit ran 10 times faster, so he gave the turtle a 100 seconds head start. When the 100 seconds had passed, the rabbit ran for 10 seconds to where the turtle was when he started to run. But the turtled had moved, so the rabbit ran for one more second to come to where the turtle was one second ago. But the turtled had moved, so the rabbit ran for one tenth of a second to come to where the turtle was one tenth of a second ago. Bu the turtle had moved...
>>>>
>>>>Using this reasoning, you can say that the rabbit never caught up with the turtle. :-)
>>>>
>>>>>german highschool (if i remember correctly). are you saying it's wrong? if so, then how come the result is correct/matches.
>>>>>
>>>>>you wanna give me the 'correct' answer then?
>>>>>
>>>>>
>>>>>>Where in the heck have you learnt this? I have many years in school of very advanced math, and I have never heard anything like your theory. You must have dreamt this?
>>>>>>
>>>>>>>>Hi to all,
>>>>>>>>
>>>>>>>>Here is the controversy:
12.345   -> 12.3
>>>>>>>>         -> 12.4
In my opinion, the first one (12.3) is the correct 'mathematical rounding' (to 1 decimal here). However, some colleagues say the second one is correct.
>>>>>>>>
>>>>>>>>Please, tell me that I'm correct! ;)
>>>>>>>
>>>>>>>
>>>>>>>sorry, but you are incorrect.
>>>>>>>
>>>>>>>roundiung starts at the very end. therefore, the 5 gets rounded up, changing the 4 into a five.
>>>>>>>
>>>>>>>since the 4 is a 5 now, this one gets rounded up making out of the 3 a 4.
>>>>>>>
>>>>>>>so you end up with 12.4
>>>>>>>
>>>>>>>if you limit the round() function to how many decimals it is supposed to look at the result will change.
>>>>>>>
>>>>>>>?round(12.345, 1) = 12.3 because the function ignores the 5
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform