5/15/2019 Square Root - Direct Method Square Root - Direct Method - - PowerPoint PPT Presentation

5 15 2019 square root direct method square root direct
SMART_READER_LITE
LIVE PREVIEW

5/15/2019 Square Root - Direct Method Square Root - Direct Method - - PowerPoint PPT Presentation

5/15/2019 Square Root - Direct Method Square Root - Direct Method In IEEE floating point standard a real number is To help the calculation of represented as : 1 2 the representation of R must be changed into = 1


slide-1
SLIDE 1

5/15/2019 1

February 2017 Square Root

∈ 0, 1 In IEEE floating point standard a real number is represented as : In 32-bit representation :

normal sub-normal

−1 × × 2 ∈ 1, 2 ∈ −126, ⋯ , 127 ∈ 0, 2

Or if

= −127

Square Root - Direct Method

February 2017 Square Root

We seek to calculate the positive real number

Square Root - Direct Method

Let R be a positive real number ( )

  • = −1 ×

× 2

  • is easy to calculate
  • 2

is odd

  • ... except when

= 0

= −1 × × 2

February 2017 Square Root

where

To help the calculation of

Square Root - Direct Method

the representation of R must be changed into

  • = −1 × ′ × 2

= 0 = Int 2

  • ∈ 0, 4

Then with

= −1 × × 2 ∈ 0, 2

February 2017 Square Root

Square Root - Direct Method

However, when the calculation of may lead to a lost of precision ′ ∈ 0, 1 ′ Therefore if ′ = 0 ′ = 0 and if is decreased and is until it can fit within ′ ∈ 0, 1 ′ ′ 1, 4 ×2

slide-2
SLIDE 2

5/15/2019 2

February 2017 Square Root

Then, the problem can be stated as :

Square Root - Direct Method

Given a positive real number ∈ 1, 4 ∈ 1, 2 we seek to calculate such as =

  • Let be an approximation of coded on n+1 bits

!

  • such as

! = " #$% × 2$%

! %&'

!

≤ < ! + 2$!

We propose to calculate digit-by-digit !

February 2017 Square Root

0 0 0 0 0

?

2$, 2$

  • $,
  • 2'

Square Root - Direct Method

Let such as

  • $, = " #$% × 2$%
  • $,

%&'

  • $,

≤ < -$, + 2$(-$,) 2$-

February 2017 Square Root

Let

Square Root - Direct Method

such as

  • = " #$% × 2$%
  • %&'
  • ≤ < - + 2$-

At each iteration is obtained from

  • $,
  • = -$, + #$-2$-

#$- ∈ 0, 1 is denoted

  • 2$-

February 2017 Square Root

Square Root - Direct Method

Let Δ- = − -

  • ≤ < - + 2$-

0 ≤ − -

< - + 2$- − -

  • 0 ≤ Δ- < 2$- 2- + 2$-

yet

  • < 2

and - + 2$- ≤ 2 then 0≤Δ

  • < 4×2

$-

  • At each iteration the upper bound
  • f

is divided by 2 0 ≤ Δ' < 4 Δ-

slide-3
SLIDE 3

5/15/2019 3

February 2017 Square Root

Square Root - Direct Method

Δ- = − -

  • Δ- = − -$, + #$-2$-

Δ- = − -$,

+ 2#$-2$--$, + #$-2$-2$-

Δ- = Δ-$, − #$-2$- 2-$, + 2$- 2-Δ- = 2-Δ-$, − #$- 2-$, + 2$- Let 2- = 2-Δ- 2- = 22-$, − #$- 2-$, + 2$-

such as 0 ≤ 2-

#$- = 1

{

February 2017 Square Root

Square Root - Direct Method

Iteration scheme : 2- = 22-$, − #$- 2-$, + 2$-

such as 0 ≤ 2-

#$- = 1

{

  • = -$, + #$-2$-

2- = 2 2-$, − #$- -$, + 2$-$,

such as 0 ≤ 2-

#$- = 1

{

February 2017 Square Root

Implementation

Dk-1 Wk-1 Xk-1

subtract

  • r

>> 2

zero detect last weight

  • r

Square Root - Direct Method

>> 1 << 1

  • =
  • $,+ #$-2$-

2

  • = 2 2
  • $, −#$-
  • $, +2$-$,
  • = 2$- = 2$,0
  • $,
  • =
  • $,+ #$-2$,0
  • $,

2

  • = 2 2
  • $, −#$-
  • $, +2$0
  • $,

February 2017 Square Root

2$, 2$

? ? 0 0 0

  • $
  • 2'
  • = -$ + 2#$-3, + #$- 2$-

#$-3, #$-

radix 4 Square Root - Direct Method - Improvement

slide-4
SLIDE 4

5/15/2019 4

February 2017 Square Root

Square Root - Direct Method - Improvement radix 4

#$-3, = 0, #$- = 0 2- = 4 2-$

  • = -$

#$-3, = 0, #$- = 1 2

  • = 4 2
  • $ −1 2
  • $ +1 × 2$-$,
  • = -$ + 1 × 2$-

#$-3, = 1, #$- = 0 2

  • = 4 2
  • $ − -$ +2 × 2$-$,
  • = -$ + 2 × 2$-

#$-3, = 1, #$- = 1 2

  • = 4 2
  • $ − 3 2
  • $ + 3× 2$-$,
  • = -$ + 3 × 2$-

February 2017 Square Root

  • r

>> 1

subtract

  • r

>> 2 << 1

Implementation Square Root - Direct Method - Improvement

zero detect last weight 2- = 4 2-$

  • = -$

2

  • = 4 2
  • $ −1 2
  • $ +1×2$-$,
  • = -$ + 1 × 2$-

2

  • = 4 2
  • $ −
  • $ +2×2$-$,
  • = -$ + 2 × 2$-

2

  • = 4 2
  • $ −3 2
  • $ +3×2$-$,
  • = -$ + 3 × 2$-
  • r
  • r
  • r

×3×2

$

×2×2

$

×1×2

$

>> 2 << 2

−1 2

  • $ +1×2

$-$,

  • $ +2×2

$-$,

−3 2

  • $ +3×2

$-$,

Dk-1 Wk-1 Xk-1 Dk-2 Xk-2 Wk-2