Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: prevent SIGFPE on systems where LONG_MIN < -LONG_MAX
- X-seq: zsh-workers 30652
- From: Peter Stephenson <Peter.Stephenson@xxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>, <zsh-workers@xxxxxxx>
- Subject: Re: PATCH: prevent SIGFPE on systems where LONG_MIN < -LONG_MAX
- Date: Mon, 3 Sep 2012 15:57:32 +0100
- In-reply-to: <CAHYJk3RU_DubPO+gcuSxW3qh6Oc2sshDC0=swbQh5t+p+8fckg@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: Cambridge Silicon Radio
- References: <CAFOazAPwkJ25FDNL--AtCFLFK2CWKHiOCyCJudx3qgK7LKcDGg@mail.gmail.com> <CAHYJk3RU_DubPO+gcuSxW3qh6Oc2sshDC0=swbQh5t+p+8fckg@mail.gmail.com>
On Mon, 3 Sep 2012 16:40:37 +0200
Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> See also this thread,
> http://www.zsh.org/mla/workers/2011/msg00613.html
>
> On 03/09/2012, Jérémie Roquet <arkanosis@xxxxxxxxx> wrote:
> > Hello,
> >
> > $ echo $[ - 2**63 / -1 ]
> > zsh: floating point exception ./Src/zsh
> >
> > $ echo $[ - 2**63 % -1 ]
> > zsh: floating point exception ./Src/zsh
> >
> > The attached patch fixes this.
>
>
> To report this email as spam click https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg== .
So what's the answer, then? Jérémie's patch makes only limited
assumptions; I think the #if is there simply to see if we can assume
two's complement arithmetic (it seems the preprocessor isn't keen on
"#if LONG_MIN - 1 == LONG_MAX", I suppose it's not required to use
"long" precision) in which case the test should work. It might not
cover all real cases, but that's a lesser evil.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
Messages sorted by:
Reverse Date,
Date,
Thread,
Author