You are here

The solution | Cypress Semiconductor

The solution

 You guys got were pretty quick.  This algorithm produces the rounded integer square root value..

 

Given a value y = n the sum would be the sum of the term doubled would be

 sum (0, 2, 4, 6 .......2(n-1))  = n^2 -n = (n - 1/2)^2 -1/4

 So

x >  (n-1/2)^2

The fact that y = n+1 is too large means

 (n-1/2)^2  < x < (n+1/2)^2

So y must be the rounded integer value of the square root of x.

 

Although slow, it is an easy algorithm to implement. Shifting x left two bits will result in y having an extra bit of resolution.  Sqrt(2 *256)/16 =  1.4375

 

I will be sending -050s to hli and Arther when they send me their contact information.

I can be reached at dwv*spamblock*@cypress.com

Comments

Arther's picture

Hi Dave,
How to reach at you?
When i tried to mail my contact information at davescorner@cypress.com, mail bounced back with delivery failure.

Regards,
Arther

ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.