| 1032 | */ |
| 1033 | |
| 1034 | int 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 |