MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / decimal2double

Function decimal2double

strings/decimal.c:955–971  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

953*/
954
955int decimal2double(const decimal_t *from, double *to)
956{
957 char strbuf[FLOATING_POINT_BUFFER], *end;
958 int len= sizeof(strbuf);
959 int rc, error;
960
961 rc = decimal2string(from, strbuf, &len, 0, 0, 0);
962 end= strbuf + len;
963
964 DBUG_PRINT("info", ("interm.: %s", strbuf));
965
966 *to= my_strtod(strbuf, &end, &error);
967
968 DBUG_PRINT("info", ("result: %f", *to));
969
970 return (rc != E_DEC_OK) ? rc : (error ? E_DEC_OVERFLOW : E_DEC_OK);
971}
972
973/*
974 Convert double to decimal

Callers 1

my_decimal2doubleFunction · 0.85

Calls 2

decimal2stringFunction · 0.85
my_strtodFunction · 0.85

Tested by

no test coverage detected