Bug #119703 after changing log function,the col_3’s value unexpectedly change

Submitted: 16 Jan 7:26 Modified: 16 Jan 10:00
Reporter: Aaditya Dubey Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.0.x, 8.4.x OS:Any
Assigned to: CPU Architecture:Any

[16 Jan 7:26] Aaditya Dubey
Description:
after changing log function,the col_3’s value unexpectedly change 

mysql> SELECT van44.c8 AS col_2, LOG(SIN(bpv50.c4), bpv50.c5) AS col_3 FROM t3 AS van44 LEFT JOIN t1 AS bpv50 ON (van44.c5 > bpv50.c5);
+-------+---------------------+
| col_2 | col_3               |
+-------+---------------------+
|    51 | -1572.4870652965908 |
+-------+---------------------+
1 row in set (0.00 sec)
mysql> SELECT van44.c8 AS col_2, LOG(EXP(LOG(SIN(bpv50.c4), bpv50.c5))) AS col_3 FROM t3 AS van44 LEFT JOIN t1 AS bpv50 ON (van44.c5 > bpv50.c5);
+-------+-------+
| col_2 | col_3 |
+-------+-------+
|    51 |  NULL |
+-------+-------+
1 row in set, 1 warning (0.00 sec)

How to repeat:
DROP DATABASE IF EXISTS test;
CREATE DATABASE IF NOT EXISTS test;
USE test;
CREATE TABLE t1 (
    c1 INT NOT NULL AUTO_INCREMENT,
    c2 VARCHAR(255) NOT NULL,
    c3 VARCHAR(255) NULL,
    c4 INT NULL,
    c5 DATE NOT NULL,
    c6 VARCHAR(10) NOT NULL,
    PRIMARY KEY (c1)
);
CREATE TABLE t3 (
    c1 INT NOT NULL AUTO_INCREMENT,
    c2 INT NOT NULL,
    c3 INT NOT NULL,
    c4 YEAR NOT NULL,
    c5 TIME NULL,
    c6 TINYINT NULL,
    c7 SMALLINT NULL,
    c8 MEDIUMINT NULL,
    c9 BIGINT NULL,
    c10 LONGTEXT NULL,
    c11 GEOMETRY NULL,
    c12 TINYTEXT NULL,
    c13 TINYBLOB NULL,
    c14 SET('x','y','z') NULL,
    c15 TINYINT(1) NULL,
    PRIMARY KEY (c1)
);
INSERT INTO t1 (c1, c2, c3, c4, c5, c6) VALUES (199, 'sample_PAx2UX0izexVkat2lF2WTNcid7wPyQim53p5isVhYKSyMY3TOTu50CDF7TVlkA3NLD5F7nKjxlpQ4eGsswpvnbjlZzrBxulLVS1a8Loh8FyRJTuwz7ST8ntWEzoSo9BoPGzQmndUR4I7wdTJS5lhqTITVau4WXnX8qmRFgX9VOjW3NFfBWJb6y2g0xGPOp5swGbOON0u6QI1OuSonmWPba6k5of5yAmFnEk6zR', 'sample_nHsdHZBOeSpo09EGGnssKOg2VESiBPNjDYG9kL4SqpQn9nsendz0F', 8, '2025-06-20', 'sample_j');
INSERT INTO t3 (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15) VALUES (1009, 8871, 4133, 2022, '2023-01-01 01:58:18', 76, 34, 51, 19, 'sample_pDek9jnwphEgfzuklg8OOzGZR9uSloHVq9U7AgaRKgPjN0XI9e7cXabbIdcQ3R6kC94kqfDpBRumDUzMfg5HJAr', ST_GeomFromText('POINT(-59.066767 132.07659)'), 'sample_FXwsfFfXtlkCbB0CmCxYydm55btQoFSsrYSs1JXyCtZhdoFv0Go4cb2foZdoGBxtqGCrcgC72lh9LoXSbc1n4Mm72kc1xFVRyNfrH4pdp8wxLqbZYobWoGyNzCUb3C9McjAfurENvJJQO1DiTKbIs8Bfnpryb', X'E988971932207F', 'z,y', NULL);
SELECT van44.c8 AS col_2, LOG(SIN(bpv50.c4), bpv50.c5) AS col_3 FROM t3 AS van44 LEFT JOIN t1 AS bpv50 ON (van44.c5 > bpv50.c5);
SELECT van44.c8 AS col_2, LOG(EXP(LOG(SIN(bpv50.c4), bpv50.c5))) AS col_3 FROM t3 AS van44 LEFT JOIN t1 AS bpv50 ON (van44.c5 > bpv50.c5);
[16 Jan 10:00] Roy Lyseng
This is not a bug.
You are trying to take the logarithm of a negative number,
which is an invalid operation.
[16 Jan 13:03] cl hl
in fact ,the result shouldn't be 0

mysql> select exp(-1572.4870652965908);
+--------------------------+
| exp(-1572.4870652965908) |
+--------------------------+
|                        0 |
+--------------------------+
1 row in set (0.00 sec)

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.066 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
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.