4. Number of points to simulate floating-point operations and common strategies
I believe that you have understood the general situation of converting a floating point to a fixed point operation. In fact, the principle is very simple. If it is applied to actual projects, various problems may occur. In my experience, there are several common strategies:
--------------------------------------------------------
Statement:
This article is original. You are welcome to reprint it. Please keep the following information for reprinting.
Author: Afreez Beijing - Zhongguancun
Contact info: Afreez.gan@gmail.com (Welcome to discuss with the author)
Initial Release Date: 2007-02-08
Initial Release on: Http://blog.csdn.net/ganxingming/
Without my consent, I shall not use words for commercial or profit purposes. Otherwise, the author has the right to pursue relevant responsibilities!
---------------------------------------------------------
1)Division to multiplication or shift
We know that, regardless of the hardware platform transformation, Division operations require much more clock cycles than multiplication operations and addition and subtraction shift operations, especially in embedded applications, "efficiency" is particularly important. Based on my experience, a large part of Division operations in the project can be converted into multiplication and shift operations, which greatly improves the efficiency.
2)Table store
Some arithmetic expressions may involve a lot of headaches in mathematical formulas, especially on the embedded hardware platform. This is a headache because the hardware-related software platform provides limited functions, some do not have many mathematical formulas such as "common" operators. If this type of operation rarely appears in a project and the number of its values is small, you can consider analyzing various situations, make various possible results into a static table (which can be understood as an array), and then use a simple conditional judgment statement to solve this type of problem.
3)Level Expansion
The problem background is the same as above. For some mathematical formulas, if the value range is not easy to handle, you can use the series expansion method.
4)Simultaneous variation of molecular denominator
For some Division operations, to ensure accuracy, if the molecular expansion range is not large enough, you can reduce the denominator or achieve the expected results. For specific examples, refer to my other article.Article" Solved a problem 2 Daily problems , Fixed Point Operation Problems ".