Floating point operation in DSP--fixed-point number simulating floating-point operation and common strategies _c language

Source: Internet
Author: User

4. Fixed-point number simulation floating-point operation and the common strategy

I believe that we have already understood the general picture of floating-point number conversion to fixed-point count. In fact, the principle is very simple, really apply to the actual project, you may encounter a variety of problems. With my experience, the common strategies are as follows:

1) Division conversion to multiplication or shift operations

We know that no matter the hardware platform if the transformation, the division operation requires much more than multiplication and subtraction shift operations, especially in embedded applications, "efficiency" is particularly important. To the author's experience, in fact, a large part of the project Division operations can be converted into multiplication and shift operations, efficiency is still a lot of room for improvement.

2) look-up table calculation

Some operational expressions may involve a lot of headaches in the mathematical formula, especially on the embedded hardware platform, this formula is a headache, because the hardware-related software platform to provide a limited number of functions, and some do not have many "common" mathematical formulas such as the root. If this class of operations is rarely present in the project, and the number of its value is not much, then you can consider the various situations to be analyzed, the various possible results produced into a static table (can understand a number of groups), and then a simple conditional judgment statement can solve this type of problem.

3) Series expansion

The background of the problem with the above questions. For some mathematical formulas, if the range of values is not easy to handle, you can use series expansion mode.

4) Simultaneous change of numerator and denominator

For some division operations, in order to ensure accuracy, if the molecular expansion range is not large enough, you can consider narrowing the denominator, you can achieve the desired effect. A specific example can refer to my other article "solve a problem that has been bothering for 2 days, fixed point operation Problem".

The above is the entire content of this article, I hope to give you a reference, but also hope that we support the cloud habitat community.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.