IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3160


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

Updated the precision of the output of floats.

Location:
trunk/psLib/test/dataManip
Files:
2 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    }
  • trunk/psLib/test/dataManip/tst_psStats09.c

    r2780 r3160  
    7171
    7272    printf("Called psVectorStats() on a vector with no elements masked.\n");
    73     printf("The calculated clippedMean was %f\n", myStats->clippedMean);
     73    printf("The calculated clippedMean was %.2f\n", myStats->clippedMean);
    7474
    7575    printFooter(stdout,
     
    8585
    8686    printf("Called psVectorStats() on a vector with no elements masked.\n");
    87     printf("The calculated clippedStdev was %f\n", myStats->clippedStdev);
     87    printf("The calculated clippedStdev was %.2f\n", myStats->clippedStdev);
    8888
    8989    printFooter(stdout,
     
    102102
    103103    printf("Called psVectorStats() on a vector with elements masked.\n");
    104     printf("The calculated clippedMean was %f\n", myStats->clippedMean);
     104    printf("The calculated clippedMean was %.2f\n", myStats->clippedMean);
    105105    printFooter(stdout,
    106106                "psVector functions",
     
    115115
    116116    printf("Called psVectorStats() on a vector with elements masked.\n");
    117     printf("The calculated clippedStdev was %f\n", myStats->clippedStdev);
     117    printf("The calculated clippedStdev was %.2f\n", myStats->clippedStdev);
    118118    printFooter(stdout,
    119119                "psVector functions",
Note: See TracChangeset for help on using the changeset viewer.