Solved a problem that plagued two days, Fixed Point Calculation Problem

Source: Internet
Author: User

The denominator is reduced, which is equivalent to moving left.

---------------------------------------------------------
Statement:
This article is original. You are welcome to reprint it. Please keep the following information for reprinting.
Author: afreez Beijing-Zhongguancun
Contact: afreez.gan@gmail.com (welcome to contact the author)
Initial Release Date: 2006-12-06

Without my consent, I shall not use words for commercial or profit purposes. Otherwise, the author has the right to pursue relevant responsibilities!

---------------------------------------------------------

A = 1-B/C;
| B | <POW (2, 23)
| C | = POW (2, 26)

| A | <1

During the operation, you need to convert the operation to a fixed point operation.
I thought about how to ensure the accuracy of a after two days, because a may be small.
A <= 8;
The accuracy of a cannot be guaranteed.

When I was about to leave work today, I suddenly had the opportunity:
C >>=6;
B <= 8;
A = 1 <14-b/C; // equivalent to a <14, ensuring the accuracy of

The numerator cannot shift too many places to the left, and the denominator shifts right to solve the problem.
Divergent thinking is easy to say and difficult to do!

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.