Re: Money type does not detect over/underflow unlike int/int8

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: peter(dot)eisentraut(at)2ndquadrant(dot)com, "<pgsql-bugs(at)postgresql(dot)org>" <pgsql-bugs(at)postgresql(dot)org>, yohgaki(at)ohgaki(dot)net
Subject: Re: Money type does not detect over/underflow unlike int/int8
Date: 2017-04-06 12:48:51
Message-ID: CAM103DuJW==9bizbLDuWuDfzGfas0pG9e+zjPMwFVibZOs=ZGw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

i wrote:
> result = (Cash)f * 100;
> if ((c > 0 && CASH_MAX / c <= result) ||
> (c < 0 && CASH_MIN / c >= result))
> ereport("overflow");

ah... this is still wrong. Will be different not so much, though.

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message david.ung 2017-04-06 15:29:32 Re: BUG #14611: Black screen when launching pgadmin4
Previous Message Kyotaro HORIGUCHI 2017-04-06 08:56:58 Re: Money type does not detect over/underflow unlike int/int8