My program results -0.0 value. Is this correct ?
Issue
- This program results
-0.0value. Is this correct? A bug?
$ cat float.c
#include<stdio.h>
int main(){
double a = 0;
double b = a * (-1.0);
printf("%f", b);
return 0;
}
$ gcc float.c
$ ./a.out
-0.00000
Environment
- Red Hat Enterprise Linux 5
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
