Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package body Mat is
- function Lnko ( A, B : Positive ) return Positive is
- X: Positive := A;
- Y: Positive := B;
- begin
- while X /= Y loop
- if X > Y then
- X := X - Y;
- else
- Y := Y - X;
- end if;
- end loop;
- return X;
- end Lnko;
- function Faktorialis( N: Natural ) return Positive is
- Fakt : Positive := 1;
- begin
- for I in 1..N loop
- Fakt := Fakt * I;
- end loop;
- return Fakt;
- end Faktorialis;
- function Maximum ( A, B : Natural ) return Positive is
- begin
- if A > B then
- return A;
- else
- return B;
- end if;
- end Maximum;
- function Maximum3 ( A, B, C : Natural ) return Positive is
- begin
- if A > B and A > C then
- return A;
- elsif B > A and B > C then
- return B;
- else
- return C;
- end if;
- end Maximum3;
- function Sin ( A : Float; P : Natural ) return Float is
- S : Float := A;
- F : Float := 1.0;
- T : Float := A;
- begin
- for N in Integer range 1 .. P loop
- T := T * A * A;
- F := F * Float((2 * N) * (2 * N + 1));
- S := S + Float((-1) ** N) * T / F;
- end loop;
- return S;
- end Sin;
- end Mat;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement