NMSE Section 6.1 mentioned, B

Percentage Accurate: 78.5% → 99.6%
Time: 12.4s
Alternatives: 6
Speedup: 2.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 6 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.5% 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, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 74.5% accurate, 2.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.15000000000000007e-44

    1. Initial program 89.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), 0\right)}{\color{blue}{a \cdot \left(a \cdot b\right)}} \]
      9. *-lowering-*.f6489.1

        \[\leadsto \frac{\mathsf{fma}\left(0.5, \pi, 0\right)}{a \cdot \color{blue}{\left(a \cdot b\right)}} \]
    5. Simplified89.1%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(0.5, \pi, 0\right)}{a \cdot \left(a \cdot b\right)}} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

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

        \[\leadsto \frac{\color{blue}{\pi} \cdot 0.5}{a \cdot \left(a \cdot b\right)} \]
    7. Applied egg-rr89.1%

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

    if -2.15000000000000007e-44 < a

    1. Initial program 77.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\pi \cdot \color{blue}{\frac{0.5}{b}}}{b \cdot a} \]
    9. Simplified70.4%

      \[\leadsto \frac{\pi \cdot \color{blue}{\frac{0.5}{b}}}{b \cdot a} \]
    10. Step-by-step derivation
      1. associate-/l*N/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{2}}{b \cdot \color{blue}{\left(b \cdot a\right)}} \cdot \mathsf{PI}\left(\right) \]
      10. PI-lowering-PI.f6470.5

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

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

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

Alternative 3: 74.5% accurate, 2.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -3.0000000000000002e-44

    1. Initial program 89.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), 0\right)}{\color{blue}{a \cdot \left(a \cdot b\right)}} \]
      9. *-lowering-*.f6489.1

        \[\leadsto \frac{\mathsf{fma}\left(0.5, \pi, 0\right)}{a \cdot \color{blue}{\left(a \cdot b\right)}} \]
    5. Simplified89.1%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(0.5, \pi, 0\right)}{a \cdot \left(a \cdot b\right)}} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\pi}{b \cdot \color{blue}{\left(a \cdot a\right)}} \]
    7. Applied egg-rr83.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{2}}{\color{blue}{\left(b \cdot a\right) \cdot a}} \cdot \mathsf{PI}\left(\right) \]
      3. *-lowering-*.f6489.0

        \[\leadsto \frac{0.5}{\color{blue}{\left(b \cdot a\right)} \cdot a} \cdot \pi \]
    11. Applied egg-rr89.0%

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

    if -3.0000000000000002e-44 < a

    1. Initial program 77.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\pi \cdot \color{blue}{\frac{0.5}{b}}}{b \cdot a} \]
    9. Simplified70.4%

      \[\leadsto \frac{\pi \cdot \color{blue}{\frac{0.5}{b}}}{b \cdot a} \]
    10. Step-by-step derivation
      1. associate-/l*N/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{2}}{b \cdot \color{blue}{\left(b \cdot a\right)}} \cdot \mathsf{PI}\left(\right) \]
      10. PI-lowering-PI.f6470.5

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

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

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

Alternative 4: 71.7% accurate, 2.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.15000000000000007e-44

    1. Initial program 89.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), 0\right)}{\color{blue}{a \cdot \left(a \cdot b\right)}} \]
      9. *-lowering-*.f6489.1

        \[\leadsto \frac{\mathsf{fma}\left(0.5, \pi, 0\right)}{a \cdot \color{blue}{\left(a \cdot b\right)}} \]
    5. Simplified89.1%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(0.5, \pi, 0\right)}{a \cdot \left(a \cdot b\right)}} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{\pi}{b \cdot \color{blue}{\left(a \cdot a\right)}} \]
    7. Applied egg-rr83.2%

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

    if -2.15000000000000007e-44 < a

    1. Initial program 77.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\pi \cdot \color{blue}{\frac{0.5}{b}}}{b \cdot a} \]
    9. Simplified70.4%

      \[\leadsto \frac{\pi \cdot \color{blue}{\frac{0.5}{b}}}{b \cdot a} \]
    10. Step-by-step derivation
      1. associate-/l*N/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{2}}{b \cdot \color{blue}{\left(b \cdot a\right)}} \cdot \mathsf{PI}\left(\right) \]
      10. PI-lowering-PI.f6470.5

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

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

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

Alternative 5: 99.1% accurate, 2.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{2}}{\left(b + a\right) \cdot \color{blue}{\left(b \cdot a\right)}} \cdot \mathsf{PI}\left(\right) \]
    19. PI-lowering-PI.f6499.0

      \[\leadsto \frac{0.5}{\left(b + a\right) \cdot \left(b \cdot a\right)} \cdot \color{blue}{\pi} \]
  8. Applied egg-rr99.0%

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

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

Alternative 6: 56.9% accurate, 2.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), 0\right)}{\color{blue}{a \cdot \left(a \cdot b\right)}} \]
    9. *-lowering-*.f6464.6

      \[\leadsto \frac{\mathsf{fma}\left(0.5, \pi, 0\right)}{a \cdot \color{blue}{\left(a \cdot b\right)}} \]
  5. Simplified64.6%

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(0.5, \pi, 0\right)}{a \cdot \left(a \cdot b\right)}} \]
  6. Step-by-step derivation
    1. +-rgt-identityN/A

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \frac{\pi}{b \cdot \color{blue}{\left(a \cdot a\right)}} \]
  7. Applied egg-rr60.1%

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

Reproduce

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