You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// This check here is needed in case bOverCRatio*c is not integer (it can happen with e.g. bOverCRatio=4./9.)
423
+
/// In this case, b is its truncation and the desired ratio is not obtained
424
+
/// It means that one needs to continue iterating until bOverCRatio*c is integer, i.e. b not truncated
425
+
///
426
+
/// Possible cases:
427
+
/// 1. we want nB = nC*R, with R integer
428
+
/// -> we enter here in the first loop iteration
429
+
/// 2. we want more charm than beauty by an integer amount, i.e. nB = nC*R with R=1./N, with N integer
430
+
/// -> we enter here after N iterations, when c=N
431
+
/// 3. we want either more charm or beauty, but with a factor R that is not integer, as well as its inverse (e.g. bOverCRatio=4./9.)
432
+
/// -> In this case, bOverCRatio*c is not integer, namely b is its truncation and the desired ratio is not obtained
433
+
/// The code iterates at most until c becomes equal to the denominator of the fraction
434
+
/// 4. we want one of the previous cases, but we assign to bOverCRatio a value that is not rational
435
+
/// or such as we do not enter here within 19 iterations
436
+
/// -> nC and nB, are not touched, therefore we do not have the desired fraction. We'll need to throw a fatal (*)
437
+
///
438
+
bestErr=err;
439
+
nC=c;
440
+
nB=b;
441
+
442
+
/// If we are at this point, we reached already the desired ratio between b and c.
443
+
/// Let's break the loop
444
+
break;
445
+
}
446
+
}
447
+
448
+
// (*) check if we have the desired fraction
449
+
boolisRatioUnity=std::fabs(bOverCRatio-1) <1e-05;
450
+
if (!isRatioUnity&&nC==1&&nB==1) {
451
+
LOG(fatal) << "nC=" << nC << ", nB=" << nB << " but you ask bOverCRatio to be " << bOverCRatio <<", which is different from nB/nC. It means either that bOverCRatio is not rational, or that you need more than " << iterNMax << " iterations. Change it!";
0 commit comments