numeric types

numeric types

am 14.04.2010 17:20:50 von Sebastien MORETTI

Hello,

I have a row which is defined as double unsigned (MySQL 5.0.26-Max,
OpenSuse).

Values in this row can go from a single digit, like 1, to values like
0.0006872207 or 1.2513e-18.



I want to store exact numbers.
But I would like also this:
1 stored as 1.00000
0.098 stored as 0.09800
0.00707 stored as 0.00707
0.0006872207 stored as 0.0006872207

How could I get this ?
MySQL stores at least double(6,5) but increases this automatically if
the precision required is longer.


Thanks

--
Sébastien Moretti


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: numeric types

am 14.04.2010 20:24:07 von Carsten Pedersen

Check out the DECIMAL type.

/ Carsten

Sebastien MORETTI skrev:
> Hello,
>
> I have a row which is defined as double unsigned (MySQL 5.0.26-Max,
> OpenSuse).
>
> Values in this row can go from a single digit, like 1, to values like
> 0.0006872207 or 1.2513e-18.
>
>
>
> I want to store exact numbers.
> But I would like also this:
> 1 stored as 1.00000
> 0.098 stored as 0.09800
> 0.00707 stored as 0.00707
> 0.0006872207 stored as 0.0006872207
>
> How could I get this ?
> MySQL stores at least double(6,5) but increases this automatically if
> the precision required is longer.
>
>
> Thanks
>
> --
> Sébastien Moretti
>
>

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: numeric types

am 16.04.2010 17:20:59 von Sebastien MORETTI

Hi

I have already tried DECIMAL type but I cannot get what I want.

Maybe the simple way to get data out of MySQL and data inside MySQL the
same, is to reproduce what MySQL does by default on my data out of MySQL.


> Check out the DECIMAL type.
>
> / Carsten
>
> Sebastien MORETTI skrev:
>> Hello,
>>
>> I have a row which is defined as double unsigned (MySQL 5.0.26-Max,
>> OpenSuse).
>>
>> Values in this row can go from a single digit, like 1, to values like
>> 0.0006872207 or 1.2513e-18.
>>
>>
>>
>> I want to store exact numbers.
>> But I would like also this:
>> 1 stored as 1.00000
>> 0.098 stored as 0.09800
>> 0.00707 stored as 0.00707
>> 0.0006872207 stored as 0.0006872207
>>
>> How could I get this ?
>> MySQL stores at least double(6,5) but increases this automatically if
>> the precision required is longer.
>>
>>
>> Thanks

--
Sébastien Moretti

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org