Ignore:
File:
1 edited

Legend:

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

    r9adb61d ra35b458  
    6464        float32_t ret = 0;
    6565        float32_t nom = 1;
    66        
     66
    6767        for (unsigned int i = 0; i < TAYLOR_DEGREE_32; i++) {
    6868                nom *= arg;
    69                
     69
    7070                if ((i % 4) == 0)
    7171                        ret += nom / factorials[i];
     
    7373                        ret -= nom / factorials[i];
    7474        }
    75        
     75
    7676        return ret;
    7777}
     
    9393        float64_t ret = 0;
    9494        float64_t nom = 1;
    95        
     95
    9696        for (unsigned int i = 0; i < TAYLOR_DEGREE_64; i++) {
    9797                nom *= arg;
    98                
     98
    9999                if ((i % 4) == 0)
    100100                        ret += nom / factorials[i];
     
    102102                        ret -= nom / factorials[i];
    103103        }
    104        
     104
    105105        return ret;
    106106}
     
    122122        float32_t ret = 1;
    123123        float32_t nom = 1;
    124        
     124
    125125        for (unsigned int i = 0; i < TAYLOR_DEGREE_32; i++) {
    126126                nom *= arg;
    127                
     127
    128128                if ((i % 4) == 1)
    129129                        ret -= nom / factorials[i];
     
    131131                        ret += nom / factorials[i];
    132132        }
    133        
     133
    134134        return ret;
    135135}
     
    151151        float64_t ret = 1;
    152152        float64_t nom = 1;
    153        
     153
    154154        for (unsigned int i = 0; i < TAYLOR_DEGREE_64; i++) {
    155155                nom *= arg;
    156                
     156
    157157                if ((i % 4) == 1)
    158158                        ret -= nom / factorials[i];
     
    160160                        ret += nom / factorials[i];
    161161        }
    162        
     162
    163163        return ret;
    164164}
     
    179179{
    180180        unsigned int period = arg / (M_PI / 4);
    181        
     181
    182182        switch (period) {
    183183        case 0:
     
    212212{
    213213        unsigned int period = arg / (M_PI / 4);
    214        
     214
    215215        switch (period) {
    216216        case 0:
     
    245245{
    246246        unsigned int period = arg / (M_PI / 4);
    247        
     247
    248248        switch (period) {
    249249        case 0:
     
    278278{
    279279        unsigned int period = arg / (M_PI / 4);
    280        
     280
    281281        switch (period) {
    282282        case 0:
     
    308308{
    309309        float32_t base_arg = fmod_f32(arg, 2 * M_PI);
    310        
     310
    311311        if (base_arg < 0)
    312312                return -base_sin_32(-base_arg);
    313        
     313
    314314        return base_sin_32(base_arg);
    315315}
     
    327327{
    328328        float64_t base_arg = fmod_f64(arg, 2 * M_PI);
    329        
     329
    330330        if (base_arg < 0)
    331331                return -base_sin_64(-base_arg);
    332        
     332
    333333        return base_sin_64(base_arg);
    334334}
     
    346346{
    347347        float32_t base_arg = fmod_f32(arg, 2 * M_PI);
    348        
     348
    349349        if (base_arg < 0)
    350350                return base_cos_32(-base_arg);
    351        
     351
    352352        return base_cos_32(base_arg);
    353353}
     
    365365{
    366366        float64_t base_arg = fmod_f64(arg, 2 * M_PI);
    367        
     367
    368368        if (base_arg < 0)
    369369                return base_cos_64(-base_arg);
    370        
     370
    371371        return base_cos_64(base_arg);
    372372}
Note: See TracChangeset for help on using the changeset viewer.