[ 
https://issues.apache.org/jira/browse/YARN-9019?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Szilard Nemeth updated YARN-9019:
---------------------------------
    Description: 
Found out that ResourceCalculator.ratio (with implementors 
DefaultResourceCalculator and DominantResourceCalculator) can produce NaN 
(Not-A-Number) as a result.

This is because [IEEE 754|http://grouper.ieee.org/groups/754/] defines {{1.0 / 
0.0}} as Infinity and {{-1.0 / 0.0}} as -Infinity and {{0.0 / 0.0}} as NaN, see 
here: [https://stackoverflow.com/a/14138032/1106893] 

I think it's very dangerous to rely on NaN can be returned from ratio 
calculations and this could have side-effects.

When ratio calculates the result and if both the numerator and the denominator 
is zero, we should use 0 as a result, I think.

  was:
Found out that ResourceCalculator.ratio (with implementors 
DefaultResourceCalculator and DominantResourceCalculator) can produce NaN 
(Not-A-Number) as a result.

This is because [IEEE 754|http://grouper.ieee.org/groups/754/] defines {{1.0 / 
0.0}} as Infinity and {{-1.0 / 0.0}} as -Infinity and {{0.0 / 0.0}} as NaN, see 
here: https://stackoverflow.com/a/14138032/1106893 

I think it's very dangerous to rely on NaN can be returned from ratio 
calculations and this could have side-effects.


> Ratio of ResourceCaculator implementations could return NaN
> -----------------------------------------------------------
>
>                 Key: YARN-9019
>                 URL: https://issues.apache.org/jira/browse/YARN-9019
>             Project: Hadoop YARN
>          Issue Type: Bug
>            Reporter: Szilard Nemeth
>            Assignee: Szilard Nemeth
>            Priority: Major
>
> Found out that ResourceCalculator.ratio (with implementors 
> DefaultResourceCalculator and DominantResourceCalculator) can produce NaN 
> (Not-A-Number) as a result.
> This is because [IEEE 754|http://grouper.ieee.org/groups/754/] defines {{1.0 
> / 0.0}} as Infinity and {{-1.0 / 0.0}} as -Infinity and {{0.0 / 0.0}} as NaN, 
> see here: [https://stackoverflow.com/a/14138032/1106893] 
> I think it's very dangerous to rely on NaN can be returned from ratio 
> calculations and this could have side-effects.
> When ratio calculates the result and if both the numerator and the 
> denominator is zero, we should use 0 as a result, I think.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to