From da7fb46d70ead949fa805ca72419c0b2abce546e Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 1 Feb 2021 11:56:21 +0100 Subject: matheunit.pas: intRoot neu --- matheunit.pas | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'matheunit.pas') diff --git a/matheunit.pas b/matheunit.pas index dd3517c..a5163c8 100644 --- a/matheunit.pas +++ b/matheunit.pas @@ -64,6 +64,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 intRoot(n: int64): int64; function ermittleAnstieg(dat: string; xSpalte,ySpalte: longestOrdinal): extended; function ermittleMittelwert(dat: string; werteSpalte,gewichteSpalte: longestOrdinal): extended; procedure sortiereNachWert(var maxima: tLongintArray; werte: tExtendedArray; logarithmischesPivot: boolean); @@ -998,6 +999,17 @@ begin // a <= b result:=b; end; +function intRoot(n: int64): int64; +begin + if n<=0 then begin + result:=0; + exit; + end; + result:=floor(sqrt(n)); + while n mod result > 0 do + dec(result); +end; + function ermittleAnstieg(dat: string; xSpalte,ySpalte: longestOrdinal): extended; var f: textFile; -- cgit v1.2.3-70-g09d2