Changeset 3160 for trunk/psLib/test/dataManip/tst_psRandom.c
- Timestamp:
- Feb 8, 2005, 9:24:26 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/dataManip/tst_psRandom.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/dataManip/tst_psRandom.c
r3010 r3160 123 123 for (psS32 i = 0 ; i < NUM_DATA ; i++) { 124 124 rans->data.F64[i] = psRandomUniform(myRNG); 125 // printf("% f\n", rans->data.F64[i]);126 } 127 stats = psVectorStats(stats, rans, NULL, NULL, 0); 128 printf("Mean is % f\n", stats->sampleMean);125 // printf("%.2f\n", rans->data.F64[i]); 126 } 127 stats = psVectorStats(stats, rans, NULL, NULL, 0); 128 printf("Mean is %.2f\n", stats->sampleMean); 129 129 stats->options = PS_STAT_SAMPLE_STDEV; 130 130 stats = psVectorStats(stats, rans, NULL, NULL, 0); 131 printf("Standard deviation is % f\n", stats->sampleStdev);131 printf("Standard deviation is %.2f\n", stats->sampleStdev); 132 132 if ((fabs(stats->sampleMean - UNIFORM_MEAN) / UNIFORM_MEAN) > ERROR_TOLERANCE) { 133 printf("ERROR: psRandomUniform() mean is % f, should be %f\n", stats->sampleMean, UNIFORM_MEAN);133 printf("ERROR: psRandomUniform() mean is %.2f, should be %.2f\n", stats->sampleMean, UNIFORM_MEAN); 134 134 testStatus = false; 135 135 } 136 136 if ((fabs(stats->sampleStdev - UNIFORM_STDEV) / UNIFORM_STDEV) > ERROR_TOLERANCE) { 137 printf("ERROR: psRandomUniform() stdev is % f, should be %f\n", stats->sampleStdev, UNIFORM_STDEV);137 printf("ERROR: psRandomUniform() stdev is %.2f, should be %.2f\n", stats->sampleStdev, UNIFORM_STDEV); 138 138 testStatus = false; 139 139 } … … 184 184 for (psS32 i = 0 ; i < NUM_DATA ; i++) { 185 185 rans->data.F64[i] = psRandomGaussian(myRNG); 186 // printf("% f\n", rans->data.F64[i]);187 } 188 stats = psVectorStats(stats, rans, NULL, NULL, 0); 189 printf("Mean is % f\n", stats->sampleMean);186 // printf("%.2f\n", rans->data.F64[i]); 187 } 188 stats = psVectorStats(stats, rans, NULL, NULL, 0); 189 printf("Mean is %.2f\n", stats->sampleMean); 190 190 stats->options = PS_STAT_SAMPLE_STDEV; 191 191 stats = psVectorStats(stats, rans, NULL, NULL, 0); 192 printf("Standard deviation is % f\n", stats->sampleStdev);192 printf("Standard deviation is %.2f\n", stats->sampleStdev); 193 193 if ((fabs(stats->sampleMean - GAUSSIAN_MEAN) / 1.0) > ERROR_TOLERANCE) { 194 printf("ERROR: psRandomUniform() mean is % f, should be %f\n", stats->sampleMean, GAUSSIAN_MEAN);194 printf("ERROR: psRandomUniform() mean is %.2f, should be %.2f\n", stats->sampleMean, GAUSSIAN_MEAN); 195 195 testStatus = false; 196 196 } 197 197 if ((fabs(stats->sampleStdev - GAUSSIAN_STDEV) / GAUSSIAN_STDEV) > ERROR_TOLERANCE) { 198 printf("ERROR: psRandomUniform() stdev is % f, should be %f\n", stats->sampleStdev, GAUSSIAN_STDEV);198 printf("ERROR: psRandomUniform() stdev is %.2f, should be %.2f\n", stats->sampleStdev, GAUSSIAN_STDEV); 199 199 testStatus = false; 200 200 } … … 245 245 for (psS32 i = 0 ; i < NUM_DATA ; i++) { 246 246 rans->data.F64[i] = psRandomPoisson(myRNG, POISSON_MEAN); 247 // printf("% f\n", rans->data.F64[i]);248 } 249 stats = psVectorStats(stats, rans, NULL, NULL, 0); 250 printf("Mean is % f\n", stats->sampleMean);247 // printf("%.2f\n", rans->data.F64[i]); 248 } 249 stats = psVectorStats(stats, rans, NULL, NULL, 0); 250 printf("Mean is %.2f\n", stats->sampleMean); 251 251 stats->options = PS_STAT_SAMPLE_STDEV; 252 252 stats = psVectorStats(stats, rans, NULL, NULL, 0); 253 printf("Standard deviation is % f\n", stats->sampleStdev);253 printf("Standard deviation is %.2f\n", stats->sampleStdev); 254 254 if ((fabs(stats->sampleMean - POISSON_MEAN) / POISSON_MEAN) > ERROR_TOLERANCE) { 255 printf("ERROR: psRandomUniform() mean is % f, should be %f\n", stats->sampleMean, POISSON_MEAN);255 printf("ERROR: psRandomUniform() mean is %.2f, should be %.2f\n", stats->sampleMean, POISSON_MEAN); 256 256 testStatus = false; 257 257 } 258 258 if ((fabs(stats->sampleStdev - POISSON_STDEV) / POISSON_STDEV) > ERROR_TOLERANCE) { 259 printf("ERROR: psRandomUniform() stdev is % f, should be %f\n", stats->sampleStdev, POISSON_STDEV);259 printf("ERROR: psRandomUniform() stdev is %.2f, should be %.2f\n", stats->sampleStdev, POISSON_STDEV); 260 260 testStatus = false; 261 261 }
Note:
See TracChangeset
for help on using the changeset viewer.
