Provide example for calculating Integer.MIN_VALUE with SpEL's power operator
This commit is contained in:
parent
1e432ff95d
commit
7025b7aac2
|
|
@ -415,6 +415,8 @@ Java::
|
|||
|
||||
int maxInt = parser.parseExpression("(2^31) - 1").getValue(int.class); // Integer.MAX_VALUE
|
||||
|
||||
int minInt = parser.parseExpression("-2^31").getValue(int.class); // Integer.MIN_VALUE
|
||||
|
||||
// -- Operator precedence --
|
||||
|
||||
int minusTwentyOne = parser.parseExpression("1+2-3*8").getValue(int.class); // -21
|
||||
|
|
@ -479,6 +481,8 @@ Kotlin::
|
|||
|
||||
val maxInt = parser.parseExpression("(2^31) - 1").getValue(Int::class.java) // Integer.MAX_VALUE
|
||||
|
||||
val minInt = parser.parseExpression("-2^31").getValue(Int::class.java) // Integer.MIN_VALUE
|
||||
|
||||
// -- Operator precedence --
|
||||
|
||||
val minusTwentyOne = parser.parseExpression("1+2-3*8").getValue(Int::class.java) // -21
|
||||
|
|
|
|||
|
|
@ -429,6 +429,9 @@ class SpelDocumentationTests extends AbstractExpressionTests {
|
|||
int maxInt = parser.parseExpression("(2^31) - 1").getValue(int.class); // Integer.MAX_VALUE
|
||||
assertThat(maxInt).isEqualTo(Integer.MAX_VALUE);
|
||||
|
||||
int minInt = parser.parseExpression("-2^31").getValue(int.class); // Integer.MIN_VALUE
|
||||
assertThat(minInt).isEqualTo(Integer.MIN_VALUE);
|
||||
|
||||
// -- Operator precedence --
|
||||
|
||||
int minusTwentyOne = parser.parseExpression("1+2-3*8").getValue(int.class); // -21
|
||||
|
|
|
|||
Loading…
Reference in New Issue