Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,49 +0,0 @@
|
|||
-- Big_Numbers is an Ada 2022 unit
|
||||
|
||||
with Ada.Numerics.Big_Numbers.Big_Integers,
|
||||
Ada.Numerics.Big_Numbers.Big_Reals,
|
||||
Ada.Numerics.Generic_Complex_Types,
|
||||
Ada.Text_IO;
|
||||
|
||||
use Ada.Numerics.Big_Numbers.Big_Integers,
|
||||
Ada.Numerics.Big_Numbers.Big_Reals,
|
||||
Ada.Text_IO;
|
||||
|
||||
procedure Test_Integer is
|
||||
-- These are the only numerical types defined in package
|
||||
-- "Standard" which is always incuded. 'Base also covers anything
|
||||
-- with the same Base types.
|
||||
function Is_Integer (N : Integer'Base) return Boolean is (True);
|
||||
function Is_Integer (N : Float'Base) return Boolean is (Float'Base'Floor (N) = N);
|
||||
|
||||
-- Additional types defined in the standard library.
|
||||
function Is_Integer (N : Big_Integer) return Boolean is (True);
|
||||
|
||||
-- The type says real, but these are rational approximations of
|
||||
-- real numbers.
|
||||
function Is_Integer (N : Big_Real) return Boolean is (Denominator (N) = 1);
|
||||
|
||||
package Complex_Float is new Ada.Numerics.Generic_Complex_Types (Float);
|
||||
use Complex_Float;
|
||||
|
||||
function Is_Integer (N : Complex) return Boolean
|
||||
is (Im (N) = 0.0 and then Is_Integer (Re (N)));
|
||||
|
||||
Int_One : Integer := 1;
|
||||
Flo_One : Float := 1.0;
|
||||
Flo_OneH : Float := 1.5;
|
||||
BInt_One : Big_Integer := To_Big_Integer (1);
|
||||
BFlo_One : Big_Real := To_Big_Real (1);
|
||||
BFlo_OneH : Big_Real := From_String ("1.5");
|
||||
CInt_One : Complex := 1.0 + 0.0 * I;
|
||||
CInt_OneI : Complex := 1.0 + 1.0 * I;
|
||||
begin
|
||||
Put_Line (Int_One'Image & " is integer? " & Is_Integer (Int_One)'Image);
|
||||
Put_Line (Flo_One'Image & " is integer? " & Is_Integer (Flo_One)'Image);
|
||||
Put_Line (Flo_OneH'Image & " is integer? " & Is_Integer (Flo_OneH)'Image);
|
||||
Put_Line (BInt_One'Image & " is integer? " & Is_Integer (BInt_One)'Image);
|
||||
Put_Line (BFlo_One'Image & " is integer? " & Is_Integer (BFlo_One)'Image);
|
||||
Put_Line (BFlo_OneH'Image & " is integer? " & Is_Integer (BFlo_OneH)'Image);
|
||||
Put_Line (CInt_One'Image & " is integer? " & Is_Integer (CInt_One)'Image);
|
||||
Put_Line (CInt_OneI'Image & " is integer? " & Is_Integer (CInt_OneI)'Image);
|
||||
end Test_Integer;
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. INTEGERNESS-PROGRAM.
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
01 INTEGERS-OR-ARE-THEY.
|
||||
05 POSSIBLE-INTEGER PIC S9(9)V9(9).
|
||||
05 DEFINITE-INTEGER PIC S9(9).
|
||||
01 COMPLEX-NUMBER.
|
||||
05 REAL-PART PIC S9(9)V9(9).
|
||||
05 IMAGINARY-PART PIC S9(9)V9(9).
|
||||
PROCEDURE DIVISION.
|
||||
TEST-PARAGRAPH.
|
||||
MOVE ZERO TO IMAGINARY-PART.
|
||||
DIVIDE -28 BY 7 GIVING POSSIBLE-INTEGER.
|
||||
PERFORM INTEGER-PARAGRAPH.
|
||||
DIVIDE 28 BY 18 GIVING POSSIBLE-INTEGER.
|
||||
PERFORM INTEGER-PARAGRAPH.
|
||||
DIVIDE 3 BY 10000000000 GIVING POSSIBLE-INTEGER.
|
||||
PERFORM INTEGER-PARAGRAPH.
|
||||
TEST-COMPLEX-PARAGRAPH.
|
||||
MOVE ZERO TO REAL-PART.
|
||||
MOVE 1 TO IMAGINARY-PART.
|
||||
MOVE REAL-PART TO POSSIBLE-INTEGER.
|
||||
PERFORM INTEGER-PARAGRAPH.
|
||||
STOP RUN.
|
||||
INTEGER-PARAGRAPH.
|
||||
IF IMAGINARY-PART IS EQUAL TO ZERO THEN PERFORM REAL-PARAGRAPH,
|
||||
ELSE PERFORM COMPLEX-PARAGRAPH.
|
||||
REAL-PARAGRAPH.
|
||||
MOVE POSSIBLE-INTEGER TO DEFINITE-INTEGER.
|
||||
IF DEFINITE-INTEGER IS EQUAL TO POSSIBLE-INTEGER
|
||||
THEN DISPLAY POSSIBLE-INTEGER ' IS AN INTEGER.',
|
||||
ELSE DISPLAY POSSIBLE-INTEGER ' IS NOT AN INTEGER.'.
|
||||
COMPLEX-PARAGRAPH.
|
||||
DISPLAY REAL-PART '+' IMAGINARY-PART 'i IS NOT AN INTEGER.'.
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
function Test-Integer ($Number)
|
||||
{
|
||||
try
|
||||
{
|
||||
$Number = [System.Numerics.Complex]$Number
|
||||
|
||||
if (($Number.Real -eq [int]$Number.Real) -and ($Number.Imaginary -eq 0))
|
||||
{
|
||||
return $true
|
||||
}
|
||||
else
|
||||
{
|
||||
return $false
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Host "Parameter was not a number."
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
Test-Integer 9
|
||||
Test-Integer 9.9
|
||||
Test-Integer (New-Object System.Numerics.Complex(14,0))
|
||||
Test-Integer (New-Object System.Numerics.Complex(14,56))
|
||||
Test-Integer "abc"
|
||||
Loading…
Add table
Add a link
Reference in a new issue