NMSE Section 6.1 mentioned, B

Percentage Accurate: 78.3% → 99.6%
Time: 3.5s
Alternatives: 10
Speedup: 1.5×

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 10 alternatives:

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

Initial Program: 78.3% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 1.1× speedup?

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

\\
\frac{\frac{\left(\frac{1}{a} - \frac{1}{b}\right) \cdot \pi}{\left(b + a\right) \cdot 2}}{b - a}
\end{array}
Derivation
  1. Initial program 78.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}{b \cdot b - \color{blue}{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. 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.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.6% accurate, 1.1× speedup?

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

\\
\frac{\pi}{\left(b + a\right) \cdot 2} \cdot \frac{\frac{1}{a} - \frac{1}{b}}{b - a}
\end{array}
Derivation
  1. Initial program 78.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}{b \cdot b - \color{blue}{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. 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.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 90.4% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.24999999999999991e123

    1. Initial program 81.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}{b \cdot b - \color{blue}{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. 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--.f6488.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.24999999999999991e123 < b

    1. Initial program 61.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}{b \cdot b - \color{blue}{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. 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--.f6482.0

        \[\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 rewrites82.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 90.2% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;a \leq 6.5 \cdot 10^{-48}:\\
\;\;\;\;\frac{\frac{\left(\frac{1}{a} - \frac{1}{b}\right) \cdot \pi}{b + b}}{b - a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -3.19999999999999977e-75 or 6.5e-48 < a

    1. Initial program 78.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. 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}{b \cdot b - \color{blue}{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. 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--.f6488.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.19999999999999977e-75 < a < 6.5e-48

    1. Initial program 78.5%

      \[\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
    2. 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}{b \cdot b - \color{blue}{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. 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--.f6486.2

        \[\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 rewrites86.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 90.0% accurate, 1.1× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -3.19999999999999977e-75 or 6.5e-48 < a

    1. Initial program 78.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. 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}{b \cdot b - \color{blue}{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. 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--.f6488.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.19999999999999977e-75 < a < 6.5e-48

    1. Initial program 78.5%

      \[\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
    2. 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}{b \cdot b - \color{blue}{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. 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--.f6486.2

        \[\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 rewrites86.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 89.9% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -3.19999999999999977e-75 or 6.5e-48 < a

    1. Initial program 78.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. 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}{b \cdot b - \color{blue}{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. 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--.f6488.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\pi}{b \cdot a} \cdot -0.5}{b - a} \]
    10. Applied rewrites90.6%

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

    if -3.19999999999999977e-75 < a < 6.5e-48

    1. Initial program 78.5%

      \[\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
    2. 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}{b \cdot b - \color{blue}{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. 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--.f6486.2

        \[\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 rewrites86.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 87.2% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;b \leq 8.8 \cdot 10^{-8}:\\
\;\;\;\;\frac{\frac{\pi}{a}}{b \cdot a} \cdot 0.5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -4.30000000000000023e-17 or 8.7999999999999994e-8 < b

    1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.30000000000000023e-17 < b < 8.7999999999999994e-8

    1. Initial program 80.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. 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-*.f6471.6

        \[\leadsto \frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot 0.5 \]
    4. Applied rewrites71.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. lower-*.f6484.0

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

      \[\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. lower-/.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-*.f6484.3

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

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

Alternative 8: 87.0% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;b \leq 8.8 \cdot 10^{-8}:\\
\;\;\;\;\frac{\pi}{a \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 b < -4.1000000000000001e-17 or 8.7999999999999994e-8 < b

    1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.1000000000000001e-17 < b < 8.7999999999999994e-8

    1. Initial program 80.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. 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-*.f6471.6

        \[\leadsto \frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot 0.5 \]
    4. Applied rewrites71.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. lower-*.f6484.0

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

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

Alternative 9: 81.6% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;b \leq 8.8 \cdot 10^{-8}:\\
\;\;\;\;\frac{\pi}{a \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 b < -4.1000000000000001e-17 or 8.7999999999999994e-8 < b

    1. Initial program 76.5%

      \[\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right) \]
    2. 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-*.f6479.4

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

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

    if -4.1000000000000001e-17 < b < 8.7999999999999994e-8

    1. Initial program 80.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. 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-*.f6471.6

        \[\leadsto \frac{\pi}{\left(a \cdot a\right) \cdot b} \cdot 0.5 \]
    4. Applied rewrites71.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. lower-*.f6484.0

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

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

Alternative 10: 62.7% accurate, 2.4× 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.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. 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-*.f6456.7

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

    \[\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. lower-*.f6462.7

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

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

Reproduce

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