From b613bdb30678a3d3cf7ca094691a3bf69930293a Mon Sep 17 00:00:00 2001 From: conrad Date: Wed, 23 Apr 2025 13:24:40 +1000 Subject: [PATCH] fix calculation of s --- include/armadillo_bits/op_expmat_meat.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/armadillo_bits/op_expmat_meat.hpp b/include/armadillo_bits/op_expmat_meat.hpp index 7278cabc..3d8b0806 100644 --- a/include/armadillo_bits/op_expmat_meat.hpp +++ b/include/armadillo_bits/op_expmat_meat.hpp @@ -108,11 +108,11 @@ op_expmat::apply_direct(Mat& out, const Base T(0)) ? double(eop_aux::log2(norm_val)) : double(0); + int exponent = int(0); std::frexp(norm_val, &exponent); - int exponent = int(0); std::frexp(log2_val, &exponent); + const uword s = (std::min)( uword( (std::max)(int(0), exponent) ), uword(1023) ); - const uword s = uword( (std::max)(int(0), exponent + int(1)) ); + arma_debug_print("op_expmat: s: ", s); A /= eT(eop_aux::pow(double(2), double(s))); @@ -125,7 +125,7 @@ op_expmat::apply_direct(Mat& out, const Base