Hi Don:

On Thu, 28 Feb 2002 22:38:04 -0000, DL Neil wrote:

>I know it's getting late, so perhaps I'm not following you sufficiently
>closely. What does "inherited" mean? 
>

"Inherited" referred to using the float(10,4) formatting of the "numbers" field in 
this case.
> Also how do you define "worked".
Good question.  I meant that it functions in the same manner on both machines.  
However, your question caused me to go back for another look.  I found that when a 
constant instead of a column_id or @variable is 
inserted for D  (round(X,D)) then the output decimal length is truncated to the value 
of the constant which is consistent with the 
manual. This is also the behavior that Roger was asking me to recognize but I had on 
my really dark glasses.    

Interestingly, if a floating point number is entered as the constant, it is apparently 
correctly rounded up from .50 before being 
applied to the calculation.

Some output from the Win98SE machine:
mysql> select * from testme;
+----------+--------+
| number   | digits |
+----------+--------+
| 100.4235 |      3 |
|  85.4000 |      1 |
|  12.3450 |      2 |
|  12.3450 |      3 |
|  12.3456 |      2 |
|  12.3456 |      3 |
|  12.3456 |      4 |
|  12.3450 |      1 |
+----------+--------+
8 rows in set (0.00 sec)

mysql> select number,round(number,digits) from testme;
+----------+----------------------+
| number   | round(number,digits) |
+----------+----------------------+
| 100.4235 |             100.4230 |
|  85.4000 |              85.4000 |
|  12.3450 |              12.3400 |
|  12.3450 |              12.3450 |
|  12.3456 |              12.3500 |
|  12.3456 |              12.3460 |
|  12.3456 |              12.3456 |
|  12.3450 |              12.3000 |
+----------+----------------------+
8 rows in set (0.05 sec)

mysql> select number,round(number,2.5) from testme;
+----------+-------------------+
| number   | round(number,2.5) |
+----------+-------------------+
| 100.4235 |           100.423 |
|  85.4000 |            85.400 |
|  12.3450 |            12.345 |
|  12.3450 |            12.345 |
|  12.3456 |            12.346 |
|  12.3456 |            12.346 |
|  12.3456 |            12.346 |
|  12.3450 |            12.345 |
+----------+-------------------+
8 rows in set (0.05 sec)

mysql> select number,round(number,2.1) from testme;
+----------+-------------------+
| number   | round(number,2.1) |
+----------+-------------------+
| 100.4235 |            100.42 |
|  85.4000 |             85.40 |
|  12.3450 |             12.34 |
|  12.3450 |             12.34 |
|  12.3456 |             12.35 |
|  12.3456 |             12.35 |
|  12.3456 |             12.35 |
|  12.3450 |             12.34 |
+----------+-------------------+
8 rows in set (0.00 sec)

Using 2 for D produces the same output as above.

>You said you didn't have the original post. Herewith Richard's first
>description:-

Thank you.  I requested the thread from the server, but it hasn't come yet.

Doug




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