RE: simple division

From: Igor Neyman <ineyman(at)perceptron(dot)com>
To: Martin Mueller <martinmueller(at)northwestern(dot)edu>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: RE: simple division
Date: 2018-12-04 20:38:15
Message-ID: DM5PR17MB1532E338DDA8BC419EFCD1D2DAAF0@DM5PR17MB1532.namprd17.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

From: Martin Mueller <martinmueller(at)northwestern(dot)edu>
Sent: Tuesday, December 4, 2018 3:30 PM
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: simple division

I have asked this question before and apologize for not remembering it. How do you do simple division in postgres and get 10/4 with decimals?

This involves cast and numeric in odd ways that are not well explained in the documentation. For instance, you’d expect an example in the Mathematical Functions. But there isn’t.

The documentation of string functions is exemplary. The documentation of mathematical less so. Remember that it may be used by folks like me whose math is shaky. The MySQL documentation is better on this simple operation.

-----
Martin Mueller
Professor emeritus of English and Classics
Northwestern University

There is nothing odd about:

select (12345678.1234/32.5678)::numeric(10,4);

Regards,
Igor Neyman

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2018-12-04 20:41:51 Re: simple division
Previous Message Joshua D. Drake 2018-12-04 20:38:07 Re: simple division