← Back to team overview

maria-developers team mailing list archive

Re: Formatting rules for double => varchar assignment


On 23 Jun 2016 1:41 am, "Sergei Golubchik" <serg@xxxxxxxxxxx> wrote:
> Hi, Jesse!
> It is based on the popular dtoa.c by David M. Gay.
> The original source code is here: http://www.netlib.org/fp/dtoa.c
> The math is explained here: http://ampl.com/REFS/rounding.pdf

Thanks Sergei,

>From what I can tell that library is focused on extracting the decimal
digits from a double. I actually managed to do that part (in a slightly
hackish way) using PHP's sprintf(), and the digits themselves do match.

Where I'm stuck is how MariaDB decides between scientific and regular
decimal notation. The number of significant digits, their position relative
to the decimal point, and the target column length all seem to play a part,
but I can't deduce exactly how.

> Regards,
> Sergei
> Chief Architect MariaDB
> and security@xxxxxxxxxxx

Follow ups