您的实施有两个问题.
将值四舍五入为2位精度的原因是您明确将比例定义为2.
此外,FLOAT是MySQL中不精确的数据类型.
要解决这两个问题,您应该使用具有适当精度和比例的DECIMAL数据类型.
例如,像这样:
CREATE TABLE `tblGeoCodes` (
`recNo` int(11) NOT NULL AUTO_INCREMENT primary key,`longLocation` decimal(18,14) DEFAULT NULL,`latLocation` decimal(18,14) DEFAULT NULL
);
例:
mysql> CREATE TABLE `tblGeoCodes` (
-> `recNo` int(11) NOT NULL AUTO_INCREMENT primary key,-> `longLocation` decimal(18,-> `latLocation` decimal(18,14) DEFAULT NULL
-> );
Query OK,0 rows affected (0.02 sec)
mysql>
mysql> insert into tblGeoCodes (longLocation,latLocation) values(-61.45859899999999,10.28289);
Query OK,1 row affected (0.00 sec)
mysql>
mysql> select * from tblGeoCodes;
+-------+--------------------+-------------------+
| recNo | longLocation | latLocation |
+-------+--------------------+-------------------+
| 1 | -61.45859899999999 | 10.28289000000000 |
+-------+--------------------+-------------------+
1 row in set (0.00 sec)