Changeset 992ffa6 in mainline for uspace/lib/math/generic/trig.c


Ignore:
Timestamp:
2015-09-04T06:40:20Z (9 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
01cdd5a
Parents:
bae1e1f
Message:

Add exp(f), log(f), pow(f). Improve precision of sin, cos.

File:
1 edited

Legend:

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

    rbae1e1f r992ffa6  
    3636#include <trig.h>
    3737
    38 #define TAYLOR_DEGREE  13
     38#define TAYLOR_DEGREE_32 13
     39#define TAYLOR_DEGREE_64 21
    3940
    4041/** Precomputed values for factorial (starting from 1!) */
    41 static float64_t factorials[TAYLOR_DEGREE] = {
     42static float64_t factorials[TAYLOR_DEGREE_64] = {
    4243        1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800,
    43         479001600, 6227020800
     44        479001600, 6227020800.0L, 87178291200.0L, 1307674368000.0L,
     45        20922789888000.0L, 355687428096000.0L, 6402373705728000.0L,
     46        121645100408832000.0L, 2432902008176640000.0L, 51090942171709440000.0L
    4447};
    4548
     
    6164        float64_t nom = 1;
    6265       
    63         for (unsigned int i = 0; i < TAYLOR_DEGREE; i++) {
     66        for (unsigned int i = 0; i < TAYLOR_DEGREE_64; i++) {
    6467                nom *= arg;
    6568               
     
    9093        float64_t nom = 1;
    9194       
    92         for (unsigned int i = 0; i < TAYLOR_DEGREE; i++) {
     95        for (unsigned int i = 0; i < TAYLOR_DEGREE_64; i++) {
    9396                nom *= arg;
    9497               
Note: See TracChangeset for help on using the changeset viewer.