Re: a very primitive question about division

From: Martin Mueller <martinmueller(at)northwestern(dot)edu>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: a very primitive question about division
Date: 2018-03-07 17:56:55
Message-ID: FA35AEB5-7FCD-4002-8164-C3E421BFB7E2@northwestern.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In Table 9.5 the division of 9 by 4 is indeed described clearly. But there is no example of 4/9 and the different ways of formatting it as a decimal fraction with different options for rounding or a percentage. Two or three added examples would make life easier for folks who have not progressed much beyond 8th grade math.

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

On Wed, Mar 7, 2018 at 10:30 AM, Martin Mueller <martinmueller(at)northwestern(dot)edu<mailto:martinmueller(at)northwestern(dot)edu>> wrote:
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.

Possibly. Patches (or even just email suggestions - though the former are generally more apt to get applied) detailing specific improvements to make are welcome.

The description "division (integer division truncates the result)" seems reasonably clear - if you don't want the result truncated, and have two integers, you have to make one of the inputs a non-integer. Of the various options I tend to choose numeric though others are possible.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2018-03-07 18:11:45 Re: a very primitive question about division
Previous Message David G. Johnston 2018-03-07 17:43:20 Re: a very primitive question about division