List:General Discussion« Previous MessageNext Message »
From:Renato Golin Date:September 7 2006 11:00am
Subject:Re: Decimal versus Float Point Type
View as plain text  
Bruno Rodrigues Silva wrote:
> Dear all.
> 
> The MySQL Manual inform that Decimal Data Type is used
> for represent exact-number, but like Float Point Data
> Type, Decimal use rounding case the fractional part is
> not sufficient. Therefore, what the difference? 

Hi Bruno,

FLOAT rounds as floating point and DECIMAL rounds as you would expect it 
to. Floating point arithmetic is not exact and that's why they've called 
DECIMAL an "exact packed decimal number" because apparently you can rely 
on it's roundings.

The primary use for DECIMAL is money, where floating point would fail 
miserably and produce lots of errors (money leak) at the end of the month.

As floating point arithmetic has it's own separated section on your 
processor (unless you have a 386 or older computer) it would be *much* 
faster than DECIMAL, so use it only if you are absolutely sure you need it.

cheers,
--renato
Thread
Decimal versus Float Point TypeBruno Rodrigues Silva7 Sep
  • Re: Decimal versus Float Point TypeRenato Golin7 Sep
  • RE: Decimal versus Float Point TypeJerry Schwartz7 Sep
    • Re: Decimal versus Float Point TypeRenato Golin7 Sep
      • Re: Decimal versus Float Point TypeGerald L. Clark7 Sep
        • Re: Decimal versus Float Point TypeRenato Golin8 Sep
          • RE: Decimal versus Float Point TypeJerry Schwartz8 Sep
            • Re: Decimal versus Float Point TypeRenato Golin8 Sep