Re: simple division

David G. Johnston <david.g.johnston@gmail.com>

From: "David G. Johnston" <david.g.johnston@gmail.com>
To: "Joshua D. Drake" <jd@commandprompt.com>
Cc: Martin Mueller <martinmueller@northwestern.edu>, pgsql-general <pgsql-general@postgresql.org>
Date: 2018-12-04T20:45:02Z
Lists: pgsql-general
On Tue, Dec 4, 2018 at 1:38 PM Joshua D. Drake <jd@commandprompt.com> wrote:
> I may be misunderstanding the question but:
Indeed...
> select cast(x/y as numeric(10,4));

Your answer is 2.0 instead of the correct 2.5 - you need to cast
before the division, not after.

David J.