Re: Behavior of CAST to integer

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Behavior of CAST to integer
Date: 2014-05-15 19:15:31
Message-ID: CAKFQuwaE48Jn-3pV5TZ3=f_uQm+9A_PHvtWfaeW+fHwcE-ixgA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

>
> You need the floor operator:
>

​floor() behaves identically to trunc() for positive numbers only; for
negative numbers floor() will round away from zero while trunc() rounds
toward zero.​ ceil() or ceiling() has the same dual-behavior - though in
reverse compared to floor() - for positive/negative numbers.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Behavior-of-CAST-to-integer-tp5803961p5804105.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Bruce Momjian 2014-05-15 21:56:47 Re: Restrict number of connections to specific table
Previous Message byron509 2014-05-15 19:15:14 Re: Behavior of CAST to integer