NMSE Section 6.1 mentioned, B

Percentage Accurate: 78.7% → 99.6%
Time: 9.1s
Alternatives: 12
Speedup: 2.0×

Specification

?
\[\begin{array}{l} \\ \left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \end{array} \]
(FPCore (a b)
 :precision binary64
 (* (* (/ (PI) 2.0) (/ 1.0 (- (* b b) (* a a)))) (- (/ 1.0 a) (/ 1.0 b))))
\begin{array}{l}

\\
\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right)
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 12 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 78.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \end{array} \]
(FPCore (a b)
 :precision binary64
 (* (* (/ (PI) 2.0) (/ 1.0 (- (* b b) (* a a)))) (- (/ 1.0 a) (/ 1.0 b))))
\begin{array}{l}

\\
\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right)
\end{array}

Alternative 1: 99.6% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \frac{\mathsf{PI}\left(\right) \cdot \frac{0.5}{b + a}}{b \cdot a} \end{array} \]
(FPCore (a b) :precision binary64 (/ (* (PI) (/ 0.5 (+ b a))) (* b a)))
\begin{array}{l}

\\
\frac{\mathsf{PI}\left(\right) \cdot \frac{0.5}{b + a}}{b \cdot a}
\end{array}
Derivation
  1. Initial program 77.2%

    \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
  2. Add Preprocessing
  3. Applied rewrites89.5%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right)}{a + b}, \frac{0.5}{b - a} \cdot {a}^{-1}, \frac{\frac{0.5}{a + b} \cdot \frac{\mathsf{PI}\left(\right)}{b - a}}{-b}\right)} \]
  4. Applied rewrites99.6%

    \[\leadsto \color{blue}{\frac{\frac{0.5}{a + b}}{a \cdot b} \cdot \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)} \]
    2. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b}} \cdot \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right) \]
    3. associate-*l/N/A

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{2}}{a + b} \cdot \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)}{a \cdot b}} \]
    4. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{2}}{a + b} \cdot \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)}{a \cdot b}} \]
    5. lift-*.f64N/A

      \[\leadsto \frac{\frac{\frac{1}{2}}{a + b} \cdot \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)}}{a \cdot b} \]
    6. lift-/.f64N/A

      \[\leadsto \frac{\frac{\frac{1}{2}}{a + b} \cdot \left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{b - a}} \cdot \left(b - a\right)\right)}{a \cdot b} \]
    7. div-invN/A

      \[\leadsto \frac{\frac{\frac{1}{2}}{a + b} \cdot \left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \frac{1}{b - a}\right)} \cdot \left(b - a\right)\right)}{a \cdot b} \]
    8. associate-*l*N/A

      \[\leadsto \frac{\frac{\frac{1}{2}}{a + b} \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{b - a} \cdot \left(b - a\right)\right)\right)}}{a \cdot b} \]
    9. inv-powN/A

      \[\leadsto \frac{\frac{\frac{1}{2}}{a + b} \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\color{blue}{{\left(b - a\right)}^{-1}} \cdot \left(b - a\right)\right)\right)}{a \cdot b} \]
    10. pow-plusN/A

      \[\leadsto \frac{\frac{\frac{1}{2}}{a + b} \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{{\left(b - a\right)}^{\left(-1 + 1\right)}}\right)}{a \cdot b} \]
    11. metadata-evalN/A

      \[\leadsto \frac{\frac{\frac{1}{2}}{a + b} \cdot \left(\mathsf{PI}\left(\right) \cdot {\left(b - a\right)}^{\color{blue}{0}}\right)}{a \cdot b} \]
    12. metadata-evalN/A

      \[\leadsto \frac{\frac{\frac{1}{2}}{a + b} \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{1}\right)}{a \cdot b} \]
    13. *-rgt-identityN/A

      \[\leadsto \frac{\frac{\frac{1}{2}}{a + b} \cdot \color{blue}{\mathsf{PI}\left(\right)}}{a \cdot b} \]
    14. lower-*.f6499.7

      \[\leadsto \frac{\color{blue}{\frac{0.5}{a + b} \cdot \mathsf{PI}\left(\right)}}{a \cdot b} \]
  6. Applied rewrites99.7%

    \[\leadsto \color{blue}{\frac{\frac{0.5}{a + b} \cdot \mathsf{PI}\left(\right)}{a \cdot b}} \]
  7. Final simplification99.7%

    \[\leadsto \frac{\mathsf{PI}\left(\right) \cdot \frac{0.5}{b + a}}{b \cdot a} \]
  8. Add Preprocessing

