Backport of WL #2934: Make/find library for doing float/double
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"
This commit is contained in:
parent
5bce1e0642
commit
f02525be83
@ -107,6 +107,14 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
|
||||
MESSAGE("Warning: Building MySQL with Visual Studio 2003.NET is no more supported.")
|
||||
MESSAGE("Please use a newer version of Visual Studio.")
|
||||
SET(WITHOUT_DYNAMIC_PLUGINS TRUE)
|
||||
|
||||
# VS2003 needs the /Op compiler option to disable floating point optimizations
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Op")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Op")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Op")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Op")
|
||||
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Op")
|
||||
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /Op")
|
||||
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
|
||||
|
||||
# Settings for Visual Studio 7 and above.
|
||||
|
@ -108,7 +108,7 @@ sql_src=log_event.h mysql_priv.h rpl_constants.h \
|
||||
log_event.cc my_decimal.h my_decimal.cc \
|
||||
log_event_old.h log_event_old.cc \
|
||||
rpl_record_old.h rpl_record_old.cc
|
||||
strings_src=decimal.c
|
||||
strings_src=decimal.c dtoa.c
|
||||
|
||||
link_sources:
|
||||
for f in $(sql_src) ; do \
|
||||
|
@ -24,10 +24,6 @@
|
||||
#include <m_string.h>
|
||||
#include <m_ctype.h>
|
||||
#include <mysql_com.h>
|
||||
#ifdef HAVE_FCONVERT
|
||||
#include <floatingpoint.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
The following extern declarations are ok as these are interface functions
|
||||
required by the string function
|
||||
@ -117,82 +113,19 @@ bool String::set(ulonglong num, CHARSET_INFO *cs)
|
||||
|
||||
bool String::set(double num,uint decimals, CHARSET_INFO *cs)
|
||||
{
|
||||
char buff[331];
|
||||
char buff[FLOATING_POINT_BUFFER];
|
||||
uint dummy_errors;
|
||||
size_t len;
|
||||
|
||||
str_charset=cs;
|
||||
if (decimals >= NOT_FIXED_DEC)
|
||||
{
|
||||
uint32 len= my_sprintf(buff,(buff, "%.15g",num));// Enough for a DATETIME
|
||||
len= my_gcvt(num, MY_GCVT_ARG_DOUBLE, sizeof(buff) - 1, buff, NULL);
|
||||
return copy(buff, len, &my_charset_latin1, cs, &dummy_errors);
|
||||
}
|
||||
#ifdef HAVE_FCONVERT
|
||||
int decpt,sign;
|
||||
char *pos,*to;
|
||||
|
||||
(void) fconvert(num,(int) decimals,&decpt,&sign,buff+1);
|
||||
if (!my_isdigit(&my_charset_latin1, buff[1]))
|
||||
{ // Nan or Inf
|
||||
pos=buff+1;
|
||||
if (sign)
|
||||
{
|
||||
buff[0]='-';
|
||||
pos=buff;
|
||||
}
|
||||
uint dummy_errors;
|
||||
return copy(pos,(uint32) strlen(pos), &my_charset_latin1, cs, &dummy_errors);
|
||||
}
|
||||
if (alloc((uint32) ((uint32) decpt+3+decimals)))
|
||||
return TRUE;
|
||||
to=Ptr;
|
||||
if (sign)
|
||||
*to++='-';
|
||||
|
||||
pos=buff+1;
|
||||
if (decpt < 0)
|
||||
{ /* value is < 0 */
|
||||
*to++='0';
|
||||
if (!decimals)
|
||||
goto end;
|
||||
*to++='.';
|
||||
if ((uint32) -decpt > decimals)
|
||||
decpt= - (int) decimals;
|
||||
decimals=(uint32) ((int) decimals+decpt);
|
||||
while (decpt++ < 0)
|
||||
*to++='0';
|
||||
}
|
||||
else if (decpt == 0)
|
||||
{
|
||||
*to++= '0';
|
||||
if (!decimals)
|
||||
goto end;
|
||||
*to++='.';
|
||||
}
|
||||
else
|
||||
{
|
||||
while (decpt-- > 0)
|
||||
*to++= *pos++;
|
||||
if (!decimals)
|
||||
goto end;
|
||||
*to++='.';
|
||||
}
|
||||
while (decimals--)
|
||||
*to++= *pos++;
|
||||
|
||||
end:
|
||||
*to=0;
|
||||
str_length=(uint32) (to-Ptr);
|
||||
return FALSE;
|
||||
#else
|
||||
#ifdef HAVE_SNPRINTF
|
||||
buff[sizeof(buff)-1]=0; // Safety
|
||||
snprintf(buff,sizeof(buff)-1, "%.*f",(int) decimals,num);
|
||||
#else
|
||||
sprintf(buff,"%.*f",(int) decimals,num);
|
||||
#endif
|
||||
return copy(buff,(uint32) strlen(buff), &my_charset_latin1, cs,
|
||||
len= my_fcvt(num, decimals, buff, NULL);
|
||||
return copy(buff, (uint32) len, &my_charset_latin1, cs,
|
||||
&dummy_errors);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -675,7 +608,8 @@ void String::qs_append(const char *str, uint32 len)
|
||||
void String::qs_append(double d)
|
||||
{
|
||||
char *buff = Ptr + str_length;
|
||||
str_length+= my_sprintf(buff, (buff, "%.15g", d));
|
||||
str_length+= my_gcvt(d, MY_GCVT_ARG_DOUBLE, FLOATING_POINT_BUFFER - 1, buff,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void String::qs_append(double *d)
|
||||
|
17
configure.in
17
configure.in
@ -375,6 +375,21 @@ case "$target_os" in
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# The following is required for portable results of floating point calculations
|
||||
# on PowerPC. The same must also be done for IA-64, but this options is missing
|
||||
# in the IA-64 gcc backend.
|
||||
|
||||
if test "$GCC" = "yes"
|
||||
then
|
||||
case "$host_cpu" in
|
||||
*ppc* | *powerpc*)
|
||||
CFLAGS="$CFLAGS -mno-fused-madd"
|
||||
CXXFLAGS="$CXXFLAGS -mno-fused-madd"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
AC_SUBST(CC)
|
||||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(CXX)
|
||||
@ -2236,7 +2251,7 @@ AC_FUNC_VPRINTF
|
||||
|
||||
AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \
|
||||
chsize cuserid fchmod fcntl \
|
||||
fconvert fdatasync fesetround finite fpresetsticky fpsetmask fsync ftruncate \
|
||||
fdatasync fesetround finite fpresetsticky fpsetmask fsync ftruncate \
|
||||
getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \
|
||||
getpwuid getrlimit getrusage getwd index initgroups isnan \
|
||||
localtime_r gethrtime gmtime_r \
|
||||
|
@ -92,9 +92,6 @@ extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */
|
||||
extern char NEAR _dig_vec_upper[];
|
||||
extern char NEAR _dig_vec_lower[];
|
||||
|
||||
/* Defined in strtod.c */
|
||||
extern const double log_10[309];
|
||||
|
||||
#ifdef BAD_STRING_COMPILER
|
||||
#define strmov(A,B) (memccpy(A,B,0,INT_MAX)-1)
|
||||
#else
|
||||
@ -199,8 +196,42 @@ extern char *strstr(const char *, const char *);
|
||||
extern int is_prefix(const char *, const char *);
|
||||
|
||||
/* Conversion routines */
|
||||
typedef enum {
|
||||
MY_GCVT_ARG_FLOAT,
|
||||
MY_GCVT_ARG_DOUBLE
|
||||
} my_gcvt_arg_type;
|
||||
|
||||
double my_strtod(const char *str, char **end, int *error);
|
||||
double my_atof(const char *nptr);
|
||||
size_t my_fcvt(double x, int precision, char *to, my_bool *error);
|
||||
size_t my_gcvt(double x, my_gcvt_arg_type type, int width, char *to,
|
||||
my_bool *error);
|
||||
|
||||
#define NOT_FIXED_DEC 31
|
||||
|
||||
/*
|
||||
The longest string my_fcvt can return is 311 + "precision" bytes.
|
||||
Here we assume that we never cal my_fcvt() with precision >= NOT_FIXED_DEC
|
||||
(+ 1 byte for the terminating '\0').
|
||||
*/
|
||||
#define FLOATING_POINT_BUFFER (311 + NOT_FIXED_DEC)
|
||||
|
||||
/*
|
||||
We want to use the 'e' format in some cases even if we have enough space
|
||||
for the 'f' one just to mimic sprintf("%.15g") behavior for large integers,
|
||||
and to improve it for numbers < 10^(-4).
|
||||
That is, for |x| < 1 we require |x| >= 10^(-15), and for |x| > 1 we require
|
||||
it to be integer and be <= 10^DBL_DIG for the 'f' format to be used.
|
||||
We don't lose precision, but make cases like "1e200" or "0.00001" look nicer.
|
||||
*/
|
||||
#define MAX_DECPT_FOR_F_FORMAT DBL_DIG
|
||||
|
||||
/*
|
||||
The maximum possible field width for my_gcvt() conversion.
|
||||
(DBL_DIG + 2) significant digits + sign + "." + ("e-NNN" or
|
||||
MAX_DECPT_FOR_F_FORMAT zeros for cases when |x|<1 and the 'f' format is used).
|
||||
*/
|
||||
#define MY_GCVT_MAX_FIELD_WIDTH (DBL_DIG + 4 + max(5, MAX_DECPT_FOR_F_FORMAT)) \
|
||||
|
||||
extern char *llstr(longlong value,char *buff);
|
||||
extern char *ullstr(longlong value,char *buff);
|
||||
|
@ -69,7 +69,7 @@ SET(CLIENT_SOURCES ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
|
||||
../strings/ctype-simple.c ../strings/ctype-sjis.c ../strings/ctype-tis620.c
|
||||
../strings/ctype-uca.c ../strings/ctype-ucs2.c ../strings/ctype-ujis.c
|
||||
../strings/ctype-utf8.c ../strings/ctype-win1250ch.c ../strings/ctype.c
|
||||
../mysys/default.c errmsg.c ../mysys/errors.c
|
||||
../mysys/default.c strings/dtoa.c errmsg.c ../mysys/errors.c
|
||||
../mysys/hash.c ../mysys/my_sleep.c ../mysys/default_modify.c
|
||||
get_password.c ../strings/int2str.c ../strings/is_prefix.c
|
||||
libmysql.c ../mysys/list.c ../strings/llstr.c
|
||||
@ -92,7 +92,7 @@ SET(CLIENT_SOURCES ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
|
||||
../mysys/safemalloc.c ../mysys/sha1.c ../strings/str2int.c
|
||||
../strings/str_alloc.c ../strings/strcend.c ../strings/strcont.c ../strings/strend.c
|
||||
../strings/strfill.c ../mysys/string.c ../strings/strinstr.c ../strings/strmake.c
|
||||
../strings/strmov.c ../strings/strnlen.c ../strings/strnmov.c ../strings/strtod.c
|
||||
../strings/strmov.c ../strings/strnlen.c ../strings/strnmov.c
|
||||
../strings/strtoll.c ../strings/strtoull.c ../strings/strxmov.c ../strings/strxnmov.c
|
||||
../mysys/thr_mutex.c ../mysys/typelib.c ../vio/vio.c ../vio/viosocket.c
|
||||
../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c ../mysys/mf_qsort.c
|
||||
|
@ -35,7 +35,7 @@ target_sources = libmysql.c password.c \
|
||||
get_password.c errmsg.c
|
||||
|
||||
mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
|
||||
strmake.lo strend.lo strtod.lo \
|
||||
strmake.lo strend.lo \
|
||||
strnlen.lo strfill.lo is_prefix.lo \
|
||||
int2str.lo str2int.lo strinstr.lo strcont.lo \
|
||||
strcend.lo bcmp.lo ctype-latin1.lo \
|
||||
@ -46,7 +46,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
|
||||
ctype-win1250ch.lo ctype-utf8.lo ctype-extra.lo \
|
||||
ctype-ucs2.lo ctype-gb2312.lo ctype-gbk.lo \
|
||||
ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo \
|
||||
ctype-uca.lo xml.lo my_strtoll10.lo str_alloc.lo
|
||||
ctype-uca.lo xml.lo my_strtoll10.lo str_alloc.lo dtoa.lo
|
||||
|
||||
mystringsextra= strto.c
|
||||
dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo
|
||||
|
@ -3372,12 +3372,13 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
||||
param output buffer descriptor
|
||||
field column metadata
|
||||
value column data
|
||||
width default number of significant digits used when converting
|
||||
float/double to string
|
||||
type either MY_GCVT_ARG_FLOAT or MY_GCVT_ARG_DOUBLE.
|
||||
Affects the maximum number of significant digits
|
||||
returned by my_gcvt().
|
||||
*/
|
||||
|
||||
static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
||||
double value, int width)
|
||||
double value, my_gcvt_arg_type type)
|
||||
{
|
||||
char *buffer= (char *)param->buffer;
|
||||
double val64 = (value < 0 ? -floor(-value) : floor(value));
|
||||
@ -3461,39 +3462,24 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
||||
floating point -> string conversion nicely, honor all typecodes
|
||||
and param->offset possibly set in mysql_stmt_fetch_column
|
||||
*/
|
||||
char buff[MAX_DOUBLE_STRING_REP_LENGTH];
|
||||
char *end;
|
||||
char buff[FLOATING_POINT_BUFFER];
|
||||
size_t len;
|
||||
if (field->decimals >= NOT_FIXED_DEC)
|
||||
{
|
||||
/*
|
||||
DBL_DIG below is to ensure that the server and client has the same
|
||||
precisions. This will ensure that on the same machine you get the
|
||||
same value as a string independent of the protocol you use.
|
||||
*/
|
||||
sprintf(buff, "%-*.*g", (int) min(sizeof(buff)-1,
|
||||
param->buffer_length),
|
||||
min(DBL_DIG, width), value);
|
||||
end= strcend(buff, ' ');
|
||||
*end= 0;
|
||||
}
|
||||
len= my_gcvt(value, type,
|
||||
(int) min(sizeof(buff)-1, param->buffer_length),
|
||||
buff, NULL);
|
||||
else
|
||||
{
|
||||
sprintf(buff, "%.*f", (int) field->decimals, value);
|
||||
end= strend(buff);
|
||||
}
|
||||
len= my_fcvt(value, (int) field->decimals, buff, NULL);
|
||||
|
||||
if (field->flags & ZEROFILL_FLAG && len < field->length &&
|
||||
field->length < MAX_DOUBLE_STRING_REP_LENGTH - 1)
|
||||
{
|
||||
size_t length= end - buff;
|
||||
if (field->flags & ZEROFILL_FLAG && length < field->length &&
|
||||
field->length < MAX_DOUBLE_STRING_REP_LENGTH - 1)
|
||||
{
|
||||
bmove_upp((uchar*) buff + field->length, (uchar*) buff + length,
|
||||
length);
|
||||
bfill((char*) buff, field->length - length, '0');
|
||||
length= field->length;
|
||||
}
|
||||
fetch_string_with_conversion(param, buff, length);
|
||||
bmove_upp((uchar*) buff + field->length, (uchar*) buff + len,
|
||||
len);
|
||||
bfill((char*) buff, field->length - len, '0');
|
||||
len= field->length;
|
||||
}
|
||||
fetch_string_with_conversion(param, buff, len);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -3538,7 +3524,7 @@ static void fetch_datetime_with_conversion(MYSQL_BIND *param,
|
||||
{
|
||||
ulonglong value= TIME_to_ulonglong(my_time);
|
||||
fetch_float_with_conversion(param, field,
|
||||
ulonglong2double(value), DBL_DIG);
|
||||
ulonglong2double(value), MY_GCVT_ARG_DOUBLE);
|
||||
break;
|
||||
}
|
||||
case MYSQL_TYPE_TINY:
|
||||
@ -3632,7 +3618,7 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
||||
{
|
||||
float value;
|
||||
float4get(value,*row);
|
||||
fetch_float_with_conversion(param, field, value, FLT_DIG);
|
||||
fetch_float_with_conversion(param, field, value, MY_GCVT_ARG_FLOAT);
|
||||
*row+= 4;
|
||||
break;
|
||||
}
|
||||
@ -3640,7 +3626,7 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
||||
{
|
||||
double value;
|
||||
float8get(value,*row);
|
||||
fetch_float_with_conversion(param, field, value, DBL_DIG);
|
||||
fetch_float_with_conversion(param, field, value, MY_GCVT_ARG_DOUBLE);
|
||||
*row+= 8;
|
||||
break;
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ fid AsText(EndPoint(g))
|
||||
107 POINT(40 10)
|
||||
SELECT fid, GLength(g) FROM gis_line ORDER by fid;
|
||||
fid GLength(g)
|
||||
105 24.142135623731
|
||||
105 24.14213562373095
|
||||
106 40
|
||||
107 30
|
||||
SELECT fid, NumPoints(g) FROM gis_line ORDER by fid;
|
||||
@ -292,7 +292,7 @@ Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint
|
||||
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
|
||||
fid AsText(Centroid(g))
|
||||
108 POINT(15 15)
|
||||
109 POINT(25.4166666666667 25.4166666666667)
|
||||
109 POINT(25.416666666666668 25.416666666666668)
|
||||
110 POINT(20 10)
|
||||
SELECT fid, Area(g) FROM gis_polygon ORDER by fid;
|
||||
fid Area(g)
|
||||
@ -326,8 +326,8 @@ fid IsClosed(g)
|
||||
116 0
|
||||
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid;
|
||||
fid AsText(Centroid(g))
|
||||
117 POINT(55.5885277530424 17.426536064114)
|
||||
118 POINT(55.5885277530424 17.426536064114)
|
||||
117 POINT(55.58852775304245 17.426536064113982)
|
||||
118 POINT(55.58852775304245 17.426536064113982)
|
||||
119 POINT(2 2)
|
||||
SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid;
|
||||
fid Area(g)
|
||||
|
@ -342,11 +342,11 @@ INSERT INTO t1 SET f1 = -1.0e+30 ;
|
||||
INSERT INTO t1 SET f1 = +1.0e+30 ;
|
||||
SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1;
|
||||
double_val cast_val
|
||||
-1e+30 -9223372036854775808
|
||||
1e+30 9223372036854775807
|
||||
-1e30 -9223372036854775808
|
||||
1e30 9223372036854775807
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1e+30'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1e+30'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1e30'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1e30'
|
||||
DROP TABLE t1;
|
||||
select isnull(date(NULL)), isnull(cast(NULL as DATE));
|
||||
isnull(date(NULL)) isnull(cast(NULL as DATE))
|
||||
@ -363,7 +363,7 @@ cast('1.2' as decimal(3,2))
|
||||
1.20
|
||||
select 1e18 * cast('1.2' as decimal(3,2));
|
||||
1e18 * cast('1.2' as decimal(3,2))
|
||||
1.2e+18
|
||||
1.2e18
|
||||
select cast(cast('1.2' as decimal(3,2)) as signed);
|
||||
cast(cast('1.2' as decimal(3,2)) as signed)
|
||||
1
|
||||
|
@ -61,7 +61,7 @@ grp sum
|
||||
NULL NULL
|
||||
1 7
|
||||
2 20.25
|
||||
3 45.4831632475944
|
||||
3 45.48316324759439
|
||||
create table t2 (grp int, a bigint unsigned, c char(10));
|
||||
insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp;
|
||||
replace into t2 select grp, a, c from t1 limit 2,1;
|
||||
@ -891,7 +891,7 @@ select 1e8 * sum(distinct df) from t1;
|
||||
330000000
|
||||
select 1e8 * min(df) from t1;
|
||||
1e8 * min(df)
|
||||
110000000
|
||||
110000000.00000001
|
||||
create table t3 (ifl int);
|
||||
insert into t3 values(1), (2);
|
||||
select cast(min(ifl) as decimal(5,2)) from t3;
|
||||
@ -1186,7 +1186,7 @@ std(s1/s2)
|
||||
0.21325764
|
||||
select std(o1/o2) from bug22555;
|
||||
std(o1/o2)
|
||||
0.213257635866493
|
||||
0.2132576358664934
|
||||
select std(e1/e2) from bug22555;
|
||||
std(e1/e2)
|
||||
0.21325764
|
||||
@ -1209,13 +1209,13 @@ i count(*) std(e1/e2)
|
||||
3 4 0.000000000000000000000000000000
|
||||
select round(std(s1/s2), 17) from bug22555;
|
||||
round(std(s1/s2), 17)
|
||||
0.21325763586649341
|
||||
0.21325763586649340
|
||||
select std(o1/o2) from bug22555;
|
||||
std(o1/o2)
|
||||
0.213257635866493
|
||||
0.2132576358664934
|
||||
select round(std(e1/e2), 17) from bug22555;
|
||||
round(std(e1/e2), 17)
|
||||
0.21325763586649341
|
||||
0.21325763586649340
|
||||
set div_precision_increment=20;
|
||||
select i, count(*), std(s1/s2) from bug22555 group by i order by i;
|
||||
i count(*) std(s1/s2)
|
||||
@ -1234,13 +1234,13 @@ i count(*) std(e1/e2)
|
||||
3 4 0.000000000000000000000000000000
|
||||
select round(std(s1/s2), 17) from bug22555;
|
||||
round(std(s1/s2), 17)
|
||||
0.21325763586649341
|
||||
0.21325763586649340
|
||||
select std(o1/o2) from bug22555;
|
||||
std(o1/o2)
|
||||
0.213257635866493
|
||||
0.2132576358664934
|
||||
select round(std(e1/e2), 17) from bug22555;
|
||||
round(std(e1/e2), 17)
|
||||
0.21325763586649341
|
||||
0.21325763586649340
|
||||
set @@div_precision_increment=@saved_div_precision_increment;
|
||||
drop table bug22555;
|
||||
create table bug22555 (s smallint, o double, e decimal);
|
||||
|
@ -44,7 +44,7 @@ Warnings:
|
||||
Note 1003 select abs(-(10)) AS `abs(-10)`,sign(-(5)) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)`
|
||||
select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
|
||||
log(exp(10)) exp(log(sqrt(10))*2) log(-1) log(NULL) log(1,1) log(3,9) log(-1,2) log(NULL,2)
|
||||
10 10 NULL NULL NULL 2 NULL NULL
|
||||
10 10.000000000000002 NULL NULL NULL 2 NULL NULL
|
||||
explain extended select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
@ -52,7 +52,7 @@ Warnings:
|
||||
Note 1003 select log(exp(10)) AS `log(exp(10))`,exp((log(sqrt(10)) * 2)) AS `exp(log(sqrt(10))*2)`,log(-(1)) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-(1),2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)`
|
||||
select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
|
||||
ln(exp(10)) exp(ln(sqrt(10))*2) ln(-1) ln(0) ln(NULL)
|
||||
10 10 NULL NULL NULL
|
||||
10 10.000000000000002 NULL NULL NULL
|
||||
explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
@ -60,7 +60,7 @@ Warnings:
|
||||
Note 1003 select ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
|
||||
select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
|
||||
log2(8) log2(15) log2(-2) log2(0) log2(NULL)
|
||||
3 3.90689059560852 NULL NULL NULL
|
||||
3 3.9068905956085187 NULL NULL NULL
|
||||
explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
@ -68,7 +68,7 @@ Warnings:
|
||||
Note 1003 select log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
|
||||
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
|
||||
log10(100) log10(18) log10(-4) log10(0) log10(NULL)
|
||||
2 1.25527250510331 NULL NULL NULL
|
||||
2 1.255272505103306 NULL NULL NULL
|
||||
explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
@ -85,7 +85,7 @@ Note 1003 select pow(10,log10(10)) AS `pow(10,log10(10))`,pow(2,4) AS `power(2,4
|
||||
set @@rand_seed1=10000000,@@rand_seed2=1000000;
|
||||
select rand(999999),rand();
|
||||
rand(999999) rand()
|
||||
0.0142313651873091 0.028870999839968
|
||||
0.014231365187309091 0.028870999839968048
|
||||
explain extended select rand(999999),rand();
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
@ -101,7 +101,7 @@ Warnings:
|
||||
Note 1003 select pi() AS `pi()`,format(sin((pi() / 2)),6) AS `format(sin(pi()/2),6)`,format(cos((pi() / 2)),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format((1 / tan(1)),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)`
|
||||
select degrees(pi()),radians(360);
|
||||
degrees(pi()) radians(360)
|
||||
180 6.28318530717959
|
||||
180 6.283185307179586
|
||||
select format(atan(-2, 2), 6);
|
||||
format(atan(-2, 2), 6)
|
||||
-0.785398
|
||||
@ -119,7 +119,7 @@ ACOS(1.0)
|
||||
0
|
||||
SELECT ASIN(1.0);
|
||||
ASIN(1.0)
|
||||
1.5707963267949
|
||||
1.5707963267948966
|
||||
SELECT ACOS(0.2*5.0);
|
||||
ACOS(0.2*5.0)
|
||||
0
|
||||
@ -128,10 +128,10 @@ ACOS(0.5*2.0)
|
||||
0
|
||||
SELECT ASIN(0.8+0.2);
|
||||
ASIN(0.8+0.2)
|
||||
1.5707963267949
|
||||
1.5707963267948966
|
||||
SELECT ASIN(1.2-0.2);
|
||||
ASIN(1.2-0.2)
|
||||
1.5707963267949
|
||||
1.5707963267948966
|
||||
select format(4.55, 1), format(4.551, 1);
|
||||
format(4.55, 1) format(4.551, 1)
|
||||
4.6 4.6
|
||||
@ -368,7 +368,7 @@ mod(5, cast(-2 as unsigned)) mod(5, 18446744073709551614) mod(5, -2)
|
||||
5 5 1
|
||||
select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5);
|
||||
pow(cast(-2 as unsigned), 5) pow(18446744073709551614, 5) pow(-2, 5)
|
||||
2.13598703592091e+96 2.13598703592091e+96 -32
|
||||
2.13598703592091e96 2.13598703592091e96 -32
|
||||
CREATE TABLE t1 (a timestamp, b varchar(20), c bit(1));
|
||||
INSERT INTO t1 VALUES('1998-09-23', 'str1', 1), ('2003-03-25', 'str2', 0);
|
||||
SELECT a DIV 900 y FROM t1 GROUP BY y;
|
||||
@ -437,10 +437,10 @@ a ROUND(a)
|
||||
2.5 2
|
||||
-2.9 -3
|
||||
2.9 3
|
||||
-1e+16 -10000000000000000
|
||||
1e+16 10000000000000000
|
||||
-1e+16 -10000000000000002
|
||||
1e+16 10000000000000002
|
||||
-1e16 -10000000000000000
|
||||
1e16 10000000000000000
|
||||
-1.0000000000000002e16 -10000000000000002
|
||||
1.0000000000000002e16 10000000000000002
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 LONGTEXT) engine=myisam;
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
@ -475,16 +475,16 @@ NULL
|
||||
CREATE OR REPLACE VIEW v1 AS SELECT NULL AS a;
|
||||
SELECT RAND(a) FROM v1;
|
||||
RAND(a)
|
||||
0.155220427694936
|
||||
0.15522042769493574
|
||||
DROP VIEW v1;
|
||||
SELECT RAND(a) FROM (SELECT NULL AS a) b;
|
||||
RAND(a)
|
||||
0.155220427694936
|
||||
0.15522042769493574
|
||||
CREATE TABLE t1 (i INT);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT RAND(i) FROM t1;
|
||||
RAND(i)
|
||||
0.155220427694936
|
||||
0.15522042769493574
|
||||
DROP TABLE t1;
|
||||
#
|
||||
select 123456789012345678901234567890.123456789012345678901234567890 div 1 as x;
|
||||
|
@ -1354,10 +1354,10 @@ cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2))
|
||||
20.06
|
||||
select conv("18383815659218730760",10,10) + 0;
|
||||
conv("18383815659218730760",10,10) + 0
|
||||
1.83838156592187e+19
|
||||
1.838381565921873e19
|
||||
select "18383815659218730760" + 0;
|
||||
"18383815659218730760" + 0
|
||||
1.83838156592187e+19
|
||||
1.838381565921873e19
|
||||
CREATE TABLE t1 (code varchar(10));
|
||||
INSERT INTO t1 VALUES ('a12'), ('A12'), ('a13');
|
||||
SELECT ASCII(code), code FROM t1 WHERE code='A12';
|
||||
|
@ -258,7 +258,7 @@ fid AsText(EndPoint(g))
|
||||
107 POINT(40 10)
|
||||
SELECT fid, GLength(g) FROM gis_line;
|
||||
fid GLength(g)
|
||||
105 24.142135623731
|
||||
105 24.14213562373095
|
||||
106 40
|
||||
107 30
|
||||
SELECT fid, NumPoints(g) FROM gis_line;
|
||||
@ -284,7 +284,7 @@ Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint
|
||||
SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
|
||||
fid AsText(Centroid(g))
|
||||
108 POINT(15 15)
|
||||
109 POINT(25.4166666666667 25.4166666666667)
|
||||
109 POINT(25.416666666666668 25.416666666666668)
|
||||
110 POINT(20 10)
|
||||
SELECT fid, Area(g) FROM gis_polygon;
|
||||
fid Area(g)
|
||||
@ -318,8 +318,8 @@ fid IsClosed(g)
|
||||
116 0
|
||||
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
|
||||
fid AsText(Centroid(g))
|
||||
117 POINT(55.5885277530424 17.426536064114)
|
||||
118 POINT(55.5885277530424 17.426536064114)
|
||||
117 POINT(55.58852775304245 17.426536064113982)
|
||||
118 POINT(55.58852775304245 17.426536064113982)
|
||||
119 POINT(2 2)
|
||||
SELECT fid, Area(g) FROM gis_multi_polygon;
|
||||
fid Area(g)
|
||||
@ -651,11 +651,11 @@ insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
|
||||
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
|
||||
t1 where object_id=85998;
|
||||
object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
|
||||
85998 MULTIPOLYGON 0 POINT(115.318773152032 -36.2374728210215)
|
||||
85998 MULTIPOLYGON 0 POINT(115.31877315203187 -36.23747282102153)
|
||||
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
|
||||
t1 where object_id=85984;
|
||||
object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
|
||||
85984 MULTIPOLYGON 0 POINT(-114.877871869233 36.3310176346905)
|
||||
85984 MULTIPOLYGON 0 POINT(-114.87787186923313 36.33101763469059)
|
||||
drop table t1;
|
||||
create table t1 (fl geometry not null);
|
||||
insert into t1 values (1);
|
||||
|
@ -266,7 +266,7 @@ fid AsText(EndPoint(g))
|
||||
107 POINT(40 10)
|
||||
SELECT fid, GLength(g) FROM gis_line ORDER by fid;
|
||||
fid GLength(g)
|
||||
105 24.142135623731
|
||||
105 24.14213562373095
|
||||
106 40
|
||||
107 30
|
||||
SELECT fid, NumPoints(g) FROM gis_line ORDER by fid;
|
||||
@ -292,7 +292,7 @@ Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint
|
||||
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
|
||||
fid AsText(Centroid(g))
|
||||
108 POINT(15 15)
|
||||
109 POINT(25.4166666666667 25.4166666666667)
|
||||
109 POINT(25.416666666666668 25.416666666666668)
|
||||
110 POINT(20 10)
|
||||
SELECT fid, Area(g) FROM gis_polygon ORDER by fid;
|
||||
fid Area(g)
|
||||
@ -326,8 +326,8 @@ fid IsClosed(g)
|
||||
116 0
|
||||
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid;
|
||||
fid AsText(Centroid(g))
|
||||
117 POINT(55.5885277530424 17.426536064114)
|
||||
118 POINT(55.5885277530424 17.426536064114)
|
||||
117 POINT(55.58852775304245 17.426536064113982)
|
||||
118 POINT(55.58852775304245 17.426536064113982)
|
||||
119 POINT(2 2)
|
||||
SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid;
|
||||
fid Area(g)
|
||||
|
@ -175,12 +175,12 @@ Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1
|
||||
select * from t1 where number =last_insert_id();
|
||||
number 4
|
||||
original_value 1e+1111111111a
|
||||
f_double 1.79769313486232e+308
|
||||
f_float 3.40282e+38
|
||||
f_double 1.7976931348623157e308
|
||||
f_float 3.40282e38
|
||||
f_double_7_2 99999.99
|
||||
f_float_4_3 9.999
|
||||
f_double_u 1.79769313486232e+308
|
||||
f_float_u 3.40282e+38
|
||||
f_double_u 1.7976931348623157e308
|
||||
f_float_u 3.40282e38
|
||||
f_double_15_1_u 99999999999999.9
|
||||
f_float_3_1_u 99.9
|
||||
set @value= "-1e+1111111111a";
|
||||
@ -204,8 +204,8 @@ Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1
|
||||
select * from t1 where number =last_insert_id();
|
||||
number 5
|
||||
original_value -1e+1111111111a
|
||||
f_double -1.79769313486232e+308
|
||||
f_float -3.40282e+38
|
||||
f_double -1.7976931348623157e308
|
||||
f_float -3.40282e38
|
||||
f_double_7_2 -99999.99
|
||||
f_float_4_3 -9.999
|
||||
f_double_u 0
|
||||
@ -227,13 +227,13 @@ Warning 1264 Out of range value for column 'f_double_15_1_u' at row 1
|
||||
Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1
|
||||
select * from t1 where number =last_insert_id();
|
||||
number 6
|
||||
original_value 1e+111
|
||||
f_double 1e+111
|
||||
f_float 3.40282e+38
|
||||
original_value 1e111
|
||||
f_double 1e111
|
||||
f_float 3.40282e38
|
||||
f_double_7_2 99999.99
|
||||
f_float_4_3 9.999
|
||||
f_double_u 1e+111
|
||||
f_float_u 3.40282e+38
|
||||
f_double_u 1e111
|
||||
f_float_u 3.40282e38
|
||||
f_double_15_1_u 99999999999999.9
|
||||
f_float_3_1_u 99.9
|
||||
set @value= -1e+111;
|
||||
@ -248,9 +248,9 @@ Warning 1264 Out of range value for column 'f_double_15_1_u' at row 1
|
||||
Warning 1264 Out of range value for column 'f_float_3_1_u' at row 1
|
||||
select * from t1 where number =last_insert_id();
|
||||
number 7
|
||||
original_value -1e+111
|
||||
f_double -1e+111
|
||||
f_float -3.40282e+38
|
||||
original_value -1e111
|
||||
f_double -1e111
|
||||
f_float -3.40282e38
|
||||
f_double_7_2 -99999.99
|
||||
f_float_4_3 -9.999
|
||||
f_double_u 0
|
||||
@ -524,42 +524,36 @@ INSERT INTO t1(a,b) VALUES (1.25e-175, 1.25e-175);
|
||||
INSERT INTO t1(a,c) VALUES (1.225e+0, 1.225e+0);
|
||||
INSERT INTO t1(a,c) VALUES (1.37e+0, 1.37e+0);
|
||||
INSERT INTO t1(a,c) VALUES (-1.37e+0, -1.37e+0);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c' at row 1
|
||||
INSERT INTO t1(a,c) VALUES (1.87e-3, 1.87e-3);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c' at row 1
|
||||
INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c' at row 1
|
||||
INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0);
|
||||
INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c' at row 1
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
9.999999 10 10
|
||||
1.225e-05 1.2e-05 1e-0
|
||||
0.0001225 0.00012 NULL
|
||||
0.00001225 1.22e-5 1e-5
|
||||
0.0001225 1.22e-4 NULL
|
||||
0.1225 0.1225 NULL
|
||||
0.1225877 0.12259 NULL
|
||||
12.25 12.25 NULL
|
||||
12.25 12.25 12.2
|
||||
122500 122500 NULL
|
||||
12250000000 1.2e+10 NULL
|
||||
1.225e+15 1.2e+15 NULL
|
||||
12250000000 1.22e10 NULL
|
||||
1.225e15 1.22e15 NULL
|
||||
5000000 5000000 NULL
|
||||
1.25e+78 1.2e+78 NULL
|
||||
1.25e78 1.25e78 NULL
|
||||
1.25e-94 1.2e-94 NULL
|
||||
1.25e+203 1e+203 NULL
|
||||
1.25e203 1.2e203 NULL
|
||||
1.25e-175 1e-175 NULL
|
||||
1.225 NULL 1.23
|
||||
1.37 NULL 1.37
|
||||
-1.37 NULL -1.3
|
||||
0.00187 NULL 0.00
|
||||
-0.0187 NULL -0.0
|
||||
-1.37 NULL -1.4
|
||||
0.00187 NULL 2e-3
|
||||
-0.0187 NULL 0
|
||||
5000 NULL 5000
|
||||
-5000 NULL -500
|
||||
-5000 NULL -5e3
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
a char(20) NOT NULL,
|
||||
@ -586,32 +580,30 @@ INSERT INTO t1(a,c) VALUES (1.37e+0, 1.37e+0);
|
||||
INSERT INTO t1(a,c) VALUES (-1.37e+0, -1.37e+0);
|
||||
INSERT INTO t1(a,c) VALUES (1.87e-3, 1.87e-3);
|
||||
INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c' at row 1
|
||||
INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0);
|
||||
INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0);
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
9.999999 10 9.999
|
||||
1.225e-05 1.2e-05 1e-05
|
||||
0.0001225 0.00012 NULL
|
||||
0.00001225 1.22e-5 1e-5
|
||||
0.0001225 1.22e-4 NULL
|
||||
0.1225 0.1225 NULL
|
||||
0.1225877 0.12259 NULL
|
||||
12.25 12.25 NULL
|
||||
12.25 12.25 12.25
|
||||
122500 122500 NULL
|
||||
12250000000 1.2e+10 NULL
|
||||
1.225e+15 1.2e+15 NULL
|
||||
12250000000 1.22e10 NULL
|
||||
1.225e15 1.22e15 NULL
|
||||
5000000 5000000 NULL
|
||||
1.25e+78 1.2e+78 NULL
|
||||
1.25e78 1.25e78 NULL
|
||||
1.25e-94 1.2e-94 NULL
|
||||
1.25e+203 1e+203 NULL
|
||||
1.25e203 1.2e203 NULL
|
||||
1.25e-175 1e-175 NULL
|
||||
1.225 NULL 1.225
|
||||
1.37 NULL 1.37
|
||||
-1.37 NULL -1.37
|
||||
0.00187 NULL 0.002
|
||||
-0.0187 NULL -0.01
|
||||
-0.0187 NULL -0.02
|
||||
5000 NULL 5000
|
||||
-5000 NULL -5000
|
||||
DROP TABLE t1;
|
||||
|
@ -251,15 +251,15 @@ CREATE TABLE t1 (c1 INT, c2 TIMESTAMP, c3 REAL, c4 DOUBLE);
|
||||
INSERT INTO t1 (c1, c2, c3, c4) VALUES (10, '1970-02-01 01:02:03', 1.1E-100, 1.1E+100);
|
||||
SELECT * FROM t1;
|
||||
c1 c2 c3 c4
|
||||
10 1970-02-01 01:02:03 1.1e-100 1.1e+100
|
||||
10 1970-02-01 01:02:03 1.1e-100 1.1e100
|
||||
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1;
|
||||
-10- -1970\-02\-01 01:02:03- -1.1e\-100- -1.1e+100-
|
||||
-10- -1970\-02\-01 01:02:03- -1.1e\-100- -1.1e100-
|
||||
EOF
|
||||
TRUNCATE t1;
|
||||
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t1 FIELDS ENCLOSED BY '-';
|
||||
SELECT * FROM t1;
|
||||
c1 c2 c3 c4
|
||||
10 1970-02-01 01:02:03 1.1e-100 1.1e+100
|
||||
10 1970-02-01 01:02:03 1.1e-100 1.1e100
|
||||
DROP TABLE t1;
|
||||
|
||||
# --
|
||||
|
@ -55,7 +55,7 @@ CREATE TABLE `t1` (
|
||||
`a` double DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
INSERT INTO `t1` VALUES (RES);
|
||||
INSERT INTO `t1` VALUES (-1.7976931348623157e308);
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#3361 mysqldump quotes DECIMAL values inconsistently
|
||||
|
@ -522,7 +522,7 @@ select conv(255 AS p1, 10 AS p2, 16 AS p3);
|
||||
ERROR 42000: Incorrect parameters in the call to native function 'conv'
|
||||
select atan(10);
|
||||
atan(10)
|
||||
1.47112767430373
|
||||
1.4711276743037347
|
||||
select atan(10 AS p1);
|
||||
ERROR 42000: Incorrect parameters in the call to native function 'atan'
|
||||
select atan(10 p1);
|
||||
@ -533,7 +533,7 @@ select atan(10 "p1");
|
||||
ERROR 42000: Incorrect parameters in the call to native function 'atan'
|
||||
select atan(10, 20);
|
||||
atan(10, 20)
|
||||
0.463647609000806
|
||||
0.4636476090008061
|
||||
select atan(10 AS p1, 20);
|
||||
ERROR 42000: Incorrect parameters in the call to native function 'atan'
|
||||
select atan(10 p1, 20);
|
||||
|
@ -2585,10 +2585,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 9.22337e+18
|
||||
c8 9.22337203685478e+18
|
||||
c9 9.22337203685478e+18
|
||||
c10 9.22337203685478e+18
|
||||
c7 9.22337e18
|
||||
c8 9.223372036854776e18
|
||||
c9 9.223372036854776e18
|
||||
c10 9.223372036854776e18
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '9223372036854775807' ;
|
||||
@ -2608,10 +2608,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 9.22337e+18
|
||||
c8 9.22337203685478e+18
|
||||
c9 9.22337203685478e+18
|
||||
c10 9.22337203685478e+18
|
||||
c7 9.22337e18
|
||||
c8 9.223372036854776e18
|
||||
c9 9.223372036854776e18
|
||||
c10 9.223372036854776e18
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= -9223372036854775808 ;
|
||||
@ -2631,10 +2631,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -9.22337e+18
|
||||
c8 -9.22337203685478e+18
|
||||
c9 -9.22337203685478e+18
|
||||
c10 -9.22337203685478e+18
|
||||
c7 -9.22337e18
|
||||
c8 -9.223372036854776e18
|
||||
c9 -9.223372036854776e18
|
||||
c10 -9.223372036854776e18
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '-9223372036854775808' ;
|
||||
@ -2654,10 +2654,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -9.22337e+18
|
||||
c8 -9.22337203685478e+18
|
||||
c9 -9.22337203685478e+18
|
||||
c10 -9.22337203685478e+18
|
||||
c7 -9.22337e18
|
||||
c8 -9.223372036854776e18
|
||||
c9 -9.223372036854776e18
|
||||
c10 -9.223372036854776e18
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= 1.11111111111111111111e+50 ;
|
||||
@ -2679,10 +2679,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 3.40282e+38
|
||||
c8 1.11111111111111e+50
|
||||
c9 1.11111111111111e+50
|
||||
c10 1.11111111111111e+50
|
||||
c7 3.40282e38
|
||||
c8 1.111111111111111e50
|
||||
c9 1.111111111111111e50
|
||||
c10 1.111111111111111e50
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '1.11111111111111111111e+50' ;
|
||||
@ -2704,10 +2704,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 3.40282e+38
|
||||
c8 1.11111111111111e+50
|
||||
c9 1.11111111111111e+50
|
||||
c10 1.11111111111111e+50
|
||||
c7 3.40282e38
|
||||
c8 1.111111111111111e50
|
||||
c9 1.111111111111111e50
|
||||
c10 1.111111111111111e50
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= -1.11111111111111111111e+50 ;
|
||||
@ -2729,10 +2729,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -3.40282e+38
|
||||
c8 -1.11111111111111e+50
|
||||
c9 -1.11111111111111e+50
|
||||
c10 -1.11111111111111e+50
|
||||
c7 -3.40282e38
|
||||
c8 -1.111111111111111e50
|
||||
c9 -1.111111111111111e50
|
||||
c10 -1.111111111111111e50
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '-1.11111111111111111111e+50' ;
|
||||
@ -2754,10 +2754,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -3.40282e+38
|
||||
c8 -1.11111111111111e+50
|
||||
c9 -1.11111111111111e+50
|
||||
c10 -1.11111111111111e+50
|
||||
c7 -3.40282e38
|
||||
c8 -1.111111111111111e50
|
||||
c9 -1.111111111111111e50
|
||||
c10 -1.111111111111111e50
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
test_sequence
|
||||
@ -2822,10 +2822,10 @@ c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
|
||||
51 5 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0
|
||||
52 5 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0
|
||||
53 5 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0
|
||||
54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
|
||||
55 5 55 55 55 55 55 55 55 55 55 55
|
||||
56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
|
||||
57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
|
||||
54 5 54 54 54 54 54 54 54 54 54 54
|
||||
55 6 55 55 55 55 55 55 55 55 55 55
|
||||
56 6 56 56 56 56 56 56 56 56 56 56
|
||||
57 6 57 57 57 57 57 57 57 57 57 57
|
||||
60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
@ -3039,7 +3039,7 @@ c1 c13 c14 c15 c16 c17
|
||||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||
|
@ -2568,10 +2568,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 9.22337e+18
|
||||
c8 9.22337203685478e+18
|
||||
c9 9.22337203685478e+18
|
||||
c10 9.22337203685478e+18
|
||||
c7 9.22337e18
|
||||
c8 9.223372036854776e18
|
||||
c9 9.223372036854776e18
|
||||
c10 9.223372036854776e18
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '9223372036854775807' ;
|
||||
@ -2591,10 +2591,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 9.22337e+18
|
||||
c8 9.22337203685478e+18
|
||||
c9 9.22337203685478e+18
|
||||
c10 9.22337203685478e+18
|
||||
c7 9.22337e18
|
||||
c8 9.223372036854776e18
|
||||
c9 9.223372036854776e18
|
||||
c10 9.223372036854776e18
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= -9223372036854775808 ;
|
||||
@ -2614,10 +2614,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -9.22337e+18
|
||||
c8 -9.22337203685478e+18
|
||||
c9 -9.22337203685478e+18
|
||||
c10 -9.22337203685478e+18
|
||||
c7 -9.22337e18
|
||||
c8 -9.223372036854776e18
|
||||
c9 -9.223372036854776e18
|
||||
c10 -9.223372036854776e18
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '-9223372036854775808' ;
|
||||
@ -2637,10 +2637,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -9.22337e+18
|
||||
c8 -9.22337203685478e+18
|
||||
c9 -9.22337203685478e+18
|
||||
c10 -9.22337203685478e+18
|
||||
c7 -9.22337e18
|
||||
c8 -9.223372036854776e18
|
||||
c9 -9.223372036854776e18
|
||||
c10 -9.223372036854776e18
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= 1.11111111111111111111e+50 ;
|
||||
@ -2662,10 +2662,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 3.40282e+38
|
||||
c8 1.11111111111111e+50
|
||||
c9 1.11111111111111e+50
|
||||
c10 1.11111111111111e+50
|
||||
c7 3.40282e38
|
||||
c8 1.111111111111111e50
|
||||
c9 1.111111111111111e50
|
||||
c10 1.111111111111111e50
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '1.11111111111111111111e+50' ;
|
||||
@ -2687,10 +2687,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 3.40282e+38
|
||||
c8 1.11111111111111e+50
|
||||
c9 1.11111111111111e+50
|
||||
c10 1.11111111111111e+50
|
||||
c7 3.40282e38
|
||||
c8 1.111111111111111e50
|
||||
c9 1.111111111111111e50
|
||||
c10 1.111111111111111e50
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= -1.11111111111111111111e+50 ;
|
||||
@ -2712,10 +2712,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -3.40282e+38
|
||||
c8 -1.11111111111111e+50
|
||||
c9 -1.11111111111111e+50
|
||||
c10 -1.11111111111111e+50
|
||||
c7 -3.40282e38
|
||||
c8 -1.111111111111111e50
|
||||
c9 -1.111111111111111e50
|
||||
c10 -1.111111111111111e50
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '-1.11111111111111111111e+50' ;
|
||||
@ -2737,10 +2737,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -3.40282e+38
|
||||
c8 -1.11111111111111e+50
|
||||
c9 -1.11111111111111e+50
|
||||
c10 -1.11111111111111e+50
|
||||
c7 -3.40282e38
|
||||
c8 -1.111111111111111e50
|
||||
c9 -1.111111111111111e50
|
||||
c10 -1.111111111111111e50
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
test_sequence
|
||||
@ -2805,10 +2805,10 @@ c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
|
||||
51 5 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0
|
||||
52 5 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0
|
||||
53 5 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0
|
||||
54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
|
||||
55 5 55 55 55 55 55 55 55 55 55 55
|
||||
56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
|
||||
57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
|
||||
54 5 54 54 54 54 54 54 54 54 54 54
|
||||
55 6 55 55 55 55 55 55 55 55 55 55
|
||||
56 6 56 56 56 56 56 56 56 56 56 56
|
||||
57 6 57 57 57 57 57 57 57 57 57 57
|
||||
60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
@ -3022,7 +3022,7 @@ c1 c13 c14 c15 c16 c17
|
||||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||
|
@ -2569,10 +2569,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 9.22337e+18
|
||||
c8 9.22337203685478e+18
|
||||
c9 9.22337203685478e+18
|
||||
c10 9.22337203685478e+18
|
||||
c7 9.22337e18
|
||||
c8 9.223372036854776e18
|
||||
c9 9.223372036854776e18
|
||||
c10 9.223372036854776e18
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '9223372036854775807' ;
|
||||
@ -2592,10 +2592,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 9.22337e+18
|
||||
c8 9.22337203685478e+18
|
||||
c9 9.22337203685478e+18
|
||||
c10 9.22337203685478e+18
|
||||
c7 9.22337e18
|
||||
c8 9.223372036854776e18
|
||||
c9 9.223372036854776e18
|
||||
c10 9.223372036854776e18
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= -9223372036854775808 ;
|
||||
@ -2615,10 +2615,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -9.22337e+18
|
||||
c8 -9.22337203685478e+18
|
||||
c9 -9.22337203685478e+18
|
||||
c10 -9.22337203685478e+18
|
||||
c7 -9.22337e18
|
||||
c8 -9.223372036854776e18
|
||||
c9 -9.223372036854776e18
|
||||
c10 -9.223372036854776e18
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '-9223372036854775808' ;
|
||||
@ -2638,10 +2638,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -9.22337e+18
|
||||
c8 -9.22337203685478e+18
|
||||
c9 -9.22337203685478e+18
|
||||
c10 -9.22337203685478e+18
|
||||
c7 -9.22337e18
|
||||
c8 -9.223372036854776e18
|
||||
c9 -9.223372036854776e18
|
||||
c10 -9.223372036854776e18
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= 1.11111111111111111111e+50 ;
|
||||
@ -2663,10 +2663,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 3.40282e+38
|
||||
c8 1.11111111111111e+50
|
||||
c9 1.11111111111111e+50
|
||||
c10 1.11111111111111e+50
|
||||
c7 3.40282e38
|
||||
c8 1.111111111111111e50
|
||||
c9 1.111111111111111e50
|
||||
c10 1.111111111111111e50
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '1.11111111111111111111e+50' ;
|
||||
@ -2688,10 +2688,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 3.40282e+38
|
||||
c8 1.11111111111111e+50
|
||||
c9 1.11111111111111e+50
|
||||
c10 1.11111111111111e+50
|
||||
c7 3.40282e38
|
||||
c8 1.111111111111111e50
|
||||
c9 1.111111111111111e50
|
||||
c10 1.111111111111111e50
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= -1.11111111111111111111e+50 ;
|
||||
@ -2713,10 +2713,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -3.40282e+38
|
||||
c8 -1.11111111111111e+50
|
||||
c9 -1.11111111111111e+50
|
||||
c10 -1.11111111111111e+50
|
||||
c7 -3.40282e38
|
||||
c8 -1.111111111111111e50
|
||||
c9 -1.111111111111111e50
|
||||
c10 -1.111111111111111e50
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '-1.11111111111111111111e+50' ;
|
||||
@ -2738,10 +2738,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -3.40282e+38
|
||||
c8 -1.11111111111111e+50
|
||||
c9 -1.11111111111111e+50
|
||||
c10 -1.11111111111111e+50
|
||||
c7 -3.40282e38
|
||||
c8 -1.111111111111111e50
|
||||
c9 -1.111111111111111e50
|
||||
c10 -1.111111111111111e50
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
test_sequence
|
||||
@ -2807,7 +2807,7 @@ c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
|
||||
52 5 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0
|
||||
53 5 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0
|
||||
54 5 54 54 54 54 54 54 54 54 54 54
|
||||
55 5 55 55 55 55 55 55 55 55 55 55
|
||||
55 6 55 55 55 55 55 55 55 55 55 55
|
||||
56 6 56 56 56 56 56 56 56 56 56 56
|
||||
57 6 57 57 57 57 57 57 57 57 57 57
|
||||
60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
@ -3023,7 +3023,7 @@ c1 c13 c14 c15 c16 c17
|
||||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||
|
@ -2505,10 +2505,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 9.22337e+18
|
||||
c8 9.22337203685478e+18
|
||||
c9 9.22337203685478e+18
|
||||
c10 9.22337203685478e+18
|
||||
c7 9.22337e18
|
||||
c8 9.223372036854776e18
|
||||
c9 9.223372036854776e18
|
||||
c10 9.223372036854776e18
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '9223372036854775807' ;
|
||||
@ -2528,10 +2528,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 9.22337e+18
|
||||
c8 9.22337203685478e+18
|
||||
c9 9.22337203685478e+18
|
||||
c10 9.22337203685478e+18
|
||||
c7 9.22337e18
|
||||
c8 9.223372036854776e18
|
||||
c9 9.223372036854776e18
|
||||
c10 9.223372036854776e18
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= -9223372036854775808 ;
|
||||
@ -2551,10 +2551,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -9.22337e+18
|
||||
c8 -9.22337203685478e+18
|
||||
c9 -9.22337203685478e+18
|
||||
c10 -9.22337203685478e+18
|
||||
c7 -9.22337e18
|
||||
c8 -9.223372036854776e18
|
||||
c9 -9.223372036854776e18
|
||||
c10 -9.223372036854776e18
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '-9223372036854775808' ;
|
||||
@ -2574,10 +2574,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -9.22337e+18
|
||||
c8 -9.22337203685478e+18
|
||||
c9 -9.22337203685478e+18
|
||||
c10 -9.22337203685478e+18
|
||||
c7 -9.22337e18
|
||||
c8 -9.223372036854776e18
|
||||
c9 -9.223372036854776e18
|
||||
c10 -9.223372036854776e18
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= 1.11111111111111111111e+50 ;
|
||||
@ -2599,10 +2599,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 3.40282e+38
|
||||
c8 1.11111111111111e+50
|
||||
c9 1.11111111111111e+50
|
||||
c10 1.11111111111111e+50
|
||||
c7 3.40282e38
|
||||
c8 1.111111111111111e50
|
||||
c9 1.111111111111111e50
|
||||
c10 1.111111111111111e50
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '1.11111111111111111111e+50' ;
|
||||
@ -2624,10 +2624,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 3.40282e+38
|
||||
c8 1.11111111111111e+50
|
||||
c9 1.11111111111111e+50
|
||||
c10 1.11111111111111e+50
|
||||
c7 3.40282e38
|
||||
c8 1.111111111111111e50
|
||||
c9 1.111111111111111e50
|
||||
c10 1.111111111111111e50
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= -1.11111111111111111111e+50 ;
|
||||
@ -2649,10 +2649,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -3.40282e+38
|
||||
c8 -1.11111111111111e+50
|
||||
c9 -1.11111111111111e+50
|
||||
c10 -1.11111111111111e+50
|
||||
c7 -3.40282e38
|
||||
c8 -1.111111111111111e50
|
||||
c9 -1.111111111111111e50
|
||||
c10 -1.111111111111111e50
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '-1.11111111111111111111e+50' ;
|
||||
@ -2674,10 +2674,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -3.40282e+38
|
||||
c8 -1.11111111111111e+50
|
||||
c9 -1.11111111111111e+50
|
||||
c10 -1.11111111111111e+50
|
||||
c7 -3.40282e38
|
||||
c8 -1.111111111111111e50
|
||||
c9 -1.111111111111111e50
|
||||
c10 -1.111111111111111e50
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
test_sequence
|
||||
@ -2742,10 +2742,10 @@ c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
|
||||
51 5 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0
|
||||
52 5 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0
|
||||
53 5 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0
|
||||
54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
|
||||
55 5 55 55 55 55 55 55 55 55 55 55
|
||||
56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
|
||||
57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
|
||||
54 5 54 54 54 54 54 54 54 54 54 54
|
||||
55 6 55 55 55 55 55 55 55 55 55 55
|
||||
56 6 56 56 56 56 56 56 56 56 56 56
|
||||
57 6 57 57 57 57 57 57 57 57 57 57
|
||||
60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
@ -2959,7 +2959,7 @@ c1 c13 c14 c15 c16 c17
|
||||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||
@ -5527,10 +5527,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 9.22337e+18
|
||||
c8 9.22337203685478e+18
|
||||
c9 9.22337203685478e+18
|
||||
c10 9.22337203685478e+18
|
||||
c7 9.22337e18
|
||||
c8 9.223372036854776e18
|
||||
c9 9.223372036854776e18
|
||||
c10 9.223372036854776e18
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '9223372036854775807' ;
|
||||
@ -5550,10 +5550,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 9.22337e+18
|
||||
c8 9.22337203685478e+18
|
||||
c9 9.22337203685478e+18
|
||||
c10 9.22337203685478e+18
|
||||
c7 9.22337e18
|
||||
c8 9.223372036854776e18
|
||||
c9 9.223372036854776e18
|
||||
c10 9.223372036854776e18
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= -9223372036854775808 ;
|
||||
@ -5573,10 +5573,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -9.22337e+18
|
||||
c8 -9.22337203685478e+18
|
||||
c9 -9.22337203685478e+18
|
||||
c10 -9.22337203685478e+18
|
||||
c7 -9.22337e18
|
||||
c8 -9.223372036854776e18
|
||||
c9 -9.223372036854776e18
|
||||
c10 -9.223372036854776e18
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '-9223372036854775808' ;
|
||||
@ -5596,10 +5596,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -9.22337e+18
|
||||
c8 -9.22337203685478e+18
|
||||
c9 -9.22337203685478e+18
|
||||
c10 -9.22337203685478e+18
|
||||
c7 -9.22337e18
|
||||
c8 -9.223372036854776e18
|
||||
c9 -9.223372036854776e18
|
||||
c10 -9.223372036854776e18
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= 1.11111111111111111111e+50 ;
|
||||
@ -5621,10 +5621,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 3.40282e+38
|
||||
c8 1.11111111111111e+50
|
||||
c9 1.11111111111111e+50
|
||||
c10 1.11111111111111e+50
|
||||
c7 3.40282e38
|
||||
c8 1.111111111111111e50
|
||||
c9 1.111111111111111e50
|
||||
c10 1.111111111111111e50
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '1.11111111111111111111e+50' ;
|
||||
@ -5646,10 +5646,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 3.40282e+38
|
||||
c8 1.11111111111111e+50
|
||||
c9 1.11111111111111e+50
|
||||
c10 1.11111111111111e+50
|
||||
c7 3.40282e38
|
||||
c8 1.111111111111111e50
|
||||
c9 1.111111111111111e50
|
||||
c10 1.111111111111111e50
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= -1.11111111111111111111e+50 ;
|
||||
@ -5671,10 +5671,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -3.40282e+38
|
||||
c8 -1.11111111111111e+50
|
||||
c9 -1.11111111111111e+50
|
||||
c10 -1.11111111111111e+50
|
||||
c7 -3.40282e38
|
||||
c8 -1.111111111111111e50
|
||||
c9 -1.111111111111111e50
|
||||
c10 -1.111111111111111e50
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '-1.11111111111111111111e+50' ;
|
||||
@ -5696,10 +5696,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -3.40282e+38
|
||||
c8 -1.11111111111111e+50
|
||||
c9 -1.11111111111111e+50
|
||||
c10 -1.11111111111111e+50
|
||||
c7 -3.40282e38
|
||||
c8 -1.111111111111111e50
|
||||
c9 -1.111111111111111e50
|
||||
c10 -1.111111111111111e50
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
test_sequence
|
||||
@ -5764,10 +5764,10 @@ c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
|
||||
51 5 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0
|
||||
52 5 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0
|
||||
53 5 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0
|
||||
54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
|
||||
55 5 55 55 55 55 55 55 55 55 55 55
|
||||
56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
|
||||
57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
|
||||
54 5 54 54 54 54 54 54 54 54 54 54
|
||||
55 6 55 55 55 55 55 55 55 55 55 55
|
||||
56 6 56 56 56 56 56 56 56 56 56 56
|
||||
57 6 57 57 57 57 57 57 57 57 57 57
|
||||
60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
@ -5981,7 +5981,7 @@ c1 c13 c14 c15 c16 c17
|
||||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||
|
@ -2784,26 +2784,26 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
select max(key1) from t1 where key1 <= 0.6158;
|
||||
max(key1)
|
||||
0.615800023078918
|
||||
0.6158000230789185
|
||||
select max(key2) from t2 where key2 <= 1.6158;
|
||||
max(key2)
|
||||
1.61580002307892
|
||||
1.6158000230789185
|
||||
select min(key1) from t1 where key1 >= 0.3762;
|
||||
min(key1)
|
||||
0.376199990510941
|
||||
0.37619999051094055
|
||||
select min(key2) from t2 where key2 >= 1.3762;
|
||||
min(key2)
|
||||
1.37619996070862
|
||||
1.3761999607086182
|
||||
select max(key1), min(key2) from t1, t2
|
||||
where key1 <= 0.6158 and key2 >= 1.3762;
|
||||
max(key1) min(key2)
|
||||
0.615800023078918 1.37619996070862
|
||||
0.6158000230789185 1.3761999607086182
|
||||
select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
|
||||
max(key1)
|
||||
0.615800023078918
|
||||
0.6158000230789185
|
||||
select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
|
||||
min(key1)
|
||||
0.376199990510941
|
||||
0.37619999051094055
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
|
||||
INSERT INTO t1 VALUES (10);
|
||||
|
@ -579,7 +579,7 @@ return 2.7182818284590452354|
|
||||
set @e = e()|
|
||||
select e(), @e|
|
||||
e() @e
|
||||
2.71828182845905 2.71828182845905
|
||||
2.718281828459045 2.718281828459045
|
||||
drop function if exists inc|
|
||||
create function inc(i int) returns int
|
||||
return i+1|
|
||||
@ -616,23 +616,23 @@ create function fun(d double, i int, u int unsigned) returns double
|
||||
return mul(inc(i), fac(u)) / e()|
|
||||
select fun(2.3, 3, 5)|
|
||||
fun(2.3, 3, 5)
|
||||
176.582131762292
|
||||
176.58213176229233
|
||||
insert into t2 values (append("xxx", "yyy"), mul(4,3), e())|
|
||||
insert into t2 values (append("a", "b"), mul(2,mul(3,4)), fun(1.7, 4, 6))|
|
||||
select * from t2 where s = append("a", "b")|
|
||||
s i d
|
||||
ab 24 1324.36598821719
|
||||
ab 24 1324.3659882171924
|
||||
select * from t2 where i = mul(4,3) or i = mul(mul(3,4),2) order by i|
|
||||
s i d
|
||||
xxxyyy 12 2.71828182845905
|
||||
ab 24 1324.36598821719
|
||||
xxxyyy 12 2.718281828459045
|
||||
ab 24 1324.3659882171924
|
||||
select * from t2 where d = e()|
|
||||
s i d
|
||||
xxxyyy 12 2.71828182845905
|
||||
xxxyyy 12 2.718281828459045
|
||||
select * from t2 order by i|
|
||||
s i d
|
||||
xxxyyy 12 2.71828182845905
|
||||
ab 24 1324.36598821719
|
||||
xxxyyy 12 2.718281828459045
|
||||
ab 24 1324.3659882171924
|
||||
delete from t2|
|
||||
drop function e|
|
||||
drop function inc|
|
||||
@ -5972,9 +5972,9 @@ CREATE TABLE t3 (f1 INT, f2 FLOAT)|
|
||||
INSERT INTO t3 VALUES (1, 3.4), (1, 2), (1, 0.9), (2, 8), (2, 7)|
|
||||
SELECT SUM(f2), bug25373(f1) FROM t3 GROUP BY bug25373(f1) WITH ROLLUP|
|
||||
SUM(f2) bug25373(f1)
|
||||
6.30000007152557 1
|
||||
6.300000071525574 1
|
||||
15 2
|
||||
21.3000000715256 NULL
|
||||
21.300000071525574 NULL
|
||||
DROP FUNCTION bug25373|
|
||||
DROP TABLE t3|
|
||||
DROP DATABASE IF EXISTS mysqltest1|
|
||||
|
@ -873,14 +873,14 @@ Warning 1264 Out of range value for column 'col2' at row 1
|
||||
SELECT * FROM t1;
|
||||
col1 col2
|
||||
-1.1e-37 0
|
||||
3.4e+38 3.4e+38
|
||||
3.4e38 3.4e38
|
||||
-1.1e-37 0
|
||||
3.4e+38 3.4e+38
|
||||
3.4e38 3.4e38
|
||||
0 NULL
|
||||
2 NULL
|
||||
NULL NULL
|
||||
3.40282e+38 0
|
||||
3.40282e+38 0
|
||||
3.40282e38 0
|
||||
3.40282e38 0
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (col1 DOUBLE PRECISION, col2 DOUBLE PRECISION UNSIGNED);
|
||||
INSERT INTO t1 VALUES (-2.2E-307,0),(2E-307,0),(+1.7E+308,+1.7E+308);
|
||||
@ -922,14 +922,14 @@ SELECT * FROM t1;
|
||||
col1 col2
|
||||
-2.2e-307 0
|
||||
1e-303 0
|
||||
NULL 1.7e+308
|
||||
NULL 1.7e308
|
||||
-2.2e-307 0
|
||||
-2e-307 0
|
||||
NULL 1.7e+308
|
||||
NULL 1.7e308
|
||||
0 NULL
|
||||
2 NULL
|
||||
NULL NULL
|
||||
1.79769313486232e+308 0
|
||||
1.7976931348623157e308 0
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (col1 CHAR(5), col2 VARCHAR(6));
|
||||
INSERT INTO t1 VALUES ('hello', 'hello'),('he', 'he'),('hello ', 'hello ');
|
||||
|
@ -796,6 +796,18 @@ SELECT ROUND(qty,3), dps, ROUND(qty,dps) FROM t1;
|
||||
ROUND(qty,3) dps ROUND(qty,dps)
|
||||
1.133 3 1.133000
|
||||
DROP TABLE t1;
|
||||
create table t1 (c1 decimal(10,6));
|
||||
insert into t1 (c1) values (9.99e-4);
|
||||
insert into t1 (c1) values (9.98e-4);
|
||||
insert into t1 (c1) values (0.000999);
|
||||
insert into t1 (c1) values (cast(9.99e-4 as decimal(10,6)));
|
||||
select * from t1;
|
||||
c1
|
||||
0.000999
|
||||
0.000998
|
||||
0.000999
|
||||
0.000999
|
||||
drop table t1;
|
||||
SELECT 1 % .123456789123456789123456789123456789123456789123456789123456789123456789123456789 AS '%';
|
||||
%
|
||||
0.012345687012345687012345687012345687012345687012345687012345687012345687000000000
|
||||
|
@ -2,9 +2,9 @@ drop table if exists t1,t2;
|
||||
SELECT 10,10.0,10.,.1e+2,100.0e-1;
|
||||
10 10.0 10. .1e+2 100.0e-1
|
||||
10 10.0 10 10 10
|
||||
SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000;
|
||||
6e-05 -6e-05 --6e-05 -6e-05+1.000000
|
||||
6e-05 -6e-05 6e-05 0.99994
|
||||
SELECT 6e-16, -6e-16, --6e-16, -6e-16+1.000000;
|
||||
6e-16 -6e-16 --6e-16 -6e-16+1.000000
|
||||
6e-16 -6e-16 6e-16 0.9999999999999994
|
||||
SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
|
||||
1e1 1.e1 1.0e1 1e+1 1.e+1 1.0e+1 1e-1 1.e-1 1.0e-1
|
||||
10 10 10 10 10 10 0.1 0.1 0.1
|
||||
@ -31,16 +31,16 @@ select * from t1;
|
||||
f1 f2
|
||||
10 10
|
||||
100000 100000
|
||||
1.23457e+09 1234567890
|
||||
1e+10 10000000000
|
||||
1e+15 1e+15
|
||||
1e+20 1e+20
|
||||
3.40282e+38 1e+50
|
||||
3.40282e+38 1e+150
|
||||
1234570000 1234567890
|
||||
10000000000 10000000000
|
||||
1e15 1e15
|
||||
1e20 1e20
|
||||
3.40282e38 1e50
|
||||
3.40282e38 1e150
|
||||
-10 -10
|
||||
1e-05 1e-05
|
||||
1e-10 1e-10
|
||||
1e-15 1e-15
|
||||
0.00001 0.00001
|
||||
0.0000000001 0.0000000001
|
||||
0.000000000000001 0.000000000000001
|
||||
1e-20 1e-20
|
||||
0 1e-50
|
||||
0 1e-150
|
||||
@ -87,7 +87,7 @@ col
|
||||
create table t2 select c1 + c1 * (c2 / 100) as col1, round(c1, 5) as col2, round(c1, 35) as col3, sqrt(c1*1e-15) col4 from t1;
|
||||
select * from t2;
|
||||
col1 col2 col3 col4
|
||||
140.36 121.00000 121 3.47850542618522e-07
|
||||
140.36 121.00000 121 0.00000034785054261852176
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
@ -201,9 +201,9 @@ insert into t1 values (2e5),(2e6),(2e-4),(2e-5);
|
||||
select * from t1;
|
||||
c
|
||||
200000
|
||||
2e+06
|
||||
2e6
|
||||
0.0002
|
||||
2e-05
|
||||
2e-5
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
reckey int unsigned NOT NULL,
|
||||
@ -267,7 +267,7 @@ select 1e-308, 1.00000001e-300, 100000000e-300;
|
||||
1e-308 1.00000001e-300 1e-292
|
||||
select 10e307;
|
||||
10e307
|
||||
1e+308
|
||||
1e308
|
||||
create table t1(a int, b double(8, 2));
|
||||
insert into t1 values
|
||||
(1, 28.50), (1, 121.85), (1, 157.23), (1, 1351.00), (1, -1965.35), (1, 81.75),
|
||||
@ -369,12 +369,12 @@ Warning 1264 Out of range value for column 'f1' at row 1
|
||||
Warning 1264 Out of range value for column 'f1' at row 2
|
||||
select f1 + 0e0 from t1;
|
||||
f1 + 0e0
|
||||
1e+199
|
||||
-1e+199
|
||||
1e+200
|
||||
-1e+200
|
||||
1e+200
|
||||
-1e+200
|
||||
1e199
|
||||
-1e199
|
||||
1e200
|
||||
-1e200
|
||||
1e200
|
||||
-1e200
|
||||
drop table t1;
|
||||
create table t1 (f1 float(30, 0));
|
||||
insert into t1 values (1e29), (-1e29);
|
||||
@ -385,12 +385,36 @@ Warning 1264 Out of range value for column 'f1' at row 1
|
||||
Warning 1264 Out of range value for column 'f1' at row 2
|
||||
select f1 + 0e0 from t1;
|
||||
f1 + 0e0
|
||||
1.00000001504747e+29
|
||||
-1.00000001504747e+29
|
||||
1.00000001504747e+30
|
||||
-1.00000001504747e+30
|
||||
1.00000001504747e+30
|
||||
-1.00000001504747e+30
|
||||
1.0000000150474662e29
|
||||
-1.0000000150474662e29
|
||||
1.0000000150474662e30
|
||||
-1.0000000150474662e30
|
||||
1.0000000150474662e30
|
||||
-1.0000000150474662e30
|
||||
drop table t1;
|
||||
create table t1 (c char(6));
|
||||
insert into t1 values (2e6),(2e-5);
|
||||
select * from t1;
|
||||
c
|
||||
2e6
|
||||
2e-5
|
||||
drop table t1;
|
||||
CREATE TABLE d1 (d DOUBLE);
|
||||
INSERT INTO d1 VALUES (1.7976931348623157E+308);
|
||||
SELECT * FROM d1;
|
||||
d
|
||||
1.7976931348623157e308
|
||||
INSERT INTO d1 VALUES (1.79769313486232e+308);
|
||||
ERROR 22007: Illegal double '1.79769313486232e+308' value found during parsing
|
||||
SELECT * FROM d1;
|
||||
d
|
||||
1.7976931348623157e308
|
||||
DROP TABLE d1;
|
||||
create table t1 (a char(20));
|
||||
insert into t1 values (1.225e-05);
|
||||
select a+0 from t1;
|
||||
a+0
|
||||
0.00001225
|
||||
drop table t1;
|
||||
create table t1(d double, u bigint unsigned);
|
||||
insert into t1(d) values (9.22337203685479e18),
|
||||
@ -405,6 +429,6 @@ CREATE TABLE t1 (f1 DOUBLE);
|
||||
INSERT INTO t1 VALUES(-1.79769313486231e+308);
|
||||
SELECT f1 FROM t1;
|
||||
f1
|
||||
-1.79769313486231e+308
|
||||
-1.79769313486231e308
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
@ -917,7 +917,7 @@ cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15))
|
||||
0.000000000100000
|
||||
select ln(14000) c1, convert(ln(14000),decimal(5,3)) c2, cast(ln(14000) as decimal(5,3)) c3;
|
||||
c1 c2 c3
|
||||
9.5468126085974 9.547 9.547
|
||||
9.546812608597396 9.547 9.547
|
||||
select convert(ln(14000),decimal(2,3)) c1;
|
||||
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '').
|
||||
select cast(ln(14000) as decimal(2,3)) c1;
|
||||
@ -1141,17 +1141,17 @@ my_float my_double my_varchar
|
||||
1.17549e-18 1.175494345e-18 1.175494345e-18
|
||||
1.17549e-17 1.175494345e-17 1.175494345e-17
|
||||
1.17549e-16 1.175494345e-16 1.175494345e-16
|
||||
1.17549e-15 1.175494345e-15 1.175494345e-15
|
||||
1.17549e-14 1.175494345e-14 1.175494345e-14
|
||||
1.17549e-13 1.175494345e-13 1.175494345e-13
|
||||
1.17549e-12 1.175494345e-12 1.175494345e-12
|
||||
1.17549e-11 1.175494345e-11 1.175494345e-11
|
||||
1.17549e-10 1.175494345e-10 1.175494345e-10
|
||||
1.17549e-09 1.175494345e-09 1.175494345e-9
|
||||
1.17549e-08 1.175494345e-08 1.175494345e-8
|
||||
1.17549e-07 1.175494345e-07 1.175494345e-7
|
||||
1.17549e-06 1.175494345e-06 1.175494345e-6
|
||||
1.17549e-05 1.175494345e-05 1.175494345e-5
|
||||
0.00000000000000117549 0.000000000000001175494345 1.175494345e-15
|
||||
0.0000000000000117549 0.00000000000001175494345 1.175494345e-14
|
||||
0.000000000000117549 0.0000000000001175494345 1.175494345e-13
|
||||
0.00000000000117549 0.000000000001175494345 1.175494345e-12
|
||||
0.0000000000117549 0.00000000001175494345 1.175494345e-11
|
||||
0.000000000117549 0.0000000001175494345 1.175494345e-10
|
||||
0.00000000117549 0.000000001175494345 1.175494345e-9
|
||||
0.0000000117549 0.00000001175494345 1.175494345e-8
|
||||
0.000000117549 0.0000001175494345 1.175494345e-7
|
||||
0.00000117549 0.000001175494345 1.175494345e-6
|
||||
0.0000117549 0.00001175494345 1.175494345e-5
|
||||
0.000117549 0.0001175494345 1.175494345e-4
|
||||
0.00117549 0.001175494345 1.175494345e-3
|
||||
0.0117549 0.01175494345 1.175494345e-2
|
||||
@ -1175,21 +1175,21 @@ CAST(my_float AS DECIMAL(65,30)) my_float
|
||||
0.000000000000000001175494374380 1.17549e-18
|
||||
0.000000000000000011754943743802 1.17549e-17
|
||||
0.000000000000000117549432474939 1.17549e-16
|
||||
0.000000000000001175494324749389 1.17549e-15
|
||||
0.000000000000011754943671010360 1.17549e-14
|
||||
0.000000000000117549429933840000 1.17549e-13
|
||||
0.000000000001175494380653563000 1.17549e-12
|
||||
0.000000000011754943372854760000 1.17549e-11
|
||||
0.000000000117549428524377200000 1.17549e-10
|
||||
0.000000001175494368510499000000 1.17549e-09
|
||||
0.000000011754943685104990000000 1.17549e-08
|
||||
0.000000117549433298336200000000 1.17549e-07
|
||||
0.000001175494389826781000000000 1.17549e-06
|
||||
0.000011754943443520460000000000 1.17549e-05
|
||||
0.000000000000001175494324749389 0.00000000000000117549
|
||||
0.000000000000011754943671010362 0.0000000000000117549
|
||||
0.000000000000117549429933840040 0.000000000000117549
|
||||
0.000000000001175494380653563400 0.00000000000117549
|
||||
0.000000000011754943372854765000 0.0000000000117549
|
||||
0.000000000117549428524377220000 0.000000000117549
|
||||
0.000000001175494368510499000000 0.00000000117549
|
||||
0.000000011754943685104990000000 0.0000000117549
|
||||
0.000000117549433298336230000000 0.000000117549
|
||||
0.000001175494389826781100000000 0.00000117549
|
||||
0.000011754943443520460000000000 0.0000117549
|
||||
0.000117549432616215200000000000 0.000117549
|
||||
0.001175494398921728000000000000 0.00117549
|
||||
0.011754943057894710000000000000 0.0117549
|
||||
0.117549434304237400000000000000 0.117549
|
||||
0.001175494398921728100000000000 0.00117549
|
||||
0.011754943057894707000000000000 0.0117549
|
||||
0.117549434304237370000000000000 0.117549
|
||||
SELECT CAST(my_double AS DECIMAL(65,30)), my_double FROM t1;
|
||||
CAST(my_double AS DECIMAL(65,30)) my_double
|
||||
0.000000000000000000000000000000 1.175494345e-32
|
||||
@ -1209,17 +1209,17 @@ CAST(my_double AS DECIMAL(65,30)) my_double
|
||||
0.000000000000000001175494345000 1.175494345e-18
|
||||
0.000000000000000011754943450000 1.175494345e-17
|
||||
0.000000000000000117549434500000 1.175494345e-16
|
||||
0.000000000000001175494345000000 1.175494345e-15
|
||||
0.000000000000011754943450000000 1.175494345e-14
|
||||
0.000000000000117549434500000000 1.175494345e-13
|
||||
0.000000000001175494345000000000 1.175494345e-12
|
||||
0.000000000011754943450000000000 1.175494345e-11
|
||||
0.000000000117549434500000000000 1.175494345e-10
|
||||
0.000000001175494345000000000000 1.175494345e-09
|
||||
0.000000011754943450000000000000 1.175494345e-08
|
||||
0.000000117549434500000000000000 1.175494345e-07
|
||||
0.000001175494345000000000000000 1.175494345e-06
|
||||
0.000011754943450000000000000000 1.175494345e-05
|
||||
0.000000000000001175494345000000 0.000000000000001175494345
|
||||
0.000000000000011754943450000000 0.00000000000001175494345
|
||||
0.000000000000117549434500000000 0.0000000000001175494345
|
||||
0.000000000001175494345000000000 0.000000000001175494345
|
||||
0.000000000011754943450000000000 0.00000000001175494345
|
||||
0.000000000117549434500000000000 0.0000000001175494345
|
||||
0.000000001175494345000000000000 0.000000001175494345
|
||||
0.000000011754943450000000000000 0.00000001175494345
|
||||
0.000000117549434500000000000000 0.0000001175494345
|
||||
0.000001175494345000000000000000 0.000001175494345
|
||||
0.000011754943450000000000000000 0.00001175494345
|
||||
0.000117549434500000000000000000 0.0001175494345
|
||||
0.001175494345000000000000000000 0.001175494345
|
||||
0.011754943450000000000000000000 0.01175494345
|
||||
@ -1278,21 +1278,21 @@ my_decimal my_float
|
||||
0.000000000000000001175494374380 1.17549e-18
|
||||
0.000000000000000011754943743802 1.17549e-17
|
||||
0.000000000000000117549432474939 1.17549e-16
|
||||
0.000000000000001175494324749389 1.17549e-15
|
||||
0.000000000000011754943671010360 1.17549e-14
|
||||
0.000000000000117549429933840000 1.17549e-13
|
||||
0.000000000001175494380653563000 1.17549e-12
|
||||
0.000000000011754943372854760000 1.17549e-11
|
||||
0.000000000117549428524377200000 1.17549e-10
|
||||
0.000000001175494368510499000000 1.17549e-09
|
||||
0.000000011754943685104990000000 1.17549e-08
|
||||
0.000000117549433298336200000000 1.17549e-07
|
||||
0.000001175494389826781000000000 1.17549e-06
|
||||
0.000011754943443520460000000000 1.17549e-05
|
||||
0.000000000000001175494324749389 0.00000000000000117549
|
||||
0.000000000000011754943671010362 0.0000000000000117549
|
||||
0.000000000000117549429933840040 0.000000000000117549
|
||||
0.000000000001175494380653563400 0.00000000000117549
|
||||
0.000000000011754943372854765000 0.0000000000117549
|
||||
0.000000000117549428524377220000 0.000000000117549
|
||||
0.000000001175494368510499000000 0.00000000117549
|
||||
0.000000011754943685104990000000 0.0000000117549
|
||||
0.000000117549433298336230000000 0.000000117549
|
||||
0.000001175494389826781100000000 0.00000117549
|
||||
0.000011754943443520460000000000 0.0000117549
|
||||
0.000117549432616215200000000000 0.000117549
|
||||
0.001175494398921728000000000000 0.00117549
|
||||
0.011754943057894710000000000000 0.0117549
|
||||
0.117549434304237400000000000000 0.117549
|
||||
0.001175494398921728100000000000 0.00117549
|
||||
0.011754943057894707000000000000 0.0117549
|
||||
0.117549434304237370000000000000 0.117549
|
||||
UPDATE t1 SET my_decimal = my_double;
|
||||
SELECT my_decimal, my_double FROM t1;
|
||||
my_decimal my_double
|
||||
@ -1313,17 +1313,17 @@ my_decimal my_double
|
||||
0.000000000000000001175494345000 1.175494345e-18
|
||||
0.000000000000000011754943450000 1.175494345e-17
|
||||
0.000000000000000117549434500000 1.175494345e-16
|
||||
0.000000000000001175494345000000 1.175494345e-15
|
||||
0.000000000000011754943450000000 1.175494345e-14
|
||||
0.000000000000117549434500000000 1.175494345e-13
|
||||
0.000000000001175494345000000000 1.175494345e-12
|
||||
0.000000000011754943450000000000 1.175494345e-11
|
||||
0.000000000117549434500000000000 1.175494345e-10
|
||||
0.000000001175494345000000000000 1.175494345e-09
|
||||
0.000000011754943450000000000000 1.175494345e-08
|
||||
0.000000117549434500000000000000 1.175494345e-07
|
||||
0.000001175494345000000000000000 1.175494345e-06
|
||||
0.000011754943450000000000000000 1.175494345e-05
|
||||
0.000000000000001175494345000000 0.000000000000001175494345
|
||||
0.000000000000011754943450000000 0.00000000000001175494345
|
||||
0.000000000000117549434500000000 0.0000000000001175494345
|
||||
0.000000000001175494345000000000 0.000000000001175494345
|
||||
0.000000000011754943450000000000 0.00000000001175494345
|
||||
0.000000000117549434500000000000 0.0000000001175494345
|
||||
0.000000001175494345000000000000 0.000000001175494345
|
||||
0.000000011754943450000000000000 0.00000001175494345
|
||||
0.000000117549434500000000000000 0.0000001175494345
|
||||
0.000001175494345000000000000000 0.000001175494345
|
||||
0.000011754943450000000000000000 0.00001175494345
|
||||
0.000117549434500000000000000000 0.0001175494345
|
||||
0.001175494345000000000000000000 0.001175494345
|
||||
0.011754943450000000000000000000 0.01175494345
|
||||
|
@ -57,7 +57,7 @@ select @`select`,@not_used;
|
||||
set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL;
|
||||
select @test_int,@test_double,@test_string,@test_string2,@select;
|
||||
@test_int @test_double @test_string @test_string2 @select
|
||||
10 1e-10 abcdeghi abcdefghij NULL
|
||||
10 0.0000000001 abcdeghi abcdefghij NULL
|
||||
set @test_int="hello",@test_double="hello",@test_string="hello",@test_string2="hello";
|
||||
select @test_int,@test_double,@test_string,@test_string2;
|
||||
@test_int @test_double @test_string @test_string2
|
||||
|
@ -2590,7 +2590,7 @@ CREATE VIEW v1 AS SELECT SQRT(a) my_sqrt FROM t1;
|
||||
SELECT my_sqrt FROM v1 ORDER BY my_sqrt;
|
||||
my_sqrt
|
||||
1
|
||||
1.4142135623731
|
||||
1.4142135623730951
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id int PRIMARY KEY);
|
||||
|
Binary file not shown.
Binary file not shown.
@ -266,7 +266,7 @@ fid AsText(EndPoint(g))
|
||||
107 POINT(40 10)
|
||||
SELECT fid, GLength(g) FROM gis_line ORDER by fid;
|
||||
fid GLength(g)
|
||||
105 24.142135623731
|
||||
105 24.14213562373095
|
||||
106 40
|
||||
107 30
|
||||
SELECT fid, NumPoints(g) FROM gis_line ORDER by fid;
|
||||
@ -292,7 +292,7 @@ Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint
|
||||
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
|
||||
fid AsText(Centroid(g))
|
||||
108 POINT(15 15)
|
||||
109 POINT(25.4166666666667 25.4166666666667)
|
||||
109 POINT(25.416666666666668 25.416666666666668)
|
||||
110 POINT(20 10)
|
||||
SELECT fid, Area(g) FROM gis_polygon ORDER by fid;
|
||||
fid Area(g)
|
||||
@ -326,8 +326,8 @@ fid IsClosed(g)
|
||||
116 0
|
||||
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid;
|
||||
fid AsText(Centroid(g))
|
||||
117 POINT(55.5885277530424 17.426536064114)
|
||||
118 POINT(55.5885277530424 17.426536064114)
|
||||
117 POINT(55.58852775304245 17.426536064113982)
|
||||
118 POINT(55.58852775304245 17.426536064113982)
|
||||
119 POINT(2 2)
|
||||
SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid;
|
||||
fid Area(g)
|
||||
@ -816,7 +816,7 @@ fid AsText(EndPoint(g))
|
||||
107 POINT(40 10)
|
||||
SELECT fid, GLength(g) FROM gis_line ORDER by fid;
|
||||
fid GLength(g)
|
||||
105 24.142135623731
|
||||
105 24.14213562373095
|
||||
106 40
|
||||
107 30
|
||||
SELECT fid, NumPoints(g) FROM gis_line ORDER by fid;
|
||||
@ -842,7 +842,7 @@ Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint
|
||||
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
|
||||
fid AsText(Centroid(g))
|
||||
108 POINT(15 15)
|
||||
109 POINT(25.4166666666667 25.4166666666667)
|
||||
109 POINT(25.416666666666668 25.416666666666668)
|
||||
110 POINT(20 10)
|
||||
SELECT fid, Area(g) FROM gis_polygon ORDER by fid;
|
||||
fid Area(g)
|
||||
@ -876,8 +876,8 @@ fid IsClosed(g)
|
||||
116 0
|
||||
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid;
|
||||
fid AsText(Centroid(g))
|
||||
117 POINT(55.5885277530424 17.426536064114)
|
||||
118 POINT(55.5885277530424 17.426536064114)
|
||||
117 POINT(55.58852775304245 17.426536064113982)
|
||||
118 POINT(55.58852775304245 17.426536064113982)
|
||||
119 POINT(2 2)
|
||||
SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid;
|
||||
fid Area(g)
|
||||
|
@ -79,7 +79,7 @@ t_pk t_date t_datetime t_timestamp t_time t_year
|
||||
1 1998-01-01 2006-08-10 10:11:12 2002-10-29 16:51:06 19:38:34 2155
|
||||
SELECT t_pk,hex(t_bit),t_tinyint,t_bool,t_smallint,t_mediumint,t_int,t_bigint,t_float,t_double,t_decimal FROM t_num;
|
||||
t_pk hex(t_bit) t_tinyint t_bool t_smallint t_mediumint t_int t_bigint t_float t_double t_decimal
|
||||
1 AAAAAAAAAAAAAAAA 125 1 32765 8388606 2147483647 9223372036854775807 1e+20 1e+150 331.0000000000000000
|
||||
1 AAAAAAAAAAAAAAAA 125 1 32765 8388606 2147483647 9223372036854775807 1e20 1e150 331.0000000000000000
|
||||
SELECT t_pk,t_char,t_varchar,hex(t_binary),hex(t_varbinary) FROM t_string_1;
|
||||
t_pk t_char t_varchar hex(t_binary) hex(t_varbinary)
|
||||
1 abcdefghijklmn abcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmn 612020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 4100
|
||||
@ -178,7 +178,7 @@ t_pk t_date t_datetime t_timestamp t_time t_year
|
||||
1 1998-01-01 2006-08-10 10:11:12 2002-10-29 16:51:06 19:38:34 2155
|
||||
SELECT t_pk,hex(t_bit),t_tinyint,t_bool,t_smallint,t_mediumint,t_int,t_bigint,t_float,t_double,t_decimal FROM t_num;
|
||||
t_pk hex(t_bit) t_tinyint t_bool t_smallint t_mediumint t_int t_bigint t_float t_double t_decimal
|
||||
1 AAAAAAAAAAAAAAAA 125 1 32765 8388606 2147483647 9223372036854775807 1e+20 1e+150 331.0000000000000000
|
||||
1 AAAAAAAAAAAAAAAA 125 1 32765 8388606 2147483647 9223372036854775807 1e20 1e150 331.0000000000000000
|
||||
SELECT t_pk,t_char,t_varchar,hex(t_binary),hex(t_varbinary) FROM t_string_1;
|
||||
t_pk t_char t_varchar hex(t_binary) hex(t_varbinary)
|
||||
1 abcdefghijklmn abcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmn 612020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 4100
|
||||
|
@ -2568,10 +2568,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 9.22337e+18
|
||||
c8 9.22337203685478e+18
|
||||
c9 9.22337203685478e+18
|
||||
c10 9.22337203685478e+18
|
||||
c7 9.22337e18
|
||||
c8 9.223372036854776e18
|
||||
c9 9.223372036854776e18
|
||||
c10 9.223372036854776e18
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '9223372036854775807' ;
|
||||
@ -2591,10 +2591,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 9.22337e+18
|
||||
c8 9.22337203685478e+18
|
||||
c9 9.22337203685478e+18
|
||||
c10 9.22337203685478e+18
|
||||
c7 9.22337e18
|
||||
c8 9.223372036854776e18
|
||||
c9 9.223372036854776e18
|
||||
c10 9.223372036854776e18
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= -9223372036854775808 ;
|
||||
@ -2614,10 +2614,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -9.22337e+18
|
||||
c8 -9.22337203685478e+18
|
||||
c9 -9.22337203685478e+18
|
||||
c10 -9.22337203685478e+18
|
||||
c7 -9.22337e18
|
||||
c8 -9.223372036854776e18
|
||||
c9 -9.223372036854776e18
|
||||
c10 -9.223372036854776e18
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '-9223372036854775808' ;
|
||||
@ -2637,10 +2637,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -9.22337e+18
|
||||
c8 -9.22337203685478e+18
|
||||
c9 -9.22337203685478e+18
|
||||
c10 -9.22337203685478e+18
|
||||
c7 -9.22337e18
|
||||
c8 -9.223372036854776e18
|
||||
c9 -9.223372036854776e18
|
||||
c10 -9.223372036854776e18
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= 1.11111111111111111111e+50 ;
|
||||
@ -2662,10 +2662,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 3.40282e+38
|
||||
c8 1.11111111111111e+50
|
||||
c9 1.11111111111111e+50
|
||||
c10 1.11111111111111e+50
|
||||
c7 3.40282e38
|
||||
c8 1.111111111111111e50
|
||||
c9 1.111111111111111e50
|
||||
c10 1.111111111111111e50
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '1.11111111111111111111e+50' ;
|
||||
@ -2687,10 +2687,10 @@ c3 8388607
|
||||
c4 2147483647
|
||||
c5 2147483647
|
||||
c6 9223372036854775807
|
||||
c7 3.40282e+38
|
||||
c8 1.11111111111111e+50
|
||||
c9 1.11111111111111e+50
|
||||
c10 1.11111111111111e+50
|
||||
c7 3.40282e38
|
||||
c8 1.111111111111111e50
|
||||
c9 1.111111111111111e50
|
||||
c10 1.111111111111111e50
|
||||
c12 9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= -1.11111111111111111111e+50 ;
|
||||
@ -2712,10 +2712,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -3.40282e+38
|
||||
c8 -1.11111111111111e+50
|
||||
c9 -1.11111111111111e+50
|
||||
c10 -1.11111111111111e+50
|
||||
c7 -3.40282e38
|
||||
c8 -1.111111111111111e50
|
||||
c9 -1.111111111111111e50
|
||||
c10 -1.111111111111111e50
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
set @arg00= '-1.11111111111111111111e+50' ;
|
||||
@ -2737,10 +2737,10 @@ c3 -8388608
|
||||
c4 -2147483648
|
||||
c5 -2147483648
|
||||
c6 -9223372036854775808
|
||||
c7 -3.40282e+38
|
||||
c8 -1.11111111111111e+50
|
||||
c9 -1.11111111111111e+50
|
||||
c10 -1.11111111111111e+50
|
||||
c7 -3.40282e38
|
||||
c8 -1.111111111111111e50
|
||||
c9 -1.111111111111111e50
|
||||
c10 -1.111111111111111e50
|
||||
c12 -9999.9999
|
||||
execute my_delete ;
|
||||
test_sequence
|
||||
@ -2805,10 +2805,10 @@ c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
|
||||
51 5 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0
|
||||
52 5 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0
|
||||
53 5 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0
|
||||
54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
|
||||
55 5 55 55 55 55 55 55 55 55 55 55
|
||||
56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
|
||||
57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
|
||||
54 5 54 54 54 54 54 54 54 54 54 54
|
||||
55 6 55 55 55 55 55 55 55 55 55 55
|
||||
56 6 56 56 56 56 56 56 56 56 56 56
|
||||
57 6 57 57 57 57 57 57 57 57 57 57
|
||||
60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
@ -3022,7 +3022,7 @@ c1 c13 c14 c15 c16 c17
|
||||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||
|
@ -177,8 +177,6 @@ select cast(1.0e+300 as signed int);
|
||||
CREATE TABLE t1 (f1 double);
|
||||
INSERT INTO t1 SET f1 = -1.0e+30 ;
|
||||
INSERT INTO t1 SET f1 = +1.0e+30 ;
|
||||
# Expected result is +-1e+30, but Windows returns +-1e+030.
|
||||
--replace_result 1e+030 1e+30
|
||||
SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
@ -353,6 +353,9 @@ insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
|
||||
36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439
|
||||
36.252666,-115.261439 36.247366,-115.247239 36.247066)))'));
|
||||
|
||||
# Expected result is 115.31877315203187, but IA64 returns 115.31877315203188
|
||||
# due to fused multiply-add instructions.
|
||||
--replace_result 115.31877315203188 115.31877315203187
|
||||
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
|
||||
t1 where object_id=85998;
|
||||
|
||||
|
@ -422,9 +422,6 @@ INSERT INTO t1(a,c) VALUES (1.87e-3, 1.87e-3);
|
||||
INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2);
|
||||
INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0);
|
||||
INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0);
|
||||
# Expected results are "12.2" and "1.2e+78", but Windows returns "12.3" and
|
||||
# "1.3e+78" due to different rounding rules
|
||||
--replace_result 12.3 12.2 1.3e+78 1.2e+78
|
||||
SELECT * FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
@ -459,9 +456,6 @@ INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2);
|
||||
INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0);
|
||||
INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0);
|
||||
|
||||
# Expected results are "12.2" and "1.2e+78", but Windows returns "12.3" and
|
||||
# "1.3e+78" due to different rounding rules
|
||||
--replace_result 12.3 12.2 1.3e+78 1.2e+78
|
||||
SELECT * FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
@ -46,9 +46,6 @@ DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a double);
|
||||
INSERT INTO t1 VALUES ('-9e999999');
|
||||
# The following replaces is here because some systems replaces the above
|
||||
# double with '-inf' and others with MAX_DOUBLE
|
||||
--replace_result (-1.79769313486232e+308) (RES) (NULL) (RES)
|
||||
--exec $MYSQL_DUMP --compact test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
|
@ -646,6 +646,10 @@ select conv(255 AS p1, 10 AS p2, 16 AS p3);
|
||||
|
||||
# Native function with a variable number of arguments
|
||||
|
||||
# Bug in libm.so on Solaris:
|
||||
# atan(10) from 32-bit version returns 1.4711276743037347
|
||||
# atan(10) from 64-bit version returns 1.4711276743037345
|
||||
--replace_result 1.4711276743037345 1.4711276743037347
|
||||
select atan(10);
|
||||
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
||||
select atan(10 AS p1);
|
||||
|
@ -409,6 +409,18 @@ SELECT ROUND(qty,3), dps, ROUND(qty,dps) FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #24541: "Data truncated..." on decimal type columns without any good reason
|
||||
#
|
||||
|
||||
create table t1 (c1 decimal(10,6));
|
||||
insert into t1 (c1) values (9.99e-4);
|
||||
insert into t1 (c1) values (9.98e-4);
|
||||
insert into t1 (c1) values (0.000999);
|
||||
insert into t1 (c1) values (cast(9.99e-4 as decimal(10,6)));
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#31019: MOD() function and operator crashes MySQL when
|
||||
# divisor is very long and < 1
|
||||
|
@ -7,7 +7,7 @@ drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
SELECT 10,10.0,10.,.1e+2,100.0e-1;
|
||||
SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000;
|
||||
SELECT 6e-16, -6e-16, --6e-16, -6e-16+1.000000;
|
||||
SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
|
||||
SELECT 0.001e+1,0.001e-1, -0.001e+01,-0.001e-01;
|
||||
SELECT 123.23E+02,-123.23E-02,"123.23E+02"+0.0,"-123.23E-02"+0.0;
|
||||
@ -252,6 +252,37 @@ insert into t1 values (2e30), (-2e30);
|
||||
select f1 + 0e0 from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #12860 "Difference in zero padding of exponent between Unix and Windows"
|
||||
#
|
||||
|
||||
create table t1 (c char(6));
|
||||
insert into t1 values (2e6),(2e-5);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #21497 "DOUBLE truncated to unusable value"
|
||||
#
|
||||
|
||||
CREATE TABLE d1 (d DOUBLE);
|
||||
INSERT INTO d1 VALUES (1.7976931348623157E+308);
|
||||
SELECT * FROM d1;
|
||||
--error ER_ILLEGAL_VALUE_FOR_TYPE
|
||||
INSERT INTO d1 VALUES (1.79769313486232e+308);
|
||||
SELECT * FROM d1;
|
||||
DROP TABLE d1;
|
||||
|
||||
#
|
||||
# Bug #26788 "mysqld (debug) aborts when inserting specific numbers into char
|
||||
# fields"
|
||||
#
|
||||
|
||||
create table t1 (a char(20));
|
||||
insert into t1 values (1.225e-05);
|
||||
select a+0 from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #27483: Casting 'scientific notation type' to 'unsigned bigint' fails on
|
||||
# windows.
|
||||
|
@ -1054,10 +1054,8 @@ while ($max_power)
|
||||
}
|
||||
SELECT my_float, my_double, my_varchar FROM t1;
|
||||
|
||||
# Expected result 0.000000000011754943372854760000
|
||||
# On windows we get 0.000000000011754943372854770000
|
||||
# use replace_result to correct it
|
||||
--replace_result 0.000000000011754943372854770000 0.000000000011754943372854760000
|
||||
# The following statement produces results with garbage past
|
||||
# the significant digits. Improving it is a part of the WL#3977.
|
||||
SELECT CAST(my_float AS DECIMAL(65,30)), my_float FROM t1;
|
||||
SELECT CAST(my_double AS DECIMAL(65,30)), my_double FROM t1;
|
||||
SELECT CAST(my_varchar AS DECIMAL(65,30)), my_varchar FROM t1;
|
||||
|
243
sql/field.cc
243
sql/field.cc
@ -31,9 +31,6 @@
|
||||
#include "slave.h" // Pull in rpl_master_has_bug()
|
||||
#include <m_ctype.h>
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_FCONVERT
|
||||
#include <floatingpoint.h>
|
||||
#endif
|
||||
|
||||
// Maximum allowed exponent value for converting string to decimal
|
||||
#define MAX_EXPONENT 1024
|
||||
@ -50,7 +47,7 @@ template class List_iterator<Create_field>;
|
||||
uchar Field_null::null[1]={1};
|
||||
const char field_separator=',';
|
||||
|
||||
#define DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE 320
|
||||
#define DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE FLOATING_POINT_BUFFER
|
||||
#define LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE 128
|
||||
#define DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE 128
|
||||
#define BLOB_PACK_LENGTH_TO_MAX_LENGH(arg) \
|
||||
@ -2304,13 +2301,7 @@ int Field_decimal::store(double nr)
|
||||
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
|
||||
|
||||
fyllchar = zerofill ? (char) '0' : (char) ' ';
|
||||
#ifdef HAVE_SNPRINTF
|
||||
buff[sizeof(buff)-1]=0; // Safety
|
||||
snprintf(buff,sizeof(buff)-1, "%.*f",(int) dec,nr);
|
||||
length= strlen(buff);
|
||||
#else
|
||||
length= my_sprintf(buff,(buff,"%.*f",dec,nr));
|
||||
#endif
|
||||
length= my_fcvt(nr, dec, buff, NULL);
|
||||
|
||||
if (length > field_length)
|
||||
{
|
||||
@ -2723,17 +2714,6 @@ int Field_new_decimal::store(double nr)
|
||||
|
||||
err= double2my_decimal(E_DEC_FATAL_ERROR & ~E_DEC_OVERFLOW, nr,
|
||||
&decimal_value);
|
||||
/*
|
||||
TODO: fix following when double2my_decimal when double2decimal
|
||||
will return E_DEC_TRUNCATED always correctly
|
||||
*/
|
||||
if (!err)
|
||||
{
|
||||
double nr2;
|
||||
my_decimal2double(E_DEC_FATAL_ERROR, &decimal_value, &nr2);
|
||||
if (nr2 != nr)
|
||||
err= E_DEC_TRUNCATED;
|
||||
}
|
||||
if (err)
|
||||
{
|
||||
if (check_overflow(err))
|
||||
@ -4231,67 +4211,20 @@ String *Field_float::val_str(String *val_buffer,
|
||||
uint to_length=max(field_length,70);
|
||||
val_buffer->alloc(to_length);
|
||||
char *to=(char*) val_buffer->ptr();
|
||||
size_t len;
|
||||
|
||||
if (dec >= NOT_FIXED_DEC)
|
||||
{
|
||||
sprintf(to,"%-*.*g",(int) field_length,FLT_DIG,nr);
|
||||
to=strcend(to,' ');
|
||||
*to=0;
|
||||
}
|
||||
len= my_gcvt(nr, MY_GCVT_ARG_FLOAT, to_length - 1, to, NULL);
|
||||
else
|
||||
{
|
||||
#ifdef HAVE_FCONVERT
|
||||
char buff[70],*pos=buff;
|
||||
int decpt,sign,tmp_dec=dec;
|
||||
|
||||
(void) sfconvert(&nr,tmp_dec,&decpt,&sign,buff);
|
||||
if (sign)
|
||||
{
|
||||
*to++='-';
|
||||
}
|
||||
if (decpt < 0)
|
||||
{ /* val_buffer is < 0 */
|
||||
*to++='0';
|
||||
if (!tmp_dec)
|
||||
goto end;
|
||||
*to++='.';
|
||||
if (-decpt > tmp_dec)
|
||||
decpt= - (int) tmp_dec;
|
||||
tmp_dec=(uint) ((int) tmp_dec+decpt);
|
||||
while (decpt++ < 0)
|
||||
*to++='0';
|
||||
}
|
||||
else if (decpt == 0)
|
||||
{
|
||||
*to++= '0';
|
||||
if (!tmp_dec)
|
||||
goto end;
|
||||
*to++='.';
|
||||
}
|
||||
else
|
||||
{
|
||||
while (decpt-- > 0)
|
||||
*to++= *pos++;
|
||||
if (!tmp_dec)
|
||||
goto end;
|
||||
*to++='.';
|
||||
}
|
||||
while (tmp_dec--)
|
||||
*to++= *pos++;
|
||||
#else
|
||||
#ifdef HAVE_SNPRINTF
|
||||
to[to_length-1]=0; // Safety
|
||||
snprintf(to,to_length-1,"%.*f",dec,nr);
|
||||
to=strend(to);
|
||||
#else
|
||||
to+= my_sprintf(to,(to,"%.*f",dec,nr));
|
||||
#endif
|
||||
#endif
|
||||
/*
|
||||
We are safe here because the buffer length is >= 70, and
|
||||
fabs(float) < 10^39, dec < NOT_FIXED_DEC. So the resulting string
|
||||
will be not longer than 69 chars + terminating '\0'.
|
||||
*/
|
||||
len= my_fcvt(nr, dec, to, NULL);
|
||||
}
|
||||
#ifdef HAVE_FCONVERT
|
||||
end:
|
||||
#endif
|
||||
val_buffer->length((uint) (to-val_buffer->ptr()));
|
||||
val_buffer->length((uint) len);
|
||||
if (zerofill)
|
||||
prepend_zeros(val_buffer);
|
||||
return val_buffer;
|
||||
@ -4479,8 +4412,12 @@ int Field_real::truncate(double *nr, double max_value)
|
||||
max_value*= log_10[order];
|
||||
max_value-= 1.0 / log_10[dec];
|
||||
|
||||
double tmp= rint((res - floor(res)) * log_10[dec]) / log_10[dec];
|
||||
res= floor(res) + tmp;
|
||||
/* Check for infinity so we don't get NaN in calculations */
|
||||
if (!my_isinf(res))
|
||||
{
|
||||
double tmp= rint((res - floor(res)) * log_10[dec]) / log_10[dec];
|
||||
res= floor(res) + tmp;
|
||||
}
|
||||
}
|
||||
|
||||
if (res < -max_value)
|
||||
@ -4590,68 +4527,14 @@ String *Field_double::val_str(String *val_buffer,
|
||||
uint to_length=max(field_length, DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE);
|
||||
val_buffer->alloc(to_length);
|
||||
char *to=(char*) val_buffer->ptr();
|
||||
size_t len;
|
||||
|
||||
if (dec >= NOT_FIXED_DEC)
|
||||
{
|
||||
sprintf(to,"%-*.*g",(int) field_length,DBL_DIG,nr);
|
||||
to=strcend(to,' ');
|
||||
}
|
||||
len= my_gcvt(nr, MY_GCVT_ARG_DOUBLE, to_length - 1, to, NULL);
|
||||
else
|
||||
{
|
||||
#ifdef HAVE_FCONVERT
|
||||
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
|
||||
char *pos= buff;
|
||||
int decpt,sign,tmp_dec=dec;
|
||||
len= my_fcvt(nr, dec, to, NULL);
|
||||
|
||||
(void) fconvert(nr,tmp_dec,&decpt,&sign,buff);
|
||||
if (sign)
|
||||
{
|
||||
*to++='-';
|
||||
}
|
||||
if (decpt < 0)
|
||||
{ /* val_buffer is < 0 */
|
||||
*to++='0';
|
||||
if (!tmp_dec)
|
||||
goto end;
|
||||
*to++='.';
|
||||
if (-decpt > tmp_dec)
|
||||
decpt= - (int) tmp_dec;
|
||||
tmp_dec=(uint) ((int) tmp_dec+decpt);
|
||||
while (decpt++ < 0)
|
||||
*to++='0';
|
||||
}
|
||||
else if (decpt == 0)
|
||||
{
|
||||
*to++= '0';
|
||||
if (!tmp_dec)
|
||||
goto end;
|
||||
*to++='.';
|
||||
}
|
||||
else
|
||||
{
|
||||
while (decpt-- > 0)
|
||||
*to++= *pos++;
|
||||
if (!tmp_dec)
|
||||
goto end;
|
||||
*to++='.';
|
||||
}
|
||||
while (tmp_dec--)
|
||||
*to++= *pos++;
|
||||
#else
|
||||
#ifdef HAVE_SNPRINTF
|
||||
to[to_length-1]=0; // Safety
|
||||
snprintf(to,to_length-1,"%.*f",dec,nr);
|
||||
to=strend(to);
|
||||
#else
|
||||
to+= my_sprintf(to,(to,"%.*f",dec,nr));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#ifdef HAVE_FCONVERT
|
||||
end:
|
||||
#endif
|
||||
|
||||
val_buffer->length((uint) (to-val_buffer->ptr()));
|
||||
val_buffer->length((uint) len);
|
||||
if (zerofill)
|
||||
prepend_zeros(val_buffer);
|
||||
return val_buffer;
|
||||
@ -6448,84 +6331,18 @@ int Field_str::store(double nr)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
|
||||
uint length;
|
||||
uint local_char_length= field_length / charset()->mbmaxlen;
|
||||
double anr= fabs(nr);
|
||||
bool fractional= (anr != floor(anr));
|
||||
int neg= (nr < 0.0) ? 1 : 0;
|
||||
uint max_length;
|
||||
int exp;
|
||||
uint digits;
|
||||
uint i;
|
||||
size_t length;
|
||||
my_bool error;
|
||||
|
||||
/* Calculate the exponent from the 'e'-format conversion */
|
||||
if (anr < 1.0 && anr > 0)
|
||||
length= my_gcvt(nr, MY_GCVT_ARG_DOUBLE, local_char_length, buff, &error);
|
||||
if (error)
|
||||
{
|
||||
for (exp= 0; anr < 1e-100; exp-= 100, anr*= 1e100) ;
|
||||
for (; anr < 1e-10; exp-= 10, anr*= 1e10) ;
|
||||
for (i= 1; anr < 1 / log_10[i]; exp--, i++) ;
|
||||
exp--;
|
||||
if (table->in_use->abort_on_warning)
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_DATA_TOO_LONG, 1);
|
||||
else
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (exp= 0; anr > 1e100; exp+= 100, anr/= 1e100) ;
|
||||
for (; anr > 1e10; exp+= 10, anr/= 1e10) ;
|
||||
for (i= 1; anr > log_10[i]; exp++, i++) ;
|
||||
}
|
||||
|
||||
max_length= local_char_length - neg;
|
||||
|
||||
/*
|
||||
Since in sprintf("%g") precision means the number of significant digits,
|
||||
calculate the maximum number of significant digits if the 'f'-format
|
||||
would be used (+1 for decimal point if the number has a fractional part).
|
||||
*/
|
||||
digits= max(1, (int) max_length - fractional);
|
||||
/*
|
||||
If the exponent is negative, decrease digits by the number of leading zeros
|
||||
after the decimal point that do not count as significant digits.
|
||||
*/
|
||||
if (exp < 0)
|
||||
digits= max(1, (int) digits + exp);
|
||||
/*
|
||||
'e'-format is used only if the exponent is less than -4 or greater than or
|
||||
equal to the precision. In this case we need to adjust the number of
|
||||
significant digits to take "e+NN" + decimal point into account (hence -5).
|
||||
We also have to reserve one additional character if abs(exp) >= 100.
|
||||
*/
|
||||
if (exp >= (int) digits || exp < -4)
|
||||
digits= max(1, (int) (max_length - 5 - (exp >= 100 || exp <= -100)));
|
||||
|
||||
/* Limit precision to DBL_DIG to avoid garbage past significant digits */
|
||||
set_if_smaller(digits, DBL_DIG);
|
||||
|
||||
length= (uint) my_sprintf(buff, (buff, "%-.*g", digits, nr));
|
||||
|
||||
#ifdef __WIN__
|
||||
/*
|
||||
Windows always zero-pads the exponent to 3 digits, we want to remove the
|
||||
leading 0 to match the sprintf() output on other platforms.
|
||||
*/
|
||||
if ((exp >= (int) digits || exp < -4) && exp > -100 && exp < 100)
|
||||
{
|
||||
DBUG_ASSERT(length >= 6); /* 1e+NNN */
|
||||
uint tmp= length - 3;
|
||||
buff[tmp]= buff[tmp + 1];
|
||||
tmp++;
|
||||
buff[tmp]= buff[tmp + 1];
|
||||
length--;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
+1 below is because "precision" in %g above means the
|
||||
max. number of significant digits, not the output width.
|
||||
Thus the width can be larger than number of significant digits by 1
|
||||
(for decimal point)
|
||||
the test for local_char_length < 5 is for extreme cases,
|
||||
like inserting 500.0 in char(1)
|
||||
*/
|
||||
DBUG_ASSERT(local_char_length < 5 || length <= local_char_length+1);
|
||||
return store(buff, length, charset());
|
||||
}
|
||||
|
||||
@ -7601,7 +7418,7 @@ oom_error:
|
||||
int Field_blob::store(double nr)
|
||||
{
|
||||
CHARSET_INFO *cs=charset();
|
||||
value.set_real(nr, 2, cs);
|
||||
value.set_real(nr, NOT_FIXED_DEC, cs);
|
||||
return Field_blob::store(value.ptr(),(uint) value.length(), cs);
|
||||
}
|
||||
|
||||
|
13
sql/item.cc
13
sql/item.cc
@ -5259,9 +5259,7 @@ int Item_null::save_safe_in_field(Field *field)
|
||||
int Item::save_in_field(Field *field, bool no_conversions)
|
||||
{
|
||||
int error;
|
||||
if (result_type() == STRING_RESULT ||
|
||||
(result_type() == REAL_RESULT &&
|
||||
field->result_type() == STRING_RESULT))
|
||||
if (result_type() == STRING_RESULT)
|
||||
{
|
||||
String *result;
|
||||
CHARSET_INFO *cs= collation.collation;
|
||||
@ -5280,6 +5278,15 @@ int Item::save_in_field(Field *field, bool no_conversions)
|
||||
error=field->store(result->ptr(),result->length(),cs);
|
||||
str_value.set_quick(0, 0, cs);
|
||||
}
|
||||
else if (result_type() == REAL_RESULT &&
|
||||
field->result_type() == STRING_RESULT)
|
||||
{
|
||||
double nr= val_real();
|
||||
if (null_value)
|
||||
return set_field_to_null_with_conversions(field, no_conversions);
|
||||
field->set_notnull();
|
||||
error= field->store(nr);
|
||||
}
|
||||
else if (result_type() == REAL_RESULT)
|
||||
{
|
||||
double nr= val_real();
|
||||
|
@ -5355,11 +5355,11 @@ void User_var_log_event::pack_info(Protocol* protocol)
|
||||
case REAL_RESULT:
|
||||
double real_val;
|
||||
float8get(real_val, val);
|
||||
if (!(buf= (char*) my_malloc(val_offset + FLOATING_POINT_BUFFER,
|
||||
if (!(buf= (char*) my_malloc(val_offset + MY_GCVT_MAX_FIELD_WIDTH + 1,
|
||||
MYF(MY_WME))))
|
||||
return;
|
||||
event_len+= my_sprintf(buf + val_offset,
|
||||
(buf + val_offset, "%.14g", real_val));
|
||||
event_len+= my_gcvt(real_val, MY_GCVT_ARG_DOUBLE, MY_GCVT_MAX_FIELD_WIDTH,
|
||||
buf + val_offset, NULL);
|
||||
break;
|
||||
case INT_RESULT:
|
||||
if (!(buf= (char*) my_malloc(val_offset + 22, MYF(MY_WME))))
|
||||
|
@ -1939,6 +1939,7 @@ extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN];
|
||||
extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file;
|
||||
extern char default_logfile_name[FN_REFLEN];
|
||||
extern char log_error_file[FN_REFLEN], *opt_tc_log_file;
|
||||
extern const double log_10[309];
|
||||
extern ulonglong log_10_int[20];
|
||||
extern ulonglong keybuff_size;
|
||||
extern ulonglong thd_startup_options;
|
||||
|
@ -212,7 +212,36 @@ inline void setup_fpu()
|
||||
/* Set FPU rounding mode to "round-to-nearest" */
|
||||
fesetround(FE_TONEAREST);
|
||||
#endif /* HAVE_FESETROUND */
|
||||
|
||||
|
||||
/*
|
||||
x86 (32-bit) requires FPU precision to be explicitly set to 64 bit for
|
||||
portable results of floating point operations
|
||||
*/
|
||||
#if defined(__i386__)
|
||||
#if defined(_WIN32)
|
||||
#if !defined(_WIN64)
|
||||
_control87(_PC_53, MCW_PC);
|
||||
#endif /* !_WIN64 */
|
||||
#else /* !_WIN32 */
|
||||
#if !defined(HAVE_FPU_CONTROL_H)
|
||||
#define fpu_control_t unsigned int
|
||||
#define _FPU_EXTENDED 0x300
|
||||
#define _FPU_DOUBLE 0x200
|
||||
#if defined(__GNUC__)
|
||||
#define _FPU_GETCW(cw) __asm__ __volatile__("fnstcw %0" : "=m" (*&cw))
|
||||
#define _FPU_SETCW(cw) __asm__ __volatile__("fldcw %0" : : "m" (*&cw))
|
||||
#else /* !__GNUC__ */
|
||||
#define _FPU_GETCW(cw) (cw= 0)
|
||||
#define _FPU_SETCW(cw)
|
||||
#endif /* __GNUC__ */
|
||||
#endif /* !HAVE_FPU_CONTROL_H */
|
||||
fpu_control_t cw;
|
||||
_FPU_GETCW(cw);
|
||||
cw= (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE;
|
||||
_FPU_SETCW(cw);
|
||||
#endif /* _WIN32 && */
|
||||
#endif /* __i386__ */
|
||||
|
||||
#if defined(__sgi) && defined(HAVE_SYS_FPU_H)
|
||||
/* Enable denormalized DOUBLE values support for IRIX */
|
||||
union fpc_csr n;
|
||||
@ -575,6 +604,40 @@ ulong expire_logs_days = 0;
|
||||
ulong rpl_recovery_rank=0;
|
||||
const char *log_output_str= "FILE";
|
||||
|
||||
const double log_10[] = {
|
||||
1e000, 1e001, 1e002, 1e003, 1e004, 1e005, 1e006, 1e007, 1e008, 1e009,
|
||||
1e010, 1e011, 1e012, 1e013, 1e014, 1e015, 1e016, 1e017, 1e018, 1e019,
|
||||
1e020, 1e021, 1e022, 1e023, 1e024, 1e025, 1e026, 1e027, 1e028, 1e029,
|
||||
1e030, 1e031, 1e032, 1e033, 1e034, 1e035, 1e036, 1e037, 1e038, 1e039,
|
||||
1e040, 1e041, 1e042, 1e043, 1e044, 1e045, 1e046, 1e047, 1e048, 1e049,
|
||||
1e050, 1e051, 1e052, 1e053, 1e054, 1e055, 1e056, 1e057, 1e058, 1e059,
|
||||
1e060, 1e061, 1e062, 1e063, 1e064, 1e065, 1e066, 1e067, 1e068, 1e069,
|
||||
1e070, 1e071, 1e072, 1e073, 1e074, 1e075, 1e076, 1e077, 1e078, 1e079,
|
||||
1e080, 1e081, 1e082, 1e083, 1e084, 1e085, 1e086, 1e087, 1e088, 1e089,
|
||||
1e090, 1e091, 1e092, 1e093, 1e094, 1e095, 1e096, 1e097, 1e098, 1e099,
|
||||
1e100, 1e101, 1e102, 1e103, 1e104, 1e105, 1e106, 1e107, 1e108, 1e109,
|
||||
1e110, 1e111, 1e112, 1e113, 1e114, 1e115, 1e116, 1e117, 1e118, 1e119,
|
||||
1e120, 1e121, 1e122, 1e123, 1e124, 1e125, 1e126, 1e127, 1e128, 1e129,
|
||||
1e130, 1e131, 1e132, 1e133, 1e134, 1e135, 1e136, 1e137, 1e138, 1e139,
|
||||
1e140, 1e141, 1e142, 1e143, 1e144, 1e145, 1e146, 1e147, 1e148, 1e149,
|
||||
1e150, 1e151, 1e152, 1e153, 1e154, 1e155, 1e156, 1e157, 1e158, 1e159,
|
||||
1e160, 1e161, 1e162, 1e163, 1e164, 1e165, 1e166, 1e167, 1e168, 1e169,
|
||||
1e170, 1e171, 1e172, 1e173, 1e174, 1e175, 1e176, 1e177, 1e178, 1e179,
|
||||
1e180, 1e181, 1e182, 1e183, 1e184, 1e185, 1e186, 1e187, 1e188, 1e189,
|
||||
1e190, 1e191, 1e192, 1e193, 1e194, 1e195, 1e196, 1e197, 1e198, 1e199,
|
||||
1e200, 1e201, 1e202, 1e203, 1e204, 1e205, 1e206, 1e207, 1e208, 1e209,
|
||||
1e210, 1e211, 1e212, 1e213, 1e214, 1e215, 1e216, 1e217, 1e218, 1e219,
|
||||
1e220, 1e221, 1e222, 1e223, 1e224, 1e225, 1e226, 1e227, 1e228, 1e229,
|
||||
1e230, 1e231, 1e232, 1e233, 1e234, 1e235, 1e236, 1e237, 1e238, 1e239,
|
||||
1e240, 1e241, 1e242, 1e243, 1e244, 1e245, 1e246, 1e247, 1e248, 1e249,
|
||||
1e250, 1e251, 1e252, 1e253, 1e254, 1e255, 1e256, 1e257, 1e258, 1e259,
|
||||
1e260, 1e261, 1e262, 1e263, 1e264, 1e265, 1e266, 1e267, 1e268, 1e269,
|
||||
1e270, 1e271, 1e272, 1e273, 1e274, 1e275, 1e276, 1e277, 1e278, 1e279,
|
||||
1e280, 1e281, 1e282, 1e283, 1e284, 1e285, 1e286, 1e287, 1e288, 1e289,
|
||||
1e290, 1e291, 1e292, 1e293, 1e294, 1e295, 1e296, 1e297, 1e298, 1e299,
|
||||
1e300, 1e301, 1e302, 1e303, 1e304, 1e305, 1e306, 1e307, 1e308
|
||||
};
|
||||
|
||||
time_t server_start_time, flush_status_time;
|
||||
|
||||
char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], system_time_zone[30];
|
||||
|
@ -17,28 +17,7 @@
|
||||
|
||||
#ifdef HAVE_SPATIAL
|
||||
|
||||
/*
|
||||
exponential notation :
|
||||
1 sign
|
||||
1 number before the decimal point
|
||||
1 decimal point
|
||||
14 number of significant digits (see String::qs_append(double))
|
||||
1 'e' sign
|
||||
1 exponent sign
|
||||
3 exponent digits
|
||||
==
|
||||
22
|
||||
|
||||
"f" notation :
|
||||
1 optional 0
|
||||
1 sign
|
||||
14 number significant digits (see String::qs_append(double) )
|
||||
1 decimal point
|
||||
==
|
||||
17
|
||||
*/
|
||||
|
||||
#define MAX_DIGITS_IN_DOUBLE 22
|
||||
#define MAX_DIGITS_IN_DOUBLE MY_GCVT_MAX_FIELD_WIDTH
|
||||
|
||||
/***************************** Gis_class_info *******************************/
|
||||
|
||||
|
@ -2166,7 +2166,8 @@ static bool show_status_array(THD *thd, const char *wild,
|
||||
value= ((char *) status_var + (ulong) value);
|
||||
/* fall through */
|
||||
case SHOW_DOUBLE:
|
||||
end= buff + my_sprintf(buff, (buff, "%f", *(double*) value));
|
||||
/* 6 is the default precision for '%f' in sprintf() */
|
||||
end= buff + my_fcvt(*(double *) value, 6, buff, NULL);
|
||||
break;
|
||||
case SHOW_LONG_STATUS:
|
||||
value= ((char *) status_var + (ulong) value);
|
||||
|
@ -24,10 +24,6 @@
|
||||
#include <m_string.h>
|
||||
#include <m_ctype.h>
|
||||
#include <mysql_com.h>
|
||||
#ifdef HAVE_FCONVERT
|
||||
#include <floatingpoint.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
The following extern declarations are ok as these are interface functions
|
||||
required by the string function
|
||||
@ -107,82 +103,19 @@ bool String::set_int(longlong num, bool unsigned_flag, CHARSET_INFO *cs)
|
||||
|
||||
bool String::set_real(double num,uint decimals, CHARSET_INFO *cs)
|
||||
{
|
||||
char buff[331];
|
||||
char buff[FLOATING_POINT_BUFFER];
|
||||
uint dummy_errors;
|
||||
size_t len;
|
||||
|
||||
str_charset=cs;
|
||||
if (decimals >= NOT_FIXED_DEC)
|
||||
{
|
||||
uint32 len= my_sprintf(buff,(buff, "%.15g",num));// Enough for a DATETIME
|
||||
len= my_gcvt(num, MY_GCVT_ARG_DOUBLE, sizeof(buff) - 1, buff, NULL);
|
||||
return copy(buff, len, &my_charset_latin1, cs, &dummy_errors);
|
||||
}
|
||||
#ifdef HAVE_FCONVERT
|
||||
int decpt,sign;
|
||||
char *pos,*to;
|
||||
|
||||
(void) fconvert(num,(int) decimals,&decpt,&sign,buff+1);
|
||||
if (!my_isdigit(&my_charset_latin1, buff[1]))
|
||||
{ // Nan or Inf
|
||||
pos=buff+1;
|
||||
if (sign)
|
||||
{
|
||||
buff[0]='-';
|
||||
pos=buff;
|
||||
}
|
||||
uint dummy_errors;
|
||||
return copy(pos,(uint32) strlen(pos), &my_charset_latin1, cs, &dummy_errors);
|
||||
}
|
||||
if (alloc((uint32) ((uint32) decpt+3+decimals)))
|
||||
return TRUE;
|
||||
to=Ptr;
|
||||
if (sign)
|
||||
*to++='-';
|
||||
|
||||
pos=buff+1;
|
||||
if (decpt < 0)
|
||||
{ /* value is < 0 */
|
||||
*to++='0';
|
||||
if (!decimals)
|
||||
goto end;
|
||||
*to++='.';
|
||||
if ((uint32) -decpt > decimals)
|
||||
decpt= - (int) decimals;
|
||||
decimals=(uint32) ((int) decimals+decpt);
|
||||
while (decpt++ < 0)
|
||||
*to++='0';
|
||||
}
|
||||
else if (decpt == 0)
|
||||
{
|
||||
*to++= '0';
|
||||
if (!decimals)
|
||||
goto end;
|
||||
*to++='.';
|
||||
}
|
||||
else
|
||||
{
|
||||
while (decpt-- > 0)
|
||||
*to++= *pos++;
|
||||
if (!decimals)
|
||||
goto end;
|
||||
*to++='.';
|
||||
}
|
||||
while (decimals--)
|
||||
*to++= *pos++;
|
||||
|
||||
end:
|
||||
*to=0;
|
||||
str_length=(uint32) (to-Ptr);
|
||||
return FALSE;
|
||||
#else
|
||||
#ifdef HAVE_SNPRINTF
|
||||
buff[sizeof(buff)-1]=0; // Safety
|
||||
snprintf(buff,sizeof(buff)-1, "%.*f",(int) decimals,num);
|
||||
#else
|
||||
sprintf(buff,"%.*f",(int) decimals,num);
|
||||
#endif
|
||||
return copy(buff,(uint32) strlen(buff), &my_charset_latin1, cs,
|
||||
len= my_fcvt(num, decimals, buff, NULL);
|
||||
return copy(buff, (uint32) len, &my_charset_latin1, cs,
|
||||
&dummy_errors);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -661,7 +594,8 @@ void String::qs_append(const char *str, uint32 len)
|
||||
void String::qs_append(double d)
|
||||
{
|
||||
char *buff = Ptr + str_length;
|
||||
str_length+= my_sprintf(buff, (buff, "%.15g", d));
|
||||
str_length+= my_gcvt(d, MY_GCVT_ARG_DOUBLE, FLOATING_POINT_BUFFER - 1, buff,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void String::qs_append(double *d)
|
||||
|
@ -213,7 +213,6 @@
|
||||
*/
|
||||
|
||||
#define BIN_LOG_HEADER_SIZE 4
|
||||
#define FLOATING_POINT_BUFFER 331
|
||||
|
||||
#define DEFAULT_KEY_CACHE_NAME "default"
|
||||
|
||||
|
@ -18,10 +18,10 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
|
||||
SET(STRINGS_SOURCES bchange.c bcmp.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c
|
||||
ctype-czech.c ctype-euc_kr.c ctype-eucjpms.c ctype-extra.c ctype-gb2312.c ctype-gbk.c
|
||||
ctype-latin1.c ctype-mb.c ctype-simple.c ctype-sjis.c ctype-tis620.c ctype-uca.c
|
||||
ctype-ucs2.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype.c decimal.c int2str.c
|
||||
ctype-ucs2.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype.c decimal.c dtoa.c int2str.c
|
||||
is_prefix.c llstr.c longlong2str.c my_strtoll10.c my_vsnprintf.c r_strinstr.c
|
||||
str2int.c str_alloc.c strcend.c strend.c strfill.c strmake.c strmov.c strnmov.c
|
||||
strtod.c strtol.c strtoll.c strtoul.c strtoull.c strxmov.c strxnmov.c xml.c
|
||||
strtol.c strtoll.c strtoul.c strtoull.c strxmov.c strxnmov.c xml.c
|
||||
my_strchr.c strcont.c strinstr.c strnlen.c)
|
||||
|
||||
IF(NOT SOURCE_SUBLIBS)
|
||||
|
@ -30,19 +30,19 @@ pkglib_LIBRARIES = libmystrings.a
|
||||
# Exact one of ASSEMBLER_X
|
||||
if ASSEMBLER_x86
|
||||
ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s
|
||||
CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c my_strchr.c
|
||||
CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c my_strchr.c dtoa.c
|
||||
else
|
||||
if ASSEMBLER_sparc32
|
||||
# These file MUST all be on the same line!! Otherwise automake
|
||||
# generats a very broken makefile
|
||||
ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s
|
||||
CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c
|
||||
CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c dtoa.c
|
||||
else
|
||||
#no assembler
|
||||
ASRCS =
|
||||
# These file MUST all be on the same line!! Otherwise automake
|
||||
# generats a very broken makefile
|
||||
CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c
|
||||
CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c dtoa.c
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -137,12 +137,6 @@ static const dec1 frac_max[DIG_PER_DEC1-1]={
|
||||
900000000, 990000000, 999000000,
|
||||
999900000, 999990000, 999999000,
|
||||
999999900, 999999990 };
|
||||
static double scaler10[]= {
|
||||
1.0, 1e10, 1e20, 1e30, 1e40, 1e50, 1e60, 1e70, 1e80, 1e90
|
||||
};
|
||||
static double scaler1[]= {
|
||||
1.0, 10.0, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9
|
||||
};
|
||||
|
||||
#ifdef HAVE_purify
|
||||
#define sanity(d) DBUG_ASSERT((d)->len > 0)
|
||||
@ -947,33 +941,25 @@ fatal_error:
|
||||
to - result will be stored there
|
||||
|
||||
RETURN VALUE
|
||||
E_DEC_OK
|
||||
E_DEC_OK/E_DEC_OVERFLOW/E_DEC_TRUNCATED
|
||||
*/
|
||||
|
||||
int decimal2double(decimal_t *from, double *to)
|
||||
{
|
||||
double result= 0.0;
|
||||
int i, exp= 0;
|
||||
dec1 *buf= from->buf;
|
||||
char strbuf[FLOATING_POINT_BUFFER], *end;
|
||||
int len= sizeof(strbuf);
|
||||
int rc, error;
|
||||
|
||||
for (i= from->intg; i > 0; i-= DIG_PER_DEC1)
|
||||
result= result * DIG_BASE + *buf++;
|
||||
|
||||
for (i= from->frac; i > 0; i-= DIG_PER_DEC1) {
|
||||
result= result * DIG_BASE + *buf++;
|
||||
exp+= DIG_PER_DEC1;
|
||||
}
|
||||
|
||||
DBUG_PRINT("info", ("interm.: %f %d %f", result, exp,
|
||||
scaler10[exp / 10] * scaler1[exp % 10]));
|
||||
|
||||
result/= scaler10[exp / 10] * scaler1[exp % 10];
|
||||
|
||||
*to= from->sign ? -result : result;
|
||||
rc = decimal2string(from, strbuf, &len, 0, 0, 0);
|
||||
end= strbuf + len;
|
||||
|
||||
DBUG_PRINT("info", ("interm.: %s", strbuf));
|
||||
|
||||
*to= my_strtod(strbuf, &end, &error);
|
||||
|
||||
DBUG_PRINT("info", ("result: %f (%lx)", *to, *(ulong *)to));
|
||||
|
||||
return E_DEC_OK;
|
||||
return (rc != E_DEC_OK) ? rc : (error ? E_DEC_OVERFLOW : E_DEC_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -990,13 +976,10 @@ int decimal2double(decimal_t *from, double *to)
|
||||
|
||||
int double2decimal(double from, decimal_t *to)
|
||||
{
|
||||
/* TODO: fix it, when we'll have dtoa */
|
||||
char buff[400], *end;
|
||||
int length, res;
|
||||
char buff[FLOATING_POINT_BUFFER], *end;
|
||||
int res;
|
||||
DBUG_ENTER("double2decimal");
|
||||
length= my_sprintf(buff, (buff, "%.16G", from));
|
||||
DBUG_PRINT("info",("from: %g from_as_str: %s", from, buff));
|
||||
end= buff+length;
|
||||
end= buff + my_gcvt(from, MY_GCVT_ARG_DOUBLE, sizeof(buff) - 1, buff, NULL);
|
||||
res= string2decimal(buff, to, &end);
|
||||
DBUG_PRINT("exit", ("res: %d", res));
|
||||
DBUG_RETURN(res);
|
||||
|
2780
strings/dtoa.c
Normal file
2780
strings/dtoa.c
Normal file
File diff suppressed because it is too large
Load Diff
236
strings/strtod.c
236
strings/strtod.c
@ -1,236 +0,0 @@
|
||||
/*
|
||||
An alternative implementation of "strtod()" that is both
|
||||
simplier, and thread-safe.
|
||||
|
||||
Original code from mit-threads as bundled with MySQL 3.23
|
||||
|
||||
SQL:2003 specifies a number as
|
||||
|
||||
<signed numeric literal> ::= [ <sign> ] <unsigned numeric literal>
|
||||
|
||||
<unsigned numeric literal> ::=
|
||||
<exact numeric literal>
|
||||
| <approximate numeric literal>
|
||||
|
||||
<exact numeric literal> ::=
|
||||
<unsigned integer> [ <period> [ <unsigned integer> ] ]
|
||||
| <period> <unsigned integer>
|
||||
|
||||
<approximate numeric literal> ::= <mantissa> E <exponent>
|
||||
|
||||
<mantissa> ::= <exact numeric literal>
|
||||
|
||||
<exponent> ::= <signed integer>
|
||||
|
||||
So do we.
|
||||
|
||||
*/
|
||||
|
||||
#include "my_base.h" /* Includes errno.h + EOVERFLOW */
|
||||
#include "m_ctype.h"
|
||||
#ifdef HAVE_IEEEFP_H
|
||||
#include <ieeefp.h>
|
||||
#endif
|
||||
|
||||
#define MAX_DBL_EXP 308
|
||||
#define MAX_RESULT_FOR_MAX_EXP 1.7976931348623157
|
||||
|
||||
const double log_10[] = {
|
||||
1e000, 1e001, 1e002, 1e003, 1e004, 1e005, 1e006, 1e007, 1e008, 1e009,
|
||||
1e010, 1e011, 1e012, 1e013, 1e014, 1e015, 1e016, 1e017, 1e018, 1e019,
|
||||
1e020, 1e021, 1e022, 1e023, 1e024, 1e025, 1e026, 1e027, 1e028, 1e029,
|
||||
1e030, 1e031, 1e032, 1e033, 1e034, 1e035, 1e036, 1e037, 1e038, 1e039,
|
||||
1e040, 1e041, 1e042, 1e043, 1e044, 1e045, 1e046, 1e047, 1e048, 1e049,
|
||||
1e050, 1e051, 1e052, 1e053, 1e054, 1e055, 1e056, 1e057, 1e058, 1e059,
|
||||
1e060, 1e061, 1e062, 1e063, 1e064, 1e065, 1e066, 1e067, 1e068, 1e069,
|
||||
1e070, 1e071, 1e072, 1e073, 1e074, 1e075, 1e076, 1e077, 1e078, 1e079,
|
||||
1e080, 1e081, 1e082, 1e083, 1e084, 1e085, 1e086, 1e087, 1e088, 1e089,
|
||||
1e090, 1e091, 1e092, 1e093, 1e094, 1e095, 1e096, 1e097, 1e098, 1e099,
|
||||
1e100, 1e101, 1e102, 1e103, 1e104, 1e105, 1e106, 1e107, 1e108, 1e109,
|
||||
1e110, 1e111, 1e112, 1e113, 1e114, 1e115, 1e116, 1e117, 1e118, 1e119,
|
||||
1e120, 1e121, 1e122, 1e123, 1e124, 1e125, 1e126, 1e127, 1e128, 1e129,
|
||||
1e130, 1e131, 1e132, 1e133, 1e134, 1e135, 1e136, 1e137, 1e138, 1e139,
|
||||
1e140, 1e141, 1e142, 1e143, 1e144, 1e145, 1e146, 1e147, 1e148, 1e149,
|
||||
1e150, 1e151, 1e152, 1e153, 1e154, 1e155, 1e156, 1e157, 1e158, 1e159,
|
||||
1e160, 1e161, 1e162, 1e163, 1e164, 1e165, 1e166, 1e167, 1e168, 1e169,
|
||||
1e170, 1e171, 1e172, 1e173, 1e174, 1e175, 1e176, 1e177, 1e178, 1e179,
|
||||
1e180, 1e181, 1e182, 1e183, 1e184, 1e185, 1e186, 1e187, 1e188, 1e189,
|
||||
1e190, 1e191, 1e192, 1e193, 1e194, 1e195, 1e196, 1e197, 1e198, 1e199,
|
||||
1e200, 1e201, 1e202, 1e203, 1e204, 1e205, 1e206, 1e207, 1e208, 1e209,
|
||||
1e210, 1e211, 1e212, 1e213, 1e214, 1e215, 1e216, 1e217, 1e218, 1e219,
|
||||
1e220, 1e221, 1e222, 1e223, 1e224, 1e225, 1e226, 1e227, 1e228, 1e229,
|
||||
1e230, 1e231, 1e232, 1e233, 1e234, 1e235, 1e236, 1e237, 1e238, 1e239,
|
||||
1e240, 1e241, 1e242, 1e243, 1e244, 1e245, 1e246, 1e247, 1e248, 1e249,
|
||||
1e250, 1e251, 1e252, 1e253, 1e254, 1e255, 1e256, 1e257, 1e258, 1e259,
|
||||
1e260, 1e261, 1e262, 1e263, 1e264, 1e265, 1e266, 1e267, 1e268, 1e269,
|
||||
1e270, 1e271, 1e272, 1e273, 1e274, 1e275, 1e276, 1e277, 1e278, 1e279,
|
||||
1e280, 1e281, 1e282, 1e283, 1e284, 1e285, 1e286, 1e287, 1e288, 1e289,
|
||||
1e290, 1e291, 1e292, 1e293, 1e294, 1e295, 1e296, 1e297, 1e298, 1e299,
|
||||
1e300, 1e301, 1e302, 1e303, 1e304, 1e305, 1e306, 1e307, 1e308
|
||||
};
|
||||
|
||||
/*
|
||||
Convert string to double (string doesn't have to be null terminated)
|
||||
|
||||
SYNOPSIS
|
||||
my_strtod()
|
||||
str String to convert
|
||||
end_ptr Pointer to pointer that points to end of string
|
||||
Will be updated to point to end of double.
|
||||
error Will contain error number in case of error (else 0)
|
||||
|
||||
RETURN
|
||||
value of str as double
|
||||
*/
|
||||
|
||||
double my_strtod(const char *str, char **end_ptr, int *error)
|
||||
{
|
||||
double result= 0.0;
|
||||
uint negative= 0, neg_exp= 0;
|
||||
size_t ndigits, dec_digits= 0;
|
||||
int exponent= 0, digits_after_dec_point= 0, tmp_exp, step;
|
||||
const char *old_str, *end= *end_ptr, *start_of_number;
|
||||
char next_char;
|
||||
my_bool overflow=0;
|
||||
double scaler= 1.0;
|
||||
|
||||
*error= 0;
|
||||
if (str >= end)
|
||||
goto done;
|
||||
|
||||
while (my_isspace(&my_charset_latin1, *str))
|
||||
{
|
||||
if (++str == end)
|
||||
goto done;
|
||||
}
|
||||
|
||||
start_of_number= str;
|
||||
if ((negative= (*str == '-')) || *str=='+')
|
||||
{
|
||||
if (++str == end)
|
||||
goto done; /* Could be changed to error */
|
||||
}
|
||||
|
||||
/* Skip pre-zero for easier calculation of overflows */
|
||||
while (*str == '0')
|
||||
{
|
||||
if (++str == end)
|
||||
goto done;
|
||||
start_of_number= 0; /* Found digit */
|
||||
}
|
||||
|
||||
old_str= str;
|
||||
while ((next_char= *str) >= '0' && next_char <= '9')
|
||||
{
|
||||
result= result*10.0 + (next_char - '0');
|
||||
scaler= scaler*10.0;
|
||||
if (++str == end)
|
||||
{
|
||||
next_char= 0; /* Found end of string */
|
||||
break;
|
||||
}
|
||||
start_of_number= 0; /* Found digit */
|
||||
}
|
||||
ndigits= (size_t) (str-old_str);
|
||||
|
||||
if (next_char == '.' && str < end-1)
|
||||
{
|
||||
/*
|
||||
Continue to add numbers after decimal point to the result, as if there
|
||||
was no decimal point. We will later (in the exponent handling) shift
|
||||
the number down with the required number of fractions. We do it this
|
||||
way to be able to get maximum precision for numbers like 123.45E+02,
|
||||
which are normal for some ODBC applications.
|
||||
*/
|
||||
old_str= ++str;
|
||||
while (my_isdigit(&my_charset_latin1, (next_char= *str)))
|
||||
{
|
||||
result= result*10.0 + (next_char - '0');
|
||||
digits_after_dec_point++;
|
||||
scaler= scaler*10.0;
|
||||
if (++str == end)
|
||||
{
|
||||
next_char= 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* If we found just '+.' or '.' then point at first character */
|
||||
if (!(dec_digits= (size_t) (str-old_str)) && start_of_number)
|
||||
str= start_of_number; /* Point at '+' or '.' */
|
||||
}
|
||||
if ((next_char == 'e' || next_char == 'E') &&
|
||||
dec_digits + ndigits != 0 && str < end-1)
|
||||
{
|
||||
const char *old_str2= str++;
|
||||
|
||||
if ((neg_exp= (*str == '-')) || *str == '+')
|
||||
str++;
|
||||
|
||||
if (str == end || !my_isdigit(&my_charset_latin1, *str))
|
||||
str= old_str2;
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
if (exponent < 9999) /* prot. against exp overfl. */
|
||||
exponent= exponent*10 + (*str - '0');
|
||||
str++;
|
||||
} while (str < end && my_isdigit(&my_charset_latin1, *str));
|
||||
}
|
||||
}
|
||||
tmp_exp= (neg_exp ? exponent + digits_after_dec_point :
|
||||
exponent - digits_after_dec_point);
|
||||
if (tmp_exp)
|
||||
{
|
||||
int order;
|
||||
/*
|
||||
Check for underflow/overflow.
|
||||
order is such an integer number that f = C * 10 ^ order,
|
||||
where f is the resulting floating point number and 1 <= C < 10.
|
||||
Here we compute the modulus
|
||||
*/
|
||||
order= exponent + (neg_exp ? -1 : 1) * (ndigits - 1);
|
||||
if (order < 0)
|
||||
order= -order;
|
||||
if (order >= MAX_DBL_EXP && !neg_exp && result)
|
||||
{
|
||||
double c;
|
||||
/* Compute modulus of C (see comment above) */
|
||||
c= result / scaler * 10.0;
|
||||
if (order > MAX_DBL_EXP || c > MAX_RESULT_FOR_MAX_EXP)
|
||||
{
|
||||
overflow= 1;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
exponent= tmp_exp;
|
||||
if (exponent < 0)
|
||||
{
|
||||
exponent= -exponent;
|
||||
neg_exp= 1; /* neg_exp was 0 before */
|
||||
}
|
||||
step= array_elements(log_10) - 1;
|
||||
for (; exponent > step; exponent-= step)
|
||||
result= neg_exp ? result / log_10[step] : result * log_10[step];
|
||||
result= neg_exp ? result / log_10[exponent] : result * log_10[exponent];
|
||||
}
|
||||
|
||||
done:
|
||||
*end_ptr= (char*) str; /* end of number */
|
||||
|
||||
if (overflow || my_isinf(result))
|
||||
{
|
||||
result= DBL_MAX;
|
||||
*error= EOVERFLOW;
|
||||
}
|
||||
|
||||
return negative ? -result : result;
|
||||
}
|
||||
|
||||
double my_atof(const char *nptr)
|
||||
{
|
||||
int error;
|
||||
const char *end= nptr+65535; /* Should be enough */
|
||||
return (my_strtod(nptr, (char**) &end, &error));
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user