[ 
https://issues.apache.org/jira/browse/MESOS-3552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15027366#comment-15027366
 ] 

Avinash Sridharan commented on MESOS-3552:
------------------------------------------

Instead of using an explicit epsilon check as has been proposed here we should 
be using the CHECK_DOUBLE_EQ macro for CPUs. Looks like CPUs are the only 
resources that are stored in double and might run into this double precision 
error. Something like this might work better:
CHECK( result.mem() == mem() &&
        result.disk() == disk() &&
        result.ports() == ports());

CHECK_DOUBLE_EQ(result.cpus().get(), cpus().get());



> CHECK failure due to floating point precision on reservation request
> --------------------------------------------------------------------
>
>                 Key: MESOS-3552
>                 URL: https://issues.apache.org/jira/browse/MESOS-3552
>             Project: Mesos
>          Issue Type: Improvement
>          Components: master
>            Reporter: Mandeep Chadha
>            Assignee: Mandeep Chadha
>              Labels: mesosphere, tech-debt
>
> result.cpus() == cpus() check is failing due to ( double == double ) 
> comparison problem. 
> Root Cause : 
> Framework requested 0.1 cpu reservation for the first task. So far so good. 
> Next Reserve operation — lead to double operations resulting in following 
> double values :
>  results.cpus() : 23.9999999999999964472863211995 cpus() : 24
> And the check ( result.cpus() == cpus() ) failed. 
>  The double arithmetic operations caused results.cpus() value to be :  
> 23.9999999999999964472863211995 and hence ( 23.9999999999999964472863211995 
> == 24 ) failed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to