new files
This commit is contained in:
parent
3af7344581
commit
86c034bb8b
1364 changed files with 21352 additions and 0 deletions
24
Task/Infinity/Ada/infinity-1.ada
Normal file
24
Task/Infinity/Ada/infinity-1.ada
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Infinities is
|
||||
function Sup return Float is -- Only for predefined types
|
||||
Result : Float := Float'Last;
|
||||
begin
|
||||
if not Float'Machine_Overflows then
|
||||
Result := Float'Succ (Result);
|
||||
end if;
|
||||
return Result;
|
||||
end Sup;
|
||||
|
||||
function Inf return Float is -- Only for predefined types
|
||||
Result : Float := Float'First;
|
||||
begin
|
||||
if not Float'Machine_Overflows then
|
||||
Result := Float'Pred (Result);
|
||||
end if;
|
||||
return Result;
|
||||
end Inf;
|
||||
begin
|
||||
Put_Line ("Supremum" & Float'Image (Sup));
|
||||
Put_Line ("Infimum " & Float'Image (Inf));
|
||||
end Infinities;
|
||||
26
Task/Infinity/Ada/infinity-2.ada
Normal file
26
Task/Infinity/Ada/infinity-2.ada
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Infinities is
|
||||
type Real is digits 5 range -10.0..10.0;
|
||||
|
||||
function Sup return Real is
|
||||
Result : Real := Real'Last;
|
||||
begin
|
||||
return Real'Succ (Result);
|
||||
exception
|
||||
when Constraint_Error =>
|
||||
return Result;
|
||||
end Sup;
|
||||
|
||||
function Inf return Real is
|
||||
Result : Real := Real'First;
|
||||
begin
|
||||
return Real'Pred (Result);
|
||||
exception
|
||||
when Constraint_Error =>
|
||||
return Result;
|
||||
end Inf;
|
||||
begin
|
||||
Put_Line ("Supremum" & Real'Image (Sup));
|
||||
Put_Line ("Infimum " & Real'Image (Inf));
|
||||
end Infinities;
|
||||
1
Task/Infinity/Ada/infinity-3.ada
Normal file
1
Task/Infinity/Ada/infinity-3.ada
Normal file
|
|
@ -0,0 +1 @@
|
|||
subtype Safe_Float is Float range Float'Range;
|
||||
Loading…
Add table
Add a link
Reference in a new issue