Skip to content

Commit a778b79

Browse files
author
camilo
committed
small fixes
1 parent a682794 commit a778b79

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

check/qlibs_cpp_test.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ void test_ltisys( void )
299299
void test_ffmath(void)
300300
{
301301
cout << "ffmath" << endl;
302+
cout << ffmath::sqrt( 0.5f ) << endl;
302303
cout << ffmath::exp( 0.5f ) << endl;
303304
cout << ffmath::log( 0.5f ) << endl;
304305
cout << ffmath::sin( 0.5f ) << endl;
@@ -328,7 +329,8 @@ void test_ffmath(void)
328329
cout << ffmath::assoc_legendre( 2, 1, 0.5f ) << endl;
329330
cout << ffmath::assoc_legendre( 2, 2, 0.5f ) << endl;
330331

331-
332+
std::cout << "beta" << std::endl;
333+
std::cout << ffmath::beta(0.123f, 1.0f - 0.123f) << std::endl;
332334
std::cout << ffmath::beta(0.1f, 0.2f) << std::endl;
333335
std::cout << "comp_ellint_1" << std::endl;
334336
std::cout << ffmath::comp_ellint_1( 0.0f ) << std::endl;

check/sa_check.ewp

+3
Original file line numberDiff line numberDiff line change
@@ -2237,6 +2237,9 @@
22372237
<file>
22382238
<name>$PROJ_DIR$\..\src\include\pid.hpp</name>
22392239
</file>
2240+
<file>
2241+
<name>$PROJ_DIR$\..\src\include\qlibs_types.hpp</name>
2242+
</file>
22402243
<file>
22412244
<name>$PROJ_DIR$\..\src\include\rms.hpp</name>
22422245
</file>

check/sa_check.ewt

+3
Original file line numberDiff line numberDiff line change
@@ -2967,6 +2967,9 @@
29672967
<file>
29682968
<name>$PROJ_DIR$\..\src\include\pid.hpp</name>
29692969
</file>
2970+
<file>
2971+
<name>$PROJ_DIR$\..\src\include\qlibs_types.hpp</name>
2972+
</file>
29702973
<file>
29712974
<name>$PROJ_DIR$\..\src\include\rms.hpp</name>
29722975
</file>

src/ffmath.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ struct limits {
1212

1313
constexpr uint32_t F32_NO_SIGN_MASK = 0x7FFFFFFFU;
1414
constexpr uint32_t F32_SIGN_MASK = 0x80000000U;
15-
constexpr uint32_t F32_EXPONENT_MASK = 0x7F800000U;
16-
constexpr uint32_t F32_MANTISSA_MASK = 0x007FFFFFU;
17-
constexpr uint32_t F32_MANTISSA_NBITS = 23U;
1815

1916
using namespace qlibs;
2017

@@ -1797,7 +1794,7 @@ float ffmath::comp_ellint_1( float k )
17971794
{
17981795
float y;
17991796

1800-
if ( ffmath::isNan( k ) || ( absolute( k ) >= 1.0F ) ) {
1797+
if ( ffmath::isNan( k ) || ( absolute( k ) >= 1.0F ) ) { //no side effects
18011798
y = ffmath::getNan();
18021799
}
18031800
else {

src/include/interp1.hpp

+5-8
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
* @author J. Camilo Gomez C.
44
* @version 1.01
55
* @note This file is part of the qLibs-cpp distribution.
6-
* @brief Helper class that implements a Tapped Delay Line (TDL). A TDL is a
7-
* delay line that provides access to its contents at arbitrary intermediate
8-
* delay length values.
9-
* This class runs in constant time O(1), so it becomes useful when you need to
10-
* work with long delayed lines.
6+
* @brief 1D Interpolation Class
117
**/
128

139
#ifndef QLIBS_INTERP1
@@ -24,9 +20,9 @@ namespace qlibs {
2420
* @{
2521
*/
2622

27-
/**
28-
* @brief An enum with all the available interpolation methods.
29-
*/
23+
/**
24+
* @brief An enum with all the available interpolation methods.
25+
*/
3026
enum interp1Method {
3127
INTERP1_NEXT = 0, /*!< Return the next neighbor.*/
3228
INTERP1_PREVIOUS, /*!< Return the previous neighbor.*/
@@ -170,6 +166,7 @@ namespace qlibs {
170166
* @brief Interpolate input point @a x to determine the value of @a y
171167
* at the points @a xi using the current method. If value is beyond
172168
* the endpoints, extrapolation is performed using the current method.
169+
* @param[in] x The input point.
173170
* @return @c The interpolated-extrapolated @a y value.
174171
*/
175172
inline real_t get( const T x ) noexcept

src/interp1.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ bool interp1::setMethod( const interp1Method m ) noexcept
2020
&interp1::cSpline,
2121
};
2222

23-
if ( ( m > 0 ) && ( m < INTERP1_MAX ) ) {
23+
if ( ( m >= 0 ) && ( m < INTERP1_MAX ) ) {
2424
method = im[ m ];
2525
retValue = true;
2626
}

0 commit comments

Comments
 (0)