Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset ba11ebb in mainline


Ignore:
Timestamp:
2014-03-06T02:45:53Z (8 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master
Children:
c60e9ee
Parents:
47f7390f
Message:

implement generic sine and cosine functions using Taylor series approximation

Location:
uspace/lib/math
Files:
4 added
13 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/math/Makefile

    r47f7390f rba11ebb  
    4141
    4242GENERIC_SOURCES = \
     43        generic/trig.c \
     44        generic/mod.c \
    4345        generic/trunc.c
    4446
  • uspace/lib/math/arch/abs32le/include/libarch/math.h

    r47f7390f rba11ebb  
    3737
    3838#include <mathtypes.h>
     39#include <mod.h>
    3940#include <trunc.h>
     41#include <trig.h>
     42
     43static inline double fmod(double dividend, double divisor)
     44{
     45        return double_mod(dividend, divisor);
     46}
    4047
    4148static inline double trunc(double val)
     
    5259static inline double sin(double val)
    5360{
    54         // FIXME TODO
    55         return 0;
     61        return double_sin(val);
    5662}
    5763
    5864static inline double cos(double val)
    5965{
    60         // FIXME TODO
    61         return 1;
     66        return double_cos(val);
    6267}
    6368
  • uspace/lib/math/arch/amd64/include/libarch/math.h

    r47f7390f rba11ebb  
    3636#define LIBMATH_amd64_MATH_H_
    3737
     38#include <mod.h>
     39
     40static inline double fmod(double dividend, double divisor)
     41{
     42        return double_mod(dividend, divisor);
     43}
     44
    3845extern double sin(double);
    3946extern double cos(double);
  • uspace/lib/math/arch/arm32/include/libarch/math.h

    r47f7390f rba11ebb  
    3737
    3838#include <mathtypes.h>
     39#include <mod.h>
    3940#include <trunc.h>
     41#include <trig.h>
     42
     43static inline double fmod(double dividend, double divisor)
     44{
     45        return double_mod(dividend, divisor);
     46}
    4047
    4148static inline double trunc(double val)
     
    5259static inline double sin(double val)
    5360{
    54         // FIXME TODO
    55         return 0;
     61        return double_sin(val);
    5662}
    5763
    5864static inline double cos(double val)
    5965{
    60         // FIXME TODO
    61         return 1;
     66        return double_cos(val);
    6267}
    6368
  • uspace/lib/math/arch/ia32/include/libarch/math.h

    r47f7390f rba11ebb  
    3636#define LIBMATH_ia32_MATH_H_
    3737
     38#include <mod.h>
     39
     40static inline double fmod(double dividend, double divisor)
     41{
     42        return double_mod(dividend, divisor);
     43}
     44
    3845extern double sin(double);
    3946extern double cos(double);
  • uspace/lib/math/arch/ia64/include/libarch/math.h

    r47f7390f rba11ebb  
    3737
    3838#include <mathtypes.h>
     39#include <mod.h>
    3940#include <trunc.h>
     41#include <trig.h>
     42
     43static inline double fmod(double dividend, double divisor)
     44{
     45        return double_mod(dividend, divisor);
     46}
    4047
    4148static inline double trunc(double val)
     
    5259static inline double sin(double val)
    5360{
    54         // FIXME TODO
    55         return 0;
     61        return double_sin(val);
    5662}
    5763
    5864static inline double cos(double val)
    5965{
    60         // FIXME TODO
    61         return 1;
     66        return double_cos(val);
    6267}
    6368
  • uspace/lib/math/arch/mips32/include/libarch/math.h

    r47f7390f rba11ebb  
    3737
    3838#include <mathtypes.h>
     39#include <mod.h>
    3940#include <trunc.h>
     41#include <trig.h>
     42
     43static inline double fmod(double dividend, double divisor)
     44{
     45        return double_mod(dividend, divisor);
     46}
    4047
    4148static inline double trunc(double val)
     
    5259static inline double sin(double val)
    5360{
    54         // FIXME TODO
    55         return 0;
     61        return double_sin(val);
    5662}
    5763
    5864static inline double cos(double val)
    5965{
    60         // FIXME TODO
    61         return 1;
     66        return double_cos(val);
    6267}
    6368
  • uspace/lib/math/arch/mips32eb/include/libarch/math.h

    r47f7390f rba11ebb  
    3737
    3838#include <mathtypes.h>
     39#include <mod.h>
    3940#include <trunc.h>
     41#include <trig.h>
     42
     43static inline double fmod(double dividend, double divisor)
     44{
     45        return double_mod(dividend, divisor);
     46}
    4047
    4148static inline double trunc(double val)
     
    5259static inline double sin(double val)
    5360{
    54         // FIXME TODO
    55         return 0;
     61        return double_sin(val);
    5662}
    5763
    5864static inline double cos(double val)
    5965{
    60         // FIXME TODO
    61         return 1;
     66        return double_cos(val);
    6267}
    6368
  • uspace/lib/math/arch/mips64/include/libarch/math.h

    r47f7390f rba11ebb  
    3737
    3838#include <mathtypes.h>
     39#include <mod.h>
    3940#include <trunc.h>
     41#include <trig.h>
     42
     43static inline double fmod(double dividend, double divisor)
     44{
     45        return double_mod(dividend, divisor);
     46}
    4047
    4148static inline double trunc(double val)
     
    5259static inline double sin(double val)
    5360{
    54         // FIXME TODO
    55         return 0;
     61        return double_sin(val);
    5662}
    5763
    5864static inline double cos(double val)
    5965{
    60         // FIXME TODO
    61         return 1;
     66        return double_cos(val);
    6267}
    6368
  • uspace/lib/math/arch/ppc32/include/libarch/math.h

    r47f7390f rba11ebb  
    3737
    3838#include <mathtypes.h>
     39#include <mod.h>
    3940#include <trunc.h>
     41#include <trig.h>
     42
     43static inline double fmod(double dividend, double divisor)
     44{
     45        return double_mod(dividend, divisor);
     46}
    4047
    4148static inline double trunc(double val)
     
    5259static inline double sin(double val)
    5360{
    54         // FIXME TODO
    55         return 0;
     61        return double_sin(val);
    5662}
    5763
    5864static inline double cos(double val)
    5965{
    60         // FIXME TODO
    61         return 1;
     66        return double_cos(val);
    6267}
    6368
  • uspace/lib/math/arch/sparc32/include/libarch/math.h

    r47f7390f rba11ebb  
    3737
    3838#include <mathtypes.h>
     39#include <mod.h>
    3940#include <trunc.h>
     41#include <trig.h>
     42
     43static inline double fmod(double dividend, double divisor)
     44{
     45        return double_mod(dividend, divisor);
     46}
    4047
    4148static inline double trunc(double val)
     
    5259static inline double sin(double val)
    5360{
    54         // FIXME TODO
    55         return 0;
     61        return double_sin(val);
    5662}
    5763
    5864static inline double cos(double val)
    5965{
    60         // FIXME TODO
    61         return 1;
     66        return double_cos(val);
    6267}
    6368
  • uspace/lib/math/arch/sparc64/include/libarch/math.h

    r47f7390f rba11ebb  
    3737
    3838#include <mathtypes.h>
     39#include <mod.h>
    3940#include <trunc.h>
     41#include <trig.h>
     42
     43static inline double fmod(double dividend, double divisor)
     44{
     45        return double_mod(dividend, divisor);
     46}
    4047
    4148static inline double trunc(double val)
     
    5259static inline double sin(double val)
    5360{
    54         // FIXME TODO
    55         return 0;
     61        return double_sin(val);
    5662}
    5763
    5864static inline double cos(double val)
    5965{
    60         // FIXME TODO
    61         return 1;
     66        return double_cos(val);
    6267}
    6368
  • uspace/lib/math/include/math.h

    r47f7390f rba11ebb  
    3838#include <libarch/math.h>
    3939
     40#define M_PI  3.14159265358979323846
     41
    4042#endif
    4143
Note: See TracChangeset for help on using the changeset viewer.