Mercurial > hg > CbC > old > device
diff test/float.c @ 84:1a723130a2c7
condtional
author | kono |
---|---|
date | Wed, 05 Mar 2003 10:54:33 +0900 |
parents | 25654dc29ecc |
children | 3789aef7331d |
line wrap: on
line diff
--- a/test/float.c Wed Mar 05 03:41:08 2003 +0900 +++ b/test/float.c Wed Mar 05 10:54:33 2003 +0900 @@ -5,12 +5,13 @@ void print(double d); extern double sin(double); -extern float fsin(float); +// extern float fsin(float); float f = 0.3; double d = 0.3; float f1 = 0.3; double d1 = 0.3; +double d2 = -0.2; int main(int ac,char *av[]) { @@ -19,19 +20,29 @@ g = 1.0; g = -g; - printf("%g\n",g); - if(f==f*1.0) printf("ok\n"); - if(d==f*1.0) printf("ok\n"); - if(f==f1) printf("ok\n"); - if(d==d1) printf("ok\n"); - if(d>d1) printf("ok\n"); - if(d>=d1) printf("ok\n"); - if(d!=d1) printf("ok\n"); + printf("%g\ncond ",g); + if(f==f*1.0) printf("1 "); + if(d==f*1.0) printf("2 "); + if(f==f1) printf("3 "); + if(d==d1) printf("4 "); + if(d==d2) printf("-4 "); + if(d>d1) printf("5 "); + if(d>d2) printf("-5 "); + if(d>=d1) printf("6 "); + if(d>=d2) printf("-6 "); + if(d!=d1) printf("7 "); + if(d!=d2) printf("-7 "); + if(d<d1) printf("8 "); + if(d<d2) printf("-8 "); + if(d<=d1) printf("9 "); + if(d<=d2) printf("-9 "); i = d; d = i; i = f; f = i; + printf("\n%d %g %f",i,d,f); f = g = d = g = d = f; + printf(" %d %g %f %g\n",i,d,f,g); print(1.0); print(0.1234); @@ -51,11 +62,11 @@ f = d; dd = (int*) &d; - printf("d %g\n",d); + printf("d %g ",d); printf("dx %08x %08x\n",*(dd),*(dd+1)); dd = (int*) &f; - printf("f %g\n",f); + printf("f %g ",f); printf("dx %08x \n",*(dd)); }