summaryrefslogtreecommitdiff
path: root/strings/dtoa.c
Commit message (Collapse)AuthorAgeFilesLines
* Merging Copyright update from 5.1Alexander Barkov2011-01-191-1/+1
|
* Bug #45882: dtoa.c might not work with gcc 4.4.0Alexey Kopytov2010-06-011-181/+192
| | | | | | | | | | | - Ported relevant changes from the upstream version to not break strict-aliasing rules and to fix compiler warnings and and infinite loops caused by that issue. - Fixed compilation with Honor_FLT_ROUNDS defined. - Fixed an unused variable warning.
* Reconciling different file ids for dtoa.c in trunk and 6.0-codebase.Alexey Kopytov2010-04-111-0/+2782
|\
| * WL #2934 "Make/find library for doing float/double to string conversionsunknown2007-12-071-0/+2754
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and vice versa" Initial import of the dtoa.c code and custom wrappers around it to allow its usage from the server code. Conversion of FLOAT/DOUBLE values to DECIMAL ones or strings and vice versa has been significantly reworked. As the new algoritms are more precise than the older ones, results of such conversions may not always match those obtained from older server versions. This in turn may break compatibility for some applications. This patch also fixes the following bugs: - bug #12860 "Difference in zero padding of exponent between Unix and Windows" - bug #21497 "DOUBLE truncated to unusable value" - bug #26788 "mysqld (debug) aborts when inserting specific numbers into char fields" - bug #24541 "Data truncated..." on decimal type columns without any good reason" BitKeeper/deleted/.del-strtod.c: Rename: strings/strtod.c -> BitKeeper/deleted/.del-strtod.c client/Makefile.am: Added dtoa.c client/sql_string.cc: Replaced sprintf() with a new wrapper around dtoa() include/m_string.h: Added declarations for the new double to/from string conversion functions. libmysql/Makefile.shared: Removed strtod.c, added dtoa.c libmysql/libmysql.c: Replaced sprintf() with my_gcvt(). We must use the same conversion method in both server and client lib. mysql-test/r/archive_gis.result: Fixed tests to take additional precision from dtoa() into account. mysql-test/r/cast.result: Fixed tests to take the formatting changes into account. mysql-test/r/func_group.result: Fixed tests to take additional precision from dtoa() into account. mysql-test/r/func_math.result: Fixed tests to take additional precision from dtoa() and formatting changes into account. mysql-test/r/func_str.result: Fixed tests to take additional precision from dtoa() and formatting changes into account. mysql-test/r/gis.result: Fixed tests to take additional precision from dtoa() into account. mysql-test/r/innodb_gis.result: Fixed tests to take additional precision from dtoa() into account. mysql-test/r/insert.result: Fixed tests to take additional precision from dtoa() into account. mysql-test/r/mysqldump.result: No need for result substitution since we do not rely on system behavior anymore. mysql-test/r/ndb_gis.result: Fixed tests to take additional precision from dtoa() into account. mysql-test/r/parser.result: Fixed tests to take additional precision from dtoa() into account. mysql-test/r/ps_2myisam.result: Fixed tests to take additional precision from dtoa() and formatting changes into account. mysql-test/r/ps_3innodb.result: Fixed tests to take additional precision from dtoa() and formatting changes into account. mysql-test/r/ps_4heap.result: Fixed tests to take additional precision from dtoa() and formatting changes into account. mysql-test/r/ps_5merge.result: Fixed tests to take additional precision from dtoa() and formatting changes into account. mysql-test/r/ps_7ndb.result: Fixed tests to take additional precision from dtoa() and formatting changes into account. mysql-test/r/select.result: Fixed tests to take additional precision from dtoa() into account. mysql-test/r/sp.result: Fixed tests to take additional precision from dtoa() into account. Decimal 2.7182818284590452354 is now converted to the double value of 2.718281828459045, not 2.718281828459. Thus we get additional precision from the subsequent calculations. mysql-test/r/strict.result: Fixed tests to take additional precision from dtoa() and formatting changes into account. mysql-test/r/type_decimal.result: Added a test case for bug #24541. mysql-test/r/type_float.result: Fixed tests to take additional precision from dtoa() and formatting changes into account. Added test cases for bugs #12860, #21497 and #26788. mysql-test/r/type_newdecimal.result: Fixed tests to take additional precision from dtoa() and formatting changes into account. mysql-test/r/variables.result: Fixed tests to take the formatting changes into account. mysql-test/r/view.result: Fixed tests to take additional precision from dtoa() into account. mysql-test/t/cast.test: No need to replace the results for Windows anymore. mysql-test/t/insert.test: Added test cases from bug #26788. mysql-test/t/mysqldump.test: Fixed tests to take additional precision from dtoa() into account. No need for results substitution because we do not rely on system behavior anymore. mysql-test/t/type_decimal.test: Added a test case for bug #24541. mysql-test/t/type_float.test: Added test cases for bugs #12860, #21497 and #26788. mysql-test/t/type_newdecimal.test: Removed replace_result which is pointless with our own floating point conversion library. Added a reference for WL#3977. sql/field.cc: Replaced the field.cc's own constant for the maximum double->string conversion buffer with the one defined in m_string.h Replaced double->string conversion code with the new wrappers around dtoa(). Fixed a bug in Field_real::truncate() which led to incorrect results when +-Infinity was passed as an input number. Fixed Field_blob::store(double) to use NOT_FIXED_DEC instead of 2 as precision, so that my_gcvt() is now used for conversion. sql/field.h: Moved NOT_FIXED_DEC to m_string.h because we now use this constant in floating point <-> string conversion routines. sql/item.cc: If a result of a numeric functions is stored in a string field, follow the same rules as in Field_str::store(double), i.e. take the field width into account. sql/log_event.cc: Replaced sprintf() with my_gcvt(). sql/mysql_priv.h: Moved log_10[] from strtod.c to mysqld.c, because we don't need it in libmystrings anymore. sql/mysqld.cc: Moved log_10[] from strtod.c to mysqld.c, because we don't need it in libmystrings anymore. sql/sql_show.cc: Replaced sprintf() with my_fcvt(). sql/sql_string.cc: Replace the double->string conversion code with the new wrappers around dtoa(). sql/unireg.h: Moved FLOATING_POINT_BUFFER from unireg.h to m_string.h so it can be used in libmystrings. strings/Makefile.am: Removed strtod.c, added dtoa.c strings/decimal.c: Replaced sprintf() with my_gcvt(). Changed double2decimal() to print the digits to a string buffer, then use my_strtod(). strings/dtoa.c: Initial import of the dtoa code and custom wrappers around it to allow its usage from the server code.
* Reconciling different file ids for dtoa.c in trunk and 6.0-codebase.Alexey Kopytov2010-04-111-2782/+0
|
* Bug #52165: Assertion failed: file .\dtoa.c, line 465Alexey Kopytov2010-04-071-1/+3
| | | | | | | | | | | | | | | | | The failing assertion was written with the assumption that a NULL string can never be passed to my_strtod(). However, an empty string may be passed under some circumstances by passing str == NULL and *end == NULL. Fixed the assertion to take the above case into account. mysql-test/r/func_misc.result: Added a test case for bug #52165. mysql-test/t/func_misc.test: Added a test case for bug #52165. strings/dtoa.c: Fixed the assertion in my_strtod() to take the case of 'str == NULL && *end == NULL' into account.
* Backport of WL #2934: Make/find library for doing float/double Alexey Kopytov2009-12-221-0/+2780
to string conversions and vice versa" Initial import of the dtoa.c code and custom wrappers around it to allow its usage from the server code. Conversion of FLOAT/DOUBLE values to DECIMAL ones or strings and vice versa has been significantly reworked. As the new algoritms are more precise than the older ones, results of such conversions may not always match those obtained from older server versions. This in turn may break compatibility for some applications. This patch also fixes the following bugs: - bug #12860 "Difference in zero padding of exponent between Unix and Windows" - bug #21497 "DOUBLE truncated to unusable value" - bug #26788 "mysqld (debug) aborts when inserting specific numbers into char fields" - bug #24541 "Data truncated..." on decimal type columns without any good reason"