MCPcopy Create free account
hub / github.com/MariaDB/server / decimal2double

Function decimal2double

strings/decimal.c:1034–1050  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1032*/
1033
1034int decimal2double(const decimal_t *from, double *to)
1035{
1036 char strbuf[FLOATING_POINT_BUFFER], *end;
1037 int len= sizeof(strbuf);
1038 int rc, error;
1039
1040 rc = decimal2string(from, strbuf, &len, 0, 0, 0);
1041 end= strbuf + len;
1042
1043 DBUG_PRINT("info", ("interm.: %s", strbuf));
1044
1045 *to= my_strtod(strbuf, &end, &error);
1046
1047 DBUG_PRINT("info", ("result: %f", *to));
1048
1049 return (rc != E_DEC_OK) ? rc : (error ? E_DEC_OVERFLOW : E_DEC_OK);
1050}
1051
1052/*
1053 Convert double to decimal

Callers 5

test_d2fFunction · 0.85
val_realMethod · 0.85
to_doubleMethod · 0.85
my_decimal2doubleFunction · 0.85

Calls 2

decimal2stringFunction · 0.85
my_strtodFunction · 0.85

Tested by 1

test_d2fFunction · 0.68