Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add helper functions to check arrays that conform to various constraints #40

Open
Assignees
delphidabbler
Labels
consideringIssue is currently under considerationenhancementNew feature or request
@delphidabbler

Description

@delphidabbler

The following helper functions check arrays for all <0, ≤0, 0, ≥0, >0 and ≠0 entries:

// Check if all elements of a non-empty array are zerofunctionArrayIsZero(const A:arrayof Extended): Boolean;begin  Assert(Length(A) >0);  Result := False;forvar Elemin Adoifnot IsZero(Elem)then      Exit;  Result := True;end;// Check if all elements of a non-empty array are <> 0functionArrayIsNonZero(const A:arrayof Extended): Boolean;begin  Assert(Length(A) >0);  Result := False;forvar Elemin Adoif IsZero(Elem)then      Exit;  Result := True;end;// Check if all elements of a non-empty array are > 0functionArrayIsPositive(const A:arrayof Extended): Boolean;begin  Assert(Length(A) >0);  Result := False;forvar Elemin Adoif Sign(Elem) <> PositiveValuethen      Exit;  Result := True;end;// Check if all elements of a non-empty array are < 0functionArrayIsNegative(const A:arrayof Extended): Boolean;begin  Assert(Length(A) >0);  Result := False;forvar Elemin Adoif Sign(Elem) <> NegativeValuethen      Exit;  Result := True;end;// Check if all elements of a non-empty array are <= 0functionArrayIsNonPositive(const A:arrayof Extended): Boolean;begin  Assert(Length(A) >0);  Result := False;forvar Elemin Adoif Sign(Elem) = PositiveValuethen      Exit;  Result := True;end;// Check if all elements of a non-empty array are >= 0functionArrayIsNonNegative(const A:arrayof Extended): Boolean;begin  Assert(Length(A) >0);  Result := False;forvar Elemin Adoif Sign(Elem) = NegativeValuethen      Exit;  Result := True;end;

This issue was extracted from issue#16

Metadata

Metadata

Assignees

Labels

consideringIssue is currently under considerationenhancementNew feature or request

Projects

Status

Considering

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp