Talk:Averages/Arithmetic mean: Difference between revisions

shouldn't need to mention 0
(Alternate action for zero.)
(shouldn't need to mention 0)
Line 7:
::''"In case of a zero-length input, zero may be returned, but since the mean of an empty set of numbers is ill-defined, the program may choose to behave in any way it deems appropriate, and if the programming language has an established convention for conveying math errors or undefined values then this may also be followed."''
:--[[User:Paddy3118|Paddy3118]] 15:32, 7 May 2012 (UTC)
 
:: Well, that's kinda the point: average of nothing really is a mistake and should be flagged as such. If it doesn't matter in your application, then any return value makes as much sense as another, so there's no need to single out 0 there--"any action you see fit" is a super set of "return 0" anyway. Think it this way, what if the task says "you may return 42"? It's also fair because everyone would then be equally disadvantaged. --[[User:Ledrug|Ledrug]] 22:35, 7 May 2012 (UTC)
Anonymous user