| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
| Cc: | Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, Andrew Geery <andrew(dot)geery(at)gmail(dot)com>, plm(at)netspace(dot)net(dot)au, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Review: Patch for phypot - Pygmy Hippotause |
| Date: | 2010-07-18 14:50:32 |
| Message-ID: | 27598.1279464632@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
> No. If x is 1e8 * y, then y will only affect the result in the 16th
> place. You can see this if you do a simple series expansion:
> sqrt(1+yx^2) = 1 + 1/2 yx^2 + O(yx^4)
Sigh, I went looking for that expansion yesterday and didn't find it.
Should've tried harder. I was relying on a gut feeling that it would
behave approximately like ln(1+x).
> For most cases, the new algorithm is no more accurate than the old
> one. The exception is when *both* x and y are very small. In this
> case, it protects against incorrect underflows to 0.
Yeah, I think you're right.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2010-07-18 15:24:20 | Parsing of aggregate ORDER BY clauses |
| Previous Message | Tom Lane | 2010-07-18 14:27:17 | Re: dividing money by money |