NMSE Section 6.1 mentioned, B

Percentage Accurate: 78.8% → 99.6%
Time: 4.0s
Alternatives: 9
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}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 78.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 1.1× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -5.00000000000000007e121 or 1.25e100 < a

    1. Initial program 61.2%

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
    3. 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-*.f6481.9

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

      \[\leadsto \color{blue}{\frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot 0.5} \]
    5. 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-*.f6498.9

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\pi}{a}}{b \cdot a} \cdot \frac{1}{2} \]
      10. lower-*.f6499.7

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

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

    if -5.00000000000000007e121 < a < 1.25e100

    1. Initial program 87.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. 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)}} \]
    3. Applied rewrites85.3%

      \[\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)}} \]
    4. 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)} \]
    5. 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.f6456.3

        \[\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)} \]
    6. Applied rewrites56.3%

      \[\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)} \]
    7. Taylor expanded in a around inf

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

        \[\leadsto \frac{\left(-a\right) \cdot \pi}{\left(a \cdot b\right) \cdot \left(2 \cdot \left(\left(b + a\right) \cdot \left(\mathsf{neg}\left(a\right)\right)\right)\right)} \]
      2. lift-neg.f6489.8

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

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

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

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

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

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

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

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

Alternative 2: 94.4% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;a \leq -1.95 \cdot 10^{-134}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;a \leq 1.1 \cdot 10^{+91}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -4.60000000000000002e150 or 1.1e91 < a

    1. Initial program 59.0%

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
    3. 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-*.f6480.8

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

      \[\leadsto \color{blue}{\frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot 0.5} \]
    5. 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-*.f6498.8

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\pi}{a}}{b \cdot a} \cdot \frac{1}{2} \]
      10. lower-*.f6499.6

        \[\leadsto \frac{\frac{\pi}{a}}{b \cdot a} \cdot 0.5 \]
    8. Applied rewrites99.6%

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

    if -4.60000000000000002e150 < a < -1.95e-134 or 2.90000000000000021e-156 < a < 1.1e91

    1. Initial program 96.4%

      \[\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
    2. 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)}} \]
    3. Applied rewrites87.3%

      \[\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)}} \]
    4. 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)} \]
    5. 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.f6468.5

        \[\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)} \]
    6. Applied rewrites68.5%

      \[\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)} \]
    7. Taylor expanded in a around inf

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

        \[\leadsto \frac{\left(-a\right) \cdot \pi}{\left(a \cdot b\right) \cdot \left(2 \cdot \left(\left(b + a\right) \cdot \left(\mathsf{neg}\left(a\right)\right)\right)\right)} \]
      2. lift-neg.f6492.5

        \[\leadsto \frac{\left(-a\right) \cdot \pi}{\left(a \cdot b\right) \cdot \left(2 \cdot \left(\left(b + a\right) \cdot \left(-a\right)\right)\right)} \]
    9. Applied rewrites92.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.95e-134 < a < 2.90000000000000021e-156

    1. Initial program 72.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. 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-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) \]
      3. 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) \]
      4. 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) \]
      5. 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) \]
      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}{b \cdot b - \color{blue}{a \cdot a}}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      8. frac-timesN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 90.7% accurate, 1.1× speedup?

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

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -4.60000000000000002e150 or 1.90000000000000012e76 < a

    1. Initial program 60.7%

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

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

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

      \[\leadsto \color{blue}{\frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot 0.5} \]
    5. 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-*.f6498.4

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\pi}{a}}{b \cdot a} \cdot \frac{1}{2} \]
      10. lower-*.f6499.2

        \[\leadsto \frac{\frac{\pi}{a}}{b \cdot a} \cdot 0.5 \]
    8. Applied rewrites99.2%

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

    if -4.60000000000000002e150 < a < 1.39999999999999996e-298

    1. Initial program 87.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. 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)}} \]
    3. Applied rewrites84.9%

      \[\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)}} \]
    4. 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)} \]
    5. 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.f6458.6

        \[\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)} \]
    6. Applied rewrites58.6%

      \[\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)} \]
    7. Taylor expanded in a around inf

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

        \[\leadsto \frac{\left(-a\right) \cdot \pi}{\left(a \cdot b\right) \cdot \left(2 \cdot \left(\left(b + a\right) \cdot \left(\mathsf{neg}\left(a\right)\right)\right)\right)} \]
      2. lift-neg.f6488.8

        \[\leadsto \frac{\left(-a\right) \cdot \pi}{\left(a \cdot b\right) \cdot \left(2 \cdot \left(\left(b + a\right) \cdot \left(-a\right)\right)\right)} \]
    9. Applied rewrites88.8%

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

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

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

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

        \[\leadsto \frac{\left(-a\right) \cdot \pi}{\color{blue}{a \cdot \left(b \cdot \left(2 \cdot \left(\left(b + a\right) \cdot \left(-a\right)\right)\right)\right)}} \]
      5. lower-*.f6488.6

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

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

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

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

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

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

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

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

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

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

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

    if 1.39999999999999996e-298 < a < 1.90000000000000012e76

    1. Initial program 86.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. 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-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) \]
      3. 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) \]
      4. 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) \]
      5. 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) \]
      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}{b \cdot b - \color{blue}{a \cdot a}}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      8. frac-timesN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\pi \cdot 1}{2 \cdot \left(\color{blue}{\left(b + a\right)} \cdot \left(b - a\right)\right)} \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      16. lower--.f6490.5

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{PI}\left(\right) \cdot 1}{2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\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 \frac{\mathsf{PI}\left(\right) \cdot 1}{2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)}} \]
      13. frac-subN/A

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

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

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

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

