From 6b624c81a152b8a33ed19eba2350a92f2f8e4a40 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 8 Nov 2017 16:00:54 +0100 Subject: matheunit.pas: ermittleAnstieg neu --- matheunit.pas | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) (limited to 'matheunit.pas') diff --git a/matheunit.pas b/matheunit.pas index e9f2a16..e8a1e1e 100644 --- a/matheunit.pas +++ b/matheunit.pas @@ -53,6 +53,7 @@ function formelnAuswerten(s: string; kvs: tKnownValues; cbgv: tCallBackGetValue) function knownValue(nam: string; val: extended): tKnownValue; function berechneEinheitsZelle(invarianz,modulus: tInt64Point): tInt64Point; function ggT(a,b: int64): int64; +function ermittleAnstieg(dat: string; xSpalte,ySpalte: int64): extended; implementation @@ -332,7 +333,7 @@ begin result:=result/10 + ord(s[i])-ord('0'); result:=result/10 + ord(s[1])-ord('0'); end - else result:=strtofloat(s); + else result:=strToFloat(s); result:=result*power(10,e); if neg then result:=-result; @@ -539,7 +540,7 @@ begin cbv:=false; for i:=1 to length(s) do cbv:=cbv or not (s[i] in ['-','0'..'9','.',',','e','E']); - if not cbv then result:=strtofloat(s) + if not cbv then result:=strToFloat(s) else if not (assigned(kvs) and kvs.extract(s,result)) then begin if st then result:=1 else if assigned(cbgv) then result:=cbgv(s) @@ -852,5 +853,46 @@ begin // a <= b result:=b; end; +function ermittleAnstieg(dat: string; xSpalte,ySpalte: int64): extended; +var + f: textFile; + s: string; + xSum,xQdrSum,ySum,xySum: extended; + wert: tExtPoint; + i,anz: int64; +begin + if xSpalte=ySpalte then begin + result:=1; + exit; + end; + anz:=0; + xSum:=0; + ySum:=0; + xySum:=0; + xQdrSum:=0; + assignFile(f,dat); + reset(f); + while not eof(f) do begin + readln(f,s); + for i:=0 to min(xSpalte,ySpalte)-1 do + erstesArgument(s); + wert[char(ord('x')+byte(ySpalte