MySQL Forums
Forum List  »  Newbie

Re: Math function logarithm
Posted by: Rick James
Date: March 15, 2011 12:03PM

To complete Peter's thought...
mysql> set @x=743.7585697483, @y=743.5888244369;

mysql> create table f412178(
    ->    decx decimal(15,10), decy decimal(15,10),
    ->    dblx DOUBLE, dbly DOUBLE);

mysql> insert into f412178 values
    ->    (743.7585697483,743.5888244369, 743.7585697483,743.5888244369),
    ->    (@x,@y, @x,@y);

mysql> SELECT decx/decy, dblx/dbly FROM f412178;
+------------------+-----------------+
| decx/decy        | dblx/dbly       |
+------------------+-----------------+
| 1.00022827845958 | 1.0002282784596 |
| 1.00022827845958 | 1.0002282784596 |
+------------------+-----------------+

mysql> select  decx, decy, ln(decx/decy),
    ->         dblx, dbly, ln(dblx/dbly)
    ->     from f412178;
+----------------+----------------+---------------------+----------------+----------------+---------------------+
| decx           | decy           | ln(decx/decy)       | dblx           | dbly           | ln(dblx/dbly)       |
+----------------+----------------+---------------------+----------------+----------------+---------------------+
| 743.7585697483 | 743.5888244369 | 0.00022825240801256 | 743.7585697483 | 743.5888244369 | 0.00022825240801278 |
| 743.7585697483 | 743.5888244369 | 0.00022825240801256 | 743.7585697483 | 743.5888244369 | 0.00022825240801278 |
+----------------+----------------+---------------------+----------------+----------------+---------------------+
Notice the slight difference between DECIMAL and DOUBLE.

Options: ReplyQuote


Subject
Written By
Posted
March 15, 2011 10:06AM
Re: Math function logarithm
March 15, 2011 12:03PM
March 17, 2011 07:59PM
March 18, 2011 02:59AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.