I have the results of my floating point test.
The function I use to print numbers to the serial port only works for integers, so I used conditional logic to determine if the answer was correct or not.
In the main thread, I had:
Code: Select all
// Floating point test
xvar = sinf(30);
if (xvar = 0.50) {
debug_println("Float Success");
} else {
debug_println("Float Fail");
}Where xvar is of type 'float'.
Running the program yielded "Float Success".
However, when using sinf(60), I get a float fail when testing like this:
Code: Select all
if (xvar > 0.80)I'm hoping this isn't because I suck at math (because I like to think I don't..!). Using my calculator, I've found that sin(60) = 0.86603 (5dp).
Is there something I did wrong with the test? If this proves that floating point actually does work, then I will do some more testing in the Controller thread...
Cheers,
MM