Skip to content

Commit

Permalink
Merge pull request #3 from FranzAlbers/fix/double-float-conversion
Browse files Browse the repository at this point in the history
Fixed type conversions: Removed unnecessary float to double conversion
  • Loading branch information
freak89dutch authored Feb 6, 2023
2 parents d9e9a42 + b0fc591 commit 4fd4873
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <iostream>

const float PI=3.1415926535897932384626433832795028841971f;
const double PI=3.1415926535897932384626433832795028841971;

bool getbit(unsigned char byte, int position);
float getScaledValue(int32_t rawValue, float lsbFactor);
double getScaledValue(int32_t rawValue, double lsbFactor);
4 changes: 2 additions & 2 deletions adma_ros2_driver/src/parser/parser_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bool getbit(unsigned char byte, int position) // position in range 0-7
return (byte >> position) & 0x1;
}

float getScaledValue(int32_t rawValue, float lsbFactor)
double getScaledValue(int32_t rawValue, double lsbFactor)
{
return rawValue * lsbFactor;
return double(rawValue) * lsbFactor;
}

0 comments on commit 4fd4873

Please sign in to comment.