[SOLVED] DOUBLE vs DECIMAL

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
irealms
Forum Contributor
Posts: 215
Joined: Mon Apr 28, 2003 7:10 am
Location: Leeds

[SOLVED] DOUBLE vs DECIMAL

Post by irealms »

whats the difference?

I mean i looked it up in the manual bit can't see what difference the 2 have in practical terms. I'm using DEICIMAL for a price field, is this the best type to use?
Last edited by irealms on Thu Nov 04, 2004 3:50 am, edited 1 time in total.
User avatar
AnarKy
Forum Contributor
Posts: 119
Joined: Tue Nov 02, 2004 1:49 am
Location: South Africa

Difference.

Post by AnarKy »

Hi,

Semantically they can be used interchangeably.

From my c/c++ experience all i can say is: Decimal is stored as strings and will take longer to process in calculations, however, Double’s are sometimes prone to rounding errors especially with extreme values.

If I were going to store currency, I would probably go for a Decimal type field. In most instances I would not bother about it. :)
User avatar
irealms
Forum Contributor
Posts: 215
Joined: Mon Apr 28, 2003 7:10 am
Location: Leeds

Post by irealms »

Ah thanks for clearing that up :)
Post Reply