Added a test for casts

This commit is contained in:
ceriel 1987-12-04 12:53:18 +00:00
parent a8703841b2
commit d98394f0cf
2 changed files with 7 additions and 0 deletions

View file

@ -99,6 +99,11 @@ t1() {
printf("\t\t\t\t\tfloat %f\n",f) ; printf("\t\t\t\t\tfloat %f\n",f) ;
#endif #endif
printf("Casts from long\n");
l = 75000;
printf("\tchar %5d, int %d, unsigned short %6o, long %11ld\n",
(char) l,(int) l,(unsigned short)l ,l) ;
#ifndef NOFLOAT #ifndef NOFLOAT
printf("From float\n") ; printf("From float\n") ;
f = 121.5 ; f = 121.5 ;

View file

@ -21,6 +21,8 @@ From integer
From long From long
char -3, int -3, unsigned 37777777775, long -3 char -3, int -3, unsigned 37777777775, long -3
float -3.000000 float -3.000000
Casts from long
char -8, int 75000, unsigned short 22370, long 75000
From float From float
char 121, int 121, unsigned 171, long 121, float 121.500000 char 121, int 121, unsigned 171, long 121, float 121.500000
char 0, int 0, unsigned 0, long 0, float 0.000100 char 0, int 0, unsigned 0, long 0, float 0.000100