[Bro] logarithm or exponential function for .bro?

Jaeyeon Jung jyjung at csail.mit.edu
Wed May 10 14:21:40 PDT 2006


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.) 

-- 
Jaeyeon

# The exp function returns the value of e (the base of natural log)
# raised to power d.
function exp%(d: double%): double
  %{
  return new Val(exp(d), TYPE_DOUBLE);
  %}

# The log function returns the natural logarithm of d. 
function log%(d: double%): double
  %{
  return new Val(log(d), TYPE_DOUBLE);
  %}

On Wed, May 10, 2006 at 03:19:27PM -0400, Ruoming Pang wrote:
> 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. :-)
> 
> Thanks,
> Ruoming
> 
> On 5/10/06, Jaeyeon Jung <jyjung at csail.mit.edu> wrote:
> > 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
> >
> >
> > _______________________________________________
> > Bro mailing list
> > bro at bro-ids.org
> > http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/bro
> >
> >
> >
> 
> _______________________________________________
> Bro mailing list
> bro at bro-ids.org
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/bro
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mailman.ICSI.Berkeley.EDU/pipermail/bro/attachments/20060510/7ab3e8e2/attachment.bin 


More information about the Bro mailing list