From 5a55e295614a1474e192d9232b55256fd6e3aafd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Fri, 21 Jan 2022 14:54:41 +0100 Subject: [PATCH] Dynare++: minor fix to check for oversized problem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The maximum value of a signed integer is 2³¹−1, so the inequality test must not be strict. --- dynare++/tl/cc/tl_static.cc | 4 ++-- license.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dynare++/tl/cc/tl_static.cc b/dynare++/tl/cc/tl_static.cc index b1603a722..f1adb8c48 100644 --- a/dynare++/tl/cc/tl_static.cc +++ b/dynare++/tl/cc/tl_static.cc @@ -1,6 +1,6 @@ /* * Copyright © 2004 Ondra Kamenik - * Copyright © 2019 Dynare Team + * Copyright © 2019-2022 Dynare Team * * This file is part of Dynare. * @@ -51,7 +51,7 @@ namespace TLStatic init(int dim, int nvar) { // Check that tensor indices will not overflow (they are stored as signed int, hence on 31 bits) - if (std::log2(nvar)*dim > std::numeric_limits::digits) + if (std::log2(nvar)*dim >= std::numeric_limits::digits) throw TLException(__FILE__, __LINE__, "Problem too large, you should decrease the approximation order"); std::lock_guard{mut}; diff --git a/license.txt b/license.txt index 6456a4cca..ed857ca84 100644 --- a/license.txt +++ b/license.txt @@ -285,7 +285,7 @@ License: GFDL-NIV-1.3+ Files: dynare++/* Copyright: 2004-2011 Ondra Kamenik - 2019-2021 Dynare Team + 2019-2022 Dynare Team License: GPL-3+ Files: m4/ax_blas.m4 m4/ax_lapack.m4