NMSE Section 6.1 mentioned, B

Percentage Accurate: 78.4% → 99.7%
Time: 11.9s
Alternatives: 11
Speedup: 1.6×

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 11 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.4% 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.7% accurate, 1.3× speedup?

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

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\pi}{a \cdot b}}{2}}{b - a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 5e128

    1. Initial program 79.7%

      \[\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
    2. Step-by-step derivation
      1. associate-*r/N/A

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

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

        \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{2} \cdot \left(\frac{1}{a} - \frac{1}{b}\right)}{\color{blue}{b \cdot b - a \cdot a}} \]
      4. *-commutativeN/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} \]
      5. associate-*r/N/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\left(\frac{1}{a} - \frac{1}{b}\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{\left(2 \cdot \left(b \cdot b - a \cdot a\right)\right)}\right) \]
    3. Simplified84.8%

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI}\left(\right), a\right), \mathsf{*.f64}\left(\color{blue}{\mathsf{+.f64}\left(b, a\right)}, \mathsf{*.f64}\left(2, \mathsf{\_.f64}\left(b, a\right)\right)\right)\right) \]
      2. PI-lowering-PI.f6459.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), a\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\color{blue}{b}, a\right), \mathsf{*.f64}\left(2, \mathsf{\_.f64}\left(b, a\right)\right)\right)\right) \]
    7. Simplified59.0%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), a\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(b, a\right), \mathsf{*.f64}\left(2, \color{blue}{b}\right)\right)\right) \]
    9. Step-by-step derivation
      1. Simplified95.2%

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

      if 5e128 < b

      1. Initial program 49.2%

        \[\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. un-div-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\frac{\mathsf{PI}\left(\right)}{a} - \frac{\mathsf{PI}\left(\right)}{b}}{b + a}}{2}\right), \color{blue}{\left(b - a\right)}\right) \]
      4. Applied egg-rr99.9%

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI}\left(\right), \left(a \cdot b\right)\right), 2\right), \mathsf{\_.f64}\left(b, a\right)\right) \]
        2. PI-lowering-PI.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \left(a \cdot b\right)\right), 2\right), \mathsf{\_.f64}\left(b, a\right)\right) \]
        3. *-lowering-*.f6499.9%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{*.f64}\left(a, b\right)\right), 2\right), \mathsf{\_.f64}\left(b, a\right)\right) \]
      7. Simplified99.9%

        \[\leadsto \frac{\frac{\color{blue}{\frac{\pi}{a \cdot b}}}{2}}{b - a} \]
    10. Recombined 2 regimes into one program.
    11. Final simplification95.9%

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

    Alternative 2: 99.7% accurate, 1.2× speedup?

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

      \[\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. un-div-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\frac{\mathsf{PI}\left(\right)}{a} - \frac{\mathsf{PI}\left(\right)}{b}}{b + a}}{2}\right), \color{blue}{\left(b - a\right)}\right) \]
    4. Applied egg-rr99.6%

      \[\leadsto \color{blue}{\frac{\frac{\frac{\frac{\pi}{a} - \frac{\pi}{b}}{b + a}}{2}}{b - a}} \]
    5. Final simplification99.6%

      \[\leadsto \frac{\frac{\frac{\frac{\pi}{a} - \frac{\pi}{b}}{a + b}}{2}}{b - a} \]
    6. Add Preprocessing

    Alternative 3: 99.6% accurate, 1.2× speedup?

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

      \[\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. un-div-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\frac{\mathsf{PI}\left(\right)}{a} - \frac{\mathsf{PI}\left(\right)}{b}}{b + a}}{2}\right), \color{blue}{\left(b - a\right)}\right) \]
    4. Applied egg-rr99.6%

      \[\leadsto \color{blue}{\frac{\frac{\frac{\frac{\pi}{a} - \frac{\pi}{b}}{b + a}}{2}}{b - a}} \]
    5. Step-by-step derivation
      1. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{\_.f64}\left(b, a\right)\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(a, b\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), a\right), \left(\frac{\mathsf{PI}\left(\right)}{b}\right)\right)\right)\right) \]
      16. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{\_.f64}\left(b, a\right)\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(a, b\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), a\right), \mathsf{/.f64}\left(\mathsf{PI}\left(\right), \color{blue}{b}\right)\right)\right)\right) \]
      17. PI-lowering-PI.f6499.6%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{\_.f64}\left(b, a\right)\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(a, b\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), a\right), \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), b\right)\right)\right)\right) \]
    6. Applied egg-rr99.6%

      \[\leadsto \color{blue}{\frac{\frac{0.5}{b - a}}{\frac{a + b}{\frac{\pi}{a} - \frac{\pi}{b}}}} \]
    7. Add Preprocessing

    Alternative 4: 99.7% accurate, 1.3× speedup?

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

      1. Initial program 79.5%

        \[\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      2. Step-by-step derivation
        1. associate-*r/N/A

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

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

          \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{2} \cdot \left(\frac{1}{a} - \frac{1}{b}\right)}{\color{blue}{b \cdot b - a \cdot a}} \]
        4. *-commutativeN/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} \]
        5. associate-*r/N/A

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

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

          \[\leadsto \mathsf{/.f64}\left(\left(\left(\frac{1}{a} - \frac{1}{b}\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{\left(2 \cdot \left(b \cdot b - a \cdot a\right)\right)}\right) \]
      3. Simplified84.7%

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI}\left(\right), a\right), \mathsf{*.f64}\left(\color{blue}{\mathsf{+.f64}\left(b, a\right)}, \mathsf{*.f64}\left(2, \mathsf{\_.f64}\left(b, a\right)\right)\right)\right) \]
        2. PI-lowering-PI.f6458.6%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), a\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\color{blue}{b}, a\right), \mathsf{*.f64}\left(2, \mathsf{\_.f64}\left(b, a\right)\right)\right)\right) \]
      7. Simplified58.6%

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), a\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(b, a\right), \mathsf{*.f64}\left(2, \color{blue}{b}\right)\right)\right) \]
      9. Step-by-step derivation
        1. Simplified95.2%

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

        if 4.99999999999999989e122 < b

        1. Initial program 51.9%

          \[\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. associate-*r/N/A

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{b}}{b}\right), a\right) \]
          10. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{b}\right), b\right), a\right) \]
          11. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{\mathsf{PI}\left(\right)}{b}\right)\right), b\right), a\right) \]
          12. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{PI}\left(\right), b\right)\right), b\right), a\right) \]
          13. PI-lowering-PI.f6473.6%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), b\right)\right), b\right), a\right) \]
        5. Simplified73.6%

          \[\leadsto \color{blue}{\frac{\frac{0.5 \cdot \frac{\pi}{b}}{b}}{a}} \]
        6. Step-by-step derivation
          1. associate-/l/N/A

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

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

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

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

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), b\right), \mathsf{/.f64}\left(\frac{1}{2}, \left(b \cdot \color{blue}{a}\right)\right)\right) \]
          9. *-lowering-*.f6499.7%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), b\right), \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(b, \color{blue}{a}\right)\right)\right) \]
        7. Applied egg-rr99.7%

          \[\leadsto \color{blue}{\frac{\pi}{b} \cdot \frac{0.5}{b \cdot a}} \]
        8. Step-by-step derivation
          1. associate-*l/N/A

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

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \left(\frac{b}{\frac{\mathsf{PI}\left(\right)}{a}}\right)\right), b\right) \]
          9. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(b, \left(\frac{\mathsf{PI}\left(\right)}{a}\right)\right)\right), b\right) \]
          10. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(b, \mathsf{/.f64}\left(\mathsf{PI}\left(\right), a\right)\right)\right), b\right) \]
          11. PI-lowering-PI.f6499.8%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(b, \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), a\right)\right)\right), b\right) \]
        9. Applied egg-rr99.8%

          \[\leadsto \color{blue}{\frac{\frac{0.5}{\frac{b}{\frac{\pi}{a}}}}{b}} \]
      10. Recombined 2 regimes into one program.
      11. Final simplification95.8%

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

      Alternative 5: 92.5% accurate, 1.3× speedup?

      \[\begin{array}{l} [a, b] = \mathsf{sort}([a, b])\\ \\ \begin{array}{l} \mathbf{if}\;b \leq 1.7 \cdot 10^{-64}:\\ \;\;\;\;\frac{\frac{0.5}{\frac{b}{\frac{\pi}{a}}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.5}{b - a}}{a \cdot \frac{b}{\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 (<= b 1.7e-64)
         (/ (/ 0.5 (/ b (/ PI a))) a)
         (/ (/ 0.5 (- b a)) (* a (/ b PI)))))
      assert(a < b);
      double code(double a, double b) {
      	double tmp;
      	if (b <= 1.7e-64) {
      		tmp = (0.5 / (b / (((double) M_PI) / a))) / a;
      	} else {
      		tmp = (0.5 / (b - a)) / (a * (b / ((double) M_PI)));
      	}
      	return tmp;
      }
      
      assert a < b;
      public static double code(double a, double b) {
      	double tmp;
      	if (b <= 1.7e-64) {
      		tmp = (0.5 / (b / (Math.PI / a))) / a;
      	} else {
      		tmp = (0.5 / (b - a)) / (a * (b / Math.PI));
      	}
      	return tmp;
      }
      
      [a, b] = sort([a, b])
      def code(a, b):
      	tmp = 0
      	if b <= 1.7e-64:
      		tmp = (0.5 / (b / (math.pi / a))) / a
      	else:
      		tmp = (0.5 / (b - a)) / (a * (b / math.pi))
      	return tmp
      
      a, b = sort([a, b])
      function code(a, b)
      	tmp = 0.0
      	if (b <= 1.7e-64)
      		tmp = Float64(Float64(0.5 / Float64(b / Float64(pi / a))) / a);
      	else
      		tmp = Float64(Float64(0.5 / Float64(b - a)) / Float64(a * Float64(b / pi)));
      	end
      	return tmp
      end
      
      a, b = num2cell(sort([a, b])){:}
      function tmp_2 = code(a, b)
      	tmp = 0.0;
      	if (b <= 1.7e-64)
      		tmp = (0.5 / (b / (pi / a))) / a;
      	else
      		tmp = (0.5 / (b - a)) / (a * (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[b, 1.7e-64], N[(N[(0.5 / N[(b / N[(Pi / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(0.5 / N[(b - a), $MachinePrecision]), $MachinePrecision] / N[(a * N[(b / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      [a, b] = \mathsf{sort}([a, b])\\
      \\
      \begin{array}{l}
      \mathbf{if}\;b \leq 1.7 \cdot 10^{-64}:\\
      \;\;\;\;\frac{\frac{0.5}{\frac{b}{\frac{\pi}{a}}}}{a}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\frac{0.5}{b - a}}{a \cdot \frac{b}{\pi}}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if b < 1.70000000000000006e-64

        1. Initial program 75.0%

          \[\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. associate-*r/N/A

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{PI.f64}\left(\right)\right), \mathsf{*.f64}\left(\left(a \cdot a\right), b\right)\right) \]
          7. *-lowering-*.f6457.1%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{PI.f64}\left(\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), b\right)\right) \]
        5. Simplified57.1%

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

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

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

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \left(\color{blue}{a} \cdot b\right)\right)\right) \]
          7. *-lowering-*.f6469.9%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{*.f64}\left(a, \color{blue}{b}\right)\right)\right) \]
        7. Applied egg-rr69.9%

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \left(\frac{a}{\mathsf{PI}\left(\right)}\right)\right), a\right)\right) \]
          10. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{/.f64}\left(a, \mathsf{PI}\left(\right)\right)\right), a\right)\right) \]
          11. PI-lowering-PI.f6469.7%

            \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{/.f64}\left(a, \mathsf{PI.f64}\left(\right)\right)\right), a\right)\right) \]
        9. Applied egg-rr69.7%

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \left(b \cdot \frac{a}{\mathsf{PI}\left(\right)}\right)\right), a\right) \]
          10. clear-numN/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \left(\frac{b}{\frac{\mathsf{PI}\left(\right)}{a}}\right)\right), a\right) \]
          12. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(b, \left(\frac{\mathsf{PI}\left(\right)}{a}\right)\right)\right), a\right) \]
          13. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(b, \mathsf{/.f64}\left(\mathsf{PI}\left(\right), a\right)\right)\right), a\right) \]
          14. PI-lowering-PI.f6469.9%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(b, \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), a\right)\right)\right), a\right) \]
        11. Applied egg-rr69.9%

          \[\leadsto \color{blue}{\frac{\frac{0.5}{\frac{b}{\frac{\pi}{a}}}}{a}} \]

        if 1.70000000000000006e-64 < b

        1. Initial program 76.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. Step-by-step derivation
          1. un-div-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\frac{\mathsf{PI}\left(\right)}{a} - \frac{\mathsf{PI}\left(\right)}{b}}{b + a}}{2}\right), \color{blue}{\left(b - a\right)}\right) \]
        4. Applied egg-rr99.6%

          \[\leadsto \color{blue}{\frac{\frac{\frac{\frac{\pi}{a} - \frac{\pi}{b}}{b + a}}{2}}{b - a}} \]
        5. Step-by-step derivation
          1. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{\_.f64}\left(b, a\right)\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(a, b\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), a\right), \left(\frac{\mathsf{PI}\left(\right)}{b}\right)\right)\right)\right) \]
          16. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{\_.f64}\left(b, a\right)\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(a, b\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), a\right), \mathsf{/.f64}\left(\mathsf{PI}\left(\right), \color{blue}{b}\right)\right)\right)\right) \]
          17. PI-lowering-PI.f6499.6%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{\_.f64}\left(b, a\right)\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(a, b\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), a\right), \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), b\right)\right)\right)\right) \]
        6. Applied egg-rr99.6%

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{\_.f64}\left(b, a\right)\right), \mathsf{*.f64}\left(a, \color{blue}{\left(\frac{b}{\mathsf{PI}\left(\right)}\right)}\right)\right) \]
          3. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{\_.f64}\left(b, a\right)\right), \mathsf{*.f64}\left(a, \mathsf{/.f64}\left(b, \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right) \]
          4. PI-lowering-PI.f6490.7%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{\_.f64}\left(b, a\right)\right), \mathsf{*.f64}\left(a, \mathsf{/.f64}\left(b, \mathsf{PI.f64}\left(\right)\right)\right)\right) \]
        9. Simplified90.7%

          \[\leadsto \frac{\frac{0.5}{b - a}}{\color{blue}{a \cdot \frac{b}{\pi}}} \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 6: 91.9% accurate, 1.3× speedup?

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

        1. Initial program 74.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. un-div-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\frac{\mathsf{PI}\left(\right)}{a} - \frac{\mathsf{PI}\left(\right)}{b}}{b + a}}{2}\right), \color{blue}{\left(b - a\right)}\right) \]
        4. Applied egg-rr99.6%

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{PI}\left(\right), \left(a \cdot b\right)\right)\right), \mathsf{\_.f64}\left(b, a\right)\right) \]
          3. PI-lowering-PI.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \left(a \cdot b\right)\right)\right), \mathsf{\_.f64}\left(b, a\right)\right) \]
          4. *-lowering-*.f6482.9%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{*.f64}\left(a, b\right)\right)\right), \mathsf{\_.f64}\left(b, a\right)\right) \]
        7. Simplified82.9%

          \[\leadsto \frac{\color{blue}{-0.5 \cdot \frac{\pi}{a \cdot b}}}{b - a} \]

        if -1.79999999999999996e-87 < a

        1. Initial program 75.9%

          \[\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. associate-*r/N/A

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{b}}{b}\right), a\right) \]
          10. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{b}\right), b\right), a\right) \]
          11. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{\mathsf{PI}\left(\right)}{b}\right)\right), b\right), a\right) \]
          12. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{PI}\left(\right), b\right)\right), b\right), a\right) \]
          13. PI-lowering-PI.f6455.1%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), b\right)\right), b\right), a\right) \]
        5. Simplified55.1%

          \[\leadsto \color{blue}{\frac{\frac{0.5 \cdot \frac{\pi}{b}}{b}}{a}} \]
        6. Step-by-step derivation
          1. associate-/l/N/A

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

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

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

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

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), b\right), \mathsf{/.f64}\left(\frac{1}{2}, \left(b \cdot \color{blue}{a}\right)\right)\right) \]
          9. *-lowering-*.f6465.9%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), b\right), \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(b, \color{blue}{a}\right)\right)\right) \]
        7. Applied egg-rr65.9%

          \[\leadsto \color{blue}{\frac{\pi}{b} \cdot \frac{0.5}{b \cdot a}} \]
        8. Step-by-step derivation
          1. associate-*r/N/A

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{PI}\left(\right) \cdot \frac{1}{b \cdot \frac{1}{\frac{1}{2}}}\right), \left(b \cdot a\right)\right) \]
          7. metadata-evalN/A

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI}\left(\right), \left(2 \cdot b\right)\right), \left(\color{blue}{b} \cdot a\right)\right) \]
          11. PI-lowering-PI.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \left(2 \cdot b\right)\right), \left(b \cdot a\right)\right) \]
          12. *-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \left(b \cdot 2\right)\right), \left(b \cdot a\right)\right) \]
          13. metadata-evalN/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \left(\frac{b}{\frac{1}{2}}\right)\right), \left(b \cdot a\right)\right) \]
          15. /-lowering-/.f64N/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(b, \frac{1}{2}\right)\right), \left(a \cdot \color{blue}{b}\right)\right) \]
          17. *-lowering-*.f6466.0%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(b, \frac{1}{2}\right)\right), \mathsf{*.f64}\left(a, \color{blue}{b}\right)\right) \]
        9. Applied egg-rr66.0%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.8 \cdot 10^{-87}:\\ \;\;\;\;\frac{\frac{\pi}{a \cdot b} \cdot -0.5}{b - a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\pi}{\frac{b}{0.5}}}{a \cdot b}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 7: 90.0% accurate, 1.5× speedup?

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

        1. Initial program 75.0%

          \[\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. associate-*r/N/A

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{PI.f64}\left(\right)\right), \mathsf{*.f64}\left(\left(a \cdot a\right), b\right)\right) \]
          7. *-lowering-*.f6457.1%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{PI.f64}\left(\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), b\right)\right) \]
        5. Simplified57.1%

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

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

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

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \left(\color{blue}{a} \cdot b\right)\right)\right) \]
          7. *-lowering-*.f6469.9%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{*.f64}\left(a, \color{blue}{b}\right)\right)\right) \]
        7. Applied egg-rr69.9%

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \left(\frac{a}{\mathsf{PI}\left(\right)}\right)\right), a\right)\right) \]
          10. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{/.f64}\left(a, \mathsf{PI}\left(\right)\right)\right), a\right)\right) \]
          11. PI-lowering-PI.f6469.7%

            \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{/.f64}\left(a, \mathsf{PI.f64}\left(\right)\right)\right), a\right)\right) \]
        9. Applied egg-rr69.7%

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \left(b \cdot \frac{a}{\mathsf{PI}\left(\right)}\right)\right), a\right) \]
          10. clear-numN/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \left(\frac{b}{\frac{\mathsf{PI}\left(\right)}{a}}\right)\right), a\right) \]
          12. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(b, \left(\frac{\mathsf{PI}\left(\right)}{a}\right)\right)\right), a\right) \]
          13. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(b, \mathsf{/.f64}\left(\mathsf{PI}\left(\right), a\right)\right)\right), a\right) \]
          14. PI-lowering-PI.f6469.9%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(b, \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), a\right)\right)\right), a\right) \]
        11. Applied egg-rr69.9%

          \[\leadsto \color{blue}{\frac{\frac{0.5}{\frac{b}{\frac{\pi}{a}}}}{a}} \]

        if 3.70000000000000012e-63 < b

        1. Initial program 76.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 inf

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{b}}{b}\right), a\right) \]
          10. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{b}\right), b\right), a\right) \]
          11. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{\mathsf{PI}\left(\right)}{b}\right)\right), b\right), a\right) \]
          12. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{PI}\left(\right), b\right)\right), b\right), a\right) \]
          13. PI-lowering-PI.f6471.5%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), b\right)\right), b\right), a\right) \]
        5. Simplified71.5%

          \[\leadsto \color{blue}{\frac{\frac{0.5 \cdot \frac{\pi}{b}}{b}}{a}} \]
        6. Step-by-step derivation
          1. associate-/l/N/A

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

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

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

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

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), b\right), \mathsf{/.f64}\left(\frac{1}{2}, \left(b \cdot \color{blue}{a}\right)\right)\right) \]
          9. *-lowering-*.f6483.9%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), b\right), \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(b, \color{blue}{a}\right)\right)\right) \]
        7. Applied egg-rr83.9%

          \[\leadsto \color{blue}{\frac{\pi}{b} \cdot \frac{0.5}{b \cdot a}} \]
        8. Step-by-step derivation
          1. associate-*r/N/A

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{PI}\left(\right) \cdot \frac{1}{b \cdot \frac{1}{\frac{1}{2}}}\right), \left(b \cdot a\right)\right) \]
          7. metadata-evalN/A

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI}\left(\right), \left(2 \cdot b\right)\right), \left(\color{blue}{b} \cdot a\right)\right) \]
          11. PI-lowering-PI.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \left(2 \cdot b\right)\right), \left(b \cdot a\right)\right) \]
          12. *-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \left(b \cdot 2\right)\right), \left(b \cdot a\right)\right) \]
          13. metadata-evalN/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \left(\frac{b}{\frac{1}{2}}\right)\right), \left(b \cdot a\right)\right) \]
          15. /-lowering-/.f64N/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(b, \frac{1}{2}\right)\right), \left(a \cdot \color{blue}{b}\right)\right) \]
          17. *-lowering-*.f6484.0%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(b, \frac{1}{2}\right)\right), \mathsf{*.f64}\left(a, \color{blue}{b}\right)\right) \]
        9. Applied egg-rr84.0%

          \[\leadsto \color{blue}{\frac{\frac{\pi}{\frac{b}{0.5}}}{a \cdot b}} \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 8: 89.9% accurate, 1.5× speedup?

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

        1. Initial program 75.0%

          \[\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. associate-*r/N/A

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{PI.f64}\left(\right)\right), \mathsf{*.f64}\left(\left(a \cdot a\right), b\right)\right) \]
          7. *-lowering-*.f6457.1%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{PI.f64}\left(\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), b\right)\right) \]
        5. Simplified57.1%

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

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

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

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \left(\color{blue}{a} \cdot b\right)\right)\right) \]
          7. *-lowering-*.f6469.9%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{*.f64}\left(a, \color{blue}{b}\right)\right)\right) \]
        7. Applied egg-rr69.9%

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \left(\frac{a}{\mathsf{PI}\left(\right)}\right)\right), a\right)\right) \]
          10. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{/.f64}\left(a, \mathsf{PI}\left(\right)\right)\right), a\right)\right) \]
          11. PI-lowering-PI.f6469.7%

            \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, \mathsf{/.f64}\left(a, \mathsf{PI.f64}\left(\right)\right)\right), a\right)\right) \]
        9. Applied egg-rr69.7%

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \left(b \cdot \frac{a}{\mathsf{PI}\left(\right)}\right)\right), a\right) \]
          10. clear-numN/A

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \left(\frac{b}{\frac{\mathsf{PI}\left(\right)}{a}}\right)\right), a\right) \]
          12. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(b, \left(\frac{\mathsf{PI}\left(\right)}{a}\right)\right)\right), a\right) \]
          13. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(b, \mathsf{/.f64}\left(\mathsf{PI}\left(\right), a\right)\right)\right), a\right) \]
          14. PI-lowering-PI.f6469.9%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(b, \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), a\right)\right)\right), a\right) \]
        11. Applied egg-rr69.9%

          \[\leadsto \color{blue}{\frac{\frac{0.5}{\frac{b}{\frac{\pi}{a}}}}{a}} \]

        if 1.26e-62 < b

        1. Initial program 76.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 inf

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{b}}{b}\right), a\right) \]
          10. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{b}\right), b\right), a\right) \]
          11. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{\mathsf{PI}\left(\right)}{b}\right)\right), b\right), a\right) \]
          12. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{PI}\left(\right), b\right)\right), b\right), a\right) \]
          13. PI-lowering-PI.f6471.5%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), b\right)\right), b\right), a\right) \]
        5. Simplified71.5%

          \[\leadsto \color{blue}{\frac{\frac{0.5 \cdot \frac{\pi}{b}}{b}}{a}} \]
        6. Step-by-step derivation
          1. associate-/l/N/A

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

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

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

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

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), b\right), \mathsf{/.f64}\left(\frac{1}{2}, \left(b \cdot \color{blue}{a}\right)\right)\right) \]
          9. *-lowering-*.f6483.9%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), b\right), \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(b, \color{blue}{a}\right)\right)\right) \]
        7. Applied egg-rr83.9%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1.26 \cdot 10^{-62}:\\ \;\;\;\;\frac{\frac{0.5}{\frac{b}{\frac{\pi}{a}}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\pi}{b} \cdot \frac{0.5}{a \cdot b}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 9: 90.0% accurate, 1.5× speedup?

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

        1. Initial program 75.0%

          \[\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. associate-*r/N/A

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{PI.f64}\left(\right)\right), \mathsf{*.f64}\left(\left(a \cdot a\right), b\right)\right) \]
          7. *-lowering-*.f6457.1%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{PI.f64}\left(\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), b\right)\right) \]
        5. Simplified57.1%

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

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

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

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \left(\color{blue}{a} \cdot b\right)\right)\right) \]
          7. *-lowering-*.f6469.9%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{*.f64}\left(a, \color{blue}{b}\right)\right)\right) \]
        7. Applied egg-rr69.9%

          \[\leadsto \color{blue}{\frac{0.5}{a} \cdot \frac{\pi}{a \cdot b}} \]

        if 4.29999999999999973e-64 < b

        1. Initial program 76.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 inf

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{b}}{b}\right), a\right) \]
          10. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{b}\right), b\right), a\right) \]
          11. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(\frac{\mathsf{PI}\left(\right)}{b}\right)\right), b\right), a\right) \]
          12. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{PI}\left(\right), b\right)\right), b\right), a\right) \]
          13. PI-lowering-PI.f6471.5%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), b\right)\right), b\right), a\right) \]
        5. Simplified71.5%

          \[\leadsto \color{blue}{\frac{\frac{0.5 \cdot \frac{\pi}{b}}{b}}{a}} \]
        6. Step-by-step derivation
          1. associate-/l/N/A

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

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

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

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

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), b\right), \mathsf{/.f64}\left(\frac{1}{2}, \left(b \cdot \color{blue}{a}\right)\right)\right) \]
          9. *-lowering-*.f6483.9%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), b\right), \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(b, \color{blue}{a}\right)\right)\right) \]
        7. Applied egg-rr83.9%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 4.3 \cdot 10^{-64}:\\ \;\;\;\;\frac{\pi}{a \cdot b} \cdot \frac{0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\pi}{b} \cdot \frac{0.5}{a \cdot b}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 10: 99.6% accurate, 1.6× speedup?

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

        \[\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. un-div-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto {\left(\left(b + a\right) \cdot \frac{2 \cdot \left(b - a\right)}{\frac{\mathsf{PI}\left(\right)}{a} - \frac{\mathsf{PI}\left(\right)}{b}}\right)}^{-1} \]
        14. unpow-prod-downN/A

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

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(b, a\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{PI.f64}\left(\right)\right), \left(a \cdot b\right)\right)\right) \]
        5. *-lowering-*.f6499.6%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(b, a\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{PI.f64}\left(\right)\right), \mathsf{*.f64}\left(a, \color{blue}{b}\right)\right)\right) \]
      7. Simplified99.6%

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

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

      Alternative 11: 63.9% accurate, 2.3× speedup?

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

        \[\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. associate-*r/N/A

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{PI.f64}\left(\right)\right), \mathsf{*.f64}\left(\left(a \cdot a\right), b\right)\right) \]
        7. *-lowering-*.f6454.2%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{PI.f64}\left(\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), b\right)\right) \]
      5. Simplified54.2%

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

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \left(\color{blue}{a} \cdot b\right)\right)\right) \]
        7. *-lowering-*.f6463.2%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{*.f64}\left(a, \color{blue}{b}\right)\right)\right) \]
      7. Applied egg-rr63.2%

        \[\leadsto \color{blue}{\frac{0.5}{a} \cdot \frac{\pi}{a \cdot b}} \]
      8. Final simplification63.2%

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

      Reproduce

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