← Back to team overview

maria-developers team mailing list archive

Re: Formatting rules for double => varchar assignment

 

Hi, Jesse!

On Jun 23, Jesse Schalken wrote:
> Hi MariaDB Developers,
> 
> I have an application which depends on the formatting MariaDB applies
> to a double when assigned to a char/varchar column of different
> lengths, and am trying to reproduce the behaviour in PHP. I have
> gotten some way but just can't seem to get the rules right.
> 
> I'm having trouble finding a specification for this in the docs or the
> code that is responsible for this in the MariaDB source. Can someone
> point me in the right direction?

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

Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx


Follow ups

References