Re: a very primitive question about division

Martin Mueller <martinmueller@northwestern.edu>

From: Martin Mueller <martinmueller@northwestern.edu>
To: "David G. Johnston" <david.g.johnston@gmail.com>
Cc: "pgsql-general@lists.postgresql.org" <pgsql-general@lists.postgresql.org>
Date: 2018-03-07T17:30:42Z
Lists: pgsql-general
Thanks.  So  round(before1550/colfreq::numeric, 2)  produces the desired result.

The explanations and examples of string functions in the Postgres documentation are a model of clarity. The explanations and examples of basic arithmetic operations  are not.  There is room for improvement there.

From: "David G. Johnston" <david.g.johnston@gmail.com>
Date: Wednesday, March 7, 2018 at 11:23 AM
To: Martin Mueller <martinmueller@northwestern.edu>
Cc: "pgsql-general@lists.postgresql.org" <pgsql-general@lists.postgresql.org>
Subject: Re: a very primitive question about division

On Wed, Mar 7, 2018 at 10:21 AM, Martin Mueller <martinmueller@northwestern.edu<mailto:martinmueller@northwestern.edu>> wrote:
Given two values defined as integers, how do I divide one by the other and get an answer with two decimals, e.g 3 /4 = 0.75.

​Case one of them to numeric.

​select 3/4::numeric
​
​David J.​