Package: mysql-server
Version: 4.0.24-10sarge1

The function sec_to_time delivers partly wrong results from calculated
arguments. Here are some examples:

mysql> select sec_to_time(69);
+-----------------+
| sec_to_time(69) |
+-----------------+
| 00:01:09        |
+-----------------+
1 row in set (0.01 sec)

-> This is correct.

mysql> select sec_to_time(69 / 100 * 100);
+-----------------------------+
| sec_to_time(69 / 100 * 100) |
+-----------------------------+
| 00:01:08                    |
+-----------------------------+
1 row in set (0.00 sec)

-> This is obviously wrong.

mysql> select sec_to_time(68 / 100 * 100);
+-----------------------------+
| sec_to_time(68 / 100 * 100) |
+-----------------------------+
| 00:01:08                    |
+-----------------------------+
1 row in set (0.00 sec)

-> This is correct.

mysql> select sec_to_time(67 / 100 * 100);
+-----------------------------+
| sec_to_time(67 / 100 * 100) |
+-----------------------------+
| 00:01:07                    |
+-----------------------------+
1 row in set (0.00 sec)

-> Correct.

mysql> select sec_to_time(62 / 100 * 100);
+-----------------------------+
| sec_to_time(62 / 100 * 100) |
+-----------------------------+
| 00:01:01                    |
+-----------------------------+
1 row in set (0.00 sec)

Wrong again. But when I do the following (which is of course
mathematically the same):

mysql> select sec_to_time(62 / (100 / 100));
+-------------------------------+
| sec_to_time(62 / (100 / 100)) |
+-------------------------------+
| 00:01:02                      |
+-------------------------------+
1 row in set (0.01 sec)

The result is correct again.

I am using Debian 3.1 (i386) with kernel 2.4.27 and libc6
2.3.2.ds1-22sarge3.


Nils


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to