Bug #97167 "ST_Latitude" and "ST_Longitude" functions do not return exact values
Submitted: 9 Oct 2019 19:49 Modified: 10 Oct 2019 12:30
Reporter: William Chiquito Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: GIS Severity:S3 (Non-critical)
Version:8.0.17 OS:Any
Assigned to: CPU Architecture:Any
Tags: ST_Latitude, ST_Longitude

[9 Oct 2019 19:49] William Chiquito
Description:
When using "ST_Latitude" and "ST_Longitude" functions, why -31, -61 and -62 are not exact values?

How to repeat:
DROP TABLE IF EXISTS `table`;

CREATE TABLE IF NOT EXISTS `table` (
  `random_point` GEOMETRY
);

SET @`SRID` := 4326;

INSERT INTO `table`
VALUES
  (ST_GeomFromText('POINT(-30 -31)', @`SRID`)),
  (ST_GeomFromText('POINT(-32 -33)', @`SRID`)),
  (ST_GeomFromText('POINT(-60 -61)', @`SRID`)),
  (ST_GeomFromText('POINT(-62 -63)', @`SRID`));

SELECT
  ST_Latitude(`random_point`) `Latitude`,
  ST_Longitude(`random_point`) `Longitude`
FROM `table`;

-------------------- ---------------------
           Latitude |           Longitude |
------------------- | ------------------- |
                -30 | -30.999999999999996 |
                -32 |                 -33 |
                -60 |  -61.00000000000001 |
 -61.99999999999999 |                 -63 |
-------------------- ---------------------
[10 Oct 2019 12:30] Sinisa Milivojevic
Hi Mr. Chiquito,

Thank you for your bug report.

However, this is not a bug. We simply follow GIS standard, so you should read it thoroughly ...