Skip to content

Commit

Permalink
bump to 1.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
camilo committed Feb 8, 2024
1 parent f4c0551 commit 8e391c2
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 5 deletions.
5 changes: 4 additions & 1 deletion check/qlibs_cpp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,10 @@ void test_ffmath(void)

std::cout << "sph_legendre" << std::endl;
std::cout << ffmath::sph_legendre( 3, 0, 2.2345 ) << std::endl;

std::cout << "copysgn" << std::endl;
std::cout << ffmath::copysign( 1, -2 ) << std::endl;
std::cout << ffmath::copysign( ffmath::getNan(), -2 ) << std::endl;
std::cout << ffmath::copysign( ffmath::getInf(), -2 ) << std::endl;
}

void test_mat( void )
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"maintainer": true
}
],
"version": "1.1.7",
"version": "1.1.8",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=qlibs
version=1.1.7
version=1.1.8
license=MIT
author=J. Camilo Gomez C. <kmilo17pet@gmail.com>
maintainer=J. Camilo Gomez C. <kmilo17pet@gmail.com>
Expand Down
24 changes: 24 additions & 0 deletions src/ffmath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,20 @@ ffmath::classification ffmath::classify( const float f )
return retVal;
}
/*============================================================================*/
float ffmath::copysign( float mag,
float sgn )
{
uint32_t u_mag, u_sgn;

cast_reinterpret( u_mag, mag );
cast_reinterpret( u_sgn, sgn );
u_mag &= 0x7FFFFFFFU;
u_mag |= u_sgn & 0x80000000U;
cast_reinterpret( mag, u_mag );

return mag;
}
/*============================================================================*/
float ffmath::sign( float x )
{
float s;
Expand Down Expand Up @@ -505,6 +519,11 @@ float ffmath::exp( float x )
return ffmath::exp2( ffmath::FFP_LOG2E*x );
}
/*============================================================================*/
float ffmath::expm1( float x )
{
return ffmath::exp2( ffmath::FFP_LOG2E*x ) - 1.0F;
}
/*============================================================================*/
float ffmath::exp10( float x )
{
return ffmath::exp2( 3.32192809F*x );
Expand All @@ -515,6 +534,11 @@ float ffmath::log( float x )
return ffmath::FFP_LN2*ffmath::log2( x );
}
/*============================================================================*/
float ffmath::log1p( float x )
{
return ffmath::FFP_LN2*ffmath::log2( 1.0F + x );
}
/*============================================================================*/
float ffmath::log10( float x )
{
return ffmath::FFP_LOG10_2*ffmath::log2( x );
Expand Down
36 changes: 36 additions & 0 deletions src/include/ffmath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,20 @@ namespace qlibs {
return ( classification::FFP_NORMAL == classify( x ) );
}

/**
* @brief Composes a floating point value with the magnitude of @a mag
* and the sign of @a sgn
* @param[in] mag floating-point value.
* @param[in] sgn floating-point value
* @return The floating point value with the magnitude of @a mag and the
* sign of @a sgn is returned. If @a mag is @c nan, then @c nan with the
* sign of @a sgn is returned. if @c sgn is @c -0, the result is only
* negative if the implementation supports the signed zero consistently
* in arithmetic operations.
*/
float copysign( float mag,
float sgn );

/**
* @brief Computes the sign function ( signum function).
* @param[in] x The floating point value
Expand Down Expand Up @@ -386,6 +400,17 @@ namespace qlibs {
*/
float exp( float x );

/**
* @brief Returns @a e raised to the given power minus one <tt>e^x-1</tt>
* power @a x.
* @param[in] x The floating point value
* @return Upon successful completion, the base-e exponential of @a x minus
* one <tt>e^(x)-1</tt> is returned. If the range validation fails due
* to overflow, @c +inf is
* returned.
*/
float expm1( float x );

/**
* @brief Computes the value of 10 raised to the power of @a x.
* @param[in] x The floating point value
Expand All @@ -404,6 +429,17 @@ namespace qlibs {
*/
float log( float x );

/**
* @brief Computes the natural (base e) logarithm of 1 plus the given
* number @a x @c ln(1+x) .
* @param[in] x The floating point value
* @return Upon successful completion, the natural (base-e) logarithm
* of 1 plus the given number @a x @c ln(1+x) is returned. If the domain
* validation fails, a @c nan value is returned. If the pole validation
* fails, @c -inf is returned.
*/
float log1p( float x );

/**
* @brief Computes the common (base-10) logarithm of @a x.
* @param[in] x The floating point value
Expand Down
4 changes: 2 additions & 2 deletions src/qlibs.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ This file is part of the QuarkTS++ OS distribution.
#ifndef QLIBS_CPP_H
#define QLIBS_CPP_H

#define QLIBS_CPP_VERSION "1.1.7"
#define QLIBS_CPP_VERNUM ( 117U )
#define QLIBS_CPP_VERSION "1.1.8"
#define QLIBS_CPP_VERNUM ( 118U )
#define QLIBS_CPP_CAPTION "qLibs++" QLIBS_CPP_VERSION

#include <include/qlibs_types.hpp>
Expand Down

0 comments on commit 8e391c2

Please sign in to comment.