File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
main/java/cn/hutool/core/math
test/java/cn/hutool/core/math Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ private static String transform(String expression) {
191191 }
192192 }
193193 }
194- if (arr [0 ] == '~' || (arr .length > 1 && arr [1 ] == '(' )) {
194+ if (arr [0 ] == '~' && (arr .length > 1 && arr [1 ] == '(' )) {
195195 arr [0 ] = '-' ;
196196 return "0" + new String (arr );
197197 } else {
Original file line number Diff line number Diff line change @@ -31,10 +31,15 @@ public void conversationTest4(){
3131 }
3232
3333 @ Test
34- @ Ignore
3534 public void conversationTest5 (){
3635 // https://github.com/dromara/hutool/issues/1984
3736 final double conversion = Calculator .conversion ("((1/1) / (1/1) -1) * 100" );
38- Assert .assertEquals ((88D * 66 / 23 ) % 26 , conversion , 2 );
37+ Assert .assertEquals (0 , conversion , 2 );
38+ }
39+
40+ @ Test
41+ public void conversationTest6 () {
42+ final double conversion = Calculator .conversion ("-((2.12-2) * 100)" );
43+ Assert .assertEquals (-1D * (2.12 - 2 ) * 100 , conversion , 2 );
3944 }
4045}
You can’t perform that action at this time.
0 commit comments