From da141305e087a3c6be222110e15862b2e4b21cf0 Mon Sep 17 00:00:00 2001 From: Sebastian Weber Date: Fri, 22 Jan 2016 15:44:51 +0100 Subject: [PATCH] Fix bug in computation of specific Wigner symbol --- src/wignerSymbols-cpp.cpp | 4 ++-- src/wignerSymbols-fortran.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wignerSymbols-cpp.cpp b/src/wignerSymbols-cpp.cpp index db5154e..a58e58e 100644 --- a/src/wignerSymbols-cpp.cpp +++ b/src/wignerSymbols-cpp.cpp @@ -223,7 +223,7 @@ double wigner3j(double l1, double l2, double l3, double l1min = std::max(std::fabs(l2-l3),std::fabs(m1)); // We fetch the proper value in the array. - int index = (int)l1-l1min; + int index = (int)(l1-l1min); return wigner3j(l2,l3,m1,m2,m3)[index]; } @@ -448,7 +448,7 @@ double wigner6j(double l1, double l2, double l3, // We compute l1min and the position of the array we will want. double l1min = std::max(std::fabs(l2-l3),std::fabs(l5-l6)); - int index = (int)l1-l1min; + int index = (int)(l1-l1min); return wigner6j(l2,l3,l4,l5,l6)[index]; } diff --git a/src/wignerSymbols-fortran.cpp b/src/wignerSymbols-fortran.cpp index 34e503b..14b3602 100644 --- a/src/wignerSymbols-fortran.cpp +++ b/src/wignerSymbols-fortran.cpp @@ -62,7 +62,7 @@ double wigner3j_f(double l1, double l2, double l3, drc3jj_wrap(l2,l3,m2,m3,&l1min,&l1max,thrcof,size,&ierr); // We fetch and return the value with the proper l1 value. - int index = (int)l1-l1min; + int index = (int)(l1-l1min); return thrcof[index]; } @@ -102,7 +102,7 @@ double wigner6j_f(double l1, double l2, double l3, drc6j_wrap(l2,l3,l4,l5,l6,&l1min,&l1max,sixcof,size,&ierr); // We fetch and return the coefficient with the proper l1 value. - int index = (int)l1-l1min; + int index = (int)(l1-l1min); return sixcof[index]; } }