NMSE Section 6.1 mentioned, B

Percentage Accurate: 77.9% → 99.6%
Time: 4.6s
Alternatives: 8
Speedup: 1.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 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: 77.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 0.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.6% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 3: 87.1% accurate, 1.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{PI}\left(\right)}{a}\\ \mathbf{if}\;a \leq -1.6 \cdot 10^{-23}:\\ \;\;\;\;\frac{t\_0}{b \cdot a} \cdot 0.5\\ \mathbf{elif}\;a \leq 1.9 \cdot 10^{-33}:\\ \;\;\;\;\frac{\frac{t\_0 \cdot 0.5}{b}}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\ \end{array} \end{array} \]
    (FPCore (a b)
     :precision binary64
     (let* ((t_0 (/ (PI) a)))
       (if (<= a -1.6e-23)
         (* (/ t_0 (* b a)) 0.5)
         (if (<= a 1.9e-33)
           (/ (/ (* t_0 0.5) b) b)
           (* (/ (PI) (* a (* a b))) 0.5)))))
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{\mathsf{PI}\left(\right)}{a}\\
    \mathbf{if}\;a \leq -1.6 \cdot 10^{-23}:\\
    \;\;\;\;\frac{t\_0}{b \cdot a} \cdot 0.5\\
    
    \mathbf{elif}\;a \leq 1.9 \cdot 10^{-33}:\\
    \;\;\;\;\frac{\frac{t\_0 \cdot 0.5}{b}}{b}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if a < -1.59999999999999988e-23

      1. Initial program 67.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. Applied rewrites76.5%

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

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

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

            if -1.59999999999999988e-23 < a < 1.89999999999999997e-33

            1. Initial program 81.3%

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

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

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

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

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

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

                  if 1.89999999999999997e-33 < a

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

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

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

                    Alternative 4: 99.6% accurate, 1.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        Alternative 5: 86.8% accurate, 1.8× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.6 \cdot 10^{-23} \lor \neg \left(a \leq 1.9 \cdot 10^{-33}\right):\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)} \cdot 0.5\\ \end{array} \end{array} \]
                        (FPCore (a b)
                         :precision binary64
                         (if (or (<= a -1.6e-23) (not (<= a 1.9e-33)))
                           (* (/ (PI) (* a (* a b))) 0.5)
                           (* (/ (PI) (* b (* b a))) 0.5)))
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;a \leq -1.6 \cdot 10^{-23} \lor \neg \left(a \leq 1.9 \cdot 10^{-33}\right):\\
                        \;\;\;\;\frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;\frac{\mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)} \cdot 0.5\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if a < -1.59999999999999988e-23 or 1.89999999999999997e-33 < a

                          1. Initial program 73.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. Applied rewrites78.2%

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

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

                              if -1.59999999999999988e-23 < a < 1.89999999999999997e-33

                              1. Initial program 81.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. Applied rewrites32.3%

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

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

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

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

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

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

                                    Alternative 6: 80.1% accurate, 1.8× speedup?

                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.6 \cdot 10^{-23} \lor \neg \left(a \leq 2.15 \cdot 10^{-75}\right):\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\ \end{array} \end{array} \]
                                    (FPCore (a b)
                                     :precision binary64
                                     (if (or (<= a -1.6e-23) (not (<= a 2.15e-75)))
                                       (* (/ (PI) (* a (* a b))) 0.5)
                                       (* (/ (PI) (* (* b b) a)) 0.5)))
                                    \begin{array}{l}
                                    
                                    \\
                                    \begin{array}{l}
                                    \mathbf{if}\;a \leq -1.6 \cdot 10^{-23} \lor \neg \left(a \leq 2.15 \cdot 10^{-75}\right):\\
                                    \;\;\;\;\frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\
                                    
                                    
                                    \end{array}
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 2 regimes
                                    2. if a < -1.59999999999999988e-23 or 2.15e-75 < a

                                      1. Initial program 74.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. Applied rewrites76.8%

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

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

                                          if -1.59999999999999988e-23 < a < 2.15e-75

                                          1. Initial program 81.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 0

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

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

                                            \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.6 \cdot 10^{-23} \lor \neg \left(a \leq 2.15 \cdot 10^{-75}\right):\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\ \end{array} \]
                                          7. Add Preprocessing

                                          Alternative 7: 86.9% accurate, 1.8× speedup?

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

                                            1. Initial program 67.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. Applied rewrites76.5%

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

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

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

                                                  if -1.59999999999999988e-23 < a < 1.89999999999999997e-33

                                                  1. Initial program 81.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. Applied rewrites32.3%

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

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

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

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

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

                                                          if 1.89999999999999997e-33 < a

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

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

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

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

                                                            Alternative 8: 63.1% accurate, 2.6× speedup?

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

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

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

                                                                Reproduce

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