NMSE Section 6.1 mentioned, B

Percentage Accurate: 78.3% → 99.6%
Time: 4.4s
Alternatives: 8
Speedup: 1.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 alternatives:

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

Initial Program: 78.3% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\frac{\frac{\pi}{2}}{b + a} \cdot \color{blue}{\frac{1}{b - a}}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
    13. lower--.f6486.9

      \[\leadsto \left(\frac{\frac{\pi}{2}}{b + a} \cdot \frac{1}{\color{blue}{b - a}}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
  4. Applied rewrites86.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\pi}{2}}{b + a} \cdot \left(\color{blue}{\frac{1}{b - a}} \cdot \frac{b - a}{a \cdot b}\right) \]
    5. lift--.f6499.6

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\pi}{2}}{b + a} \cdot \color{blue}{\frac{1}{a \cdot b}} \]
    13. lift-*.f6499.6

      \[\leadsto \frac{\frac{\pi}{2}}{b + a} \cdot \frac{1}{\color{blue}{a \cdot b}} \]
  10. Applied rewrites99.6%

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

Alternative 2: 89.3% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;a \leq 6.2 \cdot 10^{-102}:\\
\;\;\;\;\frac{\frac{\pi}{b}}{t\_0}\\

\mathbf{elif}\;a \leq 1.3 \cdot 10^{+76}:\\
\;\;\;\;\left(b - a\right) \cdot \frac{\pi}{t\_0 \cdot \left(\left(b - a\right) \cdot \left(a + b\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\pi}{a}}{t\_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if a < -1.00000000000000001e55

    1. Initial program 74.9%

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

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

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

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

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

        \[\leadsto \frac{\pi}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\pi}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
      6. pow2N/A

        \[\leadsto \frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot \frac{1}{2} \]
      7. lift-*.f6483.1

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

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

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

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

        \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
      5. lift-*.f6495.5

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

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

    if -1.00000000000000001e55 < a < 6.20000000000000026e-102

    1. Initial program 79.5%

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

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

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

        \[\leadsto \left(\color{blue}{\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) \]
      5. 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) \]
      6. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\pi}{b}}{\left(a \cdot b\right) \cdot 2} \]
    7. Applied rewrites90.9%

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

    if 6.20000000000000026e-102 < a < 1.3e76

    1. Initial program 99.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{\pi}{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{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right)} \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      3. lift-PI.f64N/A

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

        \[\leadsto \left(\color{blue}{\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) \]
      5. 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) \]
      6. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.3e76 < a

    1. Initial program 55.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{\pi}{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{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right)} \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      3. lift-PI.f64N/A

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

        \[\leadsto \left(\color{blue}{\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) \]
      5. 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) \]
      6. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\pi}{a}}{\left(a \cdot b\right) \cdot 2} \]
    7. Applied rewrites98.8%

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

Alternative 3: 87.1% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;a \leq 4.2 \cdot 10^{-75}:\\
\;\;\;\;\frac{\frac{\pi}{b}}{t\_0}\\

\mathbf{elif}\;a \leq 1.66 \cdot 10^{+56}:\\
\;\;\;\;\frac{\left(-a\right) \cdot \pi}{\left(a \cdot b\right) \cdot \left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\pi}{a}}{t\_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if a < -1.00000000000000001e55

    1. Initial program 74.9%

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

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

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

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

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

        \[\leadsto \frac{\pi}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\pi}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
      6. pow2N/A

        \[\leadsto \frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot \frac{1}{2} \]
      7. lift-*.f6483.1

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

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

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

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

        \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
      5. lift-*.f6495.5

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

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

    if -1.00000000000000001e55 < a < 4.2000000000000002e-75

    1. Initial program 80.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{\pi}{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{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right)} \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      3. lift-PI.f64N/A

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

        \[\leadsto \left(\color{blue}{\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) \]
      5. 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) \]
      6. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{\color{blue}{b}}}{\left(a \cdot b\right) \cdot 2} \]
      2. lift-PI.f6490.2

        \[\leadsto \frac{\frac{\pi}{b}}{\left(a \cdot b\right) \cdot 2} \]
    7. Applied rewrites90.2%

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

    if 4.2000000000000002e-75 < a < 1.6600000000000001e56

    1. Initial program 99.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{\pi}{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{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right)} \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      3. lift-PI.f64N/A

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

        \[\leadsto \left(\color{blue}{\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) \]
      5. 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) \]
      6. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-a\right) \cdot \mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot \left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right)} \]
      5. lift-PI.f6482.1

        \[\leadsto \frac{\left(-a\right) \cdot \pi}{\left(a \cdot b\right) \cdot \left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right)} \]
    7. Applied rewrites82.1%

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

    if 1.6600000000000001e56 < a

    1. Initial program 59.9%

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

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

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

        \[\leadsto \left(\color{blue}{\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) \]
      5. 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) \]
      6. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\pi}{a}}{\left(a \cdot b\right) \cdot 2} \]
    7. Applied rewrites97.1%

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

