<meta http-equiv="Content-Type" content="text/html; charset=GB18030"><div>Hi All,</div><div><div><br></div><div>I have some questions about Floating point ordered and unordered comparisons,</div><div>I did some searching and found link below</div><div>http://lists.llvm.org/pipermail/llvm-dev/2013-July/063571.html</div><div><br></div><div>But I still don't quite understand Floating point ordered and unordered</div><div>comparisons. For example, the following code</div><div>```</div><div>bool cmp1(float a) {</div><div>  if (a > 0.0)</div><div>   return true;</div><div>  else</div><div>   return false;</div><div>}</div><div><br></div><div>bool cmp2(float a) {</div><div>  if (!(a <= 0.0))</div><div>   return true;</div><div>  else</div><div>   return false;</div><div>}</div><div>```</div><div>The generated ir code is similar to the following:</div><div>```</div><div>define zeroext i1 @_Z4cmp1f(float %a) {</div><div>entry:</div><div>  %cmp = fcmp ogt float %a, 0.000000e+00</div><div>  ret i1 %cmp</div><div>}</div><div><br></div><div>define zeroext i1 @_Z4cmp2f(float %a) {</div><div>entry:</div><div>  %cmp = fcmp ugt float %a, 0.000000e+00</div><div>  ret i1 %cmp</div><div>}</div><div>```</div><div>If the parameter passed is NaN in this example, the result of cmp1 is false and</div><div>the result of cmp2 is true. In this case, the result is completely opposite. </div><div>When will we get 'fcmp ugt' and when will we get 'fcmp ugt' ? When comparing</div><div>ordered and unorder can be converted ? Such as converting an ordered less than</div><div>"setolt" into unordered greater than "setuge" operation. </div><div><br></div><div>Thanks in advance,</div><div>Lijia He<br></div></div>