Original date:2015-05-31 16:26:59 Edited by: irv Subject: Re: Average of 2-D array

jimcbrown said...

Maybe this is a bug... average() won't fail but just return an incorrect answer.

Technically, you're correct. average doesn't fail, it causes sum to fail with a type-check error, even though sum can handle the array when it's passed directly.

/usr/local/share/euphoria/include/std/stats.e:490 in function sum() type_check failure, result_ is {1,2,3,4,5,6,7,8,9,10}

The 'array' being passed looks like this (yep. elementary-school multiplication tables)


? sum(x) gives 3025 average(x) gives the error message above.

Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu