[SR-Users] Float Comparison

Daniel-Constantin Mierla miconda at gmail.com
Thu Aug 25 12:43:20 CEST 2011


Hello,

as mentioned before, script variables work only with integer or string 
values. In this case I suggest you load the values as string and then 
use Lua to compute what you want as float. Alternative, load as string 
(n the format integer.decimals) and split the value using transformation 
in the part before the dot and the part after dot. Then you can do 
operations with them.

Cheers,
Daniel

On 8/23/11 9:35 PM, Brandon Armstead wrote:
> Daniel,
>
>    Sorry for taking so long to respond - I am still facing an issue 
> with this (even in 3.1.4).
>
> I am loading the values from database.
>
> It looks as if the arithmetic operators are not functioning properly 
> when the data is imported into kamailio from DB - I'm going to do some 
> more research and give you some specifics.
>
> Sincerely,
> Brandon Armstead
>
> On Thu, Jan 20, 2011 at 2:13 AM, Daniel-Constantin Mierla 
> <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>
>
>
>     On 1/19/11 7:50 AM, Klaus Darilion wrote:
>
>
>
>         Am 18.01.2011 21:26, schrieb Brandon Armstead:
>
>             Hello,
>
>                Is there anything special that needs to be done for
>             float comparison?
>
>             For example:
>
>             if([5.5 >= 4.3]) ....
>
>     ^^^ this format is no longer supported starting with 3.0, just
>     skip the square brackets, now it is working like in C.
>
>
>
>             or
>             if(5.5 > 4.3) ....
>
>             The conditional does not seem to be coming back as true
>             like it should?
>
>
>         I have no idea if floating point comparison is supported, but
>         you could multiple the values (e.g. * 10000) before comparison
>
>     The pseudo-variables can hold integer or strings. Do you do
>     comparison with static values or you load the values in some
>     variables and then compare?
>
>     Cheers,
>     Daniel
>
>     -- 
>     Daniel-Constantin Mierla
>     Kamailio (OpenSER) Advanced Training
>     Jan 24-26, 2011, Irvine, CA, USA
>     http://www.asipto.com
>
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
http://linkedin.com/in/miconda -- http://twitter.com/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20110825/b1a7d63a/attachment-0001.htm>


More information about the sr-users mailing list