Alternative 4: 90.7% accurate, 1.1× speedup?

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

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

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

\mathbf{elif}\;a \leq 2 \cdot 10^{+80}:\\
\;\;\;\;\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)}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -4.60000000000000002e150 or 2e80 < a

    1. Initial program 60.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. Taylor expanded in a around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
    3. 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-*.f6481.0

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

      \[\leadsto \color{blue}{\frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot 0.5} \]
    5. 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-*.f6498.4

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\pi}{a}}{b \cdot a} \cdot \frac{1}{2} \]
      10. lower-*.f6499.2

        \[\leadsto \frac{\frac{\pi}{a}}{b \cdot a} \cdot 0.5 \]
    8. Applied rewrites99.2%

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

    if -4.60000000000000002e150 < a < 1.39999999999999996e-298

    1. Initial program 87.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. 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)}} \]
    3. Applied rewrites84.9%

      \[\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)}} \]
    4. 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)} \]
    5. 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.f6458.6

        \[\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)} \]
    6. Applied rewrites58.6%

      \[\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)} \]
    7. Taylor expanded in a around inf

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

        \[\leadsto \frac{\left(-a\right) \cdot \pi}{\left(a \cdot b\right) \cdot \left(2 \cdot \left(\left(b + a\right) \cdot \left(\mathsf{neg}\left(a\right)\right)\right)\right)} \]
      2. lift-neg.f6488.8

        \[\leadsto \frac{\left(-a\right) \cdot \pi}{\left(a \cdot b\right) \cdot \left(2 \cdot \left(\left(b + a\right) \cdot \left(-a\right)\right)\right)} \]
    9. Applied rewrites88.8%

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

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

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

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

        \[\leadsto \frac{\left(-a\right) \cdot \pi}{\color{blue}{a \cdot \left(b \cdot \left(2 \cdot \left(\left(b + a\right) \cdot \left(-a\right)\right)\right)\right)}} \]
      5. lower-*.f6488.6

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

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

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

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

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

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

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

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

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

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

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

    if 1.39999999999999996e-298 < a < 2e80

    1. Initial program 86.3%

      \[\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
    2. 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-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) \]
      3. 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) \]
      4. 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) \]
      5. 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) \]
      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}{b \cdot b - \color{blue}{a \cdot a}}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      8. frac-timesN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\pi \cdot 1}{2 \cdot \left(\color{blue}{\left(b + a\right)} \cdot \left(b - a\right)\right)} \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      16. lower--.f6490.6

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{PI}\left(\right) \cdot 1}{2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\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 \frac{\mathsf{PI}\left(\right) \cdot 1}{2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)}} \]
      13. frac-subN/A

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

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

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

      \[\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)}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 88.3% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 73.4%

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

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

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

      \[\leadsto \color{blue}{\frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot 0.5} \]
    5. 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-*.f6493.3

        \[\leadsto \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot 0.5 \]
    6. Applied rewrites93.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\pi}{a}}{b \cdot a} \cdot \frac{1}{2} \]
      10. lower-*.f6493.5

        \[\leadsto \frac{\frac{\pi}{a}}{b \cdot a} \cdot 0.5 \]
    8. Applied rewrites93.5%

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

    if -7e17 < a < 5.8000000000000001e-68

    1. Initial program 81.4%

      \[\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
    2. 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-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) \]
      3. 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) \]
      4. 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) \]
      5. 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) \]
      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}{b \cdot b - \color{blue}{a \cdot a}}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      8. frac-timesN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.8000000000000001e-68 < a

    1. Initial program 79.3%

      \[\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
    2. 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-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) \]
      3. 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) \]
      4. 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) \]
      5. 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) \]
      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}{b \cdot b - \color{blue}{a \cdot a}}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      8. frac-timesN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\pi \cdot 1}{2 \cdot \left(\color{blue}{\left(b + a\right)} \cdot \left(b - a\right)\right)} \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      16. lower--.f6489.5

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 86.3% accurate, 1.6× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -7e17 or 1.2999999999999999e-67 < a

    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. Taylor expanded in a around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
    3. 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-*.f6477.6

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

      \[\leadsto \color{blue}{\frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot 0.5} \]
    5. 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-*.f6487.6

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\pi}{a}}{b \cdot a} \cdot \frac{1}{2} \]
      10. lower-*.f6487.9

        \[\leadsto \frac{\frac{\pi}{a}}{b \cdot a} \cdot 0.5 \]
    8. Applied rewrites87.9%

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

    if -7e17 < a < 1.2999999999999999e-67

    1. Initial program 81.4%

      \[\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
    2. 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-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) \]
      3. 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) \]
      4. 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) \]
      5. 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) \]
      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}{b \cdot b - \color{blue}{a \cdot a}}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      8. frac-timesN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 86.2% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\
