vendredi 17 avril 2015

Spring Expression Language: Get absolute value

I am trying to evaluate the expression where I need to have the absolute value of operator. My expression, after evaluation, looks like this:



((-4.0 - 3.0)/-4.0) * 100


I want absolute value of denominator to be substituted there. Here is my actual expression:



((@0@ - @1@)/@0@}) * 100


I have tried using Math.abs() but it throws an exception while evaluating expression having abs() in it. Here are the expressions that I have tried (and failed):



((@0@ - @1@)/${#java.lang.Math.abs(@0@)}) * 100
((@0@ - @1@)/#java.lang.Math.abs(@0@)) * 100
((@0@ - @1@)/${java.lang.Math.abs(@0@)}) * 100


Can anyone please let me know the correct syntax for this? Also, can we use bars to get absolute value (like |@0@| or something)?


Aucun commentaire:

Enregistrer un commentaire