* Gordon
> This round discussion has nothing to do with floating point
> approximations.

well...

> Most round routines are statistically biased on the high side. The MySQL
> round is statistically correct. The more accurate rounding rule is

As far as I can tell, there is no "MySQL round"... as the behaviour is
different on different platforms. From my original post in this thread:

> solaris:
>
> mysql> select round(0.05,1),round(0.15,1),round(0.25,1),round(0.35,1);
> +---------------+---------------+---------------+---------------+
> | round(0.05,1) | round(0.15,1) | round(0.25,1) | round(0.35,1) |
> +---------------+---------------+---------------+---------------+
> |           0.0 |           0.2 |           0.2 |           0.4 |
> +---------------+---------------+---------------+---------------+
> 1 row in set (0.00 sec)
>
> Sometimes it rounds up, sometimes it rounds down...
>
> win2k:
>
> mysql> select round(0.05,1),round(0.15,1),round(0.25,1),round(0.35,1);
> +---------------+---------------+---------------+---------------+
> | round(0.05,1) | round(0.15,1) | round(0.25,1) | round(0.35,1) |
> +---------------+---------------+---------------+---------------+
> |           0.0 |           0.1 |           0.2 |           0.3 |
> +---------------+---------------+---------------+---------------+
> 1 row in set (0.00 sec)

The solaris behaviour seems to match your description of an accurate
rounding. (version 3.23.39-log on solaris and 3.23.30-gamma on win2k)

The explanation I got was that this depends on the floating point routines
in the C lib, and maybe even the math processor...

--
Roger
query


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to