5 15 2019 square root direct method square root direct
play

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


  1. 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 � × �′ × 2 �� � � = 0 where In 32-bit representation : � � = Int � 2 � � ∈ 0, 1 � � ∈ 0, 4 � ∈ 1, 2 � ∈ 0, 2 Or � ∈ −126, ⋯ , 127 � = −127 if � = −1 � × � � ∈ 0, 2 � � × 2 � � with Then normal sub-normal Square Root February 2017 Square Root February 2017 Square Root - Direct Method Square Root - Direct Method � = −1 � × � × 2 � Let R be a positive real number ( ) � = 0 �′ ∈ 0, 1 �′ However, when the calculation of may lead to a lost of precision � We seek to calculate the positive real number � = −1 � × � × 2 � � � �′ = 0 �′ = 0 Therefore if �′ ∈ 0, 1 �′ �′ ×2 � and if is decreased and is � is easy to calculate ... except when is odd 1, 4 2 until it can fit within Square Root February 2017 Square Root February 2017 1

  2. 5/15/2019 Square Root - Direct Method Square Root - Direct Method - Then, the problem can be stated as : � ≤ � < � - + 2 $- � � - = " # $% × 2 $% � - Let such as Given a positive real number � ∈ 1, 4 %&' we seek to calculate such as � � = � � � � � ∈ 1, 2 � - � -$, is obtained from At each iteration � ! � � Let be an approximation of coded on n +1 bits � - = � -$, + # $- 2 $- # $- ∈ 0, 1 ! � ≤ � < � ! + 2 $! � � ! = " # $% × 2 $% � ! 2 $- 0 such as is denoted - %&' � ! We propose to calculate digit-by-digit Square Root February 2017 Square Root February 2017 Square Root - Direct Method Square Root - Direct Method -$, � ≤ � < � - + 2 $- � � - � -$, = " # $% × 2 $% Let such as � < � - + 2 $- � − � - %&' � ≤ � < � -$, + 2 $(-$,) � � Let Δ - = � − � - � 0 ≤ � − � - � -$, 0 ≤ Δ - < 2 $- 2� - + 2 $- � � - < 2 yet and � - + 2 $- ≤ 2 � - 2 $, 2 $- $- 0≤Δ - < 4×2 � -$, then 0 ≤ Δ ' < 4 o 0 0 0 0 0 ? o At each iteration the upper bound 2 ' 2 $� Δ - of is divided by 2 Square Root February 2017 Square Root February 2017 2

  3. 5/15/2019 Square Root - Direct Method Square Root - Direct Method zero Implementation � Δ - = � − � - detect Δ - = � − � -$, + # $- 2 $- � 2 - = 2 2 -$, −# $- � -$, +2 $� 0 -$, +2 $-$, 2 - = 2 2 -$, −# $- � -$, -$, + # $- 2 $- -$, + # $- 2 $, 0 � � - = � - = � D k-1 -$, � + 2# $- 2 $- � -$, + # $- 2 $- 2 $- << 1 Δ - = � − � -$, subtract - = 2 $- = 2 $, 0 0 -$, Δ - = Δ -$, − # $- 2 $- 2� -$, + 2 $- { or X k-1 or 2 - Δ - = 2 - Δ -$, − # $- 2� -$, + 2 $- Let 2 - = 2 - Δ - >> 2 W k-1 >> 1 0 2 - = 22 -$, − # $- 2� -$, + 2 $- such as 0 ≤ 2 - # $- = last 1 weight Square Root February 2017 Square Root February 2017 { Square Root - Direct Method Square Root - Direct Method - Improvement radix 4 0 2 - = 22 -$, − # $- 2� -$, + 2 $- � - = � -$� + 2# $-3, + # $- 2 $- # $- = such as 0 ≤ 2 - 1 � - { Iteration scheme : # $-3, # $- 2 $, � -$� 2 - = 2 2 -$, − # $- � -$, + 2 $-$, ? ? 0 0 0 � - = � -$, + # $- 2 $- 0 # $- = such as 0 ≤ 2 - 2 ' 2 $� 1 Square Root February 2017 Square Root February 2017 3

  4. 5/15/2019 Square Root - Direct Method - Improvement radix 4 2 - = 4 2 -$� # $-3, = 0, # $- = 0 � - = � -$� -$� −1 2 � -$� +1 × 2 $-$, # $-3, = 0, # $- = 1 2 - = 4 2 � � - = � -$� + 1 × 2 $- -$� − � -$� +2 × 2 $-$, 2 - = 4 2 # $-3, = 1, # $- = 0 � - = � -$� + 2 × 2 $- -$� − 3 2 � -$� + 3× 2 $-$, 2 - = 4 2 � # $-3, = 1, # $- = 1 � - = � -$� + 3 × 2 $- Square Root February 2017 Square Root - Direct Method - Improvement zero Implementation detect 2 - = 4 2 -$� −1 2 $-$, � � -$� +1×2 � - = � -$� D k-2 D k-1 $-$, << 2 − � -$� +2×2 << 1 subtract -$� −1 2 -$� +1×2 $-$, 2 - = 4 2 � � −3 2 $-$, � � -$� +3×2 or � - = � -$� + 1 × 2 $- X k-2 X k-1 ×1×2 $� or or -$� +2×2 $-$, 2 - = 4 2 -$� − � $� or ×2×2 � - = � -$� + 2 × 2 $- >> 2 or W k-1 W k-2 ×3×2 $� >> 1 >> 2 -$� −3 2 2 - = 4 2 � � -$� +3×2 $-$, � - = � -$� + 3 × 2 $- last weight Square Root February 2017 4

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend