Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
camilo committed Nov 20, 2024
1 parent a682794 commit a778b79
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
4 changes: 3 additions & 1 deletion check/qlibs_cpp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ void test_ltisys( void )
void test_ffmath(void)
{
cout << "ffmath" << endl;
cout << ffmath::sqrt( 0.5f ) << endl;
cout << ffmath::exp( 0.5f ) << endl;
cout << ffmath::log( 0.5f ) << endl;
cout << ffmath::sin( 0.5f ) << endl;
Expand Down Expand Up @@ -328,7 +329,8 @@ void test_ffmath(void)
cout << ffmath::assoc_legendre( 2, 1, 0.5f ) << endl;
cout << ffmath::assoc_legendre( 2, 2, 0.5f ) << endl;


std::cout << "beta" << std::endl;
std::cout << ffmath::beta(0.123f, 1.0f - 0.123f) << std::endl;
std::cout << ffmath::beta(0.1f, 0.2f) << std::endl;
std::cout << "comp_ellint_1" << std::endl;
std::cout << ffmath::comp_ellint_1( 0.0f ) << std::endl;
Expand Down
3 changes: 3 additions & 0 deletions check/sa_check.ewp
Original file line number Diff line number Diff line change
Expand Up @@ -2237,6 +2237,9 @@
<file>
<name>$PROJ_DIR$\..\src\include\pid.hpp</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\include\qlibs_types.hpp</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\include\rms.hpp</name>
</file>
Expand Down
3 changes: 3 additions & 0 deletions check/sa_check.ewt
Original file line number Diff line number Diff line change
Expand Up @@ -2967,6 +2967,9 @@
<file>
<name>$PROJ_DIR$\..\src\include\pid.hpp</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\include\qlibs_types.hpp</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\include\rms.hpp</name>
</file>
Expand Down
5 changes: 1 addition & 4 deletions src/ffmath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ struct limits {

constexpr uint32_t F32_NO_SIGN_MASK = 0x7FFFFFFFU;
constexpr uint32_t F32_SIGN_MASK = 0x80000000U;
constexpr uint32_t F32_EXPONENT_MASK = 0x7F800000U;
constexpr uint32_t F32_MANTISSA_MASK = 0x007FFFFFU;
constexpr uint32_t F32_MANTISSA_NBITS = 23U;

using namespace qlibs;

Expand Down Expand Up @@ -1797,7 +1794,7 @@ float ffmath::comp_ellint_1( float k )
{
float y;

if ( ffmath::isNan( k ) || ( absolute( k ) >= 1.0F ) ) {
if ( ffmath::isNan( k ) || ( absolute( k ) >= 1.0F ) ) { //no side effects
y = ffmath::getNan();
}
else {
Expand Down
13 changes: 5 additions & 8 deletions src/include/interp1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
* @author J. Camilo Gomez C.
* @version 1.01
* @note This file is part of the qLibs-cpp distribution.
* @brief Helper class that implements a Tapped Delay Line (TDL). A TDL is a
* delay line that provides access to its contents at arbitrary intermediate
* delay length values.
* This class runs in constant time O(1), so it becomes useful when you need to
* work with long delayed lines.
* @brief 1D Interpolation Class
**/

#ifndef QLIBS_INTERP1
Expand All @@ -24,9 +20,9 @@ namespace qlibs {
* @{
*/

/**
* @brief An enum with all the available interpolation methods.
*/
/**
* @brief An enum with all the available interpolation methods.
*/
enum interp1Method {
INTERP1_NEXT = 0, /*!< Return the next neighbor.*/
INTERP1_PREVIOUS, /*!< Return the previous neighbor.*/
Expand Down Expand Up @@ -170,6 +166,7 @@ namespace qlibs {
* @brief Interpolate input point @a x to determine the value of @a y
* at the points @a xi using the current method. If value is beyond
* the endpoints, extrapolation is performed using the current method.
* @param[in] x The input point.
* @return @c The interpolated-extrapolated @a y value.
*/
inline real_t get( const T x ) noexcept
Expand Down
2 changes: 1 addition & 1 deletion src/interp1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bool interp1::setMethod( const interp1Method m ) noexcept
&interp1::cSpline,
};

if ( ( m > 0 ) && ( m < INTERP1_MAX ) ) {
if ( ( m >= 0 ) && ( m < INTERP1_MAX ) ) {
method = im[ m ];
retValue = true;
}
Expand Down

0 comments on commit a778b79

Please sign in to comment.