File: math.h

package info (click to toggle)
sdcc 4.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 100,120 kB
  • sloc: ansic: 935,524; cpp: 75,055; makefile: 57,615; sh: 30,106; asm: 14,243; perl: 12,136; yacc: 7,297; lisp: 1,672; python: 815; lex: 781; awk: 498; sed: 89
file content (94 lines) | stat: -rw-r--r-- 3,283 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*-------------------------------------------------------------------------
   math.h - Floating point math function declarations

   Copyright (C) 2001, Jesus Calvino-Fraga <jesusc AT ieee.org>
   Ported to PIC16 port by Vangelis Rokas, 2004 <vrokas AT otenet.gr>

   This library is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 2, or (at your option) any
   later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this library; see the file COPYING. If not, write to the
   Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
   MA 02110-1301, USA.

   As a special exception, if you link this library with other files,
   some of which are compiled with SDCC, to produce an executable,
   this library does not by itself cause the resulting executable to
   be covered by the GNU General Public License. This exception does
   not however invalidate any other reasons why the executable file
   might be covered by the GNU General Public License.
-------------------------------------------------------------------------*/

#ifndef __PIC16_MATH_H
#define __PIC16_MATH_H	1

#pragma library math

#include <sdcc-lib.h>

#define PI          3.1415926536
#define TWO_PI      6.2831853071
#define HALF_PI     1.5707963268
#define QUART_PI    0.7853981634
#define iPI         0.3183098862
#define iTWO_PI     0.1591549431
#define TWO_O_PI    0.6366197724

// EPS=B**(-t/2), where B is the radix of the floating-point representation
// and there are t base-B digits in the significand.  Therefore, for floats
// EPS=2**(-12).  Also define EPS2=EPS*EPS.
#define EPS 244.14062E-6
#define EPS2 59.6046E-9
#define XMAX 3.402823466E+38

union float_long
{
    float f;
    long l;
};

/**********************************************
 * Prototypes for float ANSI C math functions *
 **********************************************/

/* Trigonometric functions */
float sinf(float x) _MATH_REENTRANT;
float cosf(float x) _MATH_REENTRANT;
float tanf(float x) _MATH_REENTRANT;
float cotf(float x) _MATH_REENTRANT;
float asinf(float x) _MATH_REENTRANT;
float acosf(float x) _MATH_REENTRANT;
float atanf(float x) _MATH_REENTRANT;
float atan2f(float x, float y);

/* Hyperbolic functions */
float sinhf(float x) _MATH_REENTRANT;
float coshf(float x) _MATH_REENTRANT;
float tanhf(float x) _MATH_REENTRANT;

/* Exponential, logarithmic and power functions */
float expf(float x);
float logf(float x) _MATH_REENTRANT;
float log10f(float x) _MATH_REENTRANT;
float powf(float x, float y);
float sqrtf(float a) _MATH_REENTRANT;

/* Nearest integer, absolute value, and remainder functions */
float fabsf(float x) _MATH_REENTRANT;
float frexpf(float x, int *pw2);
float ldexpf(float x, int pw2);
float ceilf(float x) _MATH_REENTRANT;
float floorf(float x) _MATH_REENTRANT;
float modff(float x, float * y);

int isnan(float f);
int isinf(float f);
#endif  /* _PIC16_MATH_H */