[
https://issues.apache.org/jira/browse/MESOS-1187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14737312#comment-14737312
]
Felix Abecassis commented on MESOS-1187:
----------------------------------------
Being new to Mesos, I don't understand all the details of this bug, but are you
aware of the pitfalls of using {{numeric_limits<T>::epsilon()}}?
This value (aka {{FLT_EPSILON}} or {{DBL_EPSILON}}) only makes sense when
comparing values between 1. and 2.; even in this range, it's a very strict
comparison.
For instance, try the following code:
{code}
double r1 = 0;
for (int i = 0; i < 20; ++i)
r1 += 0.1;
double r2 = 0.1 * 20;
cout.precision(20);
std::cout << r1 << " " << r2 << std::endl;
if (r1 == r2)
cout << "it's equal" << endl;
cout << abs(r1 - r2) << " " << numeric_limits<double>::epsilon() << endl;
// This condition is *NOT* true
if (abs(r1 - r2) < numeric_limits<double>::epsilon())
cout << "it's almost equal." << endl;
// This condition will NOT trigger
if (r1 <= r2 && r1 >= r2)
cout << "it's equal too" << endl;
{code}
> precision errors with allocation calculations
> ---------------------------------------------
>
> Key: MESOS-1187
> URL: https://issues.apache.org/jira/browse/MESOS-1187
> Project: Mesos
> Issue Type: Bug
> Components: allocation, master
> Reporter: aniruddha sathaye
> Assignee: Klaus Ma
>
> As allocations are stored/transmitted as doubles many a times precision
> errors creep in.
> we have seen erroneous share calculations happen only because of floating
> point arithmetic.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)