2 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
7 /* Author: E.G. Keizer */
9 char rcs_id[] = "$Id$" ;
18 char c ; int i ; long l ; unsigned u ;
23 /* test conversions */
25 /* first some conversions on constants */
27 printf("(int) '\\377' = %d\n",(int) '\377') ;
28 printf("(long) -1 = %ld\n",(long) -1 ) ;
30 printf("(float) 12 = %f\n",(float) 12 ) ;
31 printf("(int) 3.14 = %d\n",(int) 3.14 ) ;
33 printf("(int) 32767L = %d\n",(int) 32767L ) ;
34 printf("(int) -32768L = %d\n",(int) -32768L ) ;
35 printf("(char) 128L = %d\n",(char) 128L) ;
36 printf("(char) 0377 = %d\n",(char) 0377 ) ;
37 printf("(char) -1 = %d\n",(char) -1 ) ;
38 printf("(char) 10000 = %d\n",(char) 10000 ) ;
40 /* conversions from characters */
41 printf("From character\n") ;
49 printf("\tchar %5d, int %6d, unsigned %6o, long %11ld\n",c,i,u,l) ;
51 printf("\t\t\t\t\tfloat %f\n",f) ;
60 printf("\tchar %5d, int %6d, unsigned %6o, long %11ld\n",c,i,u,l) ;
62 printf("\t\t\t\t\tfloat %f\n",f) ;
71 printf("\tchar %5d, int %6d, unsigned %6o, long %11ld\n",c,i,u,l) ;
73 printf("\t\t\t\t\tfloat %f\n",f) ;
77 printf("From integer\n") ;
85 printf("\tchar %5d, int %6d, unsigned %6o, long %11ld\n",c,i,u,l) ;
87 printf("\t\t\t\t\tfloat %f\n",f) ;
90 printf("From long\n") ;
98 printf("\tchar %5d, int %6d, unsigned %6o, long %11ld\n",c,i,u,l) ;
100 printf("\t\t\t\t\tfloat %f\n",f) ;
103 printf("Casts from long\n");
105 printf("\tchar %5d, int %d, unsigned short %6o, long %11ld\n",
106 (char) l,(int) l,(unsigned short)l ,l) ;
109 printf("From float\n") ;
115 printf("\tchar %5d, int %6d, unsigned %6o, long %11ld, float %f\n",c,i,u,l,f) ;
121 printf("\tchar %5d, int %6d, unsigned %6o, long %11ld, float %f\n",c,i,u,l,f) ;
126 printf("\tint %6d, unsigned %6o, long %11ld, float %f\n",i,u,l,f) ;
129 printf("\tlong %11ld, float %f\n",l,f) ;
132 /* some special cases */
137 printf("a[l] (l==%ld) %d\n",l,a[l]) ;
138 printf("a[3l] %d\n",a[3l] ) ;
149 l2 = (unsigned short) l1;
150 printf("(unsigned short) 0x1f010L = 0x%lx\n", l2);
152 printf("(short) 0x1f010L = 0x%lx\n", l2);