* Mark Riehl
> All - We're using MySQL under Linux to capture and analyze
> network traffic. We have two tables that store all the messages sent,
> and, another table that stores all the messages received.  The sent
> table has an transmit column (as a double) and the received table has
> a received time sent time (from the incoming packet) both stored as
> doubles (seconds and fractions of seconds).
> In addition, there are a few other fields that distinctly define each
> message (e.g., source IP, source port, etc.).
>
> We're trying to perform some analysis on the data and seem to be having
> trouble matching columns of type double.  For example, we loop through all
> of the received messages and try to find the corresponding message in the
> transmit table based on the transmit time (which appears on both tables).
> However, when the double transmit time is part of the query, we can't seem
> to find matches.  Wrapping the transmit time in the select statement with
> ROUND() finds the matching records.
>
> Is it possible that some rounding is taking place here?  We've considered
> storing time as two separate INT columns (like the timeval
> struct), however, we'd prefer to have 1 time column.
>
> Any suggestions?

Using approximate numbers is tricky, I usually avoid it, and would probably
have used a separate column for the fractions in this case, maybe a tinyint,
if two digits for the fractions is sufficient.

Take a look at this:

<URL: http://www.mysql.com/doc/en/Problems_with_float.html >

At the end of the page there is an example using ABS(), I guess this is a
relatively easy way for you to fix your problem, if you decide to keep your
DOUBLE column.

--
Roger


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to