Changeset 58775d30 in mainline for uspace/lib/math/generic/trig.c


Ignore:
Timestamp:
2015-03-16T16:07:21Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2003739
Parents:
6069061 (diff), 795e2bf (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/math/generic/trig.c

    r6069061 r58775d30  
    3939
    4040/** Precomputed values for factorial (starting from 1!) */
    41 static double factorials[TAYLOR_DEGREE] = {
     41static float64_t factorials[TAYLOR_DEGREE] = {
    4242        1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800,
    4343        479001600, 6227020800
     
    5656 *
    5757 */
    58 static double taylor_sin(double arg)
    59 {
    60         double ret = 0;
    61         double nom = 1;
     58static float64_t taylor_sin(float64_t arg)
     59{
     60        float64_t ret = 0;
     61        float64_t nom = 1;
    6262       
    6363        for (unsigned int i = 0; i < TAYLOR_DEGREE; i++) {
     
    8585 *
    8686 */
    87 static double taylor_cos(double arg)
    88 {
    89         double ret = 1;
    90         double nom = 1;
     87static float64_t taylor_cos(float64_t arg)
     88{
     89        float64_t ret = 1;
     90        float64_t nom = 1;
    9191       
    9292        for (unsigned int i = 0; i < TAYLOR_DEGREE; i++) {
     
    114114 *
    115115 */
    116 static double base_sin(double arg)
     116static float64_t base_sin(float64_t arg)
    117117{
    118118        unsigned int period = arg / (M_PI / 4);
     
    147147 *
    148148 */
    149 static double base_cos(double arg)
     149static float64_t base_cos(float64_t arg)
    150150{
    151151        unsigned int period = arg / (M_PI / 4);
     
    156156        case 1:
    157157        case 2:
    158                 return taylor_sin(arg - M_PI / 2);
     158                return -taylor_sin(arg - M_PI / 2);
    159159        case 3:
    160160        case 4:
     
    162162        case 5:
    163163        case 6:
    164                 return -taylor_sin(arg - 3 * M_PI / 2);
     164                return taylor_sin(arg - 3 * M_PI / 2);
    165165        default:
    166166                return taylor_cos(arg - 2 * M_PI);
     
    177177 *
    178178 */
    179 double double_sin(double arg)
    180 {
    181         double base_arg = fmod(arg, 2 * M_PI);
     179float64_t float64_sin(float64_t arg)
     180{
     181        float64_t base_arg = fmod(arg, 2 * M_PI);
    182182       
    183183        if (base_arg < 0)
     
    196196 *
    197197 */
    198 double double_cos(double arg)
    199 {
    200         double base_arg = fmod(arg, 2 * M_PI);
     198float64_t float64_cos(float64_t arg)
     199{
     200        float64_t base_arg = fmod(arg, 2 * M_PI);
    201201       
    202202        if (base_arg < 0)
Note: See TracChangeset for help on using the changeset viewer.