Alternative 2: 96.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot 0.5\\ \mathbf{if}\;a \leq -1.95 \cdot 10^{+96}:\\ \;\;\;\;\frac{\frac{t\_0}{b \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_0}{\left(\left(b + a\right) \cdot a\right) \cdot b}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (let* ((t_0 (* (PI) 0.5)))
   (if (<= a -1.95e+96) (/ (/ t_0 (* b a)) a) (/ t_0 (* (* (+ b a) a) b)))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot 0.5\\
\mathbf{if}\;a \leq -1.95 \cdot 10^{+96}:\\
\;\;\;\;\frac{\frac{t\_0}{b \cdot a}}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{\left(\left(b + a\right) \cdot a\right) \cdot b}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.95e96

    1. Initial program 60.1%

      \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in b around 0

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \cdot \frac{1}{2} \]
      4. lower-PI.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right)}}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
      6. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
      7. unpow2N/A

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot \frac{1}{2} \]
      8. lower-*.f6475.3

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot 0.5 \]
    5. Applied rewrites75.3%

      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{b \cdot \left(a \cdot a\right)} \cdot 0.5} \]
    6. Step-by-step derivation
      1. Applied rewrites99.7%

        \[\leadsto \frac{\frac{\mathsf{PI}\left(\right) \cdot 0.5}{a \cdot b}}{\color{blue}{a}} \]

      if -1.95e96 < a

      1. Initial program 81.9%

        \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      2. Add Preprocessing
      3. Applied rewrites92.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right)}{a + b}, \frac{0.5}{b - a} \cdot {a}^{-1}, \frac{\frac{0.5}{a + b} \cdot \frac{\mathsf{PI}\left(\right)}{b - a}}{-b}\right)} \]
      4. Applied rewrites99.6%

        \[\leadsto \color{blue}{\frac{\frac{0.5}{a + b}}{a \cdot b} \cdot \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)} \]
      5. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \color{blue}{\frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)} \]
        2. *-commutativeN/A

          \[\leadsto \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right) \cdot \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b}} \]
        3. lift-/.f64N/A

          \[\leadsto \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right) \cdot \color{blue}{\frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b}} \]
        4. lift-/.f64N/A

          \[\leadsto \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right) \cdot \frac{\color{blue}{\frac{\frac{1}{2}}{a + b}}}{a \cdot b} \]
        5. associate-/l/N/A

          \[\leadsto \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right) \cdot \color{blue}{\frac{\frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)}} \]
        6. associate-*r/N/A

          \[\leadsto \color{blue}{\frac{\left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)}} \]
        7. lift-*.f64N/A

          \[\leadsto \frac{\color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)} \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
        8. lift-/.f64N/A

          \[\leadsto \frac{\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{b - a}} \cdot \left(b - a\right)\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
        9. div-invN/A

          \[\leadsto \frac{\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \frac{1}{b - a}\right)} \cdot \left(b - a\right)\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
        10. associate-*l*N/A

          \[\leadsto \frac{\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{b - a} \cdot \left(b - a\right)\right)\right)} \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
        11. inv-powN/A

          \[\leadsto \frac{\left(\mathsf{PI}\left(\right) \cdot \left(\color{blue}{{\left(b - a\right)}^{-1}} \cdot \left(b - a\right)\right)\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
        12. pow-plusN/A

          \[\leadsto \frac{\left(\mathsf{PI}\left(\right) \cdot \color{blue}{{\left(b - a\right)}^{\left(-1 + 1\right)}}\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
        13. metadata-evalN/A

          \[\leadsto \frac{\left(\mathsf{PI}\left(\right) \cdot {\left(b - a\right)}^{\color{blue}{0}}\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
        14. metadata-evalN/A

          \[\leadsto \frac{\left(\mathsf{PI}\left(\right) \cdot \color{blue}{1}\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
        15. *-rgt-identityN/A

          \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right)} \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
        16. lift-*.f64N/A

          \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right) \cdot \frac{1}{2}}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
      6. Applied rewrites95.6%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \mathsf{PI}\left(\right)}{b \cdot \left(a \cdot \left(a + b\right)\right)}} \]
    7. Recombined 2 regimes into one program.
    8. Final simplification96.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.95 \cdot 10^{+96}:\\ \;\;\;\;\frac{\frac{\mathsf{PI}\left(\right) \cdot 0.5}{b \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right) \cdot 0.5}{\left(\left(b + a\right) \cdot a\right) \cdot b}\\ \end{array} \]
    9. Add Preprocessing

    Alternative 3: 96.2% accurate, 1.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -3.1 \cdot 10^{+93}:\\ \;\;\;\;\frac{0.5}{a} \cdot \frac{\mathsf{PI}\left(\right)}{b \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right) \cdot 0.5}{\left(\left(b + a\right) \cdot a\right) \cdot b}\\ \end{array} \end{array} \]
    (FPCore (a b)
     :precision binary64
     (if (<= a -3.1e+93)
       (* (/ 0.5 a) (/ (PI) (* b a)))
       (/ (* (PI) 0.5) (* (* (+ b a) a) b))))
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;a \leq -3.1 \cdot 10^{+93}:\\
    \;\;\;\;\frac{0.5}{a} \cdot \frac{\mathsf{PI}\left(\right)}{b \cdot a}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\mathsf{PI}\left(\right) \cdot 0.5}{\left(\left(b + a\right) \cdot a\right) \cdot b}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if a < -3.10000000000000019e93

      1. Initial program 60.8%

        \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      2. Add Preprocessing
      3. Taylor expanded in b around 0

        \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
        2. lower-*.f64N/A

          \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
        3. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \cdot \frac{1}{2} \]
        4. lower-PI.f64N/A

          \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right)}}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
        5. *-commutativeN/A

          \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
        6. lower-*.f64N/A

          \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
        7. unpow2N/A

          \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot \frac{1}{2} \]
        8. lower-*.f6475.7

          \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot 0.5 \]
      5. Applied rewrites75.7%

        \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{b \cdot \left(a \cdot a\right)} \cdot 0.5} \]
      6. Step-by-step derivation
        1. Applied rewrites99.8%

          \[\leadsto \frac{\mathsf{PI}\left(\right)}{a \cdot b} \cdot \color{blue}{\frac{0.5}{a}} \]

        if -3.10000000000000019e93 < a

        1. Initial program 81.8%

          \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
        2. Add Preprocessing
        3. Applied rewrites92.7%

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right)}{a + b}, \frac{0.5}{b - a} \cdot {a}^{-1}, \frac{\frac{0.5}{a + b} \cdot \frac{\mathsf{PI}\left(\right)}{b - a}}{-b}\right)} \]
        4. Applied rewrites99.6%

          \[\leadsto \color{blue}{\frac{\frac{0.5}{a + b}}{a \cdot b} \cdot \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)} \]
        5. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)} \]
          2. *-commutativeN/A

            \[\leadsto \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right) \cdot \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b}} \]
          3. lift-/.f64N/A

            \[\leadsto \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right) \cdot \color{blue}{\frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b}} \]
          4. lift-/.f64N/A

            \[\leadsto \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right) \cdot \frac{\color{blue}{\frac{\frac{1}{2}}{a + b}}}{a \cdot b} \]
          5. associate-/l/N/A

            \[\leadsto \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right) \cdot \color{blue}{\frac{\frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)}} \]
          6. associate-*r/N/A

            \[\leadsto \color{blue}{\frac{\left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)}} \]
          7. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)} \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
          8. lift-/.f64N/A

            \[\leadsto \frac{\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{b - a}} \cdot \left(b - a\right)\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
          9. div-invN/A

            \[\leadsto \frac{\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \frac{1}{b - a}\right)} \cdot \left(b - a\right)\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
          10. associate-*l*N/A

            \[\leadsto \frac{\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{b - a} \cdot \left(b - a\right)\right)\right)} \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
          11. inv-powN/A

            \[\leadsto \frac{\left(\mathsf{PI}\left(\right) \cdot \left(\color{blue}{{\left(b - a\right)}^{-1}} \cdot \left(b - a\right)\right)\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
          12. pow-plusN/A

            \[\leadsto \frac{\left(\mathsf{PI}\left(\right) \cdot \color{blue}{{\left(b - a\right)}^{\left(-1 + 1\right)}}\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
          13. metadata-evalN/A

            \[\leadsto \frac{\left(\mathsf{PI}\left(\right) \cdot {\left(b - a\right)}^{\color{blue}{0}}\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
          14. metadata-evalN/A

            \[\leadsto \frac{\left(\mathsf{PI}\left(\right) \cdot \color{blue}{1}\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
          15. *-rgt-identityN/A

            \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right)} \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
          16. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right) \cdot \frac{1}{2}}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
        6. Applied rewrites95.5%

          \[\leadsto \color{blue}{\frac{0.5 \cdot \mathsf{PI}\left(\right)}{b \cdot \left(a \cdot \left(a + b\right)\right)}} \]
      7. Recombined 2 regimes into one program.
      8. Final simplification96.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -3.1 \cdot 10^{+93}:\\ \;\;\;\;\frac{0.5}{a} \cdot \frac{\mathsf{PI}\left(\right)}{b \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right) \cdot 0.5}{\left(\left(b + a\right) \cdot a\right) \cdot b}\\ \end{array} \]
      9. Add Preprocessing

      Alternative 4: 96.1% accurate, 2.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -2 \cdot 10^{+96}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right) \cdot 0.5}{\left(\left(b + a\right) \cdot a\right) \cdot b}\\ \end{array} \end{array} \]
      (FPCore (a b)
       :precision binary64
       (if (<= a -2e+96)
         (* (/ (PI) (* (* b a) a)) 0.5)
         (/ (* (PI) 0.5) (* (* (+ b a) a) b))))
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;a \leq -2 \cdot 10^{+96}:\\
      \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\mathsf{PI}\left(\right) \cdot 0.5}{\left(\left(b + a\right) \cdot a\right) \cdot b}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if a < -2.0000000000000001e96

        1. Initial program 60.1%

          \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
        2. Add Preprocessing
        3. Taylor expanded in b around 0

          \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
          2. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
          3. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \cdot \frac{1}{2} \]
          4. lower-PI.f64N/A

            \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right)}}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
          5. *-commutativeN/A

            \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
          6. lower-*.f64N/A

            \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
          7. unpow2N/A

            \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot \frac{1}{2} \]
          8. lower-*.f6475.3

            \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot 0.5 \]
        5. Applied rewrites75.3%

          \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{b \cdot \left(a \cdot a\right)} \cdot 0.5} \]
        6. Step-by-step derivation
          1. Applied rewrites95.5%

            \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \cdot 0.5 \]

          if -2.0000000000000001e96 < a

          1. Initial program 81.9%

            \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
          2. Add Preprocessing
          3. Applied rewrites92.8%

            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right)}{a + b}, \frac{0.5}{b - a} \cdot {a}^{-1}, \frac{\frac{0.5}{a + b} \cdot \frac{\mathsf{PI}\left(\right)}{b - a}}{-b}\right)} \]
          4. Applied rewrites99.6%

            \[\leadsto \color{blue}{\frac{\frac{0.5}{a + b}}{a \cdot b} \cdot \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)} \]
          5. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \color{blue}{\frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)} \]
            2. *-commutativeN/A

              \[\leadsto \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right) \cdot \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b}} \]
            3. lift-/.f64N/A

              \[\leadsto \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right) \cdot \color{blue}{\frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b}} \]
            4. lift-/.f64N/A

              \[\leadsto \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right) \cdot \frac{\color{blue}{\frac{\frac{1}{2}}{a + b}}}{a \cdot b} \]
            5. associate-/l/N/A

              \[\leadsto \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right) \cdot \color{blue}{\frac{\frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)}} \]
            6. associate-*r/N/A

              \[\leadsto \color{blue}{\frac{\left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)}} \]
            7. lift-*.f64N/A

              \[\leadsto \frac{\color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)} \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
            8. lift-/.f64N/A

              \[\leadsto \frac{\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{b - a}} \cdot \left(b - a\right)\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
            9. div-invN/A

              \[\leadsto \frac{\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \frac{1}{b - a}\right)} \cdot \left(b - a\right)\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
            10. associate-*l*N/A

              \[\leadsto \frac{\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{b - a} \cdot \left(b - a\right)\right)\right)} \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
            11. inv-powN/A

              \[\leadsto \frac{\left(\mathsf{PI}\left(\right) \cdot \left(\color{blue}{{\left(b - a\right)}^{-1}} \cdot \left(b - a\right)\right)\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
            12. pow-plusN/A

              \[\leadsto \frac{\left(\mathsf{PI}\left(\right) \cdot \color{blue}{{\left(b - a\right)}^{\left(-1 + 1\right)}}\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
            13. metadata-evalN/A

              \[\leadsto \frac{\left(\mathsf{PI}\left(\right) \cdot {\left(b - a\right)}^{\color{blue}{0}}\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
            14. metadata-evalN/A

              \[\leadsto \frac{\left(\mathsf{PI}\left(\right) \cdot \color{blue}{1}\right) \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
            15. *-rgt-identityN/A

              \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right)} \cdot \frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
            16. lift-*.f64N/A

              \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right) \cdot \frac{1}{2}}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \]
          6. Applied rewrites95.6%

            \[\leadsto \color{blue}{\frac{0.5 \cdot \mathsf{PI}\left(\right)}{b \cdot \left(a \cdot \left(a + b\right)\right)}} \]
        7. Recombined 2 regimes into one program.
        8. Final simplification95.5%

          \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -2 \cdot 10^{+96}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right) \cdot 0.5}{\left(\left(b + a\right) \cdot a\right) \cdot b}\\ \end{array} \]
        9. Add Preprocessing

        Alternative 5: 96.0% accurate, 2.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -3.3 \cdot 10^{+96}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{\left(\left(b + a\right) \cdot a\right) \cdot b} \cdot \mathsf{PI}\left(\right)\\ \end{array} \end{array} \]
        (FPCore (a b)
         :precision binary64
         (if (<= a -3.3e+96)
           (* (/ (PI) (* (* b a) a)) 0.5)
           (* (/ 0.5 (* (* (+ b a) a) b)) (PI))))
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;a \leq -3.3 \cdot 10^{+96}:\\
        \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{0.5}{\left(\left(b + a\right) \cdot a\right) \cdot b} \cdot \mathsf{PI}\left(\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if a < -3.29999999999999984e96

          1. Initial program 60.1%

            \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
          2. Add Preprocessing
          3. Taylor expanded in b around 0

            \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
          4. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
            2. lower-*.f64N/A

              \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
            3. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \cdot \frac{1}{2} \]
            4. lower-PI.f64N/A

              \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right)}}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
            5. *-commutativeN/A

              \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
            6. lower-*.f64N/A

              \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
            7. unpow2N/A

              \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot \frac{1}{2} \]
            8. lower-*.f6475.3

              \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot 0.5 \]
          5. Applied rewrites75.3%

            \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{b \cdot \left(a \cdot a\right)} \cdot 0.5} \]
          6. Step-by-step derivation
            1. Applied rewrites95.5%

              \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \cdot 0.5 \]

            if -3.29999999999999984e96 < a

            1. Initial program 81.9%

              \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
            2. Add Preprocessing
            3. Applied rewrites92.8%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right)}{a + b}, \frac{0.5}{b - a} \cdot {a}^{-1}, \frac{\frac{0.5}{a + b} \cdot \frac{\mathsf{PI}\left(\right)}{b - a}}{-b}\right)} \]
            4. Applied rewrites99.6%

              \[\leadsto \color{blue}{\frac{\frac{0.5}{a + b}}{a \cdot b} \cdot \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)} \]
            5. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)} \]
              2. lift-/.f64N/A

                \[\leadsto \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{b - a}} \cdot \left(b - a\right)\right) \]
              3. div-invN/A

                \[\leadsto \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \frac{1}{b - a}\right)} \cdot \left(b - a\right)\right) \]
              4. associate-*l*N/A

                \[\leadsto \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{b - a} \cdot \left(b - a\right)\right)\right)} \]
              5. inv-powN/A

                \[\leadsto \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\color{blue}{{\left(b - a\right)}^{-1}} \cdot \left(b - a\right)\right)\right) \]
              6. pow-plusN/A

                \[\leadsto \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{{\left(b - a\right)}^{\left(-1 + 1\right)}}\right) \]
              7. metadata-evalN/A

                \[\leadsto \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \left(\mathsf{PI}\left(\right) \cdot {\left(b - a\right)}^{\color{blue}{0}}\right) \]
              8. metadata-evalN/A

                \[\leadsto \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{1}\right) \]
              9. *-rgt-identity99.6

                \[\leadsto \frac{\frac{0.5}{a + b}}{a \cdot b} \cdot \color{blue}{\mathsf{PI}\left(\right)} \]
            6. Applied rewrites99.6%

              \[\leadsto \frac{\frac{0.5}{a + b}}{a \cdot b} \cdot \color{blue}{\mathsf{PI}\left(\right)} \]
            7. Step-by-step derivation
              1. lift-/.f64N/A

                \[\leadsto \color{blue}{\frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b}} \cdot \mathsf{PI}\left(\right) \]
              2. lift-/.f64N/A

                \[\leadsto \frac{\color{blue}{\frac{\frac{1}{2}}{a + b}}}{a \cdot b} \cdot \mathsf{PI}\left(\right) \]
              3. associate-/l/N/A

                \[\leadsto \color{blue}{\frac{\frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)}} \cdot \mathsf{PI}\left(\right) \]
              4. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{\frac{1}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)}} \cdot \mathsf{PI}\left(\right) \]
              5. lift-*.f64N/A

                \[\leadsto \frac{\frac{1}{2}}{\color{blue}{\left(a \cdot b\right)} \cdot \left(a + b\right)} \cdot \mathsf{PI}\left(\right) \]
              6. *-commutativeN/A

                \[\leadsto \frac{\frac{1}{2}}{\color{blue}{\left(b \cdot a\right)} \cdot \left(a + b\right)} \cdot \mathsf{PI}\left(\right) \]
              7. associate-*l*N/A

                \[\leadsto \frac{\frac{1}{2}}{\color{blue}{b \cdot \left(a \cdot \left(a + b\right)\right)}} \cdot \mathsf{PI}\left(\right) \]
              8. lift-+.f64N/A

                \[\leadsto \frac{\frac{1}{2}}{b \cdot \left(a \cdot \color{blue}{\left(a + b\right)}\right)} \cdot \mathsf{PI}\left(\right) \]
              9. distribute-rgt-outN/A

                \[\leadsto \frac{\frac{1}{2}}{b \cdot \color{blue}{\left(a \cdot a + b \cdot a\right)}} \cdot \mathsf{PI}\left(\right) \]
              10. lower-*.f64N/A

                \[\leadsto \frac{\frac{1}{2}}{\color{blue}{b \cdot \left(a \cdot a + b \cdot a\right)}} \cdot \mathsf{PI}\left(\right) \]
              11. distribute-rgt-outN/A

                \[\leadsto \frac{\frac{1}{2}}{b \cdot \color{blue}{\left(a \cdot \left(a + b\right)\right)}} \cdot \mathsf{PI}\left(\right) \]
              12. lift-+.f64N/A

                \[\leadsto \frac{\frac{1}{2}}{b \cdot \left(a \cdot \color{blue}{\left(a + b\right)}\right)} \cdot \mathsf{PI}\left(\right) \]
              13. lower-*.f6495.5

                \[\leadsto \frac{0.5}{b \cdot \color{blue}{\left(a \cdot \left(a + b\right)\right)}} \cdot \mathsf{PI}\left(\right) \]
              14. lift-+.f64N/A

                \[\leadsto \frac{\frac{1}{2}}{b \cdot \left(a \cdot \color{blue}{\left(a + b\right)}\right)} \cdot \mathsf{PI}\left(\right) \]
              15. +-commutativeN/A

                \[\leadsto \frac{\frac{1}{2}}{b \cdot \left(a \cdot \color{blue}{\left(b + a\right)}\right)} \cdot \mathsf{PI}\left(\right) \]
              16. lower-+.f6495.5

                \[\leadsto \frac{0.5}{b \cdot \left(a \cdot \color{blue}{\left(b + a\right)}\right)} \cdot \mathsf{PI}\left(\right) \]
            8. Applied rewrites95.5%

              \[\leadsto \color{blue}{\frac{0.5}{b \cdot \left(a \cdot \left(b + a\right)\right)}} \cdot \mathsf{PI}\left(\right) \]
          7. Recombined 2 regimes into one program.
          8. Final simplification95.5%

            \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -3.3 \cdot 10^{+96}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{\left(\left(b + a\right) \cdot a\right) \cdot b} \cdot \mathsf{PI}\left(\right)\\ \end{array} \]
          9. Add Preprocessing

          Alternative 6: 99.6% accurate, 2.0× speedup?

          \[\begin{array}{l} \\ \frac{\frac{0.5}{b + a}}{b \cdot a} \cdot \mathsf{PI}\left(\right) \end{array} \]
          (FPCore (a b) :precision binary64 (* (/ (/ 0.5 (+ b a)) (* b a)) (PI)))
          \begin{array}{l}
          
          \\
          \frac{\frac{0.5}{b + a}}{b \cdot a} \cdot \mathsf{PI}\left(\right)
          \end{array}
          
          Derivation
          1. Initial program 77.2%

            \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
          2. Add Preprocessing
          3. Applied rewrites89.5%

            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right)}{a + b}, \frac{0.5}{b - a} \cdot {a}^{-1}, \frac{\frac{0.5}{a + b} \cdot \frac{\mathsf{PI}\left(\right)}{b - a}}{-b}\right)} \]
          4. Applied rewrites99.6%

            \[\leadsto \color{blue}{\frac{\frac{0.5}{a + b}}{a \cdot b} \cdot \left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)} \]
          5. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{b - a} \cdot \left(b - a\right)\right)} \]
            2. lift-/.f64N/A

              \[\leadsto \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{b - a}} \cdot \left(b - a\right)\right) \]
            3. div-invN/A

              \[\leadsto \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \frac{1}{b - a}\right)} \cdot \left(b - a\right)\right) \]
            4. associate-*l*N/A

              \[\leadsto \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{b - a} \cdot \left(b - a\right)\right)\right)} \]
            5. inv-powN/A

              \[\leadsto \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\color{blue}{{\left(b - a\right)}^{-1}} \cdot \left(b - a\right)\right)\right) \]
            6. pow-plusN/A

              \[\leadsto \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{{\left(b - a\right)}^{\left(-1 + 1\right)}}\right) \]
            7. metadata-evalN/A

              \[\leadsto \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \left(\mathsf{PI}\left(\right) \cdot {\left(b - a\right)}^{\color{blue}{0}}\right) \]
            8. metadata-evalN/A

              \[\leadsto \frac{\frac{\frac{1}{2}}{a + b}}{a \cdot b} \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{1}\right) \]
            9. *-rgt-identity99.6

              \[\leadsto \frac{\frac{0.5}{a + b}}{a \cdot b} \cdot \color{blue}{\mathsf{PI}\left(\right)} \]
          6. Applied rewrites99.6%

            \[\leadsto \frac{\frac{0.5}{a + b}}{a \cdot b} \cdot \color{blue}{\mathsf{PI}\left(\right)} \]
          7. Final simplification99.6%

            \[\leadsto \frac{\frac{0.5}{b + a}}{b \cdot a} \cdot \mathsf{PI}\left(\right) \]
          8. Add Preprocessing

          Alternative 7: 74.1% accurate, 2.2× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -2.3 \cdot 10^{-32}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot b} \cdot 0.5\\ \end{array} \end{array} \]
          (FPCore (a b)
           :precision binary64
           (if (<= a -2.3e-32)
             (* (/ (PI) (* (* b a) a)) 0.5)
             (* (/ (PI) (* (* b a) b)) 0.5)))
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;a \leq -2.3 \cdot 10^{-32}:\\
          \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot b} \cdot 0.5\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if a < -2.3000000000000001e-32

            1. Initial program 71.3%

              \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
            2. Add Preprocessing
            3. Taylor expanded in b around 0

              \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
            4. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
              2. lower-*.f64N/A

                \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
              3. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \cdot \frac{1}{2} \]
              4. lower-PI.f64N/A

                \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right)}}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
              5. *-commutativeN/A

                \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
              6. lower-*.f64N/A

                \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
              7. unpow2N/A

                \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot \frac{1}{2} \]
              8. lower-*.f6475.9

                \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot 0.5 \]
            5. Applied rewrites75.9%

              \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{b \cdot \left(a \cdot a\right)} \cdot 0.5} \]
            6. Step-by-step derivation
              1. Applied rewrites90.4%

                \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \cdot 0.5 \]

              if -2.3000000000000001e-32 < a

              1. Initial program 79.7%

                \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right)} \]
                2. lift-*.f64N/A

                  \[\leadsto \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right)} \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
                3. lift-/.f64N/A

                  \[\leadsto \left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \color{blue}{\frac{1}{b \cdot b - a \cdot a}}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
                4. un-div-invN/A

                  \[\leadsto \color{blue}{\frac{\frac{\mathsf{PI}\left(\right)}{2}}{b \cdot b - a \cdot a}} \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
                5. lift--.f64N/A

                  \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{2}}{b \cdot b - a \cdot a} \cdot \color{blue}{\left(\frac{1}{a} - \frac{1}{b}\right)} \]
                6. lift-/.f64N/A

                  \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{2}}{b \cdot b - a \cdot a} \cdot \left(\color{blue}{\frac{1}{a}} - \frac{1}{b}\right) \]
                7. lift-/.f64N/A

                  \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{2}}{b \cdot b - a \cdot a} \cdot \left(\frac{1}{a} - \color{blue}{\frac{1}{b}}\right) \]
                8. frac-subN/A

                  \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{2}}{b \cdot b - a \cdot a} \cdot \color{blue}{\frac{1 \cdot b - a \cdot 1}{a \cdot b}} \]
                9. frac-timesN/A

                  \[\leadsto \color{blue}{\frac{\frac{\mathsf{PI}\left(\right)}{2} \cdot \left(1 \cdot b - a \cdot 1\right)}{\left(b \cdot b - a \cdot a\right) \cdot \left(a \cdot b\right)}} \]
                10. frac-2negN/A

                  \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \left(1 \cdot b - a \cdot 1\right)\right)}{\mathsf{neg}\left(\left(b \cdot b - a \cdot a\right) \cdot \left(a \cdot b\right)\right)}} \]
                11. distribute-lft-neg-outN/A

                  \[\leadsto \frac{\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \left(1 \cdot b - a \cdot 1\right)\right)}{\color{blue}{\left(\mathsf{neg}\left(\left(b \cdot b - a \cdot a\right)\right)\right) \cdot \left(a \cdot b\right)}} \]
                12. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \left(1 \cdot b - a \cdot 1\right)\right)}{\left(\mathsf{neg}\left(\left(b \cdot b - a \cdot a\right)\right)\right) \cdot \left(a \cdot b\right)}} \]
              4. Applied rewrites77.0%

                \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)}{\left(\mathsf{fma}\left(-b, b, a \cdot a\right) \cdot a\right) \cdot b}} \]
              5. Taylor expanded in b around inf

                \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{a \cdot {b}^{2}}} \]
              6. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{a \cdot {b}^{2}} \cdot \frac{1}{2}} \]
                2. lower-*.f64N/A

                  \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{a \cdot {b}^{2}} \cdot \frac{1}{2}} \]
                3. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{a \cdot {b}^{2}}} \cdot \frac{1}{2} \]
                4. lower-PI.f64N/A

                  \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right)}}{a \cdot {b}^{2}} \cdot \frac{1}{2} \]
                5. *-commutativeN/A

                  \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{{b}^{2} \cdot a}} \cdot \frac{1}{2} \]
                6. lower-*.f64N/A

                  \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{{b}^{2} \cdot a}} \cdot \frac{1}{2} \]
                7. unpow2N/A

                  \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{\left(b \cdot b\right)} \cdot a} \cdot \frac{1}{2} \]
                8. lower-*.f6459.3

                  \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{\left(b \cdot b\right)} \cdot a} \cdot 0.5 \]
              7. Applied rewrites59.3%

                \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5} \]
              8. Step-by-step derivation
                1. Applied rewrites67.1%

                  \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot b} \cdot 0.5 \]
              9. Recombined 2 regimes into one program.
              10. Final simplification74.1%

                \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -2.3 \cdot 10^{-32}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot b} \cdot 0.5\\ \end{array} \]
              11. Add Preprocessing

              Alternative 8: 68.7% accurate, 2.2× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -2.3 \cdot 10^{-32}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{\left(b \cdot b\right) \cdot a} \cdot \mathsf{PI}\left(\right)\\ \end{array} \end{array} \]
              (FPCore (a b)
               :precision binary64
               (if (<= a -2.3e-32)
                 (* (/ (PI) (* (* b a) a)) 0.5)
                 (* (/ 0.5 (* (* b b) a)) (PI))))
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;a \leq -2.3 \cdot 10^{-32}:\\
              \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{0.5}{\left(b \cdot b\right) \cdot a} \cdot \mathsf{PI}\left(\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if a < -2.3000000000000001e-32

                1. Initial program 71.3%

                  \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
                2. Add Preprocessing
                3. Taylor expanded in b around 0

                  \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
                4. Step-by-step derivation
                  1. *-commutativeN/A

                    \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
                  2. lower-*.f64N/A

                    \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
                  3. lower-/.f64N/A

                    \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \cdot \frac{1}{2} \]
                  4. lower-PI.f64N/A

                    \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right)}}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
                  5. *-commutativeN/A

                    \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
                  6. lower-*.f64N/A

                    \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
                  7. unpow2N/A

                    \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot \frac{1}{2} \]
                  8. lower-*.f6475.9

                    \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot 0.5 \]
                5. Applied rewrites75.9%

                  \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{b \cdot \left(a \cdot a\right)} \cdot 0.5} \]
                6. Step-by-step derivation
                  1. Applied rewrites90.4%

                    \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \cdot 0.5 \]

                  if -2.3000000000000001e-32 < a

                  1. Initial program 79.7%

                    \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
                  2. Add Preprocessing
                  3. Step-by-step derivation
                    1. lift-*.f64N/A

                      \[\leadsto \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right)} \]
                    2. lift-*.f64N/A

                      \[\leadsto \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right)} \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
                    3. lift-/.f64N/A

                      \[\leadsto \left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \color{blue}{\frac{1}{b \cdot b - a \cdot a}}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
                    4. un-div-invN/A

                      \[\leadsto \color{blue}{\frac{\frac{\mathsf{PI}\left(\right)}{2}}{b \cdot b - a \cdot a}} \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
                    5. lift--.f64N/A

                      \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{2}}{b \cdot b - a \cdot a} \cdot \color{blue}{\left(\frac{1}{a} - \frac{1}{b}\right)} \]
                    6. lift-/.f64N/A

                      \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{2}}{b \cdot b - a \cdot a} \cdot \left(\color{blue}{\frac{1}{a}} - \frac{1}{b}\right) \]
                    7. lift-/.f64N/A

                      \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{2}}{b \cdot b - a \cdot a} \cdot \left(\frac{1}{a} - \color{blue}{\frac{1}{b}}\right) \]
                    8. frac-subN/A

                      \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{2}}{b \cdot b - a \cdot a} \cdot \color{blue}{\frac{1 \cdot b - a \cdot 1}{a \cdot b}} \]
                    9. frac-timesN/A

                      \[\leadsto \color{blue}{\frac{\frac{\mathsf{PI}\left(\right)}{2} \cdot \left(1 \cdot b - a \cdot 1\right)}{\left(b \cdot b - a \cdot a\right) \cdot \left(a \cdot b\right)}} \]
                    10. frac-2negN/A

                      \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \left(1 \cdot b - a \cdot 1\right)\right)}{\mathsf{neg}\left(\left(b \cdot b - a \cdot a\right) \cdot \left(a \cdot b\right)\right)}} \]
                    11. distribute-lft-neg-outN/A

                      \[\leadsto \frac{\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \left(1 \cdot b - a \cdot 1\right)\right)}{\color{blue}{\left(\mathsf{neg}\left(\left(b \cdot b - a \cdot a\right)\right)\right) \cdot \left(a \cdot b\right)}} \]
                    12. lower-/.f64N/A

                      \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \left(1 \cdot b - a \cdot 1\right)\right)}{\left(\mathsf{neg}\left(\left(b \cdot b - a \cdot a\right)\right)\right) \cdot \left(a \cdot b\right)}} \]
                  4. Applied rewrites77.0%

                    \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)}{\left(\mathsf{fma}\left(-b, b, a \cdot a\right) \cdot a\right) \cdot b}} \]
                  5. Taylor expanded in b around inf

                    \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{a \cdot {b}^{2}}} \]
                  6. Step-by-step derivation
                    1. *-commutativeN/A

                      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{a \cdot {b}^{2}} \cdot \frac{1}{2}} \]
                    2. lower-*.f64N/A

                      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{a \cdot {b}^{2}} \cdot \frac{1}{2}} \]
                    3. lower-/.f64N/A

                      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{a \cdot {b}^{2}}} \cdot \frac{1}{2} \]
                    4. lower-PI.f64N/A

                      \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right)}}{a \cdot {b}^{2}} \cdot \frac{1}{2} \]
                    5. *-commutativeN/A

                      \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{{b}^{2} \cdot a}} \cdot \frac{1}{2} \]
                    6. lower-*.f64N/A

                      \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{{b}^{2} \cdot a}} \cdot \frac{1}{2} \]
                    7. unpow2N/A

                      \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{\left(b \cdot b\right)} \cdot a} \cdot \frac{1}{2} \]
                    8. lower-*.f6459.3

                      \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{\left(b \cdot b\right)} \cdot a} \cdot 0.5 \]
                  7. Applied rewrites59.3%

                    \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5} \]
                  8. Step-by-step derivation
                    1. Applied rewrites59.2%

                      \[\leadsto \mathsf{PI}\left(\right) \cdot \color{blue}{\frac{0.5}{\left(b \cdot b\right) \cdot a}} \]
                  9. Recombined 2 regimes into one program.
                  10. Final simplification68.6%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -2.3 \cdot 10^{-32}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{\left(b \cdot b\right) \cdot a} \cdot \mathsf{PI}\left(\right)\\ \end{array} \]
                  11. Add Preprocessing

                  Alternative 9: 68.7% accurate, 2.2× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -2.3 \cdot 10^{-32}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\ \end{array} \end{array} \]
                  (FPCore (a b)
                   :precision binary64
                   (if (<= a -2.3e-32)
                     (* (/ (PI) (* (* b a) a)) 0.5)
                     (* (/ (PI) (* (* b b) a)) 0.5)))
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;a \leq -2.3 \cdot 10^{-32}:\\
                  \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if a < -2.3000000000000001e-32

                    1. Initial program 71.3%

                      \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
                    2. Add Preprocessing
                    3. Taylor expanded in b around 0

                      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
                    4. Step-by-step derivation
                      1. *-commutativeN/A

                        \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
                      2. lower-*.f64N/A

                        \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
                      3. lower-/.f64N/A

                        \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \cdot \frac{1}{2} \]
                      4. lower-PI.f64N/A

                        \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right)}}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
                      5. *-commutativeN/A

                        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
                      6. lower-*.f64N/A

                        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
                      7. unpow2N/A

                        \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot \frac{1}{2} \]
                      8. lower-*.f6475.9

                        \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot 0.5 \]
                    5. Applied rewrites75.9%

                      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{b \cdot \left(a \cdot a\right)} \cdot 0.5} \]
                    6. Step-by-step derivation
                      1. Applied rewrites90.4%

                        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \cdot 0.5 \]

                      if -2.3000000000000001e-32 < a

                      1. Initial program 79.7%

                        \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
                      2. Add Preprocessing
                      3. Taylor expanded in b around inf

                        \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{a \cdot {b}^{2}}} \]
                      4. Step-by-step derivation
                        1. *-commutativeN/A

                          \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{a \cdot {b}^{2}} \cdot \frac{1}{2}} \]
                        2. lower-*.f64N/A

                          \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{a \cdot {b}^{2}} \cdot \frac{1}{2}} \]
                        3. lower-/.f64N/A

                          \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{a \cdot {b}^{2}}} \cdot \frac{1}{2} \]
                        4. lower-PI.f64N/A

                          \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right)}}{a \cdot {b}^{2}} \cdot \frac{1}{2} \]
                        5. *-commutativeN/A

                          \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{{b}^{2} \cdot a}} \cdot \frac{1}{2} \]
                        6. lower-*.f64N/A

                          \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{{b}^{2} \cdot a}} \cdot \frac{1}{2} \]
                        7. unpow2N/A

                          \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{\left(b \cdot b\right)} \cdot a} \cdot \frac{1}{2} \]
                        8. lower-*.f6459.3

                          \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{\left(b \cdot b\right)} \cdot a} \cdot 0.5 \]
                      5. Applied rewrites59.3%

                        \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5} \]
                    7. Recombined 2 regimes into one program.
                    8. Final simplification68.6%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -2.3 \cdot 10^{-32}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\ \end{array} \]
                    9. Add Preprocessing

                    Alternative 10: 63.2% accurate, 2.6× speedup?

                    \[\begin{array}{l} \\ \frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5 \end{array} \]
                    (FPCore (a b) :precision binary64 (* (/ (PI) (* (* b a) a)) 0.5))
                    \begin{array}{l}
                    
                    \\
                    \frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5
                    \end{array}
                    
                    Derivation
                    1. Initial program 77.2%

                      \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
                    2. Add Preprocessing
                    3. Taylor expanded in b around 0

                      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
                    4. Step-by-step derivation
                      1. *-commutativeN/A

                        \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
                      2. lower-*.f64N/A

                        \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
                      3. lower-/.f64N/A

                        \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \cdot \frac{1}{2} \]
                      4. lower-PI.f64N/A

                        \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right)}}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
                      5. *-commutativeN/A

                        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
                      6. lower-*.f64N/A

                        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
                      7. unpow2N/A

                        \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot \frac{1}{2} \]
                      8. lower-*.f6458.3

                        \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot 0.5 \]
                    5. Applied rewrites58.3%

                      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{b \cdot \left(a \cdot a\right)} \cdot 0.5} \]
                    6. Step-by-step derivation
                      1. Applied rewrites65.6%

                        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \cdot 0.5 \]
                      2. Final simplification65.6%

                        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5 \]
                      3. Add Preprocessing

                      Alternative 11: 63.2% accurate, 2.6× speedup?

                      \[\begin{array}{l} \\ \frac{0.5}{\left(b \cdot a\right) \cdot a} \cdot \mathsf{PI}\left(\right) \end{array} \]
                      (FPCore (a b) :precision binary64 (* (/ 0.5 (* (* b a) a)) (PI)))
                      \begin{array}{l}
                      
                      \\
                      \frac{0.5}{\left(b \cdot a\right) \cdot a} \cdot \mathsf{PI}\left(\right)
                      \end{array}
                      
                      Derivation
                      1. Initial program 77.2%

                        \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
                      2. Add Preprocessing
                      3. Taylor expanded in b around 0

                        \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
                      4. Step-by-step derivation
                        1. *-commutativeN/A

                          \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
                        2. lower-*.f64N/A

                          \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
                        3. lower-/.f64N/A

                          \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \cdot \frac{1}{2} \]
                        4. lower-PI.f64N/A

                          \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right)}}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
                        5. *-commutativeN/A

                          \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
                        6. lower-*.f64N/A

                          \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
                        7. unpow2N/A

                          \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot \frac{1}{2} \]
                        8. lower-*.f6458.3

                          \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot 0.5 \]
                      5. Applied rewrites58.3%

                        \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{b \cdot \left(a \cdot a\right)} \cdot 0.5} \]
                      6. Step-by-step derivation
                        1. Applied rewrites58.3%

                          \[\leadsto \mathsf{PI}\left(\right) \cdot \color{blue}{\frac{0.5}{\left(a \cdot a\right) \cdot b}} \]
                        2. Step-by-step derivation
                          1. Applied rewrites65.5%

                            \[\leadsto \mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot b\right) \cdot \color{blue}{a}} \]
                          2. Final simplification65.5%

                            \[\leadsto \frac{0.5}{\left(b \cdot a\right) \cdot a} \cdot \mathsf{PI}\left(\right) \]
                          3. Add Preprocessing

                          Alternative 12: 57.2% accurate, 2.6× speedup?

                          \[\begin{array}{l} \\ \frac{0.5}{\left(a \cdot a\right) \cdot b} \cdot \mathsf{PI}\left(\right) \end{array} \]
                          (FPCore (a b) :precision binary64 (* (/ 0.5 (* (* a a) b)) (PI)))
                          \begin{array}{l}
                          
                          \\
                          \frac{0.5}{\left(a \cdot a\right) \cdot b} \cdot \mathsf{PI}\left(\right)
                          \end{array}
                          
                          Derivation
                          1. Initial program 77.2%

                            \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
                          2. Add Preprocessing
                          3. Taylor expanded in b around 0

                            \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
                          4. Step-by-step derivation
                            1. *-commutativeN/A

                              \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
                            2. lower-*.f64N/A

                              \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2}} \]
                            3. lower-/.f64N/A

                              \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \cdot \frac{1}{2} \]
                            4. lower-PI.f64N/A

                              \[\leadsto \frac{\color{blue}{\mathsf{PI}\left(\right)}}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
                            5. *-commutativeN/A

                              \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
                            6. lower-*.f64N/A

                              \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{b \cdot {a}^{2}}} \cdot \frac{1}{2} \]
                            7. unpow2N/A

                              \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot \frac{1}{2} \]
                            8. lower-*.f6458.3

                              \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \color{blue}{\left(a \cdot a\right)}} \cdot 0.5 \]
                          5. Applied rewrites58.3%

                            \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{b \cdot \left(a \cdot a\right)} \cdot 0.5} \]
                          6. Step-by-step derivation
                            1. Applied rewrites58.3%

                              \[\leadsto \mathsf{PI}\left(\right) \cdot \color{blue}{\frac{0.5}{\left(a \cdot a\right) \cdot b}} \]
                            2. Final simplification58.3%

                              \[\leadsto \frac{0.5}{\left(a \cdot a\right) \cdot b} \cdot \mathsf{PI}\left(\right) \]
                            3. Add Preprocessing

                            Reproduce

                            ?
                            herbie shell --seed 2024248 
                            (FPCore (a b)
                              :name "NMSE Section 6.1 mentioned, B"
                              :precision binary64
                              (* (* (/ (PI) 2.0) (/ 1.0 (- (* b b) (* a a)))) (- (/ 1.0 a) (/ 1.0 b))))