NMSE Section 6.1 mentioned, B

Percentage Accurate: 79.4% → 99.4%
Time: 8.4s
Alternatives: 9
Speedup: 2.2×

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 9 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: 79.4% 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.4% accurate, 1.8× speedup?

\[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \begin{array}{l} \mathbf{if}\;a \leq -6.2 \cdot 10^{+95}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{a} \cdot \frac{0.5}{a \cdot b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right) \cdot 0.5}{b \cdot \left(a \cdot \left(a + b\right)\right)}\\ \end{array} \end{array} \]
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (a b)
 :precision binary64
 (if (<= a -6.2e+95)
   (* (/ (PI) a) (/ 0.5 (* a b)))
   (/ (* (PI) 0.5) (* b (* a (+ a b))))))
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.2 \cdot 10^{+95}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{a} \cdot \frac{0.5}{a \cdot b}\\

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


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

    1. Initial program 54.5%

      \[\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 \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. lower-*.f64N/A

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

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

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

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

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

      if -6.2000000000000006e95 < a

      1. Initial program 80.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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 2: 99.1% accurate, 2.0× speedup?

    \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \begin{array}{l} \mathbf{if}\;a \leq -1.7 \cdot 10^{+92}:\\ \;\;\;\;\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(b \cdot a\right) \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right) \cdot 0.5}{b \cdot \left(a \cdot \left(a + b\right)\right)}\\ \end{array} \end{array} \]
    NOTE: a and b should be sorted in increasing order before calling this function.
    (FPCore (a b)
     :precision binary64
     (if (<= a -1.7e+92)
       (* (PI) (/ 0.5 (* (* b a) a)))
       (/ (* (PI) 0.5) (* b (* a (+ a b))))))
    \begin{array}{l}
    [a, b] = \mathsf{sort}([a, b])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;a \leq -1.7 \cdot 10^{+92}:\\
    \;\;\;\;\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(b \cdot a\right) \cdot a}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\mathsf{PI}\left(\right) \cdot 0.5}{b \cdot \left(a \cdot \left(a + b\right)\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if a < -1.6999999999999999e92

      1. Initial program 55.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 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 \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. lower-*.f64N/A

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

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

          \[\leadsto \frac{\mathsf{PI}\left(\right)}{\color{blue}{\left(a \cdot a\right)} \cdot b} \cdot 0.5 \]
      5. Applied rewrites78.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. Applied rewrites78.4%

          \[\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 rewrites96.3%

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

          if -1.6999999999999999e92 < a

          1. Initial program 80.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. 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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 3: 99.6% accurate, 2.0× speedup?

        \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \frac{\frac{0.5}{b \cdot a} \cdot \mathsf{PI}\left(\right)}{b + a} \end{array} \]
        NOTE: a and b should be sorted in increasing order before calling this function.
        (FPCore (a b) :precision binary64 (/ (* (/ 0.5 (* b a)) (PI)) (+ b a)))
        \begin{array}{l}
        [a, b] = \mathsf{sort}([a, b])\\
        \\
        \frac{\frac{0.5}{b \cdot a} \cdot \mathsf{PI}\left(\right)}{b + a}
        \end{array}
        
        Derivation
        1. Initial program 75.5%

          \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 4: 99.1% accurate, 2.0× speedup?

        \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \frac{0.5}{\left(a \cdot b\right) \cdot \frac{a + b}{\mathsf{PI}\left(\right)}} \end{array} \]
        NOTE: a and b should be sorted in increasing order before calling this function.
        (FPCore (a b) :precision binary64 (/ 0.5 (* (* a b) (/ (+ a b) (PI)))))
        \begin{array}{l}
        [a, b] = \mathsf{sort}([a, b])\\
        \\
        \frac{0.5}{\left(a \cdot b\right) \cdot \frac{a + b}{\mathsf{PI}\left(\right)}}
        \end{array}
        
        Derivation
        1. Initial program 75.5%

          \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 5: 89.1% accurate, 2.2× speedup?

        \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \begin{array}{l} \mathbf{if}\;a \leq -1.12 \cdot 10^{-33}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot b} \cdot 0.5\\ \end{array} \end{array} \]
        NOTE: a and b should be sorted in increasing order before calling this function.
        (FPCore (a b)
         :precision binary64
         (if (<= a -1.12e-33)
           (* (/ (PI) (* (* a b) a)) 0.5)
           (* (/ (PI) (* (* a b) b)) 0.5)))
        \begin{array}{l}
        [a, b] = \mathsf{sort}([a, b])\\
        \\
        \begin{array}{l}
        \mathbf{if}\;a \leq -1.12 \cdot 10^{-33}:\\
        \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \cdot 0.5\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot b} \cdot 0.5\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if a < -1.11999999999999999e-33

          1. Initial program 69.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 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 \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. lower-*.f64N/A

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

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

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

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

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

            if -1.11999999999999999e-33 < a

            1. Initial program 78.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. Applied rewrites88.4%

              \[\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. Taylor expanded in a around 0

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

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

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

                \[\leadsto \frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot b} \cdot 0.5 \]
            8. Recombined 2 regimes into one program.
            9. Add Preprocessing

            Alternative 6: 83.2% accurate, 2.2× speedup?

            \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \begin{array}{l} \mathbf{if}\;a \leq -1.1 \cdot 10^{-33}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\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} \]
            NOTE: a and b should be sorted in increasing order before calling this function.
            (FPCore (a b)
             :precision binary64
             (if (<= a -1.1e-33)
               (* (/ (PI) (* (* a b) a)) 0.5)
               (* (/ (PI) (* (* b b) a)) 0.5)))
            \begin{array}{l}
            [a, b] = \mathsf{sort}([a, b])\\
            \\
            \begin{array}{l}
            \mathbf{if}\;a \leq -1.1 \cdot 10^{-33}:\\
            \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\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 < -1.10000000000000003e-33

              1. Initial program 69.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 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 \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. lower-*.f64N/A

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

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

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

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

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

                if -1.10000000000000003e-33 < a

                1. Initial program 78.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 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 \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-*.f6466.7

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

                  \[\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. Add Preprocessing

              Alternative 7: 63.3% accurate, 2.6× speedup?

              \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \cdot 0.5 \end{array} \]
              NOTE: a and b should be sorted in increasing order before calling this function.
              (FPCore (a b) :precision binary64 (* (/ (PI) (* (* a b) a)) 0.5))
              \begin{array}{l}
              [a, b] = \mathsf{sort}([a, b])\\
              \\
              \frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \cdot 0.5
              \end{array}
              
              Derivation
              1. Initial program 75.5%

                \[\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 \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. lower-*.f64N/A

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

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

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

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

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

                Alternative 8: 63.3% accurate, 2.6× speedup?

                \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(b \cdot a\right) \cdot a} \end{array} \]
                NOTE: a and b should be sorted in increasing order before calling this function.
                (FPCore (a b) :precision binary64 (* (PI) (/ 0.5 (* (* b a) a))))
                \begin{array}{l}
                [a, b] = \mathsf{sort}([a, b])\\
                \\
                \mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(b \cdot a\right) \cdot a}
                \end{array}
                
                Derivation
                1. Initial program 75.5%

                  \[\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 \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. lower-*.f64N/A

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

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

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

                  \[\leadsto \color{blue}{\frac{\mathsf{PI}\left(\right)}{\left(a \cdot a\right) \cdot b} \cdot 0.5} \]
                6. Step-by-step derivation
                  1. Applied rewrites59.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 rewrites66.8%

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

                    Alternative 9: 57.9% accurate, 2.6× speedup?

                    \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot a\right) \cdot b} \end{array} \]
                    NOTE: a and b should be sorted in increasing order before calling this function.
                    (FPCore (a b) :precision binary64 (* (PI) (/ 0.5 (* (* a a) b))))
                    \begin{array}{l}
                    [a, b] = \mathsf{sort}([a, b])\\
                    \\
                    \mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot a\right) \cdot b}
                    \end{array}
                    
                    Derivation
                    1. Initial program 75.5%

                      \[\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 \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. lower-*.f64N/A

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

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

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

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

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

                      Reproduce

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