NMSE Section 6.1 mentioned, B

Percentage Accurate: 79.1% → 99.6%
Time: 3.3s
Alternatives: 8
Speedup: 1.6×

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.6% accurate, 1.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 86.8% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;a \leq 21500000000:\\
\;\;\;\;\frac{\pi}{b + b} \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\pi}{a}}{b \cdot a} \cdot 0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -6.00000000000000007e-43

    1. Initial program 78.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\pi}{a + \color{blue}{a}} \cdot \frac{1}{b \cdot a} \]
      2. lower-+.f6486.0

        \[\leadsto \frac{\pi}{a + \color{blue}{a}} \cdot \frac{1}{b \cdot a} \]
    11. Applied rewrites86.0%

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

    if -6.00000000000000007e-43 < a < 2.15e10

    1. Initial program 81.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\pi}{b + \color{blue}{b}} \cdot \frac{1}{b \cdot a} \]
      2. lower-+.f6484.4

        \[\leadsto \frac{\pi}{b + \color{blue}{b}} \cdot \frac{1}{b \cdot a} \]
    11. Applied rewrites84.4%

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

    if 2.15e10 < a

    1. Initial program 74.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-*.f6479.9

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

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

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

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

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

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

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

      \[\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-*.f6492.4

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

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

Alternative 4: 86.0% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.15 \cdot 10^{-68}:\\
\;\;\;\;\frac{\pi}{a + a} \cdot \frac{1}{b \cdot a}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\pi}{a}}{b \cdot a} \cdot 0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.14999999999999998e-68

    1. Initial program 79.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\pi}{a + \color{blue}{a}} \cdot \frac{1}{b \cdot a} \]
    11. Applied rewrites83.1%

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

    if -1.14999999999999998e-68 < a < 2.15e10

    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-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.15e10 < a

    1. Initial program 74.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-*.f6479.9

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

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

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

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

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

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

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

      \[\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-*.f6492.4

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

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

Alternative 5: 86.0% accurate, 1.5× speedup?

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

\mathbf{elif}\;a \leq 21500000000:\\
\;\;\;\;\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 < -1.14999999999999998e-68 or 2.15e10 < a

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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-*.f6487.3

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

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

    if -1.14999999999999998e-68 < a < 2.15e10

    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-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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: 85.9% accurate, 1.5× speedup?

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

\mathbf{elif}\;a \leq 21500000000:\\
\;\;\;\;\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 < -1.14999999999999998e-68 or 2.15e10 < a

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.14999999999999998e-68 < a < 2.15e10

    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-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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: 80.6% accurate, 1.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.14999999999999998e-68 or 2.15e10 < a

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.14999999999999998e-68 < a < 2.15e10

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 63.3% 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 79.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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