List:General Discussion« Previous MessageNext Message »
From:Jorge Martins Date:August 11 2006 3:50pm
Subject:Re: problem with decimal part
View as plain text  
mark addison wrote:
> On Fri, 2006-08-11 at 10:30 +0100, Jorge Martins wrote:
>   
>> Hi,
>>
>> I have a client that want's to store in a table the exact number that he 
>> get's from a file, i've used a DOUBLE data type (MySQL 3.2x), but I have 
>> the following problem:
>>
>> If the number is for example 9.0 mysql truncates and only stores 9
>>
>> I tried to use the (M,D) for example as (6,5) but the problem is that 
>> mysql stores the number as 9.00000 and I don't want that, I want the 
>> number to be the exact number I read from the file.
>>     
>
> Technically 9, 9.0 and 9.00000 are exacatly the same _number_.
>   
Not if you have to count the number os significant digits.
I just think it's strange that in a DOUBLE(6,5) the number 9.0 stores 
9.00000, I think that this should only happen if you choose ZEROFILL 
option. 5 should be the max number of digits of the decimal part not the 
mandatory number of digits...or maybe not, i'm not very good at math

>   
>> Is there any way to fix that? I thought of using a VARCHAR data type. 
>> What do you think?
>>     
>
> Would be the way to go as what your after is the origional string value.
> Why do you need exactly the same string?
> MySQL is pretty good at auto casting so you can still treat the field as
> a number in most cases and see
> http://dev.mysql.com/doc/refman/4.1/en/cast-functions.html for functions
> to use in the other cases.
>
> mark
>
>   
>> Thanks
>>
>> -- 
>> Com os melhores cumprimentos
>> Jorge Martins - Wemake, Tecnologias de Informação, Lda.
>> Tel. 223744827
>>
>>     
>  
>
>
>
>
>
> MARK ADDISON
> WEB DEVELOPER
>
> 200 GRAY'S INN ROAD
> LONDON
> WC1X 8XZ
> UNITED KINGDOM
> T +44 (0)20 7430 4678
> F 
> E MARK.ADDISON@stripped
> WWW.ITN.CO.UK
> Please Note:
>
>  
>
> Any views or opinions are solely those of the author and do not necessarily represent
> 
> those of Independent Television News Limited unless specifically stated. 
> This email and any files attached are confidential and intended solely for the use of
> the individual
> or entity to which they are addressed. 
> If you have received this email in error, please notify postmaster@stripped 
>
> Please note that to ensure regulatory compliance and for the protection of our
> clients and business,
> we may monitor and read messages sent to and from our systems.
>
> Thank You.
>
>
>
>   
Thread
problem with decimal partJorge Martins11 Aug
  • Re: problem with decimal partjoao11 Aug
  • Re: problem with decimal partmark addison11 Aug
    • Re: problem with decimal partJorge Martins11 Aug