On Sat, May 10, 2008 at 1:30 PM, Mark <[EMAIL PROTECTED]> wrote:
> I'm trying to find the median in my Array of numbers which is fine but
>  in some cases that number comes out to something like (3.92 84.5
>  3.5599999999999996 3.665). In ActionScript how do I take that number
>  and reduce the length to something more manageable like (3.9, 84.5,
>  3.6, 3.7). I know how to round up to whole numbers but not like this.

function roundToDigits ( value : Number, digits : int ) : Number {
   return Math.round( value * (digits * 10) ) / (digits * 10);
}

:)

Mark

Reply via email to