[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using the GNU GMP Library for Bignums in Emacs
From: |
Andreas Schwab |
Subject: |
Re: Using the GNU GMP Library for Bignums in Emacs |
Date: |
Mon, 23 Apr 2018 10:39:32 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
On Apr 23 2018, Helmut Eller <address@hidden> wrote:
> Out of curiousity: what's the quickest way to detect overflow on
> multiplication in ANSI C? E.g.
>
> int64_t x, y, result;
> result = x * y;
> if (<how to detect overflow?>)
There is no way to detect overflow after the fact because overflow
invokes undefined behaviour. You need to either check the range
beforehand, or use special builtins offered by the compiler
(eg. __builtin_smul_overflow in GCC).
Andreas.
--
Andreas Schwab, address@hidden
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
- Re: Using the GNU GMP Library for Bignums in Emacs, (continued)
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/21
- Re: Using the GNU GMP Library for Bignums in Emacs, dancol, 2018/04/21
- Re: Using the GNU GMP Library for Bignums in Emacs, Philipp Stephani, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Daniel Colascione, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Clément Pit-Claudel, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Siraphob (Ben) Phipathananunth, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Helmut Eller, 2018/04/23
- Re: Using the GNU GMP Library for Bignums in Emacs,
Andreas Schwab <=
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/23
- Re: Using the GNU GMP Library for Bignums in Emacs, Helmut Eller, 2018/04/23
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/23
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Helmut Eller, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/23
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/23
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/24