NMSE Section 6.1 mentioned, B

Percentage Accurate: 78.9% → 99.0%
Time: 4.7s
Alternatives: 7
Speedup: 1.8×

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 7 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.9% 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.0% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.16 \cdot 10^{+168} \lor \neg \left(a \leq 6.5 \cdot 10^{+95}\right):\\ \;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{a}}{b \cdot a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(\left(b + a\right) \cdot 2\right) \cdot \left(-a\right)} \cdot \frac{-1}{b}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (or (<= a -1.16e+168) (not (<= a 6.5e+95)))
   (* (/ (/ (PI) a) (* b a)) 0.5)
   (* (/ (PI) (* (* (+ b a) 2.0) (- a))) (/ -1.0 b))))
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.16 \cdot 10^{+168} \lor \neg \left(a \leq 6.5 \cdot 10^{+95}\right):\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{a}}{b \cdot a} \cdot 0.5\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(\left(b + a\right) \cdot 2\right) \cdot \left(-a\right)} \cdot \frac{-1}{b}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.1599999999999999e168 or 6.5e95 < a

    1. Initial program 65.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. Taylor expanded in a around inf

      \[\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 \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \color{blue}{\frac{1}{2}} \]
      2. lower-*.f64N/A

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

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

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

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
      6. pow2N/A

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(a \cdot a\right) \cdot b} \cdot \frac{1}{2} \]
      7. lower-*.f6484.4

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(a \cdot a\right) \cdot b} \cdot 0.5 \]
    5. Applied rewrites84.4%

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

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

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
      3. lower-*.f6497.9

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot 0.5 \]
    7. Applied rewrites97.9%

      \[\leadsto \frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot 0.5 \]
    8. Step-by-step derivation
      1. associate-/r*N/A

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{a}}{b \cdot a} \cdot \frac{1}{2} \]
      6. lower-*.f6499.8

        \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{a}}{b \cdot a} \cdot 0.5 \]
    9. Applied rewrites99.8%

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

    if -1.1599999999999999e168 < a < 6.5e95

    1. Initial program 85.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. Step-by-step derivation
      1. frac-timesN/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\mathsf{PI}\left(\right) \cdot 1}{2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \color{blue}{\frac{-1}{b}} \]
    8. Taylor expanded in a around inf

      \[\leadsto \frac{\mathsf{PI}\left(\right) \cdot 1}{2 \cdot \left(\left(b + a\right) \cdot \color{blue}{\left(-1 \cdot a\right)}\right)} \cdot \frac{-1}{b} \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\mathsf{PI}\left(\right) \cdot 1}{2 \cdot \left(\left(b + a\right) \cdot \left(\mathsf{neg}\left(a\right)\right)\right)} \cdot \frac{-1}{b} \]
      2. lower-neg.f6499.6

        \[\leadsto \frac{\mathsf{PI}\left(\right) \cdot 1}{2 \cdot \left(\left(b + a\right) \cdot \left(-a\right)\right)} \cdot \frac{-1}{b} \]
    10. Applied rewrites99.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(\left(b + a\right) \cdot 2\right) \cdot \left(-a\right)} \cdot \frac{-1}{b} \]
    12. Applied rewrites99.6%

      \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{\left(\left(b + a\right) \cdot 2\right) \cdot \left(-a\right)}} \cdot \frac{-1}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.16 \cdot 10^{+168} \lor \neg \left(a \leq 6.5 \cdot 10^{+95}\right):\\ \;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{a}}{b \cdot a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(\left(b + a\right) \cdot 2\right) \cdot \left(-a\right)} \cdot \frac{-1}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 99.6% accurate, 0.5× speedup?

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

\\
\frac{\frac{\mathsf{PI}\left(\right)}{2} \cdot {\left(b \cdot a\right)}^{-1}}{b + a}
\end{array}
Derivation
  1. Initial program 79.6%

    \[\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. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{\mathsf{PI}\left(\right)}{2}}{a + b} \cdot \left({\left(b - a\right)}^{-1} \cdot \left({a}^{-1} - {b}^{-1}\right)\right)} \]
  7. Taylor expanded in a around 0

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

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

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

      \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{2}}{a + b} \cdot {\left(b \cdot a\right)}^{-1} \]
    4. lower-*.f6499.6

      \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{2}}{a + b} \cdot {\left(b \cdot a\right)}^{-1} \]
  9. Applied rewrites99.6%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{2} \cdot {\left(b \cdot a\right)}^{-1}}{\mathsf{Rewrite<=}\left(+-commutative, \left(b + a\right)\right)} \]
    9. lower-*.f64N/A

      \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{2} \cdot {\left(b \cdot a\right)}^{-1}}{\mathsf{Rewrite=>}\left(lower-+.f64, \left(b + a\right)\right)} \]
  11. Applied rewrites99.6%

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

Alternative 3: 99.6% accurate, 1.5× speedup?

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

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

    \[\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. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{\mathsf{PI}\left(\right)}{2}}{a + b} \cdot \left({\left(b - a\right)}^{-1} \cdot \left({a}^{-1} - {b}^{-1}\right)\right)} \]
  7. Taylor expanded in a around 0

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

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

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

      \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{2}}{a + b} \cdot {\left(b \cdot a\right)}^{-1} \]
    4. lower-*.f6499.6

      \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{2}}{a + b} \cdot {\left(b \cdot a\right)}^{-1} \]
  9. Applied rewrites99.6%

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

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

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

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

    \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{2}}{a + b} \cdot \frac{1}{\color{blue}{b \cdot a}} \]
  12. Add Preprocessing

