aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/kompsos-math.adb54
1 files changed, 28 insertions, 26 deletions
diff --git a/src/kompsos-math.adb b/src/kompsos-math.adb
index 91743c3..e74ff60 100644
--- a/src/kompsos-math.adb
+++ b/src/kompsos-math.adb
@@ -793,15 +793,6 @@ package body Kompsos.Math is
Remainder_Term : Term renames Inputs (4);
One, Two, Three : Goal := This;
-
- N_Low : constant Term := Three.Fresh;
- N_High : constant Term := Three.Fresh;
- Quot_Low : constant Term := Three.Fresh;
- Quot_High : constant Term := Three.Fresh;
- Quot_Low_M : constant Term := Three.Fresh;
- Quot_Low_M_Remain : constant Term := Three.Fresh;
- Remain_Remain : constant Term := Three.Fresh;
- Remain_High : constant Term := Three.Fresh;
begin
One.Unify (N_Term, Remainder_Term);
One.Unify (Quotient_Term, Zero_Term);
@@ -815,25 +806,36 @@ package body Kompsos.Math is
LT_Length (Three, M_Term & N_Term);
LT (Three, Remainder_Term & M_Term);
GT_Zero (Three, Quotient_Term);
- Three.Conjunct (Split_Access, N_Term & Remainder_Term & N_Low & N_High);
- Three.Conjunct (Split_Access, Quotient_Term & Remainder_Term & Quot_Low & Quot_High);
declare
- Three_A, Three_B : Goal := Three;
+ N_Low : constant Term := Three.Fresh;
+ N_High : constant Term := Three.Fresh;
+ Quot_Low : constant Term := Three.Fresh;
+ Quot_High : constant Term := Three.Fresh;
+ Quot_Low_M : constant Term := Three.Fresh;
+ Quot_Low_M_Remain : constant Term := Three.Fresh;
+ Remain_Remain : constant Term := Three.Fresh;
+ Remain_High : constant Term := Three.Fresh;
begin
- Three_A.Unify (N_High, Zero_Term);
- Three_A.Unify (Quot_High, Zero_Term);
- Subtract (Three_A, N_Low & Remainder_Term & Quot_Low_M);
- Multiply (Three_A, Quot_Low & M_Term & Quot_Low_M);
-
- GT_Zero (Three_B, N_High);
- Multiply (Three_B, Quot_Low & M_Term & Quot_Low_M);
- Add (Three_B, Quot_Low_M & Remainder_Term & Quot_Low_M_Remain);
- Subtract (Three_B, Quot_Low_M_Remain & N_Low & Remain_Remain);
- Three_B.Conjunct (Split_Access,
- Remain_Remain & Remainder_Term & Zero_Term & Remain_High);
- Three_B.Conjunct (Divide_Access, N_High & M_Term & Quot_High & Remain_High);
-
- return Disjunct (One & Two & Three_A & Three_B);
+ Three.Conjunct (Split_Access, N_Term & Remainder_Term & N_Low & N_High);
+ Three.Conjunct (Split_Access, Quotient_Term & Remainder_Term & Quot_Low & Quot_High);
+ declare
+ Three_A, Three_B : Goal := Three;
+ begin
+ Three_A.Unify (N_High, Zero_Term);
+ Three_A.Unify (Quot_High, Zero_Term);
+ Subtract (Three_A, N_Low & Remainder_Term & Quot_Low_M);
+ Multiply (Three_A, Quot_Low & M_Term & Quot_Low_M);
+
+ GT_Zero (Three_B, N_High);
+ Multiply (Three_B, Quot_Low & M_Term & Quot_Low_M);
+ Add (Three_B, Quot_Low_M & Remainder_Term & Quot_Low_M_Remain);
+ Subtract (Three_B, Quot_Low_M_Remain & N_Low & Remain_Remain);
+ Three_B.Conjunct (Split_Access,
+ Remain_Remain & Remainder_Term & Zero_Term & Remain_High);
+ Three_B.Conjunct (Divide_Access, N_High & M_Term & Quot_High & Remain_High);
+
+ return Disjunct (One & Two & Three_A & Three_B);
+ end;
end;
end Divide;