Skip to content

Commit 8e391c2

Browse files
author
camilo
committed
bump to 1.1.8
1 parent f4c0551 commit 8e391c2

File tree

6 files changed

+68
-5
lines changed

6 files changed

+68
-5
lines changed

check/qlibs_cpp_test.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,10 @@ void test_ffmath(void)
395395

396396
std::cout << "sph_legendre" << std::endl;
397397
std::cout << ffmath::sph_legendre( 3, 0, 2.2345 ) << std::endl;
398-
398+
std::cout << "copysgn" << std::endl;
399+
std::cout << ffmath::copysign( 1, -2 ) << std::endl;
400+
std::cout << ffmath::copysign( ffmath::getNan(), -2 ) << std::endl;
401+
std::cout << ffmath::copysign( ffmath::getInf(), -2 ) << std::endl;
399402
}
400403

401404
void test_mat( void )

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"maintainer": true
1717
}
1818
],
19-
"version": "1.1.7",
19+
"version": "1.1.8",
2020
"license": "MIT",
2121
"frameworks": "arduino",
2222
"platforms": "*"

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=qlibs
2-
version=1.1.7
2+
version=1.1.8
33
license=MIT
44
author=J. Camilo Gomez C. <kmilo17pet@gmail.com>
55
maintainer=J. Camilo Gomez C. <kmilo17pet@gmail.com>

src/ffmath.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,20 @@ ffmath::classification ffmath::classify( const float f )
152152
return retVal;
153153
}
154154
/*============================================================================*/
155+
float ffmath::copysign( float mag,
156+
float sgn )
157+
{
158+
uint32_t u_mag, u_sgn;
159+
160+
cast_reinterpret( u_mag, mag );
161+
cast_reinterpret( u_sgn, sgn );
162+
u_mag &= 0x7FFFFFFFU;
163+
u_mag |= u_sgn & 0x80000000U;
164+
cast_reinterpret( mag, u_mag );
165+
166+
return mag;
167+
}
168+
/*============================================================================*/
155169
float ffmath::sign( float x )
156170
{
157171
float s;
@@ -505,6 +519,11 @@ float ffmath::exp( float x )
505519
return ffmath::exp2( ffmath::FFP_LOG2E*x );
506520
}
507521
/*============================================================================*/
522+
float ffmath::expm1( float x )
523+
{
524+
return ffmath::exp2( ffmath::FFP_LOG2E*x ) - 1.0F;
525+
}
526+
/*============================================================================*/
508527
float ffmath::exp10( float x )
509528
{
510529
return ffmath::exp2( 3.32192809F*x );
@@ -515,6 +534,11 @@ float ffmath::log( float x )
515534
return ffmath::FFP_LN2*ffmath::log2( x );
516535
}
517536
/*============================================================================*/
537+
float ffmath::log1p( float x )
538+
{
539+
return ffmath::FFP_LN2*ffmath::log2( 1.0F + x );
540+
}
541+
/*============================================================================*/
518542
float ffmath::log10( float x )
519543
{
520544
return ffmath::FFP_LOG10_2*ffmath::log2( x );

src/include/ffmath.hpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,20 @@ namespace qlibs {
150150
return ( classification::FFP_NORMAL == classify( x ) );
151151
}
152152

153+
/**
154+
* @brief Composes a floating point value with the magnitude of @a mag
155+
* and the sign of @a sgn
156+
* @param[in] mag floating-point value.
157+
* @param[in] sgn floating-point value
158+
* @return The floating point value with the magnitude of @a mag and the
159+
* sign of @a sgn is returned. If @a mag is @c nan, then @c nan with the
160+
* sign of @a sgn is returned. if @c sgn is @c -0, the result is only
161+
* negative if the implementation supports the signed zero consistently
162+
* in arithmetic operations.
163+
*/
164+
float copysign( float mag,
165+
float sgn );
166+
153167
/**
154168
* @brief Computes the sign function ( signum function).
155169
* @param[in] x The floating point value
@@ -386,6 +400,17 @@ namespace qlibs {
386400
*/
387401
float exp( float x );
388402

403+
/**
404+
* @brief Returns @a e raised to the given power minus one <tt>e^x-1</tt>
405+
* power @a x.
406+
* @param[in] x The floating point value
407+
* @return Upon successful completion, the base-e exponential of @a x minus
408+
* one <tt>e^(x)-1</tt> is returned. If the range validation fails due
409+
* to overflow, @c +inf is
410+
* returned.
411+
*/
412+
float expm1( float x );
413+
389414
/**
390415
* @brief Computes the value of 10 raised to the power of @a x.
391416
* @param[in] x The floating point value
@@ -404,6 +429,17 @@ namespace qlibs {
404429
*/
405430
float log( float x );
406431

432+
/**
433+
* @brief Computes the natural (base e) logarithm of 1 plus the given
434+
* number @a x @c ln(1+x) .
435+
* @param[in] x The floating point value
436+
* @return Upon successful completion, the natural (base-e) logarithm
437+
* of 1 plus the given number @a x @c ln(1+x) is returned. If the domain
438+
* validation fails, a @c nan value is returned. If the pole validation
439+
* fails, @c -inf is returned.
440+
*/
441+
float log1p( float x );
442+
407443
/**
408444
* @brief Computes the common (base-10) logarithm of @a x.
409445
* @param[in] x The floating point value

src/qlibs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ This file is part of the QuarkTS++ OS distribution.
4141
#ifndef QLIBS_CPP_H
4242
#define QLIBS_CPP_H
4343

44-
#define QLIBS_CPP_VERSION "1.1.7"
45-
#define QLIBS_CPP_VERNUM ( 117U )
44+
#define QLIBS_CPP_VERSION "1.1.8"
45+
#define QLIBS_CPP_VERNUM ( 118U )
4646
#define QLIBS_CPP_CAPTION "qLibs++" QLIBS_CPP_VERSION
4747

4848
#include <include/qlibs_types.hpp>

0 commit comments

Comments
 (0)