NMSE Section 6.1 mentioned, B

Percentage Accurate: 78.7% → 99.7%
Time: 11.1s
Alternatives: 11
Speedup: 2.2×

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

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

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

Alternative 1: 99.7% accurate, 2.0× speedup?

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

\\
\frac{\frac{0.5 \cdot \pi}{b \cdot a}}{b + a}
\end{array}
Derivation
  1. Initial program 82.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 96.2% accurate, 2.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \pi}{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.90000000000000006e87

    1. Initial program 74.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. lower-/.f64N/A

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

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

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

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

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

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

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

        if -1.90000000000000006e87 < 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. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 3: 96.2% accurate, 2.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.8 \cdot 10^{+44}:\\ \;\;\;\;\frac{0.5 \cdot \pi}{a \cdot \left(b \cdot \left(b + a\right)\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 -1.8e+44)
         (/ (* 0.5 PI) (* a (* b (+ b a))))
         (* PI (/ 0.5 (* b (* a (+ b a)))))))
      double code(double a, double b) {
      	double tmp;
      	if (a <= -1.8e+44) {
      		tmp = (0.5 * ((double) M_PI)) / (a * (b * (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.8e+44) {
      		tmp = (0.5 * Math.PI) / (a * (b * (b + a)));
      	} else {
      		tmp = Math.PI * (0.5 / (b * (a * (b + a))));
      	}
      	return tmp;
      }
      
      def code(a, b):
      	tmp = 0
      	if a <= -1.8e+44:
      		tmp = (0.5 * math.pi) / (a * (b * (b + a)))
      	else:
      		tmp = math.pi * (0.5 / (b * (a * (b + a))))
      	return tmp
      
      function code(a, b)
      	tmp = 0.0
      	if (a <= -1.8e+44)
      		tmp = Float64(Float64(0.5 * pi) / Float64(a * Float64(b * 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 <= -1.8e+44)
      		tmp = (0.5 * pi) / (a * (b * (b + a)));
      	else
      		tmp = pi * (0.5 / (b * (a * (b + a))));
      	end
      	tmp_2 = tmp;
      end
      
      code[a_, b_] := If[LessEqual[a, -1.8e+44], N[(N[(0.5 * Pi), $MachinePrecision] / N[(a * N[(b * 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 -1.8 \cdot 10^{+44}:\\
      \;\;\;\;\frac{0.5 \cdot \pi}{a \cdot \left(b \cdot \left(b + a\right)\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 < -1.8e44

        1. Initial program 78.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. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -1.8e44 < a

        1. Initial program 83.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. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\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 simplification96.3%

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

      Alternative 4: 96.2% accurate, 2.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -6.7 \cdot 10^{+104}:\\ \;\;\;\;\frac{0.5 \cdot \pi}{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 -6.7e+104)
         (/ (* 0.5 PI) (* a (* b a)))
         (* PI (/ 0.5 (* b (* a (+ b a)))))))
      double code(double a, double b) {
      	double tmp;
      	if (a <= -6.7e+104) {
      		tmp = (0.5 * ((double) M_PI)) / (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 <= -6.7e+104) {
      		tmp = (0.5 * Math.PI) / (a * (b * a));
      	} else {
      		tmp = Math.PI * (0.5 / (b * (a * (b + a))));
      	}
      	return tmp;
      }
      
      def code(a, b):
      	tmp = 0
      	if a <= -6.7e+104:
      		tmp = (0.5 * math.pi) / (a * (b * a))
      	else:
      		tmp = math.pi * (0.5 / (b * (a * (b + a))))
      	return tmp
      
      function code(a, b)
      	tmp = 0.0
      	if (a <= -6.7e+104)
      		tmp = Float64(Float64(0.5 * pi) / 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 <= -6.7e+104)
      		tmp = (0.5 * pi) / (a * (b * a));
      	else
      		tmp = pi * (0.5 / (b * (a * (b + a))));
      	end
      	tmp_2 = tmp;
      end
      
      code[a_, b_] := If[LessEqual[a, -6.7e+104], N[(N[(0.5 * Pi), $MachinePrecision] / N[(a * N[(b * a), $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 -6.7 \cdot 10^{+104}:\\
      \;\;\;\;\frac{0.5 \cdot \pi}{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 < -6.70000000000000017e104

        1. Initial program 72.7%

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

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

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

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

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

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

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

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

        if -6.70000000000000017e104 < a

        1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\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 simplification96.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -6.7 \cdot 10^{+104}:\\ \;\;\;\;\frac{0.5 \cdot \pi}{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 5: 99.7% 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.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 6: 75.1% accurate, 2.0× speedup?

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

        1. Initial program 82.7%

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

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

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

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

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

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

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

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

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

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

            if -1.7499999999999998e-24 < a

            1. Initial program 81.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 7: 75.1% accurate, 2.2× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.75 \cdot 10^{-24}:\\ \;\;\;\;\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 -1.75e-24)
             (* PI (/ 0.5 (* a (* b a))))
             (* PI (/ 0.5 (* b (* b a))))))
          double code(double a, double b) {
          	double tmp;
          	if (a <= -1.75e-24) {
          		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 <= -1.75e-24) {
          		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 <= -1.75e-24:
          		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 <= -1.75e-24)
          		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 <= -1.75e-24)
          		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, -1.75e-24], 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 -1.75 \cdot 10^{-24}:\\
          \;\;\;\;\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 < -1.7499999999999998e-24

            1. Initial program 82.7%

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

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

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

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

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

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

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

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

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

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

                if -1.7499999999999998e-24 < a

                1. Initial program 81.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{\frac{1}{2}}{b \cdot \color{blue}{\left(a \cdot b\right)}} \cdot \mathsf{PI}\left(\right) \]
                10. Step-by-step derivation
                  1. lower-*.f6466.8

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

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.75 \cdot 10^{-24}:\\ \;\;\;\;\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 8: 69.5% accurate, 2.2× speedup?

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

                1. Initial program 82.7%

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

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

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

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

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

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

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

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

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

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

                    if -1.7499999999999998e-24 < a

                    1. Initial program 81.7%

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 9: 98.9% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\frac{\pi \cdot -0.5}{\left(b \cdot a\right) \cdot \left(-\left(b + a\right)\right)}} \]
                  7. Final simplification99.6%

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

                  Alternative 10: 63.4% 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.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. lower-/.f64N/A

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

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

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

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

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

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

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

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

                      Alternative 11: 57.9% 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.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. lower-/.f64N/A

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

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

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

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

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

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

                        Reproduce

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