MATHLIB User Guide
MATHLIB_div_scalar.h
Go to the documentation of this file.
1
/* ======================================================================== *
2
* MATHLIB -- TI Floating-Point Math Function Library *
3
* *
4
* *
5
* Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/ *
6
* *
7
* *
8
* Redistribution and use in source and binary forms, with or without *
9
* modification, are permitted provided that the following conditions *
10
* are met: *
11
* *
12
* Redistributions of source code must retain the above copyright *
13
* notice, this list of conditions and the following disclaimer. *
14
* *
15
* Redistributions in binary form must reproduce the above copyright *
16
* notice, this list of conditions and the following disclaimer in the *
17
* documentation and/or other materials provided with the *
18
* distribution. *
19
* *
20
* Neither the name of Texas Instruments Incorporated nor the names of *
21
* its contributors may be used to endorse or promote products derived *
22
* from this software without specific prior written permission. *
23
* *
24
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
25
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
26
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
27
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
28
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
29
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
30
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
31
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
32
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
33
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
34
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
35
* ======================================================================== */
36
37
/* ======================================================================= */
38
/* MATHLIB_div_scalar.h - single precision floating point division */
39
/* optimized inlined C implementation (w/ intrinsics) */
40
/* ======================================================================= */
41
42
#ifndef MATHLIB_DIV_SCALAR_H_
43
#define MATHLIB_DIV_SCALAR_H_ 1
44
45
#include <c6x_migration.h>
46
47
static
inline
float
MATHLIB_div_scalar
(
float
a,
float
b);
48
49
#ifndef __cplusplus
/* FOR PROTECTION PURPOSE - C++ NOT SUPPORTED. */
50
#pragma CODE_SECTION(MATHLIB_div_scalar, ".text:optci"
);
51
#endif
52
53
static
inline
float
MATHLIB_div_scalar
(
float
a,
float
b)
54
{
55
float
TWO = 2.0f;
56
float
Maxe = 3.402823466E+38f;
57
float
X;
58
59
X = _rcpsp(b);
60
X = X * (TWO - (b * X));
61
X = X * (TWO - (b * X));
62
X = a * X;
63
64
if
(a == 0.0f) {
65
X = 0.0f;
66
}
67
68
if
((_fabsf(b) > Maxe) && (_fabs(a) <= Maxe)) {
69
X = 0.0f;
70
}
71
72
return
(X);
73
}
74
75
#endif
76
77
/* ======================================================================== */
78
/* End of file: MATHLIB_div_scalar.h */
79
/* ======================================================================== */
MATHLIB_div_scalar
static float MATHLIB_div_scalar(float a, float b)
Definition:
MATHLIB_div_scalar.h:53
src
MATHLIB_div
MATHLIB_div_scalar.h
Generated by
1.9.1