| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Lee Hachadoorian <lee(dot)hachadoorian(at)gmail(dot)com> |
| Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Significant Digits in Floating Point Datatype |
| Date: | 2011-11-20 19:06:27 |
| Message-ID: | 2883.1321815987@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Lee Hachadoorian <lee(dot)hachadoorian(at)gmail(dot)com> writes:
> And can I reliably retrieve the original integer by
> casting to int (or bigint) if the number of digits in the original
> integer is less than 15?
On IEEE-floating-point machines, I'd expect float8 to store integers
up to 2^52 (or maybe it's 2^53) exactly. With other floating-point
formats the limit might be different, but it should still be exact for
reasonable-size integers. This has nothing whatever to do with whether
decimal fractions are reproduced exactly (in general, they aren't, no
matter how many or few digits are involved). So integers are fine,
bigints not so much.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Gavin Flower | 2011-11-20 19:35:17 | Re: Is it ever necessary to vacuum a table that only gets inserts/updates? |
| Previous Message | Scott Marlowe | 2011-11-20 18:56:23 | Re: Installed. Now what? |