How to properly define the [float] data type in mysql
Solution 1
Open phpMyAdmin with structure option and define the float as:
FLOAT(23,19)
Solution 2
How do you define the float in phpMyAdmin
FLOAT(23,19)
when u declare the field you could use that above.
Better to go with Cygnusx1 and change to decimal
and also Problems with Float
Solution 3
DECIMAL is what you looking for.
ref:
SQL Decimal is used to specify the values in decimal datatype. The Decimal datatype can be of two types : Decimal (p) refers to floating point and Decimal fixed point (p,s). The DECIMAL data type can store decimal floating-point numbers up to a maximum of 32 significant digits and Decimal fixed point can store upto 16 significant digits.
Itay Moav -Malimovka
SOreadytohelp Below are some of the open source projects I work on. A PHP Library the wrappes SurveyMonkey's API https://github.com/itay-moav/TheKofClient A tool to Schema Check, manage Stored Procedures, Triggers, Views and get autocompletion: https://github.com/itay-moav/rahl_commander A fun way to point users at the right direction in your site ;-) https://github.com/itay-moav/babahandofgod An old version of WMD which I converted to Mootools, 8 years ago... http://moowmd.awardspace.info Feel free to contact me through linkedin http://www.linkedin.com/in/itaymoav
Updated on November 09, 2020Comments
-
Itay Moav -Malimovka over 3 years
I defined (through PHPMYADMIN) a field with the
float
data type.
When I try to insert a number as 78.556677099932222377 it will translate it to 79.
How do I make it to save the correct number, at least 7 places after the decimal dot? -
Cygnusx1 almost 13 yearsYou will probably have to set the precision and scale too. Precison for the lenght of the number to the left of the . and scale for the lenght of your decimal part.
-
Mchl almost 13 yearsDECIMAL in MySQL has slightly different parameters (e.g. DECIMAL(p) is a synonym for DECIMAL(p,0))