summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2019-01-25 12:45:28 (GMT)
committersebres <sebres@users.sourceforge.net>2019-01-25 12:45:28 (GMT)
commite3c456752e6d98384049e88f7dc7a1d89a4da0a8 (patch)
tree607a4738b13753a03f41c117e33933f072f26c32 /tests
parent25a1f3d894e556ad09ff624fd69db9b9d8b98369 (diff)
downloadtcl-e3c456752e6d98384049e88f7dc7a1d89a4da0a8.zip
tcl-e3c456752e6d98384049e88f7dc7a1d89a4da0a8.tar.gz
tcl-e3c456752e6d98384049e88f7dc7a1d89a4da0a8.tar.bz2
More simplifications in tclExecute.c (INST_EXPON), much more and well-arranged branching of wide/bignum base and exponent cases, test-cases extended to cover all this branches and edge cases.
Diffstat (limited to 'tests')
-rw-r--r--tests/mathop.test28
1 files changed, 26 insertions, 2 deletions
diff --git a/tests/mathop.test b/tests/mathop.test
index f122b7b..eff0852 100644
--- a/tests/mathop.test
+++ b/tests/mathop.test
@@ -1206,6 +1206,8 @@ test mathop-25.5 { exp operator } {TestOp ** 1 5} 1
test mathop-25.6 { exp operator } {TestOp ** 5 1} 5
test mathop-25.7 { exp operator } {TestOp ** 4 3 2 1} 262144
test mathop-25.8 { exp operator } {TestOp ** 5.5 4} 915.0625
+test mathop-25.8a { exp operator } {TestOp ** 4.0 -1} 0.25
+test mathop-25.8b { exp operator } {TestOp ** 2.0 -2} 0.25
test mathop-25.9 { exp operator } {TestOp ** 16 3.5} 16384.0
test mathop-25.10 { exp operator } {TestOp ** 3.5 0} 1.0
test mathop-25.11 { exp operator } {TestOp ** 378 0} 1
@@ -1219,8 +1221,30 @@ test mathop-25.18 { exp operator } {TestOp ** -1 -2} 1
test mathop-25.19 { exp operator } {TestOp ** -1 3} -1
test mathop-25.20 { exp operator } {TestOp ** -1 4} 1
test mathop-25.21 { exp operator } {TestOp ** 2 63} 9223372036854775808
-test mathop-25.22 { exp operator } {TestOp ** 83756485763458746358734658473567847567473 2} 7015148907444467657897585474493757781161998914521537835809623408157343003287605729
-test mathop-25.23 { exp operator errors } {
+test mathop-25.22 { exp operator } {TestOp ** 2 256} 115792089237316195423570985008687907853269984665640564039457584007913129639936
+set big 83756485763458746358734658473567847567473
+test mathop-25.23 { exp operator } {TestOp ** $big 2} 7015148907444467657897585474493757781161998914521537835809623408157343003287605729
+test mathop-25.24 { exp operator } {TestOp ** $big 0} 1
+test mathop-25.25 { exp operator } {TestOp ** $big 1} $big
+test mathop-25.26 { exp operator } {TestOp ** $big -1} 0
+test mathop-25.27 { exp operator } {TestOp ** $big -2} 0
+test mathop-25.28 { exp operator } {TestOp ** $big -$big} 0
+test mathop-25.29 { exp operator } {expr {[set res [TestOp ** $big -1.0]] > 0 && $res < 1.2e-41}} 1
+test mathop-25.30 { exp operator } {expr {[set res [TestOp ** $big -1e-18]] > 0 && $res < 1}} 1
+test mathop-25.31 { exp operator } {expr {[set res [TestOp ** -$big -1.0]] > -1 && $res < 0}} 1
+test mathop-25.32 { exp operator } {expr {[set res [TestOp ** -$big -2.0]] > 0 && $res < 1}} 1
+test mathop-25.33 { exp operator } {expr {[set res [TestOp ** -$big -3.0]] > -1 && $res < 0}} 1
+test mathop-25.34 { exp operator } {TestOp ** $big -1e-30} 1.0
+test mathop-25.35 { exp operator } {TestOp ** $big -1e+30} 0.0
+test mathop-25.36 { exp operator } {TestOp ** 0 $big} 0
+test mathop-25.37 { exp operator } {TestOp ** 1 $big} 1
+test mathop-25.38 { exp operator (small exponent power helper and its boundaries) } {
+ set pwr 0
+ set res 1
+ while {[incr pwr] <= 17 && [set i [TestOp ** 15 $pwr]] == [set res [expr {$res * 15}]]} {}
+ list [incr pwr -1] $res
+} {17 98526125335693359375}
+test mathop-25.37 { exp operator errors } {
set res {}
set exp {}