The calculation of one source code multiplication

Source: Internet
Author: User

(1) Mathematical Principles:

Two number of original code multiplied , the product of the symbol is multiplied by two number of symbols of the XOR value , the value is equal to the product of the absolute value of two.

Assume [X] original =x0.x1x2. Xn ,

Y Original =y0. Y1y2. Yn,

Then there are: [X· Y] Original = (X0⊙Y0). [(x1x2. Xn)· (y1y2. Yn)]



(2) algorithm:

Suppose x=0.x1x2. Xn ,y=0.y1y2. Yn,

i.e. all positive decimal fraction X· y= X · 0.y1y2. Yn

= X• (2-1y1+2-2y2+...+2-n+1yn-1+2-nyn)

= X• (2-nyn+2-n+1yn-1+...+2-2y2+2-1y1)

= (.. ((0+ Yn X) 2-1+yn-1x) 2-1) + ...) +Y2X) 2-1) +y1x) 2--1)

Based on the above calculation procedure,


The available algorithms are as follows:

A0=0

a1=(a0+ynx) 2-1

A2=(a1+yn-1x) 2-1

...

an-1=(an-2+y2x) 2-1

an =(an-1+y1x) 2-1


Product X· Y=an


For example 1:

X =0.1101, y =-0.1011 for y * y


Calculation process:




For example 2:

X = -0.1011, y =-0.0110 for the original code (Y * y)


The calculation process is as follows:




Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The calculation of one source code multiplication

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.