float --> int - Mailing list pgsql-hackers

From Andreas Zeugswetter
Subject float --> int
Date
Msg-id 01BD7CC5.DCCB1460@zeugswettera.user.lan.at
Whole thread Raw
List pgsql-hackers
Maurice wrote:
> Making an int from a float is only defined for "small" values of the float.
> So for the general case such a conversion would simply overflow the int,
> giving it an undefined value. Does this make sense to you?

This sure sounds good:
select (4.00000 !); -- would work, but
select (4.30000 !); -- would throw a runtime error like
ERROR: float to integer conversion error, value out of range.

Andreas


pgsql-hackers by date:

Previous
From: t-ishii@sra.co.jp
Date:
Subject: questionable codes in libpq/backend communication
Next
From: "Maurice Gittens"
Date:
Subject: Re: [HACKERS] Automatic type conversion