| 953 | */ |
| 954 | |
| 955 | int 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 |
no test coverage detected