NMSE Section 6.1 mentioned, B

Percentage Accurate: 78.5% → 99.6%
Time: 9.6s
Alternatives: 8
Speedup: 2.4×

Specification

?
\[\begin{array}{l} \\ \left(\frac{\pi}{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))))
double code(double a, double b) {
	return ((((double) M_PI) / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b));
}
public static double code(double a, double b) {
	return ((Math.PI / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b));
}
def code(a, b):
	return ((math.pi / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b))
function code(a, b)
	return Float64(Float64(Float64(pi / 2.0) * Float64(1.0 / Float64(Float64(b * b) - Float64(a * a)))) * Float64(Float64(1.0 / a) - Float64(1.0 / b)))
end
function tmp = code(a, b)
	tmp = ((pi / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b));
end
code[a_, b_] := N[(N[(N[(Pi / 2.0), $MachinePrecision] * N[(1.0 / N[(N[(b * b), $MachinePrecision] - N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / a), $MachinePrecision] - N[(1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\frac{\pi}{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: 78.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\frac{\pi}{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))))
double code(double a, double b) {
	return ((((double) M_PI) / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b));
}
public static double code(double a, double b) {
	return ((Math.PI / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b));
}
def code(a, b):
	return ((math.pi / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b))
function code(a, b)
	return Float64(Float64(Float64(pi / 2.0) * Float64(1.0 / Float64(Float64(b * b) - Float64(a * a)))) * Float64(Float64(1.0 / a) - Float64(1.0 / b)))
end
function tmp = code(a, b)
	tmp = ((pi / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b));
end
code[a_, b_] := N[(N[(N[(Pi / 2.0), $MachinePrecision] * N[(1.0 / N[(N[(b * b), $MachinePrecision] - N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / a), $MachinePrecision] - N[(1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\frac{\pi}{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.5× speedup?

\[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \frac{\pi \cdot 0.5}{a + b} \cdot \frac{\frac{1}{a}}{b} \end{array} \]
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (a b) :precision binary64 (* (/ (* PI 0.5) (+ a b)) (/ (/ 1.0 a) b)))
assert(a < b);
double code(double a, double b) {
	return ((((double) M_PI) * 0.5) / (a + b)) * ((1.0 / a) / b);
}
assert a < b;
public static double code(double a, double b) {
	return ((Math.PI * 0.5) / (a + b)) * ((1.0 / a) / b);
}
[a, b] = sort([a, b])
def code(a, b):
	return ((math.pi * 0.5) / (a + b)) * ((1.0 / a) / b)
a, b = sort([a, b])
function code(a, b)
	return Float64(Float64(Float64(pi * 0.5) / Float64(a + b)) * Float64(Float64(1.0 / a) / b))
end
a, b = num2cell(sort([a, b])){:}
function tmp = code(a, b)
	tmp = ((pi * 0.5) / (a + b)) * ((1.0 / a) / b);
end
NOTE: a and b should be sorted in increasing order before calling this function.
code[a_, b_] := N[(N[(N[(Pi * 0.5), $MachinePrecision] / N[(a + b), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / a), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\frac{\pi \cdot 0.5}{a + b} \cdot \frac{\frac{1}{a}}{b}
\end{array}
Derivation
  1. Initial program 78.1%

    \[\left(\frac{\pi}{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. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{b - a}{a \cdot b}}{b - a} \cdot \frac{0.5 \cdot \pi}{a + b}} \]
  5. Taylor expanded in b around 0

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

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

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

      \[\leadsto \frac{1}{\color{blue}{b \cdot a}} \cdot \frac{0.5 \cdot \pi}{a + b} \]
  7. Applied rewrites99.7%

    \[\leadsto \color{blue}{\frac{1}{b \cdot a}} \cdot \frac{0.5 \cdot \pi}{a + b} \]
  8. Step-by-step derivation
    1. Applied rewrites99.7%

      \[\leadsto \frac{\frac{1}{a}}{\color{blue}{b}} \cdot \frac{0.5 \cdot \pi}{a + b} \]
    2. Final simplification99.7%

      \[\leadsto \frac{\pi \cdot 0.5}{a + b} \cdot \frac{\frac{1}{a}}{b} \]
    3. Add Preprocessing

    Alternative 2: 99.7% accurate, 2.0× speedup?

    \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \frac{\frac{\pi}{a \cdot b} \cdot 0.5}{a + b} \end{array} \]
    NOTE: a and b should be sorted in increasing order before calling this function.
    (FPCore (a b) :precision binary64 (/ (* (/ PI (* a b)) 0.5) (+ a b)))
    assert(a < b);
    double code(double a, double b) {
    	return ((((double) M_PI) / (a * b)) * 0.5) / (a + b);
    }
    
    assert a < b;
    public static double code(double a, double b) {
    	return ((Math.PI / (a * b)) * 0.5) / (a + b);
    }
    
    [a, b] = sort([a, b])
    def code(a, b):
    	return ((math.pi / (a * b)) * 0.5) / (a + b)
    
    a, b = sort([a, b])
    function code(a, b)
    	return Float64(Float64(Float64(pi / Float64(a * b)) * 0.5) / Float64(a + b))
    end
    
    a, b = num2cell(sort([a, b])){:}
    function tmp = code(a, b)
    	tmp = ((pi / (a * b)) * 0.5) / (a + b);
    end
    
    NOTE: a and b should be sorted in increasing order before calling this function.
    code[a_, b_] := N[(N[(N[(Pi / N[(a * b), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] / N[(a + b), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    [a, b] = \mathsf{sort}([a, b])\\
    \\
    \frac{\frac{\pi}{a \cdot b} \cdot 0.5}{a + b}
    \end{array}
    
    Derivation
    1. Initial program 78.1%

      \[\left(\frac{\pi}{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 \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) \]
      3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\pi}{a \cdot b}} \cdot 0.5}{a + b} \]
      9. lift-*.f64N/A

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

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

        \[\leadsto \frac{\frac{\pi}{\color{blue}{b \cdot a}} \cdot 0.5}{a + b} \]
      12. lift-+.f64N/A

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

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

        \[\leadsto \frac{\frac{\pi}{b \cdot a} \cdot 0.5}{\color{blue}{b + a}} \]
    8. Applied rewrites99.7%

      \[\leadsto \color{blue}{\frac{\frac{\pi}{b \cdot a} \cdot 0.5}{b + a}} \]
    9. Final simplification99.7%

      \[\leadsto \frac{\frac{\pi}{a \cdot b} \cdot 0.5}{a + b} \]
    10. Add Preprocessing

    Alternative 3: 99.6% accurate, 2.0× speedup?

    \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \frac{0.5}{a + b} \cdot \frac{\pi}{a \cdot b} \end{array} \]
    NOTE: a and b should be sorted in increasing order before calling this function.
    (FPCore (a b) :precision binary64 (* (/ 0.5 (+ a b)) (/ PI (* a b))))
    assert(a < b);
    double code(double a, double b) {
    	return (0.5 / (a + b)) * (((double) M_PI) / (a * b));
    }
    
    assert a < b;
    public static double code(double a, double b) {
    	return (0.5 / (a + b)) * (Math.PI / (a * b));
    }
    
    [a, b] = sort([a, b])
    def code(a, b):
    	return (0.5 / (a + b)) * (math.pi / (a * b))
    
    a, b = sort([a, b])
    function code(a, b)
    	return Float64(Float64(0.5 / Float64(a + b)) * Float64(pi / Float64(a * b)))
    end
    
    a, b = num2cell(sort([a, b])){:}
    function tmp = code(a, b)
    	tmp = (0.5 / (a + b)) * (pi / (a * b));
    end
    
    NOTE: a and b should be sorted in increasing order before calling this function.
    code[a_, b_] := N[(N[(0.5 / N[(a + b), $MachinePrecision]), $MachinePrecision] * N[(Pi / N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    [a, b] = \mathsf{sort}([a, b])\\
    \\
    \frac{0.5}{a + b} \cdot \frac{\pi}{a \cdot b}
    \end{array}
    
    Derivation
    1. Initial program 78.1%

      \[\left(\frac{\pi}{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 \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) \]
      3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\pi}{b \cdot a} \cdot \color{blue}{\frac{0.5}{a + b}} \]
      11. lift-+.f64N/A

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

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

        \[\leadsto \frac{\pi}{b \cdot a} \cdot \frac{0.5}{\color{blue}{b + a}} \]
    8. Applied rewrites99.6%

      \[\leadsto \color{blue}{\frac{\pi}{b \cdot a} \cdot \frac{0.5}{b + a}} \]
    9. Final simplification99.6%

      \[\leadsto \frac{0.5}{a + b} \cdot \frac{\pi}{a \cdot b} \]
    10. Add Preprocessing

    Alternative 4: 90.0% accurate, 2.2× speedup?

    \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \begin{array}{l} \mathbf{if}\;a \leq -6.8 \cdot 10^{-74}:\\ \;\;\;\;\frac{0.5}{\left(a \cdot b\right) \cdot a} \cdot \pi\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{\left(a \cdot b\right) \cdot b} \cdot \pi\\ \end{array} \end{array} \]
    NOTE: a and b should be sorted in increasing order before calling this function.
    (FPCore (a b)
     :precision binary64
     (if (<= a -6.8e-74)
       (* (/ 0.5 (* (* a b) a)) PI)
       (* (/ 0.5 (* (* a b) b)) PI)))
    assert(a < b);
    double code(double a, double b) {
    	double tmp;
    	if (a <= -6.8e-74) {
    		tmp = (0.5 / ((a * b) * a)) * ((double) M_PI);
    	} else {
    		tmp = (0.5 / ((a * b) * b)) * ((double) M_PI);
    	}
    	return tmp;
    }
    
    assert a < b;
    public static double code(double a, double b) {
    	double tmp;
    	if (a <= -6.8e-74) {
    		tmp = (0.5 / ((a * b) * a)) * Math.PI;
    	} else {
    		tmp = (0.5 / ((a * b) * b)) * Math.PI;
    	}
    	return tmp;
    }
    
    [a, b] = sort([a, b])
    def code(a, b):
    	tmp = 0
    	if a <= -6.8e-74:
    		tmp = (0.5 / ((a * b) * a)) * math.pi
    	else:
    		tmp = (0.5 / ((a * b) * b)) * math.pi
    	return tmp
    
    a, b = sort([a, b])
    function code(a, b)
    	tmp = 0.0
    	if (a <= -6.8e-74)
    		tmp = Float64(Float64(0.5 / Float64(Float64(a * b) * a)) * pi);
    	else
    		tmp = Float64(Float64(0.5 / Float64(Float64(a * b) * b)) * pi);
    	end
    	return tmp
    end
    
    a, b = num2cell(sort([a, b])){:}
    function tmp_2 = code(a, b)
    	tmp = 0.0;
    	if (a <= -6.8e-74)
    		tmp = (0.5 / ((a * b) * a)) * pi;
    	else
    		tmp = (0.5 / ((a * b) * b)) * pi;
    	end
    	tmp_2 = tmp;
    end
    
    NOTE: a and b should be sorted in increasing order before calling this function.
    code[a_, b_] := If[LessEqual[a, -6.8e-74], N[(N[(0.5 / N[(N[(a * b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision], N[(N[(0.5 / N[(N[(a * b), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]]
    
    \begin{array}{l}
    [a, b] = \mathsf{sort}([a, b])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;a \leq -6.8 \cdot 10^{-74}:\\
    \;\;\;\;\frac{0.5}{\left(a \cdot b\right) \cdot a} \cdot \pi\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{0.5}{\left(a \cdot b\right) \cdot b} \cdot \pi\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if a < -6.8000000000000001e-74

      1. Initial program 84.6%

        \[\left(\frac{\pi}{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 0

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

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

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

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

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

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

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

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

          if -6.8000000000000001e-74 < a

          1. Initial program 75.8%

            \[\left(\frac{\pi}{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. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\frac{\frac{b - a}{a \cdot b}}{b - a} \cdot \frac{0.5 \cdot \pi}{a + b}} \]
          5. Step-by-step derivation
            1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \pi \cdot \frac{0.5}{\color{blue}{\left(b \cdot a\right)} \cdot b} \]
          9. Applied rewrites70.3%

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

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

        Alternative 5: 84.4% accurate, 2.2× speedup?

        \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \begin{array}{l} \mathbf{if}\;a \leq -6.7 \cdot 10^{-74}:\\ \;\;\;\;\frac{0.5}{\left(a \cdot b\right) \cdot a} \cdot \pi\\ \mathbf{else}:\\ \;\;\;\;\frac{\pi}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\ \end{array} \end{array} \]
        NOTE: a and b should be sorted in increasing order before calling this function.
        (FPCore (a b)
         :precision binary64
         (if (<= a -6.7e-74)
           (* (/ 0.5 (* (* a b) a)) PI)
           (* (/ PI (* (* b b) a)) 0.5)))
        assert(a < b);
        double code(double a, double b) {
        	double tmp;
        	if (a <= -6.7e-74) {
        		tmp = (0.5 / ((a * b) * a)) * ((double) M_PI);
        	} else {
        		tmp = (((double) M_PI) / ((b * b) * a)) * 0.5;
        	}
        	return tmp;
        }
        
        assert a < b;
        public static double code(double a, double b) {
        	double tmp;
        	if (a <= -6.7e-74) {
        		tmp = (0.5 / ((a * b) * a)) * Math.PI;
        	} else {
        		tmp = (Math.PI / ((b * b) * a)) * 0.5;
        	}
        	return tmp;
        }
        
        [a, b] = sort([a, b])
        def code(a, b):
        	tmp = 0
        	if a <= -6.7e-74:
        		tmp = (0.5 / ((a * b) * a)) * math.pi
        	else:
        		tmp = (math.pi / ((b * b) * a)) * 0.5
        	return tmp
        
        a, b = sort([a, b])
        function code(a, b)
        	tmp = 0.0
        	if (a <= -6.7e-74)
        		tmp = Float64(Float64(0.5 / Float64(Float64(a * b) * a)) * pi);
        	else
        		tmp = Float64(Float64(pi / Float64(Float64(b * b) * a)) * 0.5);
        	end
        	return tmp
        end
        
        a, b = num2cell(sort([a, b])){:}
        function tmp_2 = code(a, b)
        	tmp = 0.0;
        	if (a <= -6.7e-74)
        		tmp = (0.5 / ((a * b) * a)) * pi;
        	else
        		tmp = (pi / ((b * b) * a)) * 0.5;
        	end
        	tmp_2 = tmp;
        end
        
        NOTE: a and b should be sorted in increasing order before calling this function.
        code[a_, b_] := If[LessEqual[a, -6.7e-74], N[(N[(0.5 / N[(N[(a * b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision], N[(N[(Pi / N[(N[(b * b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
        
        \begin{array}{l}
        [a, b] = \mathsf{sort}([a, b])\\
        \\
        \begin{array}{l}
        \mathbf{if}\;a \leq -6.7 \cdot 10^{-74}:\\
        \;\;\;\;\frac{0.5}{\left(a \cdot b\right) \cdot a} \cdot \pi\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\pi}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if a < -6.6999999999999996e-74

          1. Initial program 84.6%

            \[\left(\frac{\pi}{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 0

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

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

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

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

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

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

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

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

              if -6.6999999999999996e-74 < a

              1. Initial program 75.8%

                \[\left(\frac{\pi}{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{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-*.f6459.0

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

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

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

            Alternative 6: 99.1% accurate, 2.4× speedup?

            \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \frac{\pi \cdot 0.5}{\left(a \cdot b\right) \cdot \left(a + b\right)} \end{array} \]
            NOTE: a and b should be sorted in increasing order before calling this function.
            (FPCore (a b) :precision binary64 (/ (* PI 0.5) (* (* a b) (+ a b))))
            assert(a < b);
            double code(double a, double b) {
            	return (((double) M_PI) * 0.5) / ((a * b) * (a + b));
            }
            
            assert a < b;
            public static double code(double a, double b) {
            	return (Math.PI * 0.5) / ((a * b) * (a + b));
            }
            
            [a, b] = sort([a, b])
            def code(a, b):
            	return (math.pi * 0.5) / ((a * b) * (a + b))
            
            a, b = sort([a, b])
            function code(a, b)
            	return Float64(Float64(pi * 0.5) / Float64(Float64(a * b) * Float64(a + b)))
            end
            
            a, b = num2cell(sort([a, b])){:}
            function tmp = code(a, b)
            	tmp = (pi * 0.5) / ((a * b) * (a + b));
            end
            
            NOTE: a and b should be sorted in increasing order before calling this function.
            code[a_, b_] := N[(N[(Pi * 0.5), $MachinePrecision] / N[(N[(a * b), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
            
            \begin{array}{l}
            [a, b] = \mathsf{sort}([a, b])\\
            \\
            \frac{\pi \cdot 0.5}{\left(a \cdot b\right) \cdot \left(a + b\right)}
            \end{array}
            
            Derivation
            1. Initial program 78.1%

              \[\left(\frac{\pi}{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 \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) \]
              3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Alternative 7: 62.2% accurate, 2.6× speedup?

            \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \frac{0.5}{\left(a \cdot b\right) \cdot a} \cdot \pi \end{array} \]
            NOTE: a and b should be sorted in increasing order before calling this function.
            (FPCore (a b) :precision binary64 (* (/ 0.5 (* (* a b) a)) PI))
            assert(a < b);
            double code(double a, double b) {
            	return (0.5 / ((a * b) * a)) * ((double) M_PI);
            }
            
            assert a < b;
            public static double code(double a, double b) {
            	return (0.5 / ((a * b) * a)) * Math.PI;
            }
            
            [a, b] = sort([a, b])
            def code(a, b):
            	return (0.5 / ((a * b) * a)) * math.pi
            
            a, b = sort([a, b])
            function code(a, b)
            	return Float64(Float64(0.5 / Float64(Float64(a * b) * a)) * pi)
            end
            
            a, b = num2cell(sort([a, b])){:}
            function tmp = code(a, b)
            	tmp = (0.5 / ((a * b) * a)) * pi;
            end
            
            NOTE: a and b should be sorted in increasing order before calling this function.
            code[a_, b_] := N[(N[(0.5 / N[(N[(a * b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]
            
            \begin{array}{l}
            [a, b] = \mathsf{sort}([a, b])\\
            \\
            \frac{0.5}{\left(a \cdot b\right) \cdot a} \cdot \pi
            \end{array}
            
            Derivation
            1. Initial program 78.1%

              \[\left(\frac{\pi}{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 0

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

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

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

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

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

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

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

                  \[\leadsto \pi \cdot \frac{0.5}{\left(a \cdot b\right) \cdot \color{blue}{a}} \]
                2. Final simplification63.1%

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

                Alternative 8: 56.3% accurate, 2.6× speedup?

                \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \frac{0.5}{\left(a \cdot a\right) \cdot b} \cdot \pi \end{array} \]
                NOTE: a and b should be sorted in increasing order before calling this function.
                (FPCore (a b) :precision binary64 (* (/ 0.5 (* (* a a) b)) PI))
                assert(a < b);
                double code(double a, double b) {
                	return (0.5 / ((a * a) * b)) * ((double) M_PI);
                }
                
                assert a < b;
                public static double code(double a, double b) {
                	return (0.5 / ((a * a) * b)) * Math.PI;
                }
                
                [a, b] = sort([a, b])
                def code(a, b):
                	return (0.5 / ((a * a) * b)) * math.pi
                
                a, b = sort([a, b])
                function code(a, b)
                	return Float64(Float64(0.5 / Float64(Float64(a * a) * b)) * pi)
                end
                
                a, b = num2cell(sort([a, b])){:}
                function tmp = code(a, b)
                	tmp = (0.5 / ((a * a) * b)) * pi;
                end
                
                NOTE: a and b should be sorted in increasing order before calling this function.
                code[a_, b_] := N[(N[(0.5 / N[(N[(a * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]
                
                \begin{array}{l}
                [a, b] = \mathsf{sort}([a, b])\\
                \\
                \frac{0.5}{\left(a \cdot a\right) \cdot b} \cdot \pi
                \end{array}
                
                Derivation
                1. Initial program 78.1%

                  \[\left(\frac{\pi}{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 0

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

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

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

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

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

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

                    \[\leadsto \pi \cdot \color{blue}{\frac{0.5}{\left(a \cdot a\right) \cdot b}} \]
                  2. Final simplification59.0%

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

                  Reproduce

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