pythagorean triple based table generation for
play

Pythagorean-Triple-Based Table Generation for Trigonometric Function - PowerPoint PPT Presentation

Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation MetaLibm Project Annual Meeting2015 Hugues de Lassus Saint-Genis Advisors: David Defour and Guillaume Revy DALI project-team, University of Perpignan Via


  1. Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation MetaLibm Project Annual Meeting’2015 Hugues de Lassus Saint-Geniès Advisors: David Defour and Guillaume Revy DALI project-team, University of Perpignan Via Domitia LIRMM, University of Montpellier 2 CNRS UMR 5506 18th February 2015

  2. Who I am in 30” Paris → 2008: bac S 2008 → 2011: CPGE 2011 → 2013: Grenoble INP 2 0 1 1 S2 2013: univ. autonome de Basse-Californie February 2014: internships (Vérimag, Argosim) October 2014: DALI/UPVD/LIRMM Grenoble August 2013 October 2014 Perpignan Ensenada, Mexico February 2014 H. de Lassus Saint-Geniès Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation 1 / 24

  3. DALI in MetaLibm 1 Background on Function Evaluation 2 Primitive Pythagorean Triples 3 Experimental Results 4 Conclusion and Perspectives 5 H. de Lassus Saint-Geniès Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation 2 / 24

  4. DALI in the MetaLibm Project Architecture-aware code generation : ◮ Parallelism, vector operations? ◮ FPU? ◮ Memory management, caches? ◮ Features like FMA, if-conversion? Focus on elementary functions Contributions : high quality code generation chain function MetaLibm interval optimized architecture code accuracy H. de Lassus Saint-Geniès Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation 2 / 24

  5. Basic Scheme for Function Evaluation x Special input yes no Floating-point number unpacking Normalization Range redution Sign and exponent computation Significand approximation Rounding decision Correct rounding computation Special output selection Result construction {± 0 , ±∞ , NaN , . . . } r H. de Lassus Saint-Geniès Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation 3 / 24

  6. Basic Scheme for Function Evaluation x Special input yes no We focus on: Floating-point number unpacking sine and cosine Normalization range reduction Range redution based on tabulated values Sign and exponent computation Significand approximation combined with Rounding decision polynomial approximations Correct rounding computation Special output selection Result construction {± 0 , ±∞ , NaN , . . . } r H. de Lassus Saint-Geniès Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation 3 / 24

  7. Basic Scheme for Sine and Cosine Evaluation Let y be a floating-point number, y ∈ F . 1 Range reduction x = y − k π x ∈ ( − π 4 , π 2 , such that 4 ] , k ∈ Z H. de Lassus Saint-Geniès Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation 4 / 24

  8. Basic Scheme for Sine and Cosine Evaluation Let y be a floating-point number, y ∈ F . 1 Range reduction x = y − k π x ∈ ( − π 4 , π 2 , such that 4 ] , k ∈ Z 2 Keeping only values in [ 0 , π/ 4 ] : x ← s · x with s = sign ( x ) H. de Lassus Saint-Geniès Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation 4 / 24

  9. Basic Scheme for Sine and Cosine Evaluation Let y be a floating-point number, y ∈ F . 1 Range reduction x = y − k π x ∈ ( − π 4 , π 2 , such that 4 ] , k ∈ Z 2 Keeping only values in [ 0 , π/ 4 ] : x ← s · x with s = sign ( x ) 3 Splitting x into high and low parts x h and x ℓ H. de Lassus Saint-Geniès Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation 4 / 24

  10. Basic Scheme for Sine and Cosine Evaluation Let y be a floating-point number, y ∈ F . 1 Range reduction x = y − k π x ∈ ( − π 4 , π 2 , such that 4 ] , k ∈ Z 2 Keeping only values in [ 0 , π/ 4 ] : x ← s · x with s = sign ( x ) 3 Splitting x into high and low parts x h and x ℓ 4 Table lookup of precomputed sine and cosine of x h H. de Lassus Saint-Geniès Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation 4 / 24

  11. Basic Scheme for Sine and Cosine Evaluation Let y be a floating-point number, y ∈ F . 1 Range reduction x = y − k π x ∈ ( − π 4 , π 2 , such that 4 ] , k ∈ Z 2 Keeping only values in [ 0 , π/ 4 ] : x ← s · x with s = sign ( x ) 3 Splitting x into high and low parts x h and x ℓ 4 Table lookup of precomputed sine and cosine of x h 5 Polynomial approximations of sine and cosine of x ℓ H. de Lassus Saint-Geniès Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation 4 / 24

  12. Basic Scheme for Sine and Cosine Evaluation Let y be a floating-point number, y ∈ F . 1 Range reduction x = y − k π x ∈ ( − π 4 , π 2 , such that 4 ] , k ∈ Z 2 Keeping only values in [ 0 , π/ 4 ] : x ← s · x with s = sign ( x ) 3 Splitting x into high and low parts x h and x ℓ 4 Table lookup of precomputed sine and cosine of x h 5 Polynomial approximations of sine and cosine of x ℓ 6 Reconstruction using basic trigonometric relations: sin ( x ) = sin ( x h ) · cos ( x ℓ ) + cos ( x h ) · sin ( x ℓ ) Then sin ( y ) depending on value of k ≡ 4 and s . H. de Lassus Saint-Geniès Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation 4 / 24

  13. Basic Scheme for Sine and Cosine Evaluation Let y be a floating-point number, y ∈ F . 1 Range reduction x = y − k π x ∈ ( − π 4 , π 2 , such that 4 ] , k ∈ Z 2 Keeping only values in [ 0 , π/ 4 ] : x ← s · x with s = sign ( x ) 3 Splitting x into high and low parts x h and x ℓ 4 Table lookup of precomputed sine and cosine of x h 5 Polynomial approximations of sine and cosine of x ℓ 6 Reconstruction using basic trigonometric relations: sin ( x ) = sin ( x h ) · cos ( x ℓ ) + cos ( x h ) · sin ( x ℓ ) Then sin ( y ) depending on value of k ≡ 4 and s . H. de Lassus Saint-Geniès Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation 4 / 24

  14. Sources of Error in the Classical Method Errors appear in: x ∈ [ 0 , π 4 ] Splitting x into ( x h , x ℓ ) x , inherently by the range reduction x h x ℓ Polynomial Table lookup approximations cos h sin h cos ( x ℓ + corr ) cos ( x ℓ ) sin ( x ℓ ) sin ( x ℓ + corr ) Reconstruction cos ( x ) = cos h ⊗ cos ( x ℓ ) ⊖ sin h ⊗ sin ( x ℓ ) sin ( x ) = sin h ⊗ cos ( x ℓ ) ⊕ cos h ⊗ sin ( x ℓ ) H. de Lassus Saint-Geniès Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation 5 / 24

  15. Sources of Error in the Classical Method Errors appear in: x ∈ [ 0 , π 4 ] Splitting x into ( x h , x ℓ ) x , inherently by the range reduction x h x ℓ sin h and cos h , which are Polynomial Table lookup approximations rounded approximations cos h sin h cos ( x ℓ + corr ) cos ( x ℓ ) sin ( x ℓ + corr ) sin ( x ℓ ) Reconstruction cos ( x ) = cos h ⊗ cos ( x ℓ ) ⊖ sin h ⊗ sin ( x ℓ ) sin ( x ) = sin h ⊗ cos ( x ℓ ) ⊕ cos h ⊗ sin ( x ℓ ) H. de Lassus Saint-Geniès Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation 5 / 24

  16. Sources of Error in the Classical Method Errors appear in: x ∈ [ 0 , π 4 ] Splitting x into ( x h , x ℓ ) x , inherently by the range reduction x h x ℓ sin h and cos h , which are Polynomial Table lookup approximations rounded approximations cos h sin h cos ( x ℓ + corr ) cos ( x ℓ ) sin ( x ℓ ) sin ( x ℓ + corr ) sin ( x ℓ ) and cos ( x ℓ ) , which are Reconstruction computed by polynomial cos ( x ) = cos h ⊗ cos ( x ℓ ) ⊖ sin h ⊗ sin ( x ℓ ) evaluation sin ( x ) = sin h ⊗ cos ( x ℓ ) ⊕ cos h ⊗ sin ( x ℓ ) H. de Lassus Saint-Geniès Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation 5 / 24

  17. Sources of Error in the Classical Method Errors appear in: x ∈ [ 0 , π 4 ] Splitting x into ( x h , x ℓ ) x , inherently by the range reduction x h x ℓ sin h and cos h , which are Polynomial Table lookup approximations rounded approximations cos h sin h cos ( x ℓ + corr ) cos ( x ℓ ) sin ( x ℓ ) sin ( x ℓ + corr ) sin ( x ℓ ) and cos ( x ℓ ) , which are Reconstruction computed by polynomial cos ( x ) = cos h ⊗ cos ( x ℓ ) ⊖ sin h ⊗ sin ( x ℓ ) evaluation sin ( x ) = sin h ⊗ cos ( x ℓ ) ⊕ cos h ⊗ sin ( x ℓ ) in the reconstruction process H. de Lassus Saint-Geniès Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation 5 / 24

  18. Sources of Error in the Classical Method Errors appear in: x ∈ [ 0 , π 4 ] Splitting x into ( x h , x ℓ ) x , inherently by the range reduction x h x ℓ sin h and cos h , which are Polynomial Table lookup approximations rounded approximations cos h sin h cos ( x ℓ + corr ) cos ( x ℓ ) sin ( x ℓ ) sin ( x ℓ + corr ) sin ( x ℓ ) and cos ( x ℓ ) , which are Reconstruction computed by polynomial cos ( x ) = cos h ⊗ cos ( x ℓ ) ⊖ sin h ⊗ sin ( x ℓ ) evaluation sin ( x ) = sin h ⊗ cos ( x ℓ ) ⊕ cos h ⊗ sin ( x ℓ ) in the reconstruction process Drawback : additional bits in computation steps for accuracy purpose H. de Lassus Saint-Geniès Pythagorean-Triple-Based Table Generation for Trigonometric Function Evaluation 5 / 24

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