From dc4f1e710402bd9365b6de5c49aed9f3de03bf0c Mon Sep 17 00:00:00 2001 From: John Cremona Date: Fri, 3 May 2024 15:01:58 +0100 Subject: [PATCH] cppcheck --- libsrc/eclib/bigrat.h | 4 +++- libsrc/points.cc | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libsrc/eclib/bigrat.h b/libsrc/eclib/bigrat.h index 0823b00..28f9ddd 100644 --- a/libsrc/eclib/bigrat.h +++ b/libsrc/eclib/bigrat.h @@ -32,11 +32,12 @@ class bigrational { public: // constructors bigrational() : n(0), d(1) {;} - bigrational(const bigint& num_val) : n(num_val), d(1) {;} + explicit bigrational(const bigint& num_val) : n(num_val), d(1) {;} bigrational(const bigint& num_val, const bigint& den_val); bigrational(const bigrational& q); explicit bigrational(const rational& q); void operator=(const bigrational& q); + void operator=(const bigint& a); void operator=(const rational& q); // bigrational manipulations @@ -103,6 +104,7 @@ inline bigrational::bigrational(const bigint& num_val, const bigint& den_val) inline bigrational::bigrational(const bigrational& q) :n(q.n), d(q.d) {;} inline bigrational::bigrational(const rational& q) :n(q.n), d(q.d) {;} inline void bigrational::operator=(const bigrational& q) {n=q.n; d=q.d;} +inline void bigrational::operator=(const bigint& a) {n=a; d=bigint(1);} inline void bigrational::operator=(const rational& q) {n=bigint(q.n); d=bigint(q.d);} inline bigrational bigrational::operator+() diff --git a/libsrc/points.cc b/libsrc/points.cc index 7943003..564978a 100644 --- a/libsrc/points.cc +++ b/libsrc/points.cc @@ -482,7 +482,7 @@ vector m_torsion(Curvedata& E, long m, int exact) // accumulate the points with each x-coorindate: for( const auto& xi : xs) { - vector Ps = points_from_x(E, xi); + vector Ps = points_from_x(E, bigrational(xi)); #ifdef DEBUG_TORSION cout<<" x = "<