'variance using simd registers
==============================
float t      'total
float d[100] 'data set
float v      'variance
float t      'total
float m      'mean
float n      'data count
int i        'iterator
int e        'iterator end
'
string cr=chr(13,10)
'
'test figures
=============
d={1,2,2,4,5,6,3,4,7,9}
n=10
'
'calc total and mean
====================
t=0
int i
t=0
e=n
movss xmm0,t
float di
for i=1 to e
  di=d[i]
  addss xmm0,di
next
movss t,xmm0 'total
divss xmm0,n '
movss m,xmm0 'mean
'
'calc variance
==============
subss xmm0,xmm0 'nul
movss xmm1,m 'mean
for i=1 to e
  di=d[i]
  movss xmm2,di
  subss xmm2,xmm1  'deduct mean
  mulss xmm2,xmm2  'square
  addss xmm0,xmm2  'add variance to total
next
divss xmm0,n  'mean variance
movss v,xmm0  'store variance

'display results
================
print "count=" n cr+
      "total=" str(t,4) cr+
      "mean=" str(m,4) cr+
      "variance=" str(v,4)

'standard deviation sd is sqr(v)
