NMSE Section 6.1 mentioned, B

Percentage Accurate: 78.6% → 99.6%
Time: 4.7s
Alternatives: 7
Speedup: 2.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 7 alternatives:

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

Initial Program: 78.6% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 1.2× speedup?

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

\\
\frac{0.5}{b - a} \cdot \frac{\left(b - a\right) \cdot \frac{\mathsf{PI}\left(\right)}{b + a}}{b \cdot a}
\end{array}
Derivation
  1. Initial program 82.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 rewrites85.6%

    \[\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. Step-by-step derivation
    1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 96.5% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.3 \cdot 10^{+105}:\\
\;\;\;\;\frac{\frac{0.5}{b \cdot a}}{a} \cdot \mathsf{PI}\left(\right)\\

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


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

    1. Initial program 71.4%

      \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in a around 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-*.f6490.4

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

          \[\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 rewrites99.8%

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

          if -1.3000000000000001e105 < a

          1. Initial program 84.2%

            \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
          2. Add Preprocessing
          3. 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 rewrites83.2%

            \[\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. Step-by-step derivation
            1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 3: 96.4% accurate, 2.0× speedup?

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

          1. Initial program 72.2%

            \[\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
          2. Add Preprocessing
          3. Taylor expanded in 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-*.f6490.6

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

              \[\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 rewrites97.8%

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

              if -2.9999999999999998e102 < a

              1. Initial program 84.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. 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 rewrites83.1%

                \[\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. Step-by-step derivation
                1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Alternative 4: 99.6% accurate, 2.0× speedup?

            \[\begin{array}{l} \\ \frac{\frac{0.5}{b \cdot a} \cdot \mathsf{PI}\left(\right)}{b + a} \end{array} \]
            (FPCore (a b) :precision binary64 (/ (* (/ 0.5 (* b a)) (PI)) (+ b a)))
            \begin{array}{l}
            
            \\
            \frac{\frac{0.5}{b \cdot a} \cdot \mathsf{PI}\left(\right)}{b + a}
            \end{array}
            
            Derivation
            1. Initial program 82.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 rewrites85.6%

              \[\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. Step-by-step derivation
              1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Alternative 5: 69.2% accurate, 2.2× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -5.8 \cdot 10^{-44}:\\ \;\;\;\;\frac{0.5}{\left(b \cdot a\right) \cdot a} \cdot \mathsf{PI}\left(\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\ \end{array} \end{array} \]
            (FPCore (a b)
             :precision binary64
             (if (<= a -5.8e-44)
               (* (/ 0.5 (* (* b a) a)) (PI))
               (* (/ (PI) (* (* b b) a)) 0.5)))
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;a \leq -5.8 \cdot 10^{-44}:\\
            \;\;\;\;\frac{0.5}{\left(b \cdot a\right) \cdot a} \cdot \mathsf{PI}\left(\right)\\
            
            \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 < -5.8000000000000003e-44

              1. Initial program 83.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-*.f6482.7

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

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

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

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

                  if -5.8000000000000003e-44 < a

                  1. Initial program 82.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-*.f6461.7

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

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

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

                Alternative 6: 62.4% accurate, 2.6× speedup?

                \[\begin{array}{l} \\ \frac{0.5}{\left(b \cdot a\right) \cdot a} \cdot \mathsf{PI}\left(\right) \end{array} \]
                (FPCore (a b) :precision binary64 (* (/ 0.5 (* (* b a) a)) (PI)))
                \begin{array}{l}
                
                \\
                \frac{0.5}{\left(b \cdot a\right) \cdot a} \cdot \mathsf{PI}\left(\right)
                \end{array}
                
                Derivation
                1. Initial program 82.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-*.f6458.5

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

                  \[\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 rewrites58.5%

                    \[\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 rewrites62.2%

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

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

                    Alternative 7: 56.8% accurate, 2.6× speedup?

                    \[\begin{array}{l} \\ \frac{0.5}{\left(a \cdot a\right) \cdot b} \cdot \mathsf{PI}\left(\right) \end{array} \]
                    (FPCore (a b) :precision binary64 (* (/ 0.5 (* (* a a) b)) (PI)))
                    \begin{array}{l}
                    
                    \\
                    \frac{0.5}{\left(a \cdot a\right) \cdot b} \cdot \mathsf{PI}\left(\right)
                    \end{array}
                    
                    Derivation
                    1. Initial program 82.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-*.f6458.5

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

                      \[\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 rewrites58.5%

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

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

                      Reproduce

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