refactoring as the list funcs either skip invalid values or recall ToDoubleList
parent
adce58b33a
commit
6b277394c0
|
@ -10119,31 +10119,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Float llListStatistics(int operation, LSL_List src)
|
public LSL_Float llListStatistics(int operation, LSL_List src)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
LSL_List nums = LSL_List.ToDoubleList(src);
|
|
||||||
switch (operation)
|
switch (operation)
|
||||||
{
|
{
|
||||||
case ScriptBaseClass.LIST_STAT_RANGE:
|
case ScriptBaseClass.LIST_STAT_RANGE:
|
||||||
return nums.Range();
|
return src.Range();
|
||||||
case ScriptBaseClass.LIST_STAT_MIN:
|
case ScriptBaseClass.LIST_STAT_MIN:
|
||||||
return nums.Min();
|
return src.Min();
|
||||||
case ScriptBaseClass.LIST_STAT_MAX:
|
case ScriptBaseClass.LIST_STAT_MAX:
|
||||||
return nums.Max();
|
return src.Max();
|
||||||
case ScriptBaseClass.LIST_STAT_MEAN:
|
case ScriptBaseClass.LIST_STAT_MEAN:
|
||||||
return nums.Mean();
|
return src.Mean();
|
||||||
case ScriptBaseClass.LIST_STAT_MEDIAN:
|
case ScriptBaseClass.LIST_STAT_MEDIAN:
|
||||||
return nums.Median();
|
return LSL_List.ToDoubleList(src).Median();
|
||||||
case ScriptBaseClass.LIST_STAT_NUM_COUNT:
|
case ScriptBaseClass.LIST_STAT_NUM_COUNT:
|
||||||
return nums.NumericLength();
|
return src.NumericLength();
|
||||||
case ScriptBaseClass.LIST_STAT_STD_DEV:
|
case ScriptBaseClass.LIST_STAT_STD_DEV:
|
||||||
return nums.StdDev();
|
return src.StdDev();
|
||||||
case ScriptBaseClass.LIST_STAT_SUM:
|
case ScriptBaseClass.LIST_STAT_SUM:
|
||||||
return nums.Sum();
|
return src.Sum();
|
||||||
case ScriptBaseClass.LIST_STAT_SUM_SQUARES:
|
case ScriptBaseClass.LIST_STAT_SUM_SQUARES:
|
||||||
return nums.SumSqrs();
|
return src.SumSqrs();
|
||||||
case ScriptBaseClass.LIST_STAT_GEOMETRIC_MEAN:
|
case ScriptBaseClass.LIST_STAT_GEOMETRIC_MEAN:
|
||||||
return nums.GeometricMean();
|
return src.GeometricMean();
|
||||||
case ScriptBaseClass.LIST_STAT_HARMONIC_MEAN:
|
case ScriptBaseClass.LIST_STAT_HARMONIC_MEAN:
|
||||||
return nums.HarmonicMean();
|
return src.HarmonicMean();
|
||||||
default:
|
default:
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue