How do I find out if my embedded system has Floating Point Unit(FPU)? I'm using Keil tools. Our target board uses NXP LPC2468 series Microcontroller ? Does this microcontroller have FPU? Looking in the microcontroller manual I couldn't find any information on FPU.
Basic math facts:
60 / 10 = 6
60 / 2 = 30
1 / 2 = 0.5
0.5 * 60 = 30 Multiply by reciprocal, it's computationally cheaper
30 / 10 = 3
0.5 * 6 = 3
Done in floating point
TenthsOfHours = (int)(((Mins / 60.0) * 10.0) + 0.5); // Rounding up
In order to maintain precision with integer math we need to move the divide to the final operation = (((Mins * 10.0) / 60.0) + 0.5) = (((Mins * 1.0) / 6.0) + 0.5) = ((Mins / 6.0) + 0.5) = ((Mins + 3.0) / 6.0) = ((Mins + 3) / 6)
Thank you for explaining in detail.
I already knew basic math facts.
Thanks again! That was very helpful!
Somehow integer arithmetic is so often forgotten just because pocket calculators and PC:s can do floating point.