summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-09-01 16:06:20 +0200
committerErich Eckner <git@eckner.net>2017-09-01 16:06:20 +0200
commitbb5c53c82761f4a68aeb6f95935eac11b1d77a07 (patch)
treeac31b180c198f25c7eeced87edbaa75f7790a22b
parente27c4eee1cf1aa3d8816dce5d5741959d393b3d1 (diff)
downloadunits-bb5c53c82761f4a68aeb6f95935eac11b1d77a07.tar.xz
matheunit.pas lowlevelunit.pas: diverse Operatoren neu; alles Mögliche auf tInt64Point umgestellt
-rw-r--r--lowlevelunit.pas162
-rw-r--r--matheunit.pas6
2 files changed, 164 insertions, 4 deletions
diff --git a/lowlevelunit.pas b/lowlevelunit.pas
index e22369c..36aa4ae 100644
--- a/lowlevelunit.pas
+++ b/lowlevelunit.pas
@@ -28,6 +28,7 @@ type
tByteArray = specialize tArray<byte>;
tStringArray = specialize tArray<string>;
tIntPointArray = specialize tArray<tIntPoint>;
+ tInt64PointArray = specialize tArray<tInt64Point>;
tBooleanArray = specialize tArray<boolean>;
tRGB = record
rgbBlue : byte;
@@ -44,6 +45,22 @@ operator = (x1,x2: t2x2Extended): boolean;
operator = (x1,x2: tInt64Point): boolean;
operator = (x1,x2: tIntPoint): boolean;
operator = (x1,x2: tExtPoint): boolean;
+operator + (x1,x2: t2x2Extended): t2x2Extended;
+operator + (x1,x2: tInt64Point): tInt64Point;
+operator + (x1,x2: tIntPoint): tIntPoint;
+operator + (x1,x2: tExtPoint): tExtPoint;
+operator - (x1,x2: t2x2Extended): t2x2Extended;
+operator - (x1,x2: tInt64Point): tInt64Point;
+operator - (x1,x2: tIntPoint): tIntPoint;
+operator - (x1,x2: tExtPoint): tExtPoint;
+operator * (a: extended; x: t2x2Extended): t2x2Extended;
+operator * (a: int64; x: tInt64Point): tInt64Point;
+operator * (a: extended; x: tInt64Point): tExtPoint;
+operator * (a: longint; x: tIntPoint): tIntPoint;
+operator * (a: extended; x: tIntPoint): tExtPoint;
+operator * (a: extended; x: tExtPoint): tExtPoint;
+
+function round(x: tExtPoint): tInt64Point; overload;
function signSqr(x: extended): extended; inline;
function myTimeToStr(t: extended): string;
@@ -88,9 +105,12 @@ function t2x2ExtendedToStr(p: t2x2Extended): string;
function t2x2LongintToStr(p: t2x2Longint): string;
function tExtPointToStr(p: tExtPoint): string;
function tIntPointToStr(p: tIntPoint): string;
+function tInt64PointToStr(p: tInt64Point): string;
procedure fehler(s: string);
function intPoint(x,y: longint): tIntPoint;
-function extPoint(x,y: extended): tExtPoint;
+function int64Point(x,y: int64): tInt64Point;
+function extPoint(x,y: extended): tExtPoint; overload;
+function extPoint(x: tInt64Point): tExtPoint; overload;
function _2x2Longint(xx,xy,yx,yy: longint): t2x2Longint;
function _2x2Extended(xx,xy,yx,yy: extended): t2x2Extended;
@@ -169,8 +189,131 @@ begin
result:=result and (x1[c]=x2[c]);
end;
+operator + (x1,x2: t2x2Extended): t2x2Extended;
+var
+ c,d: char;
+begin
+ for c:='x' to 'y' do
+ for d:='x' to 'y' do
+ result[c,d]:=x1[c,d]+x2[c,d];
+end;
+
+operator + (x1,x2: tInt64Point): tInt64Point;
+var
+ c: char;
+begin
+ for c:='x' to 'y' do
+ result[c]:=x1[c]+x2[c];
+end;
+
+operator + (x1,x2: tIntPoint): tIntPoint;
+var
+ c: char;
+begin
+ for c:='x' to 'y' do
+ result[c]:=x1[c]+x2[c];
+end;
+
+operator + (x1,x2: tExtPoint): tExtPoint;
+var
+ c: char;
+begin
+ for c:='x' to 'y' do
+ result[c]:=x1[c]+x2[c];
+end;
+
+operator - (x1,x2: t2x2Extended): t2x2Extended;
+var
+ c,d: char;
+begin
+ for c:='x' to 'y' do
+ for d:='x' to 'y' do
+ result[c,d]:=x1[c,d]-x2[c,d];
+end;
+
+operator - (x1,x2: tInt64Point): tInt64Point;
+var
+ c: char;
+begin
+ for c:='x' to 'y' do
+ result[c]:=x1[c]-x2[c];
+end;
+
+operator - (x1,x2: tIntPoint): tIntPoint;
+var
+ c: char;
+begin
+ for c:='x' to 'y' do
+ result[c]:=x1[c]-x2[c];
+end;
+
+operator - (x1,x2: tExtPoint): tExtPoint;
+var
+ c: char;
+begin
+ for c:='x' to 'y' do
+ result[c]:=x1[c]-x2[c];
+end;
+
+operator * (a: extended; x: t2x2Extended): t2x2Extended;
+var
+ c,d: char;
+begin
+ for c:='x' to 'y' do
+ for d:='x' to 'y' do
+ result[c,d]:=a*x[c,d];
+end;
+
+operator * (a: int64; x: tInt64Point): tInt64Point;
+var
+ c: char;
+begin
+ for c:='x' to 'y' do
+ result[c]:=a*x[c];
+end;
+
+operator * (a: extended; x: tInt64Point): tExtPoint;
+var
+ c: char;
+begin
+ for c:='x' to 'y' do
+ result[c]:=a*x[c];
+end;
+
+operator * (a: longint; x: tIntPoint): tIntPoint;
+var
+ c: char;
+begin
+ for c:='x' to 'y' do
+ result[c]:=a*x[c];
+end;
+
+operator * (a: extended; x: tIntPoint): tExtPoint;
+var
+ c: char;
+begin
+ for c:='x' to 'y' do
+ result[c]:=a*x[c];
+end;
+
+operator * (a: extended; x: tExtPoint): tExtPoint;
+var
+ c: char;
+begin
+ for c:='x' to 'y' do
+ result[c]:=a*x[c];
+end;
+
// allgemeine Funktionen *******************************************************
+function round(x: tExtPoint): tInt64Point;
+var
+ c: char;
+begin
+ for c:='x' to 'y' do
+ result[c]:=round(x[c]);
+end;
+
function signSqr(x: extended): extended;
begin
result:=sign(x)*sqr(x);
@@ -715,6 +858,11 @@ begin
result:=intToStr(p['x'])+';'+intToStr(p['y']);
end;
+function tInt64PointToStr(p: tInt64Point): string;
+begin
+ result:=intToStr(p['x'])+';'+intToStr(p['y']);
+end;
+
procedure fehler(s: string);
begin
gibAus(s,1);
@@ -727,12 +875,24 @@ begin
result['y']:=y;
end;
+function int64Point(x,y: int64): tInt64Point;
+begin
+ result['x']:=x;
+ result['y']:=y;
+end;
+
function extPoint(x,y: extended): tExtPoint;
begin
result['x']:=x;
result['y']:=y;
end;
+function extPoint(x: tInt64Point): tExtPoint;
+begin
+ result['x']:=x['x'];
+ result['y']:=x['y'];
+end;
+
function _2x2Longint(xx,xy,yx,yy: longint): t2x2Longint;
begin
result['x','x']:=xx;
diff --git a/matheunit.pas b/matheunit.pas
index 20f6e6b..e9f2a16 100644
--- a/matheunit.pas
+++ b/matheunit.pas
@@ -51,7 +51,7 @@ function exprToFloat(st: boolean; s: string; kvs: tKnownValues; cbgv: tCallBackG
function exprToBool(st: boolean; s: string; kvs: tKnownValues; cbgv: tCallBackGetValue): boolean;
function formelnAuswerten(s: string; kvs: tKnownValues; cbgv: tCallBackGetValue): string;
function knownValue(nam: string; val: extended): tKnownValue;
-function berechneEinheitsZelle(invarianz,modulus: tIntPoint): tIntPoint;
+function berechneEinheitsZelle(invarianz,modulus: tInt64Point): tInt64Point;
function ggT(a,b: int64): int64;
implementation
@@ -795,10 +795,10 @@ begin
result.value:=val;
end;
-function berechneEinheitsZelle(invarianz,modulus: tIntPoint): tIntPoint;
+function berechneEinheitsZelle(invarianz,modulus: tInt64Point): tInt64Point;
var
c: char;
- fak: tIntPoint;
+ fak: tInt64Point;
verh: tExtPoint;
begin
for c:='x' to 'y' do begin