[ create a new paste ] login | about

Link: http://codepad.org/QCLg3bto    [ raw code | output | fork ]

C, pasted on Jul 3:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include<stdio.h>

int main () {    
    double d1, d2, d3;
    d1 = 1;
    d2 = 2;
    d3 = d1 + d2;
    printf ("%d\n", ((((double)0.1)+((double)0.2)) == ((double)d3)));
    printf ("%.17f\n", d1+d2);
    printf ("%d\n", ((d1+d2) == d3));
    printf ("%.17f, %.17f, %.17f\n", d1, d2, d3);
    printf ("%g, %g, %g\n", d1, d2, d3);

    return 0;
}


Output:
1
2
3
4
5
0
3.00000000000000000
1
1.00000000000000000, 2.00000000000000000, 3.00000000000000000
1, 2, 3


Create a new paste based on this one


Comments: