|
1 | 1 | /* gmpxx.h -- C++ class wrapper for GMP types. -*- C++ -*-
|
2 | 2 |
|
3 |
| -Copyright 2001-2003, 2006, 2008, 2011-2015 Free Software Foundation, Inc. |
| 3 | +Copyright 2001-2003, 2006, 2008, 2011-2015, 2018 Free Software |
| 4 | +Foundation, Inc. |
4 | 5 |
|
5 | 6 | This file is part of the GNU MP Library.
|
6 | 7 |
|
@@ -981,11 +982,15 @@ struct __gmp_binary_equal
|
981 | 982 | { return mpq_equal(q, r) != 0; }
|
982 | 983 |
|
983 | 984 | static bool eval(mpq_srcptr q, unsigned long int l)
|
984 |
| - { return mpz_cmp_ui(mpq_denref(q), 1) == 0 && mpz_cmp_ui(mpq_numref(q), l) == 0; } |
| 985 | + { return ((__GMPXX_CONSTANT(l) && l == 0) || |
| 986 | + mpz_cmp_ui(mpq_denref(q), 1) == 0) && |
| 987 | + mpz_cmp_ui(mpq_numref(q), l) == 0; } |
985 | 988 | static bool eval(unsigned long int l, mpq_srcptr q)
|
986 | 989 | { return eval(q, l); }
|
987 | 990 | static bool eval(mpq_srcptr q, signed long int l)
|
988 |
| - { return mpz_cmp_ui(mpq_denref(q), 1) == 0 && mpz_cmp_si(mpq_numref(q), l) == 0; } |
| 991 | + { return ((__GMPXX_CONSTANT(l) && l == 0) || |
| 992 | + mpz_cmp_ui(mpq_denref(q), 1) == 0) && |
| 993 | + mpz_cmp_si(mpq_numref(q), l) == 0; } |
989 | 994 | static bool eval(signed long int l, mpq_srcptr q)
|
990 | 995 | { return eval(q, l); }
|
991 | 996 | static bool eval(mpq_srcptr q, double d)
|
|
0 commit comments