Changed the way POW_FROM_RIGHT works with negative constants.

This commit is contained in:
Lewis Van Winkle
2016-08-23 15:05:59 -05:00
parent b4310cc55c
commit 2d58ae9fb2
2 changed files with 9 additions and 5 deletions

6
test.c
View File

@@ -525,6 +525,10 @@ void test_pow() {
#ifdef TE_POW_FROM_RIGHT
test_equ cases[] = {
{"2^3^4", "2^(3^4)"},
{"-2^2", "-(2^2)"},
{"-(2)^2", "-(2^2)"},
{"-(2*1)^2", "-(2^2)"},
{"-2^2", "-4"},
{"2^1.1^1.2^1.3", "2^(1.1^(1.2^1.3))"},
{"-a^b", "-(a^b)"},
{"-a^-b", "-(a^-b)"}
@@ -532,6 +536,8 @@ void test_pow() {
#else
test_equ cases[] = {
{"2^3^4", "(2^3)^4"},
{"-2^2", "(-2)^2"},
{"-2^2", "4"},
{"2^1.1^1.2^1.3", "((2^1.1)^1.2)^1.3"},
{"-a^b", "(-a)^b"},
{"-a^-b", "(-a)^(-b)"}