UNIVERSITY OF MASSACHUSETTS Dept

Slides:



Advertisements
Similar presentations
Copyright © Cengage Learning. All rights reserved. 6 Inverse Functions.
Advertisements

ECIV 201 Computational Methods for Civil Engineers Richard P. Ray, Ph.D., P.E. Error Analysis.
UNIVERSITY OF MASSACHUSETTS Dept
Copyright 2008 Koren ECE666/Koren Part.6b.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
Copyright 2008 Koren ECE666/Koren Part.9b.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
Copyright 2008 Koren ECE666/Koren Sample Mid-term 2.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital.
Part 3 Truncation Errors.
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
Distributed Arithmetic: Implementations and Applications
Copyright 2008 Koren ECE666/Koren Part.6a.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
THE REAL NUMBERS College Algebra. Sets Set notation Union of sets Intersection of sets Subsets Combinations of three or more sets Applications.
Computer Arithmetic Integers: signed / unsigned (can overflow) Fixed point (can overflow) Floating point (can overflow, underflow) (Boolean / Character)
1. Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Rational Exponents, Radicals, and Complex Numbers CHAPTER 10.1Radical.
Algebra Seeing Structure in Expressions Arithmetic with Polynomials and Rational Expressions Creating Equations Reasoning with Equations and Inequalities.
Section 5.5 Inverse Trigonometric Functions & Their Graphs
CpE- 310B Engineering Computation and Simulation Dr. Manal Al-Bzoor
Rational Exponents, Radicals, and Complex Numbers
20 March 2009College Algebra Ch.41 Chapter 4 Exponential & Logarithmic Functions.
Copyright © 2013, 2009, 2005 Pearson Education, Inc. 1 3 Polynomial and Rational Functions Copyright © 2013, 2009, 2005 Pearson Education, Inc.
Chapter 4 Trigonometric Functions Inverse Trigonometric Functions Objectives:  Evaluate inverse sine functions.  Evaluate other inverse trigonometric.
June 2007 Computer Arithmetic, Function EvaluationSlide 1 VI Function Evaluation Topics in This Part Chapter 21 Square-Rooting Methods Chapter 22 The CORDIC.
Inverse Trigonometric
Copyright 2008 Koren ECE666/Koren Part.7b.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
Recursive Architectures for 2DLNS Multiplication RESEARCH CENTRE FOR INTEGRATED MICROSYSTEMS - UNIVERSITY OF WINDSOR 11 Recursive Architectures for 2DLNS.
Chapter 3 Exponential & Logarithmic Functions. 3.1 Exponential Functions Objectives –Evaluate exponential functions. –Graph exponential functions. –Evaluate.
9.3 Taylor’s Theorem: Error Analysis yes no.
Copyright © Cengage Learning. All rights reserved.
Trigonometric Identities
Inverse Trigonometric Functions
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
Warm Up Let g(x) = {(1, 3), (2, 5), (4, 10), (-3, 7)}. What is g -1(x)? Write the inverse of the function: f(x) = 2x – 3 Determine whether the function.
Definition, Domain,Range,Even,Odd,Trig,Inverse
UNIVERSITY OF MASSACHUSETTS Dept
6.6 Inverse Trigonometric Functions
Inverse Trigonometric Functions
Chapter 6 Floating Point
UNIVERSITY OF MASSACHUSETTS Dept
CSE 575 Computer Arithmetic Spring 2003 Mary Jane Irwin (www. cse. psu
4.9 – Antiderivatives.
Trigonometric Identities
2.3 Inverse Trigonometric Functions
Class Notes 9: Power Series (1/3)
Unconventional Fixed-Radix Number Systems
Today’s class Multiple Variable Linear Regression
How to represent real numbers
How to represent real numbers
Inverse Trigonometric Functions
Inverse Trigonometric Functions
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
6 The Circular Functions and Their Graphs
1.6 Inverse Functions and Logarithms
Digital Systems and Binary Numbers
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
Chapter 9: Trigonometric Identities and Equations
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
Errors and Error Analysis Lecture 2
1.2 Essential Functions.
Presentation transcript:

UNIVERSITY OF MASSACHUSETTS Dept UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer Arithmetic ECE 666 Part 9b Evaluation of Elementary Functions - II Israel Koren

Inverse Trigonometric Functions Multiplicative normalization bi=(1+j si 2 ) where If g(bi)=i=arctan(si 2 ) & y0=0 xi complex variable = Ui + jVi Recursive formulas for real and imaginary parts: (i) Ui+1 + j Vi+1 = (Ui+jVi) (1+j si 2 ) (i) Ui+1= Ui - si 2 Vi (i)’ Vi+1= Vi + si 2 Ui -i -i -i -i -i

Final Values of Um and Vm Relationship between Um, Vm and ym : Substituting bi and g(bi) Replacing xm and x0 by real and imaginary parts (Um + jVm) (cos  -j sin  ) = K (U0+jV0) Um cos  +Vm sin  =K U0 -Um sin  +Vm cos  =K V0 Set V0=0 & U0=1/K : Um=cos  and Vm=sin  K constant if si{-1, 1}

Calculate  =arccos C for given C Select si's - Um  C      obtained from ym=, Table of arctan(2 ) needed as for sine and cosine To calculate  =arcsin D select si's so that Vm  D and    arctan C: Vm 0 - tan =-V0/U0 & =-arctan(V0/U0) Set V0=C, U0=1: arctan C=- In summary si in {-1, 1} according to signs of Vi and Ui so that Vi+1 is closer to 0 -i

Example: arctan(1.0) in 10-bit Precision Final result: y11=0.11001001002 Equal to “exact” result in 10-bit precision

Approximation Error: Additive normalization x0 n-bit fraction - approaches x0 Error - ||2 Evaluate y=F(x0) by calculating Taylor series expansion:  is of order 2 - last two terms negligible Error  in y of order  dF/dx|x0 Magnitude of error depends on function F(x0) Example - exponential function F(x0)=e dF/dx|x0=e - thus ||  2 e =2 for x0 ln 2 Maximum error double size of error in argument Can be reduced by increasing number of bits in xi -n -n x0 x0 -n ln 2 -(n-1)

Approx Error: Multiplicative Normalization Error is Instead of F(x0) we calculate Taylor series expansion Natural logarithm F(x0)= ln x0 y=F(x0)+  +0(²) Error in y: ||  ||  2 - satisfactory precision -n

Speed-up Techniques: Exponential Function For i>n/2 - approximately si 2 Smaller ROM & Replace last n/2 steps by a single operation Previously canceled at least first (i-1) bits in xi: zk (k=i, i+1, … ) - single bit To cancel remaining nonzero bits in xi (in/2) select sk=zk (k>i) All remaining sk's can be predicted ahead of time In last steps calculate Since sk=zk - last term is (1+xi)  ym = yi (1+xi ) Called Termination Algorithm

Termination Algorithm Required - fast multiplier If not available - can still benefit - perform all additions of products in carry-save manner Also for F(x0)=ln x0 xi has the form: or Formula for xi+1 For xi+1 1 select sk=zk for ki In parallel calculate Based on Taylor series for ln (1+sk 2 ) - terminal approximation for in/2 : -k

Accelerate Trigonometric Functions Predict si's based on To obtain constant K - si restricted to {-1,1} If replaced by -n Deviation from exact value < 2 For i>n/2, may select sk (ki) from {0,1} and predict sk=zk, where: Can perform additions for xi, Zi and Wi in carry-save manner Reexamining series expansion of arctan - may predict sl 's for i  l  3i at once Corresponding terms added in carry-save adder For l <n/2 - still use {-1,1}

Speeding-Up First steps Use radix > 2 Example: g(bi)=1+si r (r - power of 2, say r=2 ) si  {-(r-1),-(r-2),…,-1,0,1,…,r-1} q bits of x in a single step - but increased complexity of step - si has larger range Some improvement in speed is possible Another method: allow si to assume values in {-1, 0,1} - modify selection rule so that probability of si=0 maximized Similar to variations of SRT i q

Other Techniques for Evaluating Elementary Functions (1) Use rational approximations (commonly used in software) When fast adder and multiplier available and high precision is required; e.g., extended double-precision IEEE floating-point Hardware implementation of rational approximations can compete with continued summations and multiplications when execution time and chip area are considered (2) Use polynomial approximations with look-up table

Polynomial Approximations with look-up table Domain of argument x of f(x) divided into smaller intervals (usually of equal size) - f(xi) kept in look-up table Value of f(x) at x calculated based on f(xi), for xi closest to x, and a polynomial approximation p(x-xi) for f(x-xi) Distance (x-xi) is small - simple polynomial requiring less time than a rational approximation Overall algorithm has three steps: (1) Find closest boundary point xi and calculate “reduction transformation” - usually distance d=x-xi (2) Calculate p(d) (3) Combine f(xi) with p(d) to calculate f(x)

Example - Calculating 2 in [-1,1] 32 boundary points xi=i/32, i=0,1,…,31 2 precalculated and stored in look-up table Step 1: search for xi such that |x-m-xi|  1/64, where m=-1,0,1; calculate d=(x-m-xi) ln 2 d satisfies e =2 , and |d| (ln 2)/64 Step 2: approximation for e -1 using a polynomial p2, p3 … pk precalculated coefficients of polynomial approximation of e -1 on [-(ln 2)/64, (ln 2)/64 ] Step 3: reconstruct 2 using Error bounded by 0.556 ulp (ulp=2 ) xi d x-m-xi d d x -52