1 /**
2 * \file sincos.c
3 * \brief Provide a sincos and sincosf implementation, used implicitly by gcc
4 *
5 * \date 2008-05-27
6 * \author Adam Lackorzynski <adam@os.inf.tu-dresden.de>
7 *
8 */
9 /*
10 * (c) 2008-2009 Author(s)
11 * economic rights: Technische Universität Dresden (Germany)
12 * This file is part of TUD:OS and distributed under the terms of the
13 * GNU Lesser General Public License 2.1.
14 * Please see the COPYING-LGPL-2.1 file for details.
15 */
16
17 #include <math.h>
18
19 /* The following is a tiny bit tricky, uclibc does not really provide
20 * sincos. Additionally, gcc has an optimization that merges close calls of
21 * sin and cos to sincos, i.e. sincos in here would recurse if we'd just use
22 * sin and cos. So we trick gcc by using an additional .o-file */
23
24 void sincos(double x, double *s, double *c);
25 void sincosf(float x, float *s, float *c);
26
27 double _sin(double x);
28 float _sinf(float x);
29
sincos(double x,double * s,double * c)30 void sincos(double x, double *s, double *c)
31 {
32 *s = _sin(x);
33 *c = cos(x);
34 }
35
sincosf(float x,float * s,float * c)36 void sincosf(float x, float *s, float *c)
37 {
38 *s = _sinf(x);
39 *c = cosf(x);
40 }
41