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) {
191
191
}
192
192
}
193
193
}
194
- if (arr [0 ] == '~' || (arr .length > 1 && arr [1 ] == '(' )) {
194
+ if (arr [0 ] == '~' && (arr .length > 1 && arr [1 ] == '(' )) {
195
195
arr [0 ] = '-' ;
196
196
return "0" + new String (arr );
197
197
} else {
Original file line number Diff line number Diff line change @@ -31,10 +31,15 @@ public void conversationTest4(){
31
31
}
32
32
33
33
@ Test
34
- @ Ignore
35
34
public void conversationTest5 (){
36
35
// https://github.com/dromara/hutool/issues/1984
37
36
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 );
39
44
}
40
45
}
You can’t perform that action at this time.
0 commit comments