Monetary, Float Types

Started by Robert Clevelandover 27 years ago2 messagesgeneral
Jump to latest
#1Robert Cleveland
rob.cleveland@wardsauto.com

I am trying to add prices together using either the monetary type or float4 type. Monetary doesn't seem to add, and float4 renders results out to 7 decimal places. Also, float4 doesn't display prices with .00 cents. Which data type should I use to solve this problem?

#2D'Arcy J.M. Cain
darcy@druid.net
In reply to: Robert Cleveland (#1)
Re: [GENERAL] Monetary, Float Types

Thus spake Rob Cleveland

I am trying to add prices together using either the monetary type or =
float4 type. Monetary doesn't seem to add, and float4 renders results =

darcy=> select '12.34'::money + '43.21'::money;
?column?
--------
$55.55
(1 row)

Can you show an example that doesn't work?

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.