logarithm or exponential function for .bro?

Hi,

What is the best way to compute log (x) or exp (x) (and get
the double-precision result) in a Bro policy? I notice
that large-conns.bro has logarithm() implemented, but
this returns the integer logarithm.

Thanks!
Jaeyeon

Hi,

I cannot find any log/exp implementation in bro.bif. But you are
encouraged to add your own (see src/bro.bif for examples). And if you
do so, please send your code to us. :slight_smile:

Thanks,
Ruoming

Hi Ruoming,

Thanks for the pointer (bro.bif). Added two functions, exp and log,
in bro.bif as below. (Also tested them with a simple test.bro script.)