Content area
Full text
Until very recently, using floating point computations in firmware required too heavy a penalty in code space and computation time. Now there are a number of relatively inexpensive microcontrollers which have single-precision floating point capabilities implemented in hardware. Now I don't hesitate to include floating point computations in the firmware I design for a variety of medical devices.
Here are 4 things I recommend while coding and debugging floating point calculations in Digital Health and ultrasound applications.
1. Check Code Execution Time Regularly
Burning excessive CPU time can crop up for many reasons and not just for teething issues with a new tool chain or getting used to a new compiler. For instance, it's really easy to forget the "f" at the end of a constant and suddenly a whole line of math gets promoted to double. It's pretty easy to accidentally prevent the compiler from even using the floating-point unit (FPU). Plus there's still plenty of computations that can only be implemented in software.
Some functions just take a bunch of time, although not always predictably. The mod operator is a good example. If the dividend is considerably bigger than the divisor then it often...