Alternative 4: 86.8% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -34000 \lor \neg \left(a \leq 3.4 \cdot 10^{-17}\right):\\ \;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{a}}{b \cdot a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)} \cdot 0.5\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (or (<= a -34000.0) (not (<= a 3.4e-17)))
   (* (/ (/ (PI) a) (* b a)) 0.5)
   (* (/ (PI) (* b (* b a))) 0.5)))
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -34000 \lor \neg \left(a \leq 3.4 \cdot 10^{-17}\right):\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{a}}{b \cdot a} \cdot 0.5\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)} \cdot 0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -34000 or 3.3999999999999998e-17 < a

    1. Initial program 78.0%

      \[\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 a around inf

      \[\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 \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \color{blue}{\frac{1}{2}} \]
      2. lower-*.f64N/A

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

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

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

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
      6. pow2N/A

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(a \cdot a\right) \cdot b} \cdot \frac{1}{2} \]
      7. lower-*.f6483.9

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

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

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

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
      3. lower-*.f6491.7

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

      \[\leadsto \frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot 0.5 \]
    8. Step-by-step derivation
      1. associate-/r*N/A

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{a}}{b \cdot a} \cdot \frac{1}{2} \]
      6. lower-*.f6493.1

        \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{a}}{b \cdot a} \cdot 0.5 \]
    9. Applied rewrites93.1%

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

    if -34000 < a < 3.3999999999999998e-17

    1. Initial program 81.4%

      \[\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. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{PI}\left(\right)}{2}}{a + b} \cdot \left({\left(b - a\right)}^{-1} \cdot \left({a}^{-1} - {b}^{-1}\right)\right)} \]
    7. Taylor expanded in a around 0

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot \frac{1}{2} \]
      8. lower-*.f6472.0

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5 \]
    9. Applied rewrites72.0%

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

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

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)} \cdot \frac{1}{2} \]
      3. lower-*.f6486.6

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)} \cdot 0.5 \]
    11. Applied rewrites86.6%

      \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)} \cdot 0.5 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification90.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -34000 \lor \neg \left(a \leq 3.4 \cdot 10^{-17}\right):\\ \;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{a}}{b \cdot a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)} \cdot 0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 86.7% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -34000 \lor \neg \left(a \leq 3.4 \cdot 10^{-17}\right):\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)} \cdot 0.5\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (or (<= a -34000.0) (not (<= a 3.4e-17)))
   (* (/ (PI) (* a (* a b))) 0.5)
   (* (/ (PI) (* b (* b a))) 0.5)))
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -34000 \lor \neg \left(a \leq 3.4 \cdot 10^{-17}\right):\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)} \cdot 0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -34000 or 3.3999999999999998e-17 < a

    1. Initial program 78.0%

      \[\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 a around inf

      \[\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 \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \color{blue}{\frac{1}{2}} \]
      2. lower-*.f64N/A

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

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

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

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
      6. pow2N/A

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(a \cdot a\right) \cdot b} \cdot \frac{1}{2} \]
      7. lower-*.f6483.9

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

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

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

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
      3. lower-*.f6491.7

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

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

    if -34000 < a < 3.3999999999999998e-17

    1. Initial program 81.4%

      \[\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. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{PI}\left(\right)}{2}}{a + b} \cdot \left({\left(b - a\right)}^{-1} \cdot \left({a}^{-1} - {b}^{-1}\right)\right)} \]
    7. Taylor expanded in a around 0

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot \frac{1}{2} \]
      8. lower-*.f6472.0

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5 \]
    9. Applied rewrites72.0%

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

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

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)} \cdot \frac{1}{2} \]
      3. lower-*.f6486.6

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)} \cdot 0.5 \]
    11. Applied rewrites86.6%

      \[\leadsto \frac{\mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)} \cdot 0.5 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -34000 \lor \neg \left(a \leq 3.4 \cdot 10^{-17}\right):\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)} \cdot 0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 81.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -34000 \lor \neg \left(a \leq 3.4 \cdot 10^{-17}\right):\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \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 (or (<= a -34000.0) (not (<= a 3.4e-17)))
   (* (/ (PI) (* a (* a b))) 0.5)
   (* (/ (PI) (* (* b b) a)) 0.5)))
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -34000 \lor \neg \left(a \leq 3.4 \cdot 10^{-17}\right):\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \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 < -34000 or 3.3999999999999998e-17 < a

    1. Initial program 78.0%

      \[\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 a around inf

      \[\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 \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \color{blue}{\frac{1}{2}} \]
      2. lower-*.f64N/A

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

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

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

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
      6. pow2N/A

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(a \cdot a\right) \cdot b} \cdot \frac{1}{2} \]
      7. lower-*.f6483.9

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

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

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

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
      3. lower-*.f6491.7

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

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

    if -34000 < a < 3.3999999999999998e-17

    1. Initial program 81.4%

      \[\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 a around 0

      \[\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 \frac{\mathsf{PI}\left(\right)}{a \cdot {b}^{2}} \cdot \color{blue}{\frac{1}{2}} \]
      2. lower-*.f64N/A

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

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

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

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

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

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot \frac{1}{2} \]
      8. lower-*.f6472.0

        \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5 \]
    5. Applied rewrites72.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -34000 \lor \neg \left(a \leq 3.4 \cdot 10^{-17}\right):\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 62.3% accurate, 2.6× speedup?

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

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

    \[\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 a around inf

    \[\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 \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \color{blue}{\frac{1}{2}} \]
    2. lower-*.f64N/A

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

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

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

      \[\leadsto \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
    6. pow2N/A

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

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

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

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

      \[\leadsto \frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
    3. lower-*.f6464.0

      \[\leadsto \frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot 0.5 \]
  7. Applied rewrites64.0%

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

Reproduce

?
herbie shell --seed 2025044 
(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))))