简体   繁体   English

在C中验证长long Int表现异常

[英]Validation of long long Int in C behaving unusually

I am writing an MPI program in which rank 0 reads parameters from a file and broadcasts the parameters on all the other ranks using MPI_BCAST. 我正在编写一个MPI程序,其中0级从文件中读取参数,并使用MPI_BCAST在所有其他级别上广播参数。

I am trying to validate if the long long integers obtained are non zero or not in C, While I can validate if the variables are non zero, but for I cannot validate the converse. 我试图验证在C中获得的长整数是否为非零,而我可以验证变量是否为非零,但是我无法验证反转。 (I have initialized the variables to zero). (我已将变量初始化为零)。 I have verified that the broadcast does work correctly but yet I am unable to validate 我已经验证广播确实可以正常工作,但我无法验证

if ((min_length==0LL) || (max_length==0LL) || (stride_length==0LL) || (nflops == 0LL))

Whereas I can validate its converse ie 虽然我可以验证它的反转即

if ((min_length!=0LL) || (max_length!=0LL) || (stride_length!=0LL) || (nflops != 0LL))

Just to clear out the stuff, none of the values are zero, if any value obtained is zero, my program needs to terminate. 只是为了清除这些东西,没有值为零,如果获得的任何值为零,我的程序需要终止。

Thank you in advance. 先感谢您。

Use de Morgan is you want to inverse/negate your condition 使用de Morgan你想要逆转/否定你的状况

if (min_length!=0LL && max_length!=0LL && stride_length!=0LL && nflops != 0LL) {
}

http://en.wikipedia.org/wiki/De_Morgan%27s_laws http://en.wikipedia.org/wiki/De_Morgan%27s_laws

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM