Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,46 @@
|
|||
INCLUDE "H6:REALMATH.ACT"
|
||||
|
||||
REAL sum,sum2
|
||||
INT count
|
||||
|
||||
PROC Calc(REAL POINTER x,sd)
|
||||
REAL tmp1,tmp2,tmp3
|
||||
|
||||
RealAdd(sum,x,tmp1) ;tmp1=sum+x
|
||||
RealAssign(tmp1,sum) ;sum=sum+x
|
||||
RealMult(x,x,tmp1) ;tmp1=x*x
|
||||
RealAdd(sum2,tmp1,tmp2) ;tmp2=sum2+x*x
|
||||
RealAssign(tmp2,sum2) ;sum2=sum2+x*x
|
||||
count==+1
|
||||
IF count=0 THEN
|
||||
IntToReal(0,sd) ;sd=0
|
||||
ELSE
|
||||
IntToReal(count,tmp1)
|
||||
RealMult(sum,sum,tmp2) ;tmp2=sum*sum
|
||||
RealDiv(tmp2,tmp1,tmp3) ;tmp3=sum*sum/count
|
||||
RealDiv(tmp3,tmp1,tmp2) ;tmp2=sum*sum/count/count
|
||||
RealDiv(sum2,tmp1,tmp3) ;tmp3=sum2/count
|
||||
RealSub(tmp3,tmp2,tmp1) ;tmp1=sum2/count-sum*sum/count/count
|
||||
Sqrt(tmp1,sd) ;sd=sqrt(sum2/count-sum*sum/count/count)
|
||||
FI
|
||||
RETURN
|
||||
|
||||
PROC Main()
|
||||
INT ARRAY values=[2 4 4 4 5 5 7 9]
|
||||
INT i
|
||||
REAL x,sd
|
||||
|
||||
Put(125) PutE() ;clear screen
|
||||
MathInit()
|
||||
IntToReal(0,sum)
|
||||
IntToReal(0,sum2)
|
||||
count=0
|
||||
FOR i=0 TO 7
|
||||
DO
|
||||
IntToReal(values(i),x)
|
||||
Calc(x,sd)
|
||||
Print("x=") PrintR(x)
|
||||
Print(" sum=") PrintR(sum)
|
||||
Print(" sd=") PrintRE(sd)
|
||||
OD
|
||||
RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue