NMSE Section 6.1 mentioned, B

Percentage Accurate: 78.2% → 99.6%
Time: 10.6s
Alternatives: 9
Speedup: 1.9×

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 9 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.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \end{array} \]
(FPCore (a b)
 :precision binary64
 (* (* (/ PI 2.0) (/ 1.0 (- (* b b) (* a a)))) (- (/ 1.0 a) (/ 1.0 b))))
double code(double a, double b) {
	return ((((double) M_PI) / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b));
}
public static double code(double a, double b) {
	return ((Math.PI / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b));
}
def code(a, b):
	return ((math.pi / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b))
function code(a, b)
	return Float64(Float64(Float64(pi / 2.0) * Float64(1.0 / Float64(Float64(b * b) - Float64(a * a)))) * Float64(Float64(1.0 / a) - Float64(1.0 / b)))
end
function tmp = code(a, b)
	tmp = ((pi / 2.0) * (1.0 / ((b * b) - (a * a)))) * ((1.0 / a) - (1.0 / b));
end
code[a_, b_] := N[(N[(N[(Pi / 2.0), $MachinePrecision] * N[(1.0 / N[(N[(b * b), $MachinePrecision] - N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / a), $MachinePrecision] - N[(1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 99.6% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \frac{0.5}{a \cdot b} \cdot \left(\pi \cdot \frac{1}{a + b}\right) \end{array} \]
(FPCore (a b) :precision binary64 (* (/ 0.5 (* a b)) (* PI (/ 1.0 (+ a b)))))
double code(double a, double b) {
	return (0.5 / (a * b)) * (((double) M_PI) * (1.0 / (a + b)));
}
public static double code(double a, double b) {
	return (0.5 / (a * b)) * (Math.PI * (1.0 / (a + b)));
}
def code(a, b):
	return (0.5 / (a * b)) * (math.pi * (1.0 / (a + b)))
function code(a, b)
	return Float64(Float64(0.5 / Float64(a * b)) * Float64(pi * Float64(1.0 / Float64(a + b))))
end
function tmp = code(a, b)
	tmp = (0.5 / (a * b)) * (pi * (1.0 / (a + b)));
end
code[a_, b_] := N[(N[(0.5 / N[(a * b), $MachinePrecision]), $MachinePrecision] * N[(Pi * N[(1.0 / N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{0.5}{a \cdot b} \cdot \left(\pi \cdot \frac{1}{a + b}\right)
\end{array}
Derivation
  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. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{\pi}{b \cdot b - a \cdot a} \cdot \left(b - a\right)}{2 \cdot \left(b \cdot a\right)}} \]
  5. Step-by-step derivation
    1. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 74.4% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.35 \cdot 10^{-65}:\\ \;\;\;\;\frac{0.5 \cdot \pi}{a \cdot \left(a \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\pi}{b}}{\left(a \cdot b\right) \cdot 2}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= a -1.35e-65)
   (/ (* 0.5 PI) (* a (* a b)))
   (/ (/ PI b) (* (* a b) 2.0))))
double code(double a, double b) {
	double tmp;
	if (a <= -1.35e-65) {
		tmp = (0.5 * ((double) M_PI)) / (a * (a * b));
	} else {
		tmp = (((double) M_PI) / b) / ((a * b) * 2.0);
	}
	return tmp;
}
public static double code(double a, double b) {
	double tmp;
	if (a <= -1.35e-65) {
		tmp = (0.5 * Math.PI) / (a * (a * b));
	} else {
		tmp = (Math.PI / b) / ((a * b) * 2.0);
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if a <= -1.35e-65:
		tmp = (0.5 * math.pi) / (a * (a * b))
	else:
		tmp = (math.pi / b) / ((a * b) * 2.0)
	return tmp
function code(a, b)
	tmp = 0.0
	if (a <= -1.35e-65)
		tmp = Float64(Float64(0.5 * pi) / Float64(a * Float64(a * b)));
	else
		tmp = Float64(Float64(pi / b) / Float64(Float64(a * b) * 2.0));
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if (a <= -1.35e-65)
		tmp = (0.5 * pi) / (a * (a * b));
	else
		tmp = (pi / b) / ((a * b) * 2.0);
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[a, -1.35e-65], N[(N[(0.5 * Pi), $MachinePrecision] / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi / b), $MachinePrecision] / N[(N[(a * b), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.35 \cdot 10^{-65}:\\
\;\;\;\;\frac{0.5 \cdot \pi}{a \cdot \left(a \cdot b\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\pi}{b}}{\left(a \cdot b\right) \cdot 2}\\


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

    1. Initial program 81.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-*.f6478.9%

        \[\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. Simplified78.9%

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

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

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

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

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

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

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

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

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

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

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

    if -1.3499999999999999e-65 < a

    1. Initial program 79.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. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 74.4% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -5.4 \cdot 10^{-67}:\\ \;\;\;\;\frac{0.5 \cdot \pi}{a \cdot \left(a \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.5}{\frac{b}{\pi}}}{a \cdot b}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= a -5.4e-67)
   (/ (* 0.5 PI) (* a (* a b)))
   (/ (/ 0.5 (/ b PI)) (* a b))))
double code(double a, double b) {
	double tmp;
	if (a <= -5.4e-67) {
		tmp = (0.5 * ((double) M_PI)) / (a * (a * b));
	} else {
		tmp = (0.5 / (b / ((double) M_PI))) / (a * b);
	}
	return tmp;
}
public static double code(double a, double b) {
	double tmp;
	if (a <= -5.4e-67) {
		tmp = (0.5 * Math.PI) / (a * (a * b));
	} else {
		tmp = (0.5 / (b / Math.PI)) / (a * b);
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if a <= -5.4e-67:
		tmp = (0.5 * math.pi) / (a * (a * b))
	else:
		tmp = (0.5 / (b / math.pi)) / (a * b)
	return tmp
function code(a, b)
	tmp = 0.0
	if (a <= -5.4e-67)
		tmp = Float64(Float64(0.5 * pi) / Float64(a * Float64(a * b)));
	else
		tmp = Float64(Float64(0.5 / Float64(b / pi)) / Float64(a * b));
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if (a <= -5.4e-67)
		tmp = (0.5 * pi) / (a * (a * b));
	else
		tmp = (0.5 / (b / pi)) / (a * b);
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[a, -5.4e-67], N[(N[(0.5 * Pi), $MachinePrecision] / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / N[(b / Pi), $MachinePrecision]), $MachinePrecision] / N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.4 \cdot 10^{-67}:\\
\;\;\;\;\frac{0.5 \cdot \pi}{a \cdot \left(a \cdot b\right)}\\

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


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

    1. Initial program 81.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-*.f6478.9%

        \[\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. Simplified78.9%

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

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

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

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

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

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

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

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

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

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

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

    if -5.40000000000000032e-67 < a

    1. Initial program 79.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. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 74.4% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -2.3 \cdot 10^{-65}:\\ \;\;\;\;\frac{0.5 \cdot \pi}{a \cdot \left(a \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.5}{\frac{a}{\frac{\pi}{b}}}}{b}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= a -2.3e-65)
   (/ (* 0.5 PI) (* a (* a b)))
   (/ (/ 0.5 (/ a (/ PI b))) b)))
double code(double a, double b) {
	double tmp;
	if (a <= -2.3e-65) {
		tmp = (0.5 * ((double) M_PI)) / (a * (a * b));
	} else {
		tmp = (0.5 / (a / (((double) M_PI) / b))) / b;
	}
	return tmp;
}
public static double code(double a, double b) {
	double tmp;
	if (a <= -2.3e-65) {
		tmp = (0.5 * Math.PI) / (a * (a * b));
	} else {
		tmp = (0.5 / (a / (Math.PI / b))) / b;
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if a <= -2.3e-65:
		tmp = (0.5 * math.pi) / (a * (a * b))
	else:
		tmp = (0.5 / (a / (math.pi / b))) / b
	return tmp
function code(a, b)
	tmp = 0.0
	if (a <= -2.3e-65)
		tmp = Float64(Float64(0.5 * pi) / Float64(a * Float64(a * b)));
	else
		tmp = Float64(Float64(0.5 / Float64(a / Float64(pi / b))) / b);
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if (a <= -2.3e-65)
		tmp = (0.5 * pi) / (a * (a * b));
	else
		tmp = (0.5 / (a / (pi / b))) / b;
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[a, -2.3e-65], N[(N[(0.5 * Pi), $MachinePrecision] / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / N[(a / N[(Pi / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.3 \cdot 10^{-65}:\\
\;\;\;\;\frac{0.5 \cdot \pi}{a \cdot \left(a \cdot b\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{\frac{a}{\frac{\pi}{b}}}}{b}\\


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

    1. Initial program 81.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-*.f6478.9%

        \[\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. Simplified78.9%

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

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

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

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

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

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

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

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

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

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

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

    if -2.3e-65 < a

    1. Initial program 79.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. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 74.4% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -3.8 \cdot 10^{-65}:\\ \;\;\;\;\frac{0.5 \cdot \pi}{a \cdot \left(a \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \frac{\frac{0.5}{a \cdot b}}{b}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= a -3.8e-65)
   (/ (* 0.5 PI) (* a (* a b)))
   (* PI (/ (/ 0.5 (* a b)) b))))
double code(double a, double b) {
	double tmp;
	if (a <= -3.8e-65) {
		tmp = (0.5 * ((double) M_PI)) / (a * (a * b));
	} else {
		tmp = ((double) M_PI) * ((0.5 / (a * b)) / b);
	}
	return tmp;
}
public static double code(double a, double b) {
	double tmp;
	if (a <= -3.8e-65) {
		tmp = (0.5 * Math.PI) / (a * (a * b));
	} else {
		tmp = Math.PI * ((0.5 / (a * b)) / b);
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if a <= -3.8e-65:
		tmp = (0.5 * math.pi) / (a * (a * b))
	else:
		tmp = math.pi * ((0.5 / (a * b)) / b)
	return tmp
function code(a, b)
	tmp = 0.0
	if (a <= -3.8e-65)
		tmp = Float64(Float64(0.5 * pi) / Float64(a * Float64(a * b)));
	else
		tmp = Float64(pi * Float64(Float64(0.5 / Float64(a * b)) / b));
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if (a <= -3.8e-65)
		tmp = (0.5 * pi) / (a * (a * b));
	else
		tmp = pi * ((0.5 / (a * b)) / b);
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[a, -3.8e-65], N[(N[(0.5 * Pi), $MachinePrecision] / N[(a * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(Pi * N[(N[(0.5 / N[(a * b), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.8 \cdot 10^{-65}:\\
\;\;\;\;\frac{0.5 \cdot \pi}{a \cdot \left(a \cdot b\right)}\\

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


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

    1. Initial program 81.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-*.f6478.9%

        \[\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. Simplified78.9%

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

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

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

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

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

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

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

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

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

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

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

    if -3.8000000000000002e-65 < a

    1. Initial program 79.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. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({b}^{-1} \cdot {\left(2 \cdot \left(b \cdot a\right)\right)}^{-1}\right) \cdot \mathsf{PI}\left(\right) \]
      7. inv-powN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 74.5% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -7.2 \cdot 10^{-65}:\\ \;\;\;\;\frac{0.5}{a} \cdot \frac{\pi}{a \cdot b}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \frac{\frac{0.5}{a \cdot b}}{b}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= a -7.2e-65)
   (* (/ 0.5 a) (/ PI (* a b)))
   (* PI (/ (/ 0.5 (* a b)) b))))
double code(double a, double b) {
	double tmp;
	if (a <= -7.2e-65) {
		tmp = (0.5 / a) * (((double) M_PI) / (a * b));
	} else {
		tmp = ((double) M_PI) * ((0.5 / (a * b)) / b);
	}
	return tmp;
}
public static double code(double a, double b) {
	double tmp;
	if (a <= -7.2e-65) {
		tmp = (0.5 / a) * (Math.PI / (a * b));
	} else {
		tmp = Math.PI * ((0.5 / (a * b)) / b);
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if a <= -7.2e-65:
		tmp = (0.5 / a) * (math.pi / (a * b))
	else:
		tmp = math.pi * ((0.5 / (a * b)) / b)
	return tmp
function code(a, b)
	tmp = 0.0
	if (a <= -7.2e-65)
		tmp = Float64(Float64(0.5 / a) * Float64(pi / Float64(a * b)));
	else
		tmp = Float64(pi * Float64(Float64(0.5 / Float64(a * b)) / b));
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if (a <= -7.2e-65)
		tmp = (0.5 / a) * (pi / (a * b));
	else
		tmp = pi * ((0.5 / (a * b)) / b);
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[a, -7.2e-65], N[(N[(0.5 / a), $MachinePrecision] * N[(Pi / N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(Pi * N[(N[(0.5 / N[(a * b), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.2 \cdot 10^{-65}:\\
\;\;\;\;\frac{0.5}{a} \cdot \frac{\pi}{a \cdot b}\\

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


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

    1. Initial program 81.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-*.f6478.9%

        \[\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. Simplified78.9%

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \left(\frac{\color{blue}{\mathsf{PI}\left(\right)}}{b \cdot a}\right)\right) \]
      6. /-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(b \cdot a\right)}\right)\right) \]
      7. 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}{b} \cdot a\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \left(a \cdot \color{blue}{b}\right)\right)\right) \]
      9. *-lowering-*.f6490.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-rr90.2%

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

    if -7.1999999999999996e-65 < a

    1. Initial program 79.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. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({b}^{-1} \cdot {\left(2 \cdot \left(b \cdot a\right)\right)}^{-1}\right) \cdot \mathsf{PI}\left(\right) \]
      7. inv-powN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 74.5% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\pi}{a \cdot b}\\ \mathbf{if}\;a \leq -7.2 \cdot 10^{-65}:\\ \;\;\;\;\frac{0.5}{a} \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \frac{0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (let* ((t_0 (/ PI (* a b))))
   (if (<= a -7.2e-65) (* (/ 0.5 a) t_0) (* t_0 (/ 0.5 b)))))
double code(double a, double b) {
	double t_0 = ((double) M_PI) / (a * b);
	double tmp;
	if (a <= -7.2e-65) {
		tmp = (0.5 / a) * t_0;
	} else {
		tmp = t_0 * (0.5 / b);
	}
	return tmp;
}
public static double code(double a, double b) {
	double t_0 = Math.PI / (a * b);
	double tmp;
	if (a <= -7.2e-65) {
		tmp = (0.5 / a) * t_0;
	} else {
		tmp = t_0 * (0.5 / b);
	}
	return tmp;
}
def code(a, b):
	t_0 = math.pi / (a * b)
	tmp = 0
	if a <= -7.2e-65:
		tmp = (0.5 / a) * t_0
	else:
		tmp = t_0 * (0.5 / b)
	return tmp
function code(a, b)
	t_0 = Float64(pi / Float64(a * b))
	tmp = 0.0
	if (a <= -7.2e-65)
		tmp = Float64(Float64(0.5 / a) * t_0);
	else
		tmp = Float64(t_0 * Float64(0.5 / b));
	end
	return tmp
end
function tmp_2 = code(a, b)
	t_0 = pi / (a * b);
	tmp = 0.0;
	if (a <= -7.2e-65)
		tmp = (0.5 / a) * t_0;
	else
		tmp = t_0 * (0.5 / b);
	end
	tmp_2 = tmp;
end
code[a_, b_] := Block[{t$95$0 = N[(Pi / N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -7.2e-65], N[(N[(0.5 / a), $MachinePrecision] * t$95$0), $MachinePrecision], N[(t$95$0 * N[(0.5 / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\pi}{a \cdot b}\\
\mathbf{if}\;a \leq -7.2 \cdot 10^{-65}:\\
\;\;\;\;\frac{0.5}{a} \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{0.5}{b}\\


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

    1. Initial program 81.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-*.f6478.9%

        \[\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. Simplified78.9%

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \left(\frac{\color{blue}{\mathsf{PI}\left(\right)}}{b \cdot a}\right)\right) \]
      6. /-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(b \cdot a\right)}\right)\right) \]
      7. 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}{b} \cdot a\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \left(a \cdot \color{blue}{b}\right)\right)\right) \]
      9. *-lowering-*.f6490.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-rr90.2%

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

    if -7.1999999999999996e-65 < a

    1. Initial program 79.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. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{\pi}{b}}}{2 \cdot \left(b \cdot a\right)} \]
    8. Step-by-step derivation
      1. div-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 99.1% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \frac{\frac{\pi}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)} \end{array} \]
(FPCore (a b) :precision binary64 (/ (/ PI 2.0) (* (* a b) (+ a b))))
double code(double a, double b) {
	return (((double) M_PI) / 2.0) / ((a * b) * (a + b));
}
public static double code(double a, double b) {
	return (Math.PI / 2.0) / ((a * b) * (a + b));
}
def code(a, b):
	return (math.pi / 2.0) / ((a * b) * (a + b))
function code(a, b)
	return Float64(Float64(pi / 2.0) / Float64(Float64(a * b) * Float64(a + b)))
end
function tmp = code(a, b)
	tmp = (pi / 2.0) / ((a * b) * (a + b));
end
code[a_, b_] := N[(N[(Pi / 2.0), $MachinePrecision] / N[(N[(a * b), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{\pi}{2}}{\left(a \cdot b\right) \cdot \left(a + b\right)}
\end{array}
Derivation
  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. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{\pi}{b \cdot b - a \cdot a} \cdot \left(b - a\right)}{2 \cdot \left(b \cdot a\right)}} \]
  5. Step-by-step derivation
    1. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), 2\right), \left(\left(\color{blue}{a} + b\right) \cdot \left(a \cdot b\right)\right)\right) \]
    9. remove-double-divN/A

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), 2\right), \left(\frac{\left(\mathsf{neg}\left(-1\right)\right) \cdot \left(a \cdot b\right)}{\frac{1}{a + b}}\right)\right) \]
    12. distribute-lft-neg-inN/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), 2\right), \left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(a \cdot b\right)\right)\right)}{\frac{1}{a + b}}\right)\right) \]
    14. remove-double-negN/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), 2\right), \left(\left(a \cdot b\right) \cdot \color{blue}{\frac{1}{\frac{1}{a + b}}}\right)\right) \]
    16. remove-double-divN/A

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

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

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

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

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

Alternative 9: 62.7% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \frac{0.5}{a} \cdot \frac{\pi}{a \cdot b} \end{array} \]
(FPCore (a b) :precision binary64 (* (/ 0.5 a) (/ PI (* a b))))
double code(double a, double b) {
	return (0.5 / a) * (((double) M_PI) / (a * b));
}
public static double code(double a, double b) {
	return (0.5 / a) * (Math.PI / (a * b));
}
def code(a, b):
	return (0.5 / a) * (math.pi / (a * b))
function code(a, b)
	return Float64(Float64(0.5 / a) * Float64(pi / Float64(a * b)))
end
function tmp = code(a, b)
	tmp = (0.5 / a) * (pi / (a * b));
end
code[a_, b_] := N[(N[(0.5 / a), $MachinePrecision] * N[(Pi / N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{0.5}{a} \cdot \frac{\pi}{a \cdot b}
\end{array}
Derivation
  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. 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-*.f6456.6%

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \left(\frac{\color{blue}{\mathsf{PI}\left(\right)}}{b \cdot a}\right)\right) \]
    6. /-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(b \cdot a\right)}\right)\right) \]
    7. 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}{b} \cdot a\right)\right)\right) \]
    8. *-commutativeN/A

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

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

    \[\leadsto \color{blue}{\frac{0.5}{a} \cdot \frac{\pi}{a \cdot b}} \]
  8. Add Preprocessing

Reproduce

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