Discussion: What is Nothing?
Execute the code to understand the output and gain insights into floating-point arithmetic.
We'll cover the following...
Run the code
Now, it's time to execute the code and observe the output.
Press + to interact
#include <stdio.h>int main(){float n, p;n = -0.0;p = +0.0;if( n==p )printf("negative zero is equal to positive zero\n");elseprintf("negative zero is not equal to positive zero\n");return(0);}
Understanding the output
The code compares negative and positive zero as created by the compiler and stored in memory:
negative zero is equal to positive zero
Code ouput