Alternative 4: 85.1% accurate, 1.6× speedup?

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

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

\mathbf{elif}\;a \leq 4.1 \cdot 10^{-75}:\\
\;\;\;\;\frac{\frac{\pi}{b}}{t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\pi}{a}}{t\_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.00000000000000001e55

    1. Initial program 74.9%

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

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

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

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

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

        \[\leadsto \frac{\pi}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\pi}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
      6. pow2N/A

        \[\leadsto \frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot \frac{1}{2} \]
      7. lift-*.f6483.1

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

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

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

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

        \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
      5. lift-*.f6495.5

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

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

    if -1.00000000000000001e55 < a < 4.10000000000000002e-75

    1. Initial program 80.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{\pi}{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{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right)} \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      3. lift-PI.f64N/A

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

        \[\leadsto \left(\color{blue}{\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) \]
      5. 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) \]
      6. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{PI}\left(\right)}{\color{blue}{b}}}{\left(a \cdot b\right) \cdot 2} \]
      2. lift-PI.f6490.2

        \[\leadsto \frac{\frac{\pi}{b}}{\left(a \cdot b\right) \cdot 2} \]
    7. Applied rewrites90.2%

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

    if 4.10000000000000002e-75 < a

    1. Initial program 72.9%

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

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

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

        \[\leadsto \left(\color{blue}{\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) \]
      5. 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) \]
      6. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\pi}{a}}{\left(a \cdot b\right) \cdot 2} \]
    7. Applied rewrites85.9%

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

Alternative 5: 84.9% accurate, 1.6× speedup?

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

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

\mathbf{elif}\;a \leq 4.1 \cdot 10^{-75}:\\
\;\;\;\;\frac{0.5 \cdot \pi}{\left(a \cdot b\right) \cdot b}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.00000000000000001e55

    1. Initial program 74.9%

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

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

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

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

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

        \[\leadsto \frac{\pi}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\pi}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
      6. pow2N/A

        \[\leadsto \frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot \frac{1}{2} \]
      7. lift-*.f6483.1

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

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

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

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

        \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
      5. lift-*.f6495.5

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

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

    if -1.00000000000000001e55 < a < 4.10000000000000002e-75

    1. Initial program 80.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{\pi}{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{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right)} \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      3. lift-PI.f64N/A

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

        \[\leadsto \left(\color{blue}{\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) \]
      5. 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) \]
      6. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{2} \cdot \frac{\pi}{\color{blue}{a} \cdot {b}^{2}} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{1}{2} \cdot \frac{\pi}{a \cdot \color{blue}{{b}^{2}}} \]
      5. pow2N/A

        \[\leadsto \frac{1}{2} \cdot \frac{\pi}{a \cdot \left(b \cdot \color{blue}{b}\right)} \]
      6. lift-*.f6476.5

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5 \cdot \pi}{a \cdot \left(b \cdot b\right)} \]
      8. lift-*.f64N/A

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

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

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

        \[\leadsto \frac{\frac{1}{2} \cdot \pi}{\left(a \cdot b\right) \cdot \color{blue}{b}} \]
      12. lift-*.f6489.8

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

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

    if 4.10000000000000002e-75 < a

    1. Initial program 72.9%

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

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

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

        \[\leadsto \left(\color{blue}{\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) \]
      5. 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) \]
      6. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\pi}{a}}{\left(a \cdot b\right) \cdot 2} \]
    7. Applied rewrites85.9%

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

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

