Numeric Scale Differences

From: Nuno Sousa <nunofgs(at)gmail(dot)com>
To: pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: Numeric Scale Differences
Date: 2021-10-21 13:47:48
Message-ID: CAMZ4ZVqq9kHN7DJs5T=zL8jDJuk-3v2-spyYtjd8e2xj_OPM8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi all,

I've run into an interesting issue when trying to do numeric math. I
expected the following to return the same number of decimal digits in the
fractional part:

select scale(1/0.6::numeric), scale(1/6::numeric);

But it returns a scale of 16 and 20, respectively.

Any idea why?
--
Nuno Sousa

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2021-10-21 14:06:04 Re: Numeric Scale Differences
Previous Message Agil Azimov 2021-10-19 13:59:46 Re: Password settings requirements