Changeset 802a8c8 in mainline for uspace/app/tester/float/float2.c


Ignore:
Timestamp:
2018-07-16T11:27:30Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c45dc5e1
Parents:
58daded
git-author:
Jiri Svoboda <jiri@…> (2018-07-16 06:27:08)
git-committer:
Jiri Svoboda <jiri@…> (2018-07-16 11:27:30)
Message:

Add log2, log2f to math library.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/float/float2.c

    r58daded r802a8c8  
    138138};
    139139
     140static double results_log2[OPERANDS] = {
     141        1.807354922058, 6.643856189775, 5.643856189775, 9.585555236434,
     142        10.077483355524, 0.000000000000, 6.044394119358, 1.442695040889,
     143        3.307428525192, -9.965784284662
     144};
     145
    140146static double results_sin[OPERANDS] = {
    141147        -0.350783227690, -0.863209366649, -0.506365641110, -0.262374853704,
     
    431437
    432438        for (unsigned int i = 0; i < OPERANDS; i++) {
     439                double res = log2(arguments_log[i]);
     440
     441                if (!cmp_double(res, results_log2[i])) {
     442                        TPRINTF("Double precision log2 failed "
     443                            "(%lf != %lf, arg %u)\n", res, results_log2[i], i);
     444                        fail = true;
     445                }
     446        }
     447
     448        for (unsigned int i = 0; i < OPERANDS; i++) {
     449                float res = log2f(arguments_log[i]);
     450
     451                if (!cmp_float(res, results_log2[i])) {
     452                        TPRINTF("Single precision log2 failed "
     453                            "(%f != %lf, arg %u)\n", res, results_log2[i], i);
     454                        fail = true;
     455                }
     456        }
     457
     458        for (unsigned int i = 0; i < OPERANDS; i++) {
    433459                double res = sin(arguments[i]);
    434460
Note: See TracChangeset for help on using the changeset viewer.