Support for: Fixed-point arithmetic #15
GiorgosXou
started this conversation in
Ideas
Replies: 1 comment 4 replies
-
the closest you can get to a (4-byte)-float's precision is #include <FixedPoints.h>
#include <FixedPointsCommon.h>
//#define A -9.1233450 <- why this has error 0.0000001 ????
#define A -9.1233459
#define B 0.0753235
void TestS4x27(void)
{
SFixed<4,27> a = A;
SFixed<4,27> b = B;
Serial.println(static_cast<float>(a*b), 7);
Serial.println(A*B, 7);
}
void setup()
{
Serial.begin(9600);
while(!Serial);
TestS4x27();
}
void loop(){} |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I just found out that I can speed up things by using Fixed-point arithmetic, thanks to this video at 3:19 (see also results at 5:00)
I wish i'll find some free time to do something about it, but my fucking life costs money.
Beta Was this translation helpful? Give feedback.
All reactions