Alternative 6: 84.8% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1 \cdot 10^{+55} \lor \neg \left(a \leq 4.1 \cdot 10^{-75}\right):\\
\;\;\;\;\frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.00000000000000001e55 or 4.10000000000000002e-75 < a

    1. Initial program 73.8%

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

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

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

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

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

        \[\leadsto \frac{\pi}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\pi}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
      6. pow2N/A

        \[\leadsto \frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot \frac{1}{2} \]
      7. lift-*.f6476.7

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

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

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

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

        \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
      5. lift-*.f6490.4

        \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot 0.5 \]
    7. Applied rewrites90.4%

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

    if -1.00000000000000001e55 < a < 4.10000000000000002e-75

    1. Initial program 80.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{\pi}{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{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right)} \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      3. lift-PI.f64N/A

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

        \[\leadsto \left(\color{blue}{\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) \]
      5. 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) \]
      6. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{2} \cdot \frac{\pi}{\color{blue}{a} \cdot {b}^{2}} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{1}{2} \cdot \frac{\pi}{a \cdot \color{blue}{{b}^{2}}} \]
      5. pow2N/A

        \[\leadsto \frac{1}{2} \cdot \frac{\pi}{a \cdot \left(b \cdot \color{blue}{b}\right)} \]
      6. lift-*.f6476.5

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5 \cdot \pi}{a \cdot \left(b \cdot b\right)} \]
      8. lift-*.f64N/A

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

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

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

        \[\leadsto \frac{\frac{1}{2} \cdot \pi}{\left(a \cdot b\right) \cdot \color{blue}{b}} \]
      12. lift-*.f6489.8

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

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

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

Alternative 7: 79.2% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1 \cdot 10^{+55} \lor \neg \left(a \leq 4.1 \cdot 10^{-75}\right):\\
\;\;\;\;\frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.00000000000000001e55 or 4.10000000000000002e-75 < a

    1. Initial program 73.8%

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

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

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

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

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

        \[\leadsto \frac{\pi}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\pi}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
      6. pow2N/A

        \[\leadsto \frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot \frac{1}{2} \]
      7. lift-*.f6476.7

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

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

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

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

        \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
      5. lift-*.f6490.4

        \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot 0.5 \]
    7. Applied rewrites90.4%

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

    if -1.00000000000000001e55 < a < 4.10000000000000002e-75

    1. Initial program 80.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 a around 0

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

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

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

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

        \[\leadsto \frac{\pi}{a \cdot {b}^{2}} \cdot \frac{1}{2} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\pi}{{b}^{2} \cdot a} \cdot \frac{1}{2} \]
      6. lower-*.f64N/A

        \[\leadsto \frac{\pi}{{b}^{2} \cdot a} \cdot \frac{1}{2} \]
      7. pow2N/A

        \[\leadsto \frac{\pi}{\left(b \cdot b\right) \cdot a} \cdot \frac{1}{2} \]
      8. lift-*.f6476.5

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

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

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

Alternative 8: 63.0% accurate, 2.6× speedup?

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

\\
\frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot 0.5
\end{array}
Derivation
  1. Initial program 76.6%

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

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

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

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

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

      \[\leadsto \frac{\pi}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
    5. lower-*.f64N/A

      \[\leadsto \frac{\pi}{{a}^{2} \cdot b} \cdot \frac{1}{2} \]
    6. pow2N/A

      \[\leadsto \frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot \frac{1}{2} \]
    7. lift-*.f6453.5

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

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

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

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

      \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
    4. lower-*.f64N/A

      \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot \frac{1}{2} \]
    5. lift-*.f6461.2

      \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot 0.5 \]
  7. Applied rewrites61.2%

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

Reproduce

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