xilebo noone | sur cpp.sh , cela semble fonctionner :
Code :
- // Example program
- #include <iostream>
- #include <string>
- #include <stdio.h>
- #include <math.h>
- # define M_PI 3.14159265358979323846
- static double cos64[16], cos32[8], cos16[4], cos8[2], cos4[1];
- double *pnts[] = { cos64,cos32,cos16,cos8,cos4 };
- //double pnts[16];
- #ifndef DOUBLE_TO_REAL
- # define DOUBLE_TO_REAL(x) (double)(x)
- #endif
- void prepare_decode_tables()
- {
- int i, k, kr, divv;
- double *costab;
- for (i = 0; i < 5; i++)
- {
- kr = 0x10 >> i; divv = 0x40 >> i;
- costab = pnts[i];
- for (k = 0; k < kr; k++)
- {
- costab[k] = DOUBLE_TO_REAL(1.0 / (2.0 * cos(M_PI * ((double)k * 2.0 + 1.0) / 1.0 / (double)divv)));
- printf("%d/%d , %f", i , k , costab[k]);
- }
- printf("\n" );
- }
- }
- int main()
- {
- prepare_decode_tables ();
-
- return 0;
- }
|
Code :
- 0/0 , 0.5006030/1 , 0.5054710/2 , 0.5154470/3 , 0.5310430/4 , 0.5531040/5 , 0.5829350/6 , 0.6225040/7 , 0.6748080/8 , 0.7445360/9 , 0.8393500/10 , 0.9725680/11 , 1.1694400/12 , 1.4841650/13 , 2.0577810/14 , 3.4076080/15 , 10.190008
- 1/0 , 0.5024191/1 , 0.5224991/2 , 0.5669441/3 , 0.6468221/4 , 0.7881551/5 , 1.0606781/6 , 1.7224471/7 , 5.101149
- 2/0 , 0.5097962/1 , 0.6013452/2 , 0.8999762/3 , 2.562915
- 3/0 , 0.5411963/1 , 1.306563
- 4/0 , 0.707107
|
|