[OpenSIPS-Users] negative values in math_rpn
Liviu Chircu
liviu at opensips.org
Mon Jul 10 07:05:55 EDT 2017
I suggest you use math_eval() - it's much more human friendly. The
following should work:
$var(neg) = "-6.135";
$var(neg_int) = $(var(neg){s.int});
math_eval("abs($var(neg_int))", "$var(result)");
OTOH, if you really want to use RPN, this will fix it:
math_rpn("abs $var(neg_int)", "$var(result)");
Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 10.07.2017 13:55, xaled wrote:
>
> Hi,
>
> am I doing something wrong, or can math_rpn not handle negative values?
>
> $var(neg) = "-6.135";
>
> $var(neg_int) = $(var(neg){s.int});
>
> math_rpn("$var(neg_int) abs", "$avp(result)");
>
> 2017-07-10T12:47:59.804008+02:00 fra-ivr01
> /usr/local/sbin/opensips[10971]: DBG:mathops:w_evaluate_rpn:
> Evaluating expression: -6 abs
>
> 2017-07-10T12:47:59.804339+02:00 fra-ivr01
> /usr/local/sbin/opensips[10971]: WARNING:mathops:get_rpn_op: Parse
> expr error: Invalid operator! <-6>
>
> 2017-07-10T12:47:59.804669+02:00 fra-ivr01
> /usr/local/sbin/opensips[10971]: ERROR:mathops:evaluate_rpn: Failed to
> parse RPN!
>
> Thanks,
>
> xaled
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20170710/a5b23096/attachment.html>
More information about the Users
mailing list