mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 14:57:35 +08:00
avoid double promotions
This commit is contained in:
committed by
Lorenz Meier
parent
412f956636
commit
4b8bedef48
@@ -1,15 +1,7 @@
|
||||
#include <unit_test/unit_test.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include <px4_config.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <cfloat>
|
||||
|
||||
typedef union {
|
||||
float f;
|
||||
@@ -33,7 +25,7 @@ bool FloatTest::singlePrecisionTests()
|
||||
{
|
||||
float sinf_zero = sinf(0.0f);
|
||||
float sinf_one = sinf(1.0f);
|
||||
float sqrt_two = sqrt(2.0f);
|
||||
float sqrt_two = sqrtf(2.0f);
|
||||
|
||||
ut_assert("sinf(0.0f) == 0.0f", fabsf(sinf_zero) < FLT_EPSILON);
|
||||
ut_assert("sinf(1.0f) == 0.84147f", fabsf((sinf_one - 0.841470956802368164062500000000f)) < FLT_EPSILON);
|
||||
|
||||
@@ -64,9 +64,11 @@ using matrix::Quatf;
|
||||
using matrix::Eulerf;
|
||||
using matrix::Vector3f;
|
||||
|
||||
using std::fabs;
|
||||
|
||||
bool MatrixTest::attitudeTests()
|
||||
{
|
||||
double eps = 1e-6;
|
||||
float eps = 1e-6;
|
||||
|
||||
// check data
|
||||
Eulerf euler_check(0.1f, 0.2f, 0.3f);
|
||||
@@ -207,8 +209,9 @@ bool MatrixTest::attitudeTests()
|
||||
Quatf q_from_m(m4);
|
||||
ut_test(isEqual(q_from_m, m4));
|
||||
|
||||
// quaternion derivate
|
||||
// quaternion derivative
|
||||
Vector<float, 4> q_dot = q.derivative1(Vector3f(1, 2, 3));
|
||||
(void)q_dot;
|
||||
|
||||
// quaternion product
|
||||
Quatf q_prod_check(0.93394439f, 0.0674002f, 0.20851f, 0.28236266f);
|
||||
|
||||
Reference in New Issue
Block a user