NMSE Section 6.1 mentioned, B

Percentage Accurate: 78.5% → 99.3%
Time: 7.9s
Alternatives: 12
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 12 alternatives:

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

Initial Program: 78.5% 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.3% accurate, 1.2× speedup?

\[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \begin{array}{l} \mathbf{if}\;a \leq -2 \cdot 10^{+110}:\\ \;\;\;\;\left(\frac{-1}{b} \cdot \frac{\mathsf{PI}\left(\right)}{a + b}\right) \cdot \frac{0.5}{b - a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{b - a}{a + b}}{\left(\left(b - a\right) \cdot a\right) \cdot b} \cdot \left(0.5 \cdot \mathsf{PI}\left(\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 -2e+110)
   (* (* (/ -1.0 b) (/ (PI) (+ a b))) (/ 0.5 (- b a)))
   (* (/ (/ (- b a) (+ a b)) (* (* (- b a) a) b)) (* 0.5 (PI)))))
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{+110}:\\
\;\;\;\;\left(\frac{-1}{b} \cdot \frac{\mathsf{PI}\left(\right)}{a + b}\right) \cdot \frac{0.5}{b - a}\\

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


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

    1. Initial program 60.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. 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 \left(\frac{1}{a} - \frac{1}{b}\right) \cdot \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right)} \]
      4. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -2e110 < a

      1. Initial program 79.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. Applied rewrites91.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 2: 92.6% accurate, 0.5× speedup?

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

      1. Initial program 74.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-*.f6457.1

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

          \[\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 rewrites69.0%

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

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

            if 2.09999999999999996e-109 < b

            1. Initial program 79.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. 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 \left(\frac{1}{a} - \frac{1}{b}\right) \cdot \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right)} \]
              4. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 3: 99.0% accurate, 1.4× speedup?

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

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

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

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

          Alternative 4: 92.5% accurate, 1.5× speedup?

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

            1. Initial program 74.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-*.f6457.1

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

                \[\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 rewrites69.0%

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

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

                  if 2.09999999999999996e-109 < b

                  1. Initial program 79.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. 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 \left(\frac{1}{a} - \frac{1}{b}\right) \cdot \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right)} \]
                    4. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 5: 92.5% accurate, 1.5× speedup?

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

                  1. Initial program 74.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-*.f6457.1

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

                      \[\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 rewrites69.0%

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

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

                        if 2.09999999999999996e-109 < b

                        1. Initial program 79.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. 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 \left(\frac{1}{a} - \frac{1}{b}\right) \cdot \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right)} \]
                          4. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      Alternative 6: 92.2% accurate, 1.8× speedup?

                      \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \begin{array}{l} \mathbf{if}\;b \leq 2.1 \cdot 10^{-109}:\\ \;\;\;\;\frac{\frac{0.5 \cdot \mathsf{PI}\left(\right)}{a \cdot b}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b - a\right) \cdot \left(\left(a \cdot b\right) \cdot 2\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 (<= b 2.1e-109)
                         (/ (/ (* 0.5 (PI)) (* a b)) a)
                         (/ (PI) (* (- b a) (* (* a b) 2.0)))))
                      \begin{array}{l}
                      [a, b] = \mathsf{sort}([a, b])\\
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;b \leq 2.1 \cdot 10^{-109}:\\
                      \;\;\;\;\frac{\frac{0.5 \cdot \mathsf{PI}\left(\right)}{a \cdot b}}{a}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b - a\right) \cdot \left(\left(a \cdot b\right) \cdot 2\right)}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if b < 2.09999999999999996e-109

                        1. Initial program 74.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-*.f6457.1

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

                            \[\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 rewrites69.0%

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

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

                              if 2.09999999999999996e-109 < b

                              1. Initial program 79.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. Applied rewrites98.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. Applied rewrites98.8%

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

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

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

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

                            Alternative 7: 92.2% accurate, 1.8× speedup?

                            \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \begin{array}{l} \mathbf{if}\;b \leq 2.1 \cdot 10^{-109}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{a} \cdot \frac{0.5}{a \cdot b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b - a\right) \cdot \left(\left(a \cdot b\right) \cdot 2\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 (<= b 2.1e-109)
                               (* (/ (PI) a) (/ 0.5 (* a b)))
                               (/ (PI) (* (- b a) (* (* a b) 2.0)))))
                            \begin{array}{l}
                            [a, b] = \mathsf{sort}([a, b])\\
                            \\
                            \begin{array}{l}
                            \mathbf{if}\;b \leq 2.1 \cdot 10^{-109}:\\
                            \;\;\;\;\frac{\mathsf{PI}\left(\right)}{a} \cdot \frac{0.5}{a \cdot b}\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b - a\right) \cdot \left(\left(a \cdot b\right) \cdot 2\right)}\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if b < 2.09999999999999996e-109

                              1. Initial program 74.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-*.f6457.1

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

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

                                if 2.09999999999999996e-109 < b

                                1. Initial program 79.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. Applied rewrites98.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. Applied rewrites98.8%

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

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

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

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

                              Alternative 8: 91.9% accurate, 2.0× speedup?

                              \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \begin{array}{l} \mathbf{if}\;b \leq 2.1 \cdot 10^{-109}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b - a\right) \cdot \left(\left(a \cdot b\right) \cdot 2\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 (<= b 2.1e-109)
                                 (* (/ (PI) (* (* a b) a)) 0.5)
                                 (/ (PI) (* (- b a) (* (* a b) 2.0)))))
                              \begin{array}{l}
                              [a, b] = \mathsf{sort}([a, b])\\
                              \\
                              \begin{array}{l}
                              \mathbf{if}\;b \leq 2.1 \cdot 10^{-109}:\\
                              \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \cdot 0.5\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b - a\right) \cdot \left(\left(a \cdot b\right) \cdot 2\right)}\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 2 regimes
                              2. if b < 2.09999999999999996e-109

                                1. Initial program 74.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-*.f6457.1

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

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

                                  if 2.09999999999999996e-109 < b

                                  1. Initial program 79.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. Applied rewrites98.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. Applied rewrites98.8%

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

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

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

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

                                Alternative 9: 83.8% accurate, 2.2× speedup?

                                \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \begin{array}{l} \mathbf{if}\;b \leq 4 \cdot 10^{-93}:\\ \;\;\;\;\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 (<= b 4e-93)
                                   (* (/ (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}\;b \leq 4 \cdot 10^{-93}:\\
                                \;\;\;\;\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 b < 3.9999999999999996e-93

                                  1. Initial program 75.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 \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-*.f6458.0

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

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

                                    if 3.9999999999999996e-93 < b

                                    1. Initial program 77.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 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-*.f6473.3

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

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

                                  Alternative 10: 62.6% 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.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 \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-*.f6452.6

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

                                    \[\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 rewrites61.0%

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

                                    Alternative 11: 62.6% 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.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 \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-*.f6452.6

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

                                      \[\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 rewrites52.6%

                                        \[\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 rewrites61.0%

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

                                        Alternative 12: 56.7% 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.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 \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-*.f6452.6

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

                                          \[\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 rewrites52.6%

                                            \[\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 2024317 
                                          (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))))