2009-03-20 12:42 AM
flaoting point math in Ride7?
2011-05-17 04:06 AM
Why don’t simple floating point operations work in my compiled code? I'm using Ride7.
Or must I have to activate floating point math somehow? Try this for example: float x, y; x = 1000.0; y = x * 2.0; // Works y = x * 0.5; // Error y = x / 2.0; // Error Insane results. :o2011-05-17 04:06 AM
Although it should not be necessary, Try
#include2011-05-17 04:06 AM
Hi,
I did the test also and you're right. I get something 1.1E-38 for the multiplication. (viewed in the simulator) Maybe there must be some float library be added. But I can't find in the linker config tab. Be careful tough that you must be aware of compiler optimizations. Better to write volatile in front of your float than you're sure. But I tested it without optimizations on and gave the same wrong result. So indeed we are missing something here. PS It's not needed to do any include normally to work with a float type. But it can be necessary to link with some dedicated float library for the target. ( It's the same with AVR targets based on gcc dists)2011-05-17 04:06 AM
Hello again, the problem is solved.
I have located the floating point bug to Ride7's internal simulator. When I tried the same code in hardware it debuggs ok.2011-05-17 04:06 AM
Ok thx for letting me know.
Maybe you can post this bug to the ride7 people.