aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/kompsos-math.adb73
-rw-r--r--test/expo.adb2
2 files changed, 39 insertions, 36 deletions
diff --git a/src/kompsos-math.adb b/src/kompsos-math.adb
index 0f2cc10..91743c3 100644
--- a/src/kompsos-math.adb
+++ b/src/kompsos-math.adb
@@ -994,52 +994,55 @@ package body Kompsos.Math is
Exp_Low1_Var : constant Term := Outputs (7).Fresh;
Exp_Low_Var : constant Term := Outputs (7).Fresh;
S_Var : constant Term := Outputs (7).Fresh;
-
- Exp1_Var : constant Term := Outputs (7).Fresh;
- BaseW_Exp1_Var : constant Term := Outputs (7).Fresh;
-
- Base_Exp_Low_Var : constant Term := Outputs (7).Fresh;
- Exp_High_Var : constant Term := Outputs (7).Fresh;
- S2_Var : constant Term := Outputs (7).Fresh;
- ExpD_High_Var : constant Term := Outputs (7).Fresh;
- ExpD_Var : constant Term := Outputs (7).Fresh;
-
- Base_ExpD_Var : constant Term := Outputs (7).Fresh;
- Base_Exp1_Var : constant Term := Outputs (7).Fresh;
- Base_Exp_Var : constant Term := Outputs (7).Fresh;
begin
Outputs (7).Conjunct (Exp_Two_Access, Base_Term & Zero_Term & BaseW1_Var);
Add (Outputs (7), BaseW1_Var & One_Term & BaseW_Var);
LT_Length (Outputs (7), Exponent_Term & Power_Term);
- Add (Outputs (7), Exponent_Term & One_Term & Exp1_Var);
- Multiply (Outputs (7), BaseW_Var & Exp1_Var & BaseW_Exp1_Var);
- LT (Outputs (7), PowerW1_Var & BaseW_Exp1_Var);
+ declare
+ Exp1_Var : constant Term := Outputs (7).Fresh;
+ BaseW_Exp1_Var : constant Term := Outputs (7).Fresh;
+ begin
+ Add (Outputs (7), Exponent_Term & One_Term & Exp1_Var);
+ Multiply (Outputs (7), BaseW_Var & Exp1_Var & BaseW_Exp1_Var);
+ LT (Outputs (7), PowerW1_Var & BaseW_Exp1_Var);
+ end;
Outputs (7).Conjunct (Exp_Two_Access, Power_Term & Zero_Term & PowerW1_Var);
Add (Outputs (7), PowerW1_Var & One_Term & PowerW_Var);
Divide (Outputs (7), PowerW_Var & BaseW_Var & Exp_Low1_Var & S_Var);
Add (Outputs (7), Exp_Low_Var & One_Term & Exp_Low1_Var);
- Outputs (7) := Disjunct
- (Outputs (7).Unify (Exponent_Term, Exp_Low_Var),
- LT_Length (Outputs (7), Exp_Low_Var & Exponent_Term));
-
- Outputs (7).Conjunct (Repeated_Multiply_Access,
- Base_Term & Exp_Low_Var & Base_Exp_Low_Var);
- Divide (Outputs (7), PowerW_Var & BaseW1_Var & Exp_High_Var & S2_Var);
- Add (Outputs (7), Exp_Low_Var & ExpD_High_Var & Exp_High_Var);
- Add (Outputs (7), Exp_Low_Var & ExpD_Var & Exponent_Term);
- Outputs (7) := Disjunct
- (Outputs (7).Unify (ExpD_Var, ExpD_High_Var),
- LT (Outputs (7), ExpD_Var & ExpD_High_Var));
-
- Outputs (7).Conjunct (Repeated_Multiply_Access,
- Base_Term & ExpD_Var & Base_ExpD_Var);
- Multiply (Outputs (7), Base_Exp_Low_Var & Base_ExpD_Var & Base_Exp_Var);
- Multiply (Outputs (7), Base_Term & Base_Exp_Var & Base_Exp1_Var);
- Add (Outputs (7), Base_Exp_Var & Remainder_Term & Power_Term);
- LT (Outputs (7), Power_Term & Base_Exp1_Var);
+ LTE_Length (Outputs (7), Exp_Low_Var & Exponent_Term);
+
+ declare
+ Base_Exp_Low_Var : constant Term := Outputs (7).Fresh;
+ Exp_High_Var : constant Term := Outputs (7).Fresh;
+ S_Var : constant Term := Outputs (7).Fresh;
+ ExpD_High_Var : constant Term := Outputs (7).Fresh;
+ ExpD_Var : constant Term := Outputs (7).Fresh;
+ begin
+ Outputs (7).Conjunct (Repeated_Multiply_Access,
+ Base_Term & Exp_Low_Var & Base_Exp_Low_Var);
+ Divide (Outputs (7), PowerW_Var & BaseW1_Var & Exp_High_Var & S_Var);
+ Add (Outputs (7), Exp_Low_Var & ExpD_High_Var & Exp_High_Var);
+ Add (Outputs (7), Exp_Low_Var & ExpD_Var & Exponent_Term);
+ LTE (Outputs (7), ExpD_Var & ExpD_High_Var);
+
+ declare
+ Base_ExpD_Var : constant Term := Outputs (7).Fresh;
+ Base_Exp1_Var : constant Term := Outputs (7).Fresh;
+ Base_Exp_Var : constant Term := Outputs (7).Fresh;
+ begin
+ Outputs (7).Conjunct (Repeated_Multiply_Access,
+ Base_Term & ExpD_Var & Base_ExpD_Var);
+ Multiply (Outputs (7), Base_Exp_Low_Var & Base_ExpD_Var & Base_Exp_Var);
+ Multiply (Outputs (7), Base_Term & Base_Exp_Var & Base_Exp1_Var);
+ Add (Outputs (7), Base_Exp_Var & Remainder_Term & Power_Term);
+ LT (Outputs (7), Power_Term & Base_Exp1_Var);
+ end;
+ end;
end;
+
return Disjunct (Outputs);
end Logarithm;
diff --git a/test/expo.adb b/test/expo.adb
index 3b5489a..ea2e950 100644
--- a/test/expo.adb
+++ b/test/expo.adb
@@ -74,7 +74,7 @@ procedure Expo is
begin
TIO.Put_Line ("Exponential");
- -- Exp_Test (3, 5); -- uncomment this when logarithms properly worked out
+ Exp_Test (3, 4);
TIO.New_Line;