Exactly what I learnt in my last lesson in Micros lecture only last week. I was amazed the amount of code required to do floating point calculation compared to integer based calculation.
One disadvantage I found which will have an affect more on Arduino platforms is the integer based calculation quickly use up 8, 16 and 32 bit integers. So the best platforms are high speed 32 bit processors now. Freescale have a function called umuldiv() that is specifically catered for integer based floating point calculations and just places two integers and a scaling factor.
I am steering away from Arduino platforms for more complex application and starting to other platforms like Freescale and dsPIC and PIC32.
Some of the development boards I have a super powerful and nice to program plus unusually cheaper than Arduino. The best I have for is the PIC EasyFusion v7 and the C compiler for great development, while the nice small platform solution is the Freescale KL25z which only cost $29.00 and has Arduino compatible headers.
I am sure there are plenty of development platforms out there that are just as good though, but i have too many including Beaglebone Black and other smaller stuff. I am not really interested in the Beaglbone though.
Another
really really cool platform is the PSoc4 platform which as a brilliant IDE that is component based and I believe super easy to develop. I will consider this as a possible option after completing this semester.
Quote:
Originally Posted by Garbz
For efficient code you want to as avoid using any floats single or double (which means no decimal places) and avoid performing any math which results in a division that has a decimal place. Hence in the above code the /5 is an expensive instruction however the *410>>11 is not (this is the same as *410/2048 which is divide by 4.99512 so in our application effectively the same).
|