This might seem trivial, but it has me stumped. The variance of numbers 0..20 is 38.5. Then why does Math:NumberCruncher show it as 36.6667? Here's a sample prog, and it's output. Here test04.dat is a file that has numbers 0 to 20, on separate lines. #-------------------start---------------- #!/usr/bin/perl -w use Math::NumberCruncher; # Program to test Math::NumberCruncher # Get a file from STDIN, print the variance, and the std. deviation. @array = <>; map {chomp} @array; $variance = Math::NumberCruncher::Variance(\@array); $stddev = Math::NumberCruncher::StandardDeviation(\@array); $sd2 = $stddev**2; print scalar(@array), "\n"; printf "Var=$variance, S.D=$stddev S.D^2 = $sd2\n"; exit; #----------------end--------------------- And the output is: 21 Var=36.6666666666667, S.D=6.05530070819498 S.D^2 = 36.6666666666667 What could be possibly wrong? Even the standard value is wrong. TIA, -tir -- Tirthankar, IGIDR. +91-22-8400919 x275 (r), x593(o), x542(CFL). http://www.igidr.ac.in/~tir LEGACY, n. A gift from one who is legging it out of this vale of tears.Thread Next