IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 8, 2005, 9:24:26 AM (21 years ago)
Author:
desonia
Message:

Updated the precision of the output of floats.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/dataManip/tst_psRandom.c

    r3010 r3160  
    123123    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
    124124        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);
    129129    stats->options = PS_STAT_SAMPLE_STDEV;
    130130    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);
    132132    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);
    134134        testStatus = false;
    135135    }
    136136    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);
    138138        testStatus = false;
    139139    }
     
    184184    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
    185185        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);
    190190    stats->options = PS_STAT_SAMPLE_STDEV;
    191191    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);
    193193    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);
    195195        testStatus = false;
    196196    }
    197197    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);
    199199        testStatus = false;
    200200    }
     
    245245    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
    246246        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);
    251251    stats->options = PS_STAT_SAMPLE_STDEV;
    252252    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);
    254254    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);
    256256        testStatus = false;
    257257    }
    258258    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);
    260260        testStatus = false;
    261261    }
Note: See TracChangeset for help on using the changeset viewer.