@@ -15,7 +15,7 @@ using std::cout;
1515using std::endl;
1616using std::is_same;
1717
18- namespace ql {
18+ namespace ql {
1919
2020 template <typename TOutput, typename TMass, typename TScale>
2121 Tools<TOutput,TMass,TScale>::Tools():
@@ -269,21 +269,21 @@ namespace ql {
269269 template <typename TOutput, typename TMass, typename TScale>
270270 TOutput Tools<TOutput,TMass,TScale>::fndd(int const & n, TOutput const & x, TScale const & iep) const
271271 {
272- const int infty = 16 ;
273- TOutput res = _czero;
272+ const int infty = 16 ;
273+ TOutput res = _czero;
274274 if (Abs (x) < _ten)
275275 {
276276 if (!iszero (Abs (x-_cone)))
277277 res = (_cone-Pow (x,n+1 ))*(cLn (x-_cone, iep) - cLn (x, iep));
278278
279279 for (int j = 0 ; j <= n; j++)
280280 res -= Pow (x, n-j)/(j+_one);
281- }
281+ }
282282 else
283- {
283+ {
284284 res = cLn (_cone-_cone/x, iep);
285285 for (int j = n+1 ; j <= n+infty; j++)
286- res += Pow (x, n-j)/(j+_one);
286+ res += Pow (x, n-j)/(j+_one);
287287 }
288288 return res;
289289 }
@@ -481,18 +481,18 @@ namespace ql {
481481
482482 if (Real (z12) > _half)
483483 {
484- cspence = ltspence (1 , z12, _zero);
484+ cspence = ltspence (1 , z12, _zero);
485485 const int etas = eta (z1, im1, z2, im2, im12);
486486 if (etas != 0 ) cspence += TOutput (etas)*cLn (_cone-z12, -im12)*_2ipi;
487487 }
488488 else if (Abs (z12) < _eps4)
489489 {
490- cspence = TOutput (_pi2o6);
490+ cspence = TOutput (_pi2o6);
491491 if (Abs (z12) > _eps14)
492492 cspence += -ltspence (0 , z12, _zero) + (cLn (z1,im1) + cLn (z2,im2))*z12*(_cone + z12*(_chalf + z12*(_cone/_cthree + z12/_cfour)));
493493 }
494494 else
495- cspence = TOutput (_pi2o6) - ltspence (0 , z12, _zero) - (cLn (z1, im1) + cLn (z2, im2))*cLn (_cone-z12,_zero);
495+ cspence = TOutput (_pi2o6) - ltspence (0 , z12, _zero) - (cLn (z1, im1) + cLn (z2, im2))*cLn (_cone-z12,_zero);
496496
497497 return cspence;
498498 }
@@ -819,7 +819,7 @@ namespace ql {
819819 {
820820 const TOutput arg4 = (y0-_cone)/y0;
821821 res += extra*cLn (arg4, Sign (Imag (arg4)));
822- }
822+ }
823823
824824 return res;
825825 }
@@ -1221,30 +1221,38 @@ namespace ql {
12211221 if (iszero (Imag (discr)))
12221222 {
12231223 const TMass sgnb = Sign (Real (b));
1224- if (Real (discr) > 0 )
1225- {
1226- const TMass q = -_half*(b+sgnb*Sqrt (discr));
1227- if (Real (b) > 0 )
1228- {
1229- z[0 ] = TOutput (c/q);
1230- z[1 ] = TOutput (q/a);
1231- }
1232- else
1233- {
1234- z[0 ] = TOutput (q/a);
1235- z[1 ] = TOutput (c/q);
1236- }
1237- }
1238- else
1239- {
1240- z[1 ] = -(TOutput (b)+sgnb*Sqrt (TOutput (discr)))/(_ctwo*a);
1241- z[0 ] = Conjg (z[1 ]);
1242- if (Real (b) < 0 )
1243- {
1244- z[0 ] = z[1 ];
1245- z[1 ] = Conjg (z[0 ]);
1246- }
1247- }
1224+ if (iszero (Real (b)))
1225+ {
1226+ z[0 ] = -(TOutput (b)-Sqrt (TOutput (discr)))/(_ctwo*a);
1227+ z[1 ] = -(TOutput (b)+Sqrt (TOutput (discr)))/(_ctwo*a);
1228+ }
1229+ else
1230+ {
1231+ if (Real (discr) > 0 )
1232+ {
1233+ const TMass q = -_half*(b+sgnb*Sqrt (discr));
1234+ if (Real (b) > 0 )
1235+ {
1236+ z[0 ] = TOutput (c/q);
1237+ z[1 ] = TOutput (q/a);
1238+ }
1239+ else
1240+ {
1241+ z[0 ] = TOutput (q/a);
1242+ z[1 ] = TOutput (c/q);
1243+ }
1244+ }
1245+ else
1246+ {
1247+ z[1 ] = -(TOutput (b)+sgnb*Sqrt (TOutput (discr)))/(_ctwo*a);
1248+ z[0 ] = Conjg (z[1 ]);
1249+ if (Real (b) < 0 )
1250+ {
1251+ z[0 ] = z[1 ];
1252+ z[1 ] = Conjg (z[0 ]);
1253+ }
1254+ }
1255+ }
12481256 }
12491257 else
12501258 {
0 commit comments