[SR-Users] Float Comparison
Daniel-Constantin Mierla
miconda at gmail.com
Thu Aug 25 13:03:44 CEST 2011
On 8/25/11 12:54 PM, Alex Hermann wrote:
> On Thursday 25 August 2011, Daniel-Constantin Mierla wrote:
>> 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.
> If you just use fixed-point for fractional values, you can remove the dot and
> convert to int.
>
> $(var(float){s.replace,.}{s.int})
By fixed point do you mean when the fractional part has fixed length?
That should work, indeed.
Cheers,
Daniel
--
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
More information about the sr-users
mailing list