• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Hons-and-memoization
      • Events
      • History
      • Parallelism
      • Programming
      • Start-here
      • Real
      • Debugging
      • Miscellaneous
        • Term
        • Ld
        • Hints
        • Type-set
        • Ordinals
        • ACL2-customization
        • With-prover-step-limit
        • With-prover-time-limit
        • Set-prover-step-limit
        • Set-case-split-limitations
        • Subversive-recursions
        • Local-incompatibility
        • Specious-simplification
        • Defsum
        • Oracle-timelimit
        • Thm
        • Defopener
        • Gcl
        • Case-split-limitations
        • Set-gc-strategy
        • Default-defun-mode
        • Top-level
        • Reader
        • Ttags-seen
        • Adviser
        • Ttree
        • Abort-soft
        • Defsums
        • Gc$
        • With-timeout
        • Coi-debug::fail
        • Expander
        • Gc-strategy
        • Coi-debug::assert
        • Sin-cos
          • Fast-compute-series
          • Compute-series
          • Truncated-integer-sin/cos-table
          • Truncated-integer-sin/cos-table-fn
            • Fast-compute-sin
            • Truncated-integer-sin
            • Truncated-integer-cos
            • Fast-compute-cos
          • Def::doc
          • Syntax
          • Subversive-inductions
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Sin-cos

    Truncated-integer-sin/cos-table-fn

    Helper for SIN/COS-TABLE-FN.

    Note that this function has special code for 0, \pi/2, \pi, and \frac{3}{2}\pi. The convergence of the series at these points is problematic in the context of truncation (vs. rounding).

    Definitions and Theorems

    Function: truncated-integer-sin/cos-table-fn

    (defun
     truncated-integer-sin/cos-table-fn
     (sin/cos i n pie itr scale)
     (declare
          (xargs :guard (and (or (eq sin/cos :sin) (eq sin/cos :cos))
                             (integerp i)
                             (<= 0 i)
                             (integerp n)
                             (<= 0 n)
                             (<= i n)
                             (rationalp pie)
                             (integerp itr)
                             (<= 0 itr)
                             (rationalp scale))))
     (cond
      ((zp (- n i)) nil)
      (t
       (let
        ((i/n (/ i n)))
        (cons
         (cons i
               (case sin/cos
                     (:sin (case i/n ((0 1/2) 0)
                                 (1/4 (truncate scale 1))
                                 (3/4 (truncate scale -1))
                                 (t (truncated-integer-sin (* 2 pie i/n)
                                                           itr scale))))
                     (t (case i/n (0 (truncate scale 1))
                              ((1/4 3/4) 0)
                              (1/2 (truncate scale -1))
                              (t (truncated-integer-cos (* 2 pie i/n)
                                                        itr scale))))))
         (truncated-integer-sin/cos-table-fn sin/cos (1+ i)
                                             n pie itr scale))))))