[Bro-Dev] #908: Need for function bytestring_to_double
Bro Tracker
bro at tracker.bro-ids.org
Thu Oct 25 17:14:29 PDT 2012
#908: Need for function bytestring_to_double
------------------------------+-------------------------------
Reporter: carsten | Owner:
Type: Feature Request | Status: needs information
Priority: Normal | Milestone: Bro2.2
Component: Bro | Version: git/master
Resolution: | Keywords:
------------------------------+-------------------------------
Comment (by matthias):
Replying to [comment:7 jsiwek]:
> > - there is a check that the length of bytestring equals the length of
the internal representation of double in "if ( s->Len() != sizeof(d))".
>
> Maybe it also needs a check that `sizeof(uint64) == sizeof(double)`
since the bytes are copied to `uint64` storage first.
I'm not entirely convinced that this is the right solution. In memory, a
double is indeed 64 bits, however, double-precision registers are 80 bits
on x86 [1]. Consequently, if a compiler decides to hold a double purely in
a register, you will see truncation.
Matthias
[1] http://en.wikipedia.org/wiki/Extended_precision
--
Ticket URL: <http://tracker.bro-ids.org/bro/ticket/908#comment:9>
Bro Tracker <http://tracker.bro-ids.org/bro>
Bro Issue Tracker
More information about the bro-dev
mailing list