\mathbf{if}\;a \leq -7 \cdot 10^{+17}:\\
\;\;\;\;t\_0\\

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -7e17 or 1.2999999999999999e-67 < a

    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. Taylor expanded in a around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
    3. 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-*.f6477.6

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

      \[\leadsto \color{blue}{\frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot 0.5} \]
    5. 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-*.f6487.6

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

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

    if -7e17 < a < 1.2999999999999999e-67

    1. Initial program 81.4%

      \[\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
    2. 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-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) \]
      3. 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) \]
      4. 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) \]
      5. 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) \]
      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}{b \cdot b - \color{blue}{a \cdot a}}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
      8. frac-timesN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 80.8% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\pi}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\
\mathbf{if}\;a \leq -7 \cdot 10^{+17}:\\
\;\;\;\;t\_0\\

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -7e17 or 1.2999999999999999e-67 < a

    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. Taylor expanded in a around inf

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
    3. 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-*.f6477.6

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

      \[\leadsto \color{blue}{\frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot 0.5} \]
    5. 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-*.f6487.6

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

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

    if -7e17 < a < 1.2999999999999999e-67

    1. Initial program 81.4%

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{a \cdot {b}^{2}}} \]
    3. 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-*.f6472.8

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

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

Alternative 9: 62.9% 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 78.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. Taylor expanded in a around inf

    \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{{a}^{2} \cdot b}} \]
  3. 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-*.f6457.5

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

    \[\leadsto \color{blue}{\frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot 0.5} \]
  5. 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-*.f6462.9

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

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

Reproduce

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