NMSE Section 6.1 mentioned, B

Percentage Accurate: 78.8% → 99.6%
Time: 11.3s
Alternatives: 11
Speedup: 2.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 78.8% 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.7× speedup?

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

\\
\frac{\pi \cdot 0.5}{b + a} \cdot \frac{1}{b \cdot a}
\end{array}
Derivation
  1. Initial program 82.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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 96.2% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 71.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\pi \cdot 0.5}{\color{blue}{b \cdot a}}}{a} \]
    7. Applied egg-rr99.9%

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

    if -5.40000000000000031e88 < a

    1. Initial program 83.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\pi \cdot 0.5}{b \cdot \left(a \cdot \color{blue}{\left(b + a\right)}\right)} \]
    8. Applied egg-rr97.1%

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

Alternative 3: 96.2% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 70.3%

      \[\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 \color{blue}{\frac{\frac{1}{2} \cdot \mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
      2. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\frac{\color{blue}{\pi} \cdot 0.5}{a}}{b}}{a} \]
    7. Applied egg-rr99.9%

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{0.5}{b \cdot a} \cdot \color{blue}{\pi}}{a} \]
    9. Applied egg-rr99.8%

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

    if -2.5999999999999999e94 < a

    1. Initial program 84.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. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\pi \cdot 0.5}{b \cdot \left(a \cdot \color{blue}{\left(b + a\right)}\right)} \]
    8. Applied egg-rr97.1%

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

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

Alternative 4: 96.1% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 59.4%

      \[\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 \color{blue}{\frac{\frac{1}{2} \cdot \mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
      2. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \pi \cdot \frac{0.5}{b \cdot \color{blue}{\left(a \cdot a\right)}} \]
    7. Applied egg-rr84.4%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{a \cdot \left(b \cdot a\right)} \cdot \color{blue}{\pi} \]
    9. Applied egg-rr99.8%

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

    if -1.35000000000000003e154 < a

    1. Initial program 84.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\pi \cdot 0.5}{b \cdot \left(a \cdot \color{blue}{\left(b + a\right)}\right)} \]
    8. Applied egg-rr97.2%

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

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

Alternative 5: 96.1% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 65.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \pi \cdot \frac{0.5}{b \cdot \color{blue}{\left(a \cdot a\right)}} \]
    7. Applied egg-rr86.6%

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

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

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

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

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

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

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

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

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

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

    if -5.0000000000000001e109 < a

    1. Initial program 84.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\pi \cdot 0.5}{b + a} \cdot \frac{1}{b \cdot a}} \]
    7. Step-by-step derivation
      1. un-div-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{b \cdot \left(a \cdot \left(b + a\right)\right)} \cdot \color{blue}{\pi} \]
    8. Applied egg-rr97.1%

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

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

Alternative 6: 99.6% accurate, 2.0× speedup?

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

\\
\frac{\pi}{b \cdot a} \cdot \frac{0.5}{b + a}
\end{array}
Derivation
  1. Initial program 82.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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\pi \cdot 0.5}{b + a} \cdot \frac{1}{b \cdot a}} \]
  7. Step-by-step derivation
    1. un-div-invN/A

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

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

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

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

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

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

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

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

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

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

Alternative 7: 74.2% accurate, 2.2× speedup?

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

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

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


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

    1. Initial program 84.1%

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

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

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

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

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

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

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

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

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

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

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

    if -2.54999999999999998e-55 < a

    1. Initial program 81.6%

      \[\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. frac-subN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{0.5}{b + a} \cdot \color{blue}{\pi}}{b \cdot a} \]
    6. Applied egg-rr99.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\pi \cdot 0.5}{\color{blue}{\left(b \cdot a\right)} \cdot b} \]
    11. Applied egg-rr68.6%

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

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

Alternative 8: 74.2% accurate, 2.2× speedup?

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

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

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


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

    1. Initial program 84.1%

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

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

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

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

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

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

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

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

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

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

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

    if -6.79999999999999946e-55 < a

    1. Initial program 81.6%

      \[\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. frac-subN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{0.5}{b + a} \cdot \color{blue}{\pi}}{b \cdot a} \]
    6. Applied egg-rr99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 74.2% accurate, 2.2× speedup?

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

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

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


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

    1. Initial program 84.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \pi \cdot \frac{0.5}{b \cdot \color{blue}{\left(a \cdot a\right)}} \]
    7. Applied egg-rr73.6%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{a \cdot \left(b \cdot a\right)} \cdot \color{blue}{\pi} \]
    9. Applied egg-rr79.2%

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

    if -3.09999999999999997e-55 < a

    1. Initial program 81.6%

      \[\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. frac-subN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{0.5}{b + a} \cdot \color{blue}{\pi}}{b \cdot a} \]
    6. Applied egg-rr99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 62.6% accurate, 2.6× speedup?

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

\\
\pi \cdot \frac{0.5}{a \cdot \left(b \cdot a\right)}
\end{array}
Derivation
  1. Initial program 82.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. 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 \color{blue}{\frac{\frac{1}{2} \cdot \mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
    2. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \pi \cdot \frac{0.5}{b \cdot \color{blue}{\left(a \cdot a\right)}} \]
  7. Applied egg-rr56.4%

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 56.8% accurate, 2.6× speedup?

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

\\
\pi \cdot \frac{0.5}{b \cdot \left(a \cdot a\right)}
\end{array}
Derivation
  1. Initial program 82.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. 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 \color{blue}{\frac{\frac{1}{2} \cdot \mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
    2. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \pi \cdot \frac{0.5}{b \cdot \color{blue}{\left(a \cdot a\right)}} \]
  7. Applied egg-rr56.4%

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

Reproduce

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