English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Ok so I'm trying to store Lat and Long positioning locations

so '-118.010101' is coming up as -9.999999

I've changed the data type on the field to almost all the number fields but it still comes out the same on every one!!! I've set the values (10,6) and it's still coming up -9.999999 only on postive numbers does it give me the right results..... I'm thinking it might be my Insert statement as i'm inserting them as -118.010101 for the value...does there need to be any special quotes or can i enter in a number with a '-' sign on the front??? please help O_o

2007-02-10 22:06:46 · 4 answers · asked by thelastryan 3 in Computers & Internet Programming & Design

4 answers

what fieldtype you used for storing the lat and long position ?
integer? number? float? smallint? etc ?
check your mysql documentation about limitation for each fieldtype.
try to get the record in mysql console (mysql.exe) , see if the numbers you store in the table are correct.

2007-02-10 22:59:52 · answer #1 · answered by Manzana verde 5 · 0 1

http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html

As of MySQL 5.0.3, DECIMAL and NUMERIC values are stored in binary format. Previously, they were stored as strings, with one character used for each digit of the value, the decimal point (if the scale is greater than 0), and the ‘-’ sign (for negative numbers). See Chapter 21, Precision Math.

When declaring a DECIMAL or NUMERIC column, the precision and scale can be (and usually is) specified; for example:

salary DECIMAL(5,2)

In this example, 5 is the precision and 2 is the scale. The precision represents the number of significant digits that are stored for values, and the scale represents the number of digits that can be stored following the decimal point. If the scale is 0, DECIMAL and NUMERIC values contain no decimal point or fractional part.

Standard SQL requires that the salary column be able to store any value with five digits and two decimals. In this case, therefore, the range of values that can be stored in the salary column is from -999.99 to 999.99. MySQL enforces this limit as of MySQL 5.0.3. Before 5.0.3, on the positive end of the range, the column could actually store numbers up to 9999.99. (For positive numbers, MySQL 5.0.2 and earlier used the byte reserved for the sign to extend the upper end of the range.)

2007-02-13 22:53:26 · answer #2 · answered by ajreal 2 · 0 0

you won't be able to change the way it really is saved. it is going to continuously be saved as yyyymmdd. reckoning on what you locale settings are on your pc, it should be displayed in yet differently in diverse procedures which includes Toad or SQLYog, although the underlying format will continuously be yyyymmdd. that's continuously staggering to apply the interior of reach format for storage and then change the displayed values as needed by technique of the using.

2016-11-27 00:20:53 · answer #3 · answered by ? 4 · 0 0

well i think that the number is stored correct but that you dont use the proper method to show the number

there is no logic in displaying -118.010101 as -9.999 and 6 also as -9.9999

2007-02-10 22:15:37 · answer #4 · answered by gjmb1960 7 · 0 0

fedest.com, questions and answers