test_printf.c

00001 
00002 int main (){
00003 double f;
00004 
00005 /*double f4;
00006 long double f1;
00007 float f2, f3;
00008 float flottant;*/
00009 
00010  f = 48656568.256479123456789123456789;
00011 /*
00012 f1= 48656568.256479123456789123456789;
00013 f2 = 456.45366;
00014 f3 = 456.45362; */
00015 //printf("Test du printf");
00016 
00017 /*Simple test of %f format */
00018 printf("double    :%lf\n",f);
00019 
00020 /* Test with format specifying first number is equal to minimal number
00021    of caracter to be print the second one is number of digits */
00022 /*
00023 printf("LONG DOUBLE  :%Lf - %20.10Lf - %20.15Lf - %20.20Lf - %30.30Lf\n", f1,  f1, f1, f1, f1);
00024 printf("float2    :%4.2f %+.0e %E \n", 3.1416, 3.1416, 3.1416);*/
00025 
00026 /*Note: the output should be float2: 3.14 +3e+000 3.141600E+000*/
00027 /*
00028 printf("float3    :%7.3f\n", 1.2345);
00029 printf("float3bis :%7.3lf\n",4865.256479 );
00030 printf("float4    :%10.3f\n", 1.2345e3);
00031 printf("float5    :%10.3f\n", 1.2345e7);
00032 printf("float6    :%12.4e\n", 1.2345);
00033 printf("float7    :%12.4e\n", 123.456789e8);
00034 printf("float8    :%15.5lf\n",48656568.256479 );
00035 printf("float9    :%15.6lf\n",48656568.256479 - 48656568.256478 );
00036 printf("float9bis :%15.2lf\n",f2*f3 );*/
00037 /*Note : the outputs shoud be
00038 for 1.2345, ^^1.235
00039 for 1.2345e5, ^^1234.500
00040 for 1.2345e7, 12345000.000
00041 for 1.2345, ^^1.2345e+00
00042 for 123.456789e8, ^^1.2346e+10
00043 for 48656568.256479 - 48656568.2563,^^^^^^^^0.00001
00044 for f2*f3 ,^^^^^^208349,92
00045 ^ is equal to a space */
00046 
00047 /*
00048 printf("float10   :01234567 \n" );
00049 printf("float11   :%8g|\n", 12.34 );
00050 printf("float12   :%8g|\n", 1234.5678 );
00051 printf("float13   :%8g|\n", 0.0478 );
00052 printf("float14   :%8g|\n", 422121.0 );
00053 printf("float15   :%8g|\n", 422121234.345345 );*/
00054 /*Note : outputs should be
00055 01234567
00056    12.34|
00057  1234.57|
00058   0.0478|
00059   422121|
00060 4.22121e+08|
00061 */
00062 /*
00063 
00064 printf("float16   :%.0f|\n",  1000.123456789123456789 );
00065 printf("float17   :%.1f|\n",  2000.123456789123456789 );
00066 printf("float18   :%.2f|\n",  3000.123456789123456789 );
00067 printf("float19   :%.10f|\n", 4000.123456789123456789 );
00068 printf("float20   :%.30f|\n", 5000.123456789123456789 );
00069 printf("float21   :%f|\n",    6000.123456789123456789 );
00070 printf("float22   :%.f|\n",   7000.123456789123456789 );
00071 */
00072 /*Note : outputs should be
00073 1000|
00074 2000.1|
00075 3000.12|
00076 4000.1234567891|
00077 5000.12345678912333823973312939761|
00078 6000.123457|
00079 7000|
00080 */
00081 
00082 
00083 //while(1);
00084 
00085 }
00086 
00087 

Generated on Mon Apr 11 14:23:40 2011 for Contiki 2.5 by  doxygen 1.6.1