1/2(abs(p)+abs(r) - sqrt((p-r)^2 + 4q^2))

Percentage Accurate: 24.9% → 62.4%
Time: 7.2s
Alternatives: 12
Speedup: 2.8×

Specification

?
\[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
(FPCore (p r q)
  :precision binary64
  :pre TRUE
  (*
 (/ 1.0 2.0)
 (-
  (+ (fabs p) (fabs r))
  (sqrt (+ (pow (- p r) 2.0) (* 4.0 (pow q 2.0)))))))
double code(double p, double r, double q) {
	return (1.0 / 2.0) * ((fabs(p) + fabs(r)) - sqrt((pow((p - r), 2.0) + (4.0 * pow(q, 2.0)))));
}
real(8) function code(p, r, q)
use fmin_fmax_functions
    real(8), intent (in) :: p
    real(8), intent (in) :: r
    real(8), intent (in) :: q
    code = (1.0d0 / 2.0d0) * ((abs(p) + abs(r)) - sqrt((((p - r) ** 2.0d0) + (4.0d0 * (q ** 2.0d0)))))
end function
public static double code(double p, double r, double q) {
	return (1.0 / 2.0) * ((Math.abs(p) + Math.abs(r)) - Math.sqrt((Math.pow((p - r), 2.0) + (4.0 * Math.pow(q, 2.0)))));
}
def code(p, r, q):
	return (1.0 / 2.0) * ((math.fabs(p) + math.fabs(r)) - math.sqrt((math.pow((p - r), 2.0) + (4.0 * math.pow(q, 2.0)))))
function code(p, r, q)
	return Float64(Float64(1.0 / 2.0) * Float64(Float64(abs(p) + abs(r)) - sqrt(Float64((Float64(p - r) ^ 2.0) + Float64(4.0 * (q ^ 2.0))))))
end
function tmp = code(p, r, q)
	tmp = (1.0 / 2.0) * ((abs(p) + abs(r)) - sqrt((((p - r) ^ 2.0) + (4.0 * (q ^ 2.0)))));
end
code[p_, r_, q_] := N[(N[(1.0 / 2.0), $MachinePrecision] * N[(N[(N[Abs[p], $MachinePrecision] + N[Abs[r], $MachinePrecision]), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(p - r), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[Power[q, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(p, r, q):
	p in [-inf, +inf],
	r in [-inf, +inf],
	q in [-inf, +inf]
code: THEORY
BEGIN
f(p, r, q: real): real =
	((1) / (2)) * (((abs(p)) + (abs(r))) - (sqrt((((p - r) ^ (2)) + ((4) * (q ^ (2)))))))
END code
\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right)

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 12 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: 24.9% accurate, 1.0× speedup?

\[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
(FPCore (p r q)
  :precision binary64
  :pre TRUE
  (*
 (/ 1.0 2.0)
 (-
  (+ (fabs p) (fabs r))
  (sqrt (+ (pow (- p r) 2.0) (* 4.0 (pow q 2.0)))))))
double code(double p, double r, double q) {
	return (1.0 / 2.0) * ((fabs(p) + fabs(r)) - sqrt((pow((p - r), 2.0) + (4.0 * pow(q, 2.0)))));
}
real(8) function code(p, r, q)
use fmin_fmax_functions
    real(8), intent (in) :: p
    real(8), intent (in) :: r
    real(8), intent (in) :: q
    code = (1.0d0 / 2.0d0) * ((abs(p) + abs(r)) - sqrt((((p - r) ** 2.0d0) + (4.0d0 * (q ** 2.0d0)))))
end function
public static double code(double p, double r, double q) {
	return (1.0 / 2.0) * ((Math.abs(p) + Math.abs(r)) - Math.sqrt((Math.pow((p - r), 2.0) + (4.0 * Math.pow(q, 2.0)))));
}
def code(p, r, q):
	return (1.0 / 2.0) * ((math.fabs(p) + math.fabs(r)) - math.sqrt((math.pow((p - r), 2.0) + (4.0 * math.pow(q, 2.0)))))
function code(p, r, q)
	return Float64(Float64(1.0 / 2.0) * Float64(Float64(abs(p) + abs(r)) - sqrt(Float64((Float64(p - r) ^ 2.0) + Float64(4.0 * (q ^ 2.0))))))
end
function tmp = code(p, r, q)
	tmp = (1.0 / 2.0) * ((abs(p) + abs(r)) - sqrt((((p - r) ^ 2.0) + (4.0 * (q ^ 2.0)))));
end
code[p_, r_, q_] := N[(N[(1.0 / 2.0), $MachinePrecision] * N[(N[(N[Abs[p], $MachinePrecision] + N[Abs[r], $MachinePrecision]), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(p - r), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[Power[q, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(p, r, q):
	p in [-inf, +inf],
	r in [-inf, +inf],
	q in [-inf, +inf]
code: THEORY
BEGIN
f(p, r, q: real): real =
	((1) / (2)) * (((abs(p)) + (abs(r))) - (sqrt((((p - r) ^ (2)) + ((4) * (q ^ (2)))))))
END code
\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right)

Alternative 1: 62.4% accurate, 1.5× speedup?

\[\begin{array}{l} t_0 := \left|\left|\left|q\right|\right|\right|\\ \mathbf{if}\;\left|q\right| \leq 4.557515498840622 \cdot 10^{-224}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \mathsf{min}\left(p, r\right), 0.5 \cdot \left|\mathsf{min}\left(p, r\right)\right|\right)\\ \mathbf{elif}\;\left|q\right| \leq 6.464052203376903 \cdot 10^{-132}:\\ \;\;\;\;\left(\left|\mathsf{max}\left(p, r\right)\right| - \mathsf{max}\left(p, r\right)\right) \cdot 0.5\\ \mathbf{elif}\;\left|q\right| \leq 7.9369521420701055 \cdot 10^{+152}:\\ \;\;\;\;-\frac{t\_0 \cdot t\_0}{\left|\mathsf{min}\left(p, r\right) - \mathsf{max}\left(p, r\right)\right|}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left|q\right|\\ \end{array} \]
(FPCore (p r q)
  :precision binary64
  :pre TRUE
  (let* ((t_0 (fabs (fabs (fabs q)))))
  (if (<= (fabs q) 4.557515498840622e-224)
    (fma 0.5 (fmin p r) (* 0.5 (fabs (fmin p r))))
    (if (<= (fabs q) 6.464052203376903e-132)
      (* (- (fabs (fmax p r)) (fmax p r)) 0.5)
      (if (<= (fabs q) 7.9369521420701055e+152)
        (- (/ (* t_0 t_0) (fabs (- (fmin p r) (fmax p r)))))
        (* -1.0 (fabs q)))))))
double code(double p, double r, double q) {
	double t_0 = fabs(fabs(fabs(q)));
	double tmp;
	if (fabs(q) <= 4.557515498840622e-224) {
		tmp = fma(0.5, fmin(p, r), (0.5 * fabs(fmin(p, r))));
	} else if (fabs(q) <= 6.464052203376903e-132) {
		tmp = (fabs(fmax(p, r)) - fmax(p, r)) * 0.5;
	} else if (fabs(q) <= 7.9369521420701055e+152) {
		tmp = -((t_0 * t_0) / fabs((fmin(p, r) - fmax(p, r))));
	} else {
		tmp = -1.0 * fabs(q);
	}
	return tmp;
}
function code(p, r, q)
	t_0 = abs(abs(abs(q)))
	tmp = 0.0
	if (abs(q) <= 4.557515498840622e-224)
		tmp = fma(0.5, fmin(p, r), Float64(0.5 * abs(fmin(p, r))));
	elseif (abs(q) <= 6.464052203376903e-132)
		tmp = Float64(Float64(abs(fmax(p, r)) - fmax(p, r)) * 0.5);
	elseif (abs(q) <= 7.9369521420701055e+152)
		tmp = Float64(-Float64(Float64(t_0 * t_0) / abs(Float64(fmin(p, r) - fmax(p, r)))));
	else
		tmp = Float64(-1.0 * abs(q));
	end
	return tmp
end
code[p_, r_, q_] := Block[{t$95$0 = N[Abs[N[Abs[N[Abs[q], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Abs[q], $MachinePrecision], 4.557515498840622e-224], N[(0.5 * N[Min[p, r], $MachinePrecision] + N[(0.5 * N[Abs[N[Min[p, r], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[q], $MachinePrecision], 6.464052203376903e-132], N[(N[(N[Abs[N[Max[p, r], $MachinePrecision]], $MachinePrecision] - N[Max[p, r], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[Abs[q], $MachinePrecision], 7.9369521420701055e+152], (-N[(N[(t$95$0 * t$95$0), $MachinePrecision] / N[Abs[N[(N[Min[p, r], $MachinePrecision] - N[Max[p, r], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), N[(-1.0 * N[Abs[q], $MachinePrecision]), $MachinePrecision]]]]]
f(p, r, q):
	p in [-inf, +inf],
	r in [-inf, +inf],
	q in [-inf, +inf]
code: THEORY
BEGIN
f(p, r, q: real): real =
	LET t_0 = (abs((abs((abs(q)))))) IN
		LET tmp_3 = IF (p < r) THEN p ELSE r ENDIF IN
		LET tmp_4 = IF (p < r) THEN p ELSE r ENDIF IN
		LET tmp_8 = IF (p > r) THEN p ELSE r ENDIF IN
		LET tmp_9 = IF (p > r) THEN p ELSE r ENDIF IN
		LET tmp_13 = IF (p < r) THEN p ELSE r ENDIF IN
		LET tmp_14 = IF (p > r) THEN p ELSE r ENDIF IN
		LET tmp_12 = IF ((abs(q)) <= (793695214207010549394295837606750342657594630784604214204722160226809782014176242727525847186246669014477279767840489997115548886399255551646001916805120)) THEN (- ((t_0 * t_0) / (abs((tmp_13 - tmp_14))))) ELSE ((-1) * (abs(q))) ENDIF IN
		LET tmp_7 = IF ((abs(q)) <= (64640522033769029565138429508852196844745941894902936958307745803855193639074720755858340683878438702180559360342558369030961851628134324353801568030996047795040160945136260684781924278891734281364170179204165566659411874861021888786258825358790874278592993263033945823340528837197666023518453788013265330626599849787872198447757909889332950115203857421875e-487)) THEN (((abs(tmp_8)) - tmp_9) * (5e-1)) ELSE tmp_12 ENDIF IN
		LET tmp_2 = IF ((abs(q)) <= (455751549884062244170618353664987813679928129710642048770426244336053309898944506130668837610833522374956128267578437372348816795100975731058891712385526576726203146052604137641254260187812020010720901723652994086589582859064511134283826643557649482362291680126742925802747426314394811502219510265241887219330890971275825076028926291827318038408835291666130099147432671651032965867624610640276195877342109773220084631793378338018649155334709502959862796022883816378246775781996740794191315632456437805293260338992870121245279510686920776407760058646090328693389892578125e-793)) THEN (((5e-1) * tmp_3) + ((5e-1) * (abs(tmp_4)))) ELSE tmp_7 ENDIF IN
	tmp_2
END code
\begin{array}{l}
t_0 := \left|\left|\left|q\right|\right|\right|\\
\mathbf{if}\;\left|q\right| \leq 4.557515498840622 \cdot 10^{-224}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \mathsf{min}\left(p, r\right), 0.5 \cdot \left|\mathsf{min}\left(p, r\right)\right|\right)\\

\mathbf{elif}\;\left|q\right| \leq 6.464052203376903 \cdot 10^{-132}:\\
\;\;\;\;\left(\left|\mathsf{max}\left(p, r\right)\right| - \mathsf{max}\left(p, r\right)\right) \cdot 0.5\\

\mathbf{elif}\;\left|q\right| \leq 7.9369521420701055 \cdot 10^{+152}:\\
\;\;\;\;-\frac{t\_0 \cdot t\_0}{\left|\mathsf{min}\left(p, r\right) - \mathsf{max}\left(p, r\right)\right|}\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \left|q\right|\\


\end{array}
Derivation
  1. Split input into 4 regimes
  2. if q < 4.5575154988406224e-224

    1. Initial program 24.9%

      \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
    2. Taylor expanded in p around -inf

      \[\leadsto {p}^{2} \cdot \left(\frac{-1}{2} \cdot \left|\frac{-1}{p}\right| + \frac{1}{2} \cdot \frac{1}{p}\right) \]
    3. Step-by-step derivation
      1. Applied rewrites9.6%

        \[\leadsto {p}^{2} \cdot \mathsf{fma}\left(-0.5, \left|\frac{-1}{p}\right|, 0.5 \cdot \frac{1}{p}\right) \]
      2. Taylor expanded in p around 0

        \[\leadsto \frac{1}{2} \cdot p + \frac{1}{2} \cdot \left|p\right| \]
      3. Step-by-step derivation
        1. Applied rewrites16.4%

          \[\leadsto \mathsf{fma}\left(0.5, p, 0.5 \cdot \left|p\right|\right) \]

        if 4.5575154988406224e-224 < q < 6.464052203376903e-132

        1. Initial program 24.9%

          \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
        2. Taylor expanded in q around inf

          \[\leadsto \frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - 2 \cdot q\right) \]
        3. Step-by-step derivation
          1. Applied rewrites18.9%

            \[\leadsto \frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - 2 \cdot q\right) \]
          2. Applied rewrites18.9%

            \[\leadsto \left(\left(\left|r\right| + \left|p\right|\right) - \left(q + q\right)\right) \cdot 0.5 \]
          3. Applied rewrites18.8%

            \[\leadsto \left(\left(\left|r\right| - p\right) - \left(q + q\right)\right) \cdot 0.5 \]
          4. Taylor expanded in p around -inf

            \[\leadsto \left(\left|r\right| - r\right) \cdot 0.5 \]
          5. Step-by-step derivation
            1. Applied rewrites16.5%

              \[\leadsto \left(\left|r\right| - r\right) \cdot 0.5 \]

            if 6.464052203376903e-132 < q < 7.9369521420701055e152

            1. Initial program 24.9%

              \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
            2. Taylor expanded in q around 0

              \[\leadsto -1 \cdot \frac{{q}^{2}}{\sqrt{{\left(p - r\right)}^{2}}} + \frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2}}\right) \]
            3. Step-by-step derivation
              1. Applied rewrites18.8%

                \[\leadsto \mathsf{fma}\left(-1, \frac{{q}^{2}}{\sqrt{{\left(p - r\right)}^{2}}}, 0.5 \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2}}\right)\right) \]
              2. Step-by-step derivation
                1. Applied rewrites38.8%

                  \[\leadsto -\left(-0.5 \cdot \left(\left(\left|r\right| + \left|p\right|\right) - \left|p - r\right|\right) - \frac{q \cdot q}{-\left|p - r\right|}\right) \]
                2. Taylor expanded in q around inf

                  \[\leadsto -\frac{{q}^{2}}{\left|p - r\right|} \]
                3. Step-by-step derivation
                  1. Applied rewrites38.2%

                    \[\leadsto -\frac{{q}^{2}}{\left|p - r\right|} \]
                  2. Step-by-step derivation
                    1. Applied rewrites38.2%

                      \[\leadsto -\frac{\left|\left|q\right|\right| \cdot \left|\left|q\right|\right|}{\left|p - r\right|} \]

                    if 7.9369521420701055e152 < q

                    1. Initial program 24.9%

                      \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                    2. Taylor expanded in q around inf

                      \[\leadsto -1 \cdot q \]
                    3. Step-by-step derivation
                      1. Applied rewrites19.9%

                        \[\leadsto -1 \cdot q \]
                    4. Recombined 4 regimes into one program.
                    5. Add Preprocessing

                    Alternative 2: 62.4% accurate, 1.6× speedup?

                    \[\begin{array}{l} \mathbf{if}\;\left|q\right| \leq 4.557515498840622 \cdot 10^{-224}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \mathsf{min}\left(p, r\right), 0.5 \cdot \left|\mathsf{min}\left(p, r\right)\right|\right)\\ \mathbf{elif}\;\left|q\right| \leq 6.464052203376903 \cdot 10^{-132}:\\ \;\;\;\;\left(\left|\mathsf{max}\left(p, r\right)\right| - \mathsf{max}\left(p, r\right)\right) \cdot 0.5\\ \mathbf{elif}\;\left|q\right| \leq 7.9369521420701055 \cdot 10^{+152}:\\ \;\;\;\;-\left(\left|q\right| \cdot \left|q\right|\right) \cdot \frac{1}{\left|\mathsf{max}\left(p, r\right) - \mathsf{min}\left(p, r\right)\right|}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left|q\right|\\ \end{array} \]
                    (FPCore (p r q)
                      :precision binary64
                      :pre TRUE
                      (if (<= (fabs q) 4.557515498840622e-224)
                      (fma 0.5 (fmin p r) (* 0.5 (fabs (fmin p r))))
                      (if (<= (fabs q) 6.464052203376903e-132)
                        (* (- (fabs (fmax p r)) (fmax p r)) 0.5)
                        (if (<= (fabs q) 7.9369521420701055e+152)
                          (-
                           (*
                            (* (fabs q) (fabs q))
                            (/ 1.0 (fabs (- (fmax p r) (fmin p r))))))
                          (* -1.0 (fabs q))))))
                    double code(double p, double r, double q) {
                    	double tmp;
                    	if (fabs(q) <= 4.557515498840622e-224) {
                    		tmp = fma(0.5, fmin(p, r), (0.5 * fabs(fmin(p, r))));
                    	} else if (fabs(q) <= 6.464052203376903e-132) {
                    		tmp = (fabs(fmax(p, r)) - fmax(p, r)) * 0.5;
                    	} else if (fabs(q) <= 7.9369521420701055e+152) {
                    		tmp = -((fabs(q) * fabs(q)) * (1.0 / fabs((fmax(p, r) - fmin(p, r)))));
                    	} else {
                    		tmp = -1.0 * fabs(q);
                    	}
                    	return tmp;
                    }
                    
                    function code(p, r, q)
                    	tmp = 0.0
                    	if (abs(q) <= 4.557515498840622e-224)
                    		tmp = fma(0.5, fmin(p, r), Float64(0.5 * abs(fmin(p, r))));
                    	elseif (abs(q) <= 6.464052203376903e-132)
                    		tmp = Float64(Float64(abs(fmax(p, r)) - fmax(p, r)) * 0.5);
                    	elseif (abs(q) <= 7.9369521420701055e+152)
                    		tmp = Float64(-Float64(Float64(abs(q) * abs(q)) * Float64(1.0 / abs(Float64(fmax(p, r) - fmin(p, r))))));
                    	else
                    		tmp = Float64(-1.0 * abs(q));
                    	end
                    	return tmp
                    end
                    
                    code[p_, r_, q_] := If[LessEqual[N[Abs[q], $MachinePrecision], 4.557515498840622e-224], N[(0.5 * N[Min[p, r], $MachinePrecision] + N[(0.5 * N[Abs[N[Min[p, r], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[q], $MachinePrecision], 6.464052203376903e-132], N[(N[(N[Abs[N[Max[p, r], $MachinePrecision]], $MachinePrecision] - N[Max[p, r], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[Abs[q], $MachinePrecision], 7.9369521420701055e+152], (-N[(N[(N[Abs[q], $MachinePrecision] * N[Abs[q], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Abs[N[(N[Max[p, r], $MachinePrecision] - N[Min[p, r], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(-1.0 * N[Abs[q], $MachinePrecision]), $MachinePrecision]]]]
                    
                    f(p, r, q):
                    	p in [-inf, +inf],
                    	r in [-inf, +inf],
                    	q in [-inf, +inf]
                    code: THEORY
                    BEGIN
                    f(p, r, q: real): real =
                    	LET tmp_3 = IF (p < r) THEN p ELSE r ENDIF IN
                    	LET tmp_4 = IF (p < r) THEN p ELSE r ENDIF IN
                    	LET tmp_8 = IF (p > r) THEN p ELSE r ENDIF IN
                    	LET tmp_9 = IF (p > r) THEN p ELSE r ENDIF IN
                    	LET tmp_13 = IF (p > r) THEN p ELSE r ENDIF IN
                    	LET tmp_14 = IF (p < r) THEN p ELSE r ENDIF IN
                    	LET tmp_12 = IF ((abs(q)) <= (793695214207010549394295837606750342657594630784604214204722160226809782014176242727525847186246669014477279767840489997115548886399255551646001916805120)) THEN (- (((abs(q)) * (abs(q))) * ((1) / (abs((tmp_13 - tmp_14)))))) ELSE ((-1) * (abs(q))) ENDIF IN
                    	LET tmp_7 = IF ((abs(q)) <= (64640522033769029565138429508852196844745941894902936958307745803855193639074720755858340683878438702180559360342558369030961851628134324353801568030996047795040160945136260684781924278891734281364170179204165566659411874861021888786258825358790874278592993263033945823340528837197666023518453788013265330626599849787872198447757909889332950115203857421875e-487)) THEN (((abs(tmp_8)) - tmp_9) * (5e-1)) ELSE tmp_12 ENDIF IN
                    	LET tmp_2 = IF ((abs(q)) <= (455751549884062244170618353664987813679928129710642048770426244336053309898944506130668837610833522374956128267578437372348816795100975731058891712385526576726203146052604137641254260187812020010720901723652994086589582859064511134283826643557649482362291680126742925802747426314394811502219510265241887219330890971275825076028926291827318038408835291666130099147432671651032965867624610640276195877342109773220084631793378338018649155334709502959862796022883816378246775781996740794191315632456437805293260338992870121245279510686920776407760058646090328693389892578125e-793)) THEN (((5e-1) * tmp_3) + ((5e-1) * (abs(tmp_4)))) ELSE tmp_7 ENDIF IN
                    	tmp_2
                    END code
                    \begin{array}{l}
                    \mathbf{if}\;\left|q\right| \leq 4.557515498840622 \cdot 10^{-224}:\\
                    \;\;\;\;\mathsf{fma}\left(0.5, \mathsf{min}\left(p, r\right), 0.5 \cdot \left|\mathsf{min}\left(p, r\right)\right|\right)\\
                    
                    \mathbf{elif}\;\left|q\right| \leq 6.464052203376903 \cdot 10^{-132}:\\
                    \;\;\;\;\left(\left|\mathsf{max}\left(p, r\right)\right| - \mathsf{max}\left(p, r\right)\right) \cdot 0.5\\
                    
                    \mathbf{elif}\;\left|q\right| \leq 7.9369521420701055 \cdot 10^{+152}:\\
                    \;\;\;\;-\left(\left|q\right| \cdot \left|q\right|\right) \cdot \frac{1}{\left|\mathsf{max}\left(p, r\right) - \mathsf{min}\left(p, r\right)\right|}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;-1 \cdot \left|q\right|\\
                    
                    
                    \end{array}
                    
                    Derivation
                    1. Split input into 4 regimes
                    2. if q < 4.5575154988406224e-224

                      1. Initial program 24.9%

                        \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                      2. Taylor expanded in p around -inf

                        \[\leadsto {p}^{2} \cdot \left(\frac{-1}{2} \cdot \left|\frac{-1}{p}\right| + \frac{1}{2} \cdot \frac{1}{p}\right) \]
                      3. Step-by-step derivation
                        1. Applied rewrites9.6%

                          \[\leadsto {p}^{2} \cdot \mathsf{fma}\left(-0.5, \left|\frac{-1}{p}\right|, 0.5 \cdot \frac{1}{p}\right) \]
                        2. Taylor expanded in p around 0

                          \[\leadsto \frac{1}{2} \cdot p + \frac{1}{2} \cdot \left|p\right| \]
                        3. Step-by-step derivation
                          1. Applied rewrites16.4%

                            \[\leadsto \mathsf{fma}\left(0.5, p, 0.5 \cdot \left|p\right|\right) \]

                          if 4.5575154988406224e-224 < q < 6.464052203376903e-132

                          1. Initial program 24.9%

                            \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                          2. Taylor expanded in q around inf

                            \[\leadsto \frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - 2 \cdot q\right) \]
                          3. Step-by-step derivation
                            1. Applied rewrites18.9%

                              \[\leadsto \frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - 2 \cdot q\right) \]
                            2. Applied rewrites18.9%

                              \[\leadsto \left(\left(\left|r\right| + \left|p\right|\right) - \left(q + q\right)\right) \cdot 0.5 \]
                            3. Applied rewrites18.8%

                              \[\leadsto \left(\left(\left|r\right| - p\right) - \left(q + q\right)\right) \cdot 0.5 \]
                            4. Taylor expanded in p around -inf

                              \[\leadsto \left(\left|r\right| - r\right) \cdot 0.5 \]
                            5. Step-by-step derivation
                              1. Applied rewrites16.5%

                                \[\leadsto \left(\left|r\right| - r\right) \cdot 0.5 \]

                              if 6.464052203376903e-132 < q < 7.9369521420701055e152

                              1. Initial program 24.9%

                                \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                              2. Taylor expanded in q around 0

                                \[\leadsto -1 \cdot \frac{{q}^{2}}{\sqrt{{\left(p - r\right)}^{2}}} + \frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2}}\right) \]
                              3. Step-by-step derivation
                                1. Applied rewrites18.8%

                                  \[\leadsto \mathsf{fma}\left(-1, \frac{{q}^{2}}{\sqrt{{\left(p - r\right)}^{2}}}, 0.5 \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2}}\right)\right) \]
                                2. Step-by-step derivation
                                  1. Applied rewrites38.8%

                                    \[\leadsto -\left(-0.5 \cdot \left(\left(\left|r\right| + \left|p\right|\right) - \left|p - r\right|\right) - \frac{q \cdot q}{-\left|p - r\right|}\right) \]
                                  2. Taylor expanded in q around inf

                                    \[\leadsto -\frac{{q}^{2}}{\left|p - r\right|} \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites38.2%

                                      \[\leadsto -\frac{{q}^{2}}{\left|p - r\right|} \]
                                    2. Step-by-step derivation
                                      1. Applied rewrites38.1%

                                        \[\leadsto -\left(q \cdot q\right) \cdot \frac{1}{\left|r - p\right|} \]

                                      if 7.9369521420701055e152 < q

                                      1. Initial program 24.9%

                                        \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                      2. Taylor expanded in q around inf

                                        \[\leadsto -1 \cdot q \]
                                      3. Step-by-step derivation
                                        1. Applied rewrites19.9%

                                          \[\leadsto -1 \cdot q \]
                                      4. Recombined 4 regimes into one program.
                                      5. Add Preprocessing

                                      Alternative 3: 61.9% accurate, 0.6× speedup?

                                      \[\begin{array}{l} t_0 := \left|\mathsf{max}\left(p, r\right)\right|\\ t_1 := \left|\mathsf{min}\left(p, r\right) - \mathsf{max}\left(p, r\right)\right|\\ t_2 := \left|\mathsf{min}\left(p, r\right)\right|\\ t_3 := -\sqrt{t\_2}\\ \mathbf{if}\;{q}^{2} \leq 0:\\ \;\;\;\;\mathsf{fma}\left(0.5, \mathsf{min}\left(p, r\right), 0.5 \cdot t\_2\right)\\ \mathbf{elif}\;{q}^{2} \leq 4 \cdot 10^{+292}:\\ \;\;\;\;-\left(-0.5 \cdot \left(\left(t\_0 + t\_2\right) - t\_1\right) - \frac{q \cdot q}{-t\_1}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \left(\mathsf{fma}\left(t\_3, t\_3, t\_0\right) - \mathsf{hypot}\left(\left(-\left|q\right|\right) \cdot 2, -\left(-\left|\mathsf{max}\left(p, r\right) - \mathsf{min}\left(p, r\right)\right|\right)\right)\right)\\ \end{array} \]
                                      (FPCore (p r q)
                                        :precision binary64
                                        :pre TRUE
                                        (let* ((t_0 (fabs (fmax p r)))
                                             (t_1 (fabs (- (fmin p r) (fmax p r))))
                                             (t_2 (fabs (fmin p r)))
                                             (t_3 (- (sqrt t_2))))
                                        (if (<= (pow q 2.0) 0.0)
                                          (fma 0.5 (fmin p r) (* 0.5 t_2))
                                          (if (<= (pow q 2.0) 4e+292)
                                            (- (- (* -0.5 (- (+ t_0 t_2) t_1)) (/ (* q q) (- t_1))))
                                            (*
                                             (/ 1.0 2.0)
                                             (-
                                              (fma t_3 t_3 t_0)
                                              (hypot
                                               (* (- (fabs q)) 2.0)
                                               (- (- (fabs (- (fmax p r) (fmin p r))))))))))))
                                      double code(double p, double r, double q) {
                                      	double t_0 = fabs(fmax(p, r));
                                      	double t_1 = fabs((fmin(p, r) - fmax(p, r)));
                                      	double t_2 = fabs(fmin(p, r));
                                      	double t_3 = -sqrt(t_2);
                                      	double tmp;
                                      	if (pow(q, 2.0) <= 0.0) {
                                      		tmp = fma(0.5, fmin(p, r), (0.5 * t_2));
                                      	} else if (pow(q, 2.0) <= 4e+292) {
                                      		tmp = -((-0.5 * ((t_0 + t_2) - t_1)) - ((q * q) / -t_1));
                                      	} else {
                                      		tmp = (1.0 / 2.0) * (fma(t_3, t_3, t_0) - hypot((-fabs(q) * 2.0), -(-fabs((fmax(p, r) - fmin(p, r))))));
                                      	}
                                      	return tmp;
                                      }
                                      
                                      function code(p, r, q)
                                      	t_0 = abs(fmax(p, r))
                                      	t_1 = abs(Float64(fmin(p, r) - fmax(p, r)))
                                      	t_2 = abs(fmin(p, r))
                                      	t_3 = Float64(-sqrt(t_2))
                                      	tmp = 0.0
                                      	if ((q ^ 2.0) <= 0.0)
                                      		tmp = fma(0.5, fmin(p, r), Float64(0.5 * t_2));
                                      	elseif ((q ^ 2.0) <= 4e+292)
                                      		tmp = Float64(-Float64(Float64(-0.5 * Float64(Float64(t_0 + t_2) - t_1)) - Float64(Float64(q * q) / Float64(-t_1))));
                                      	else
                                      		tmp = Float64(Float64(1.0 / 2.0) * Float64(fma(t_3, t_3, t_0) - hypot(Float64(Float64(-abs(q)) * 2.0), Float64(-Float64(-abs(Float64(fmax(p, r) - fmin(p, r))))))));
                                      	end
                                      	return tmp
                                      end
                                      
                                      code[p_, r_, q_] := Block[{t$95$0 = N[Abs[N[Max[p, r], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(N[Min[p, r], $MachinePrecision] - N[Max[p, r], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[Min[p, r], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = (-N[Sqrt[t$95$2], $MachinePrecision])}, If[LessEqual[N[Power[q, 2.0], $MachinePrecision], 0.0], N[(0.5 * N[Min[p, r], $MachinePrecision] + N[(0.5 * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[q, 2.0], $MachinePrecision], 4e+292], (-N[(N[(-0.5 * N[(N[(t$95$0 + t$95$2), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[(q * q), $MachinePrecision] / (-t$95$1)), $MachinePrecision]), $MachinePrecision]), N[(N[(1.0 / 2.0), $MachinePrecision] * N[(N[(t$95$3 * t$95$3 + t$95$0), $MachinePrecision] - N[Sqrt[N[((-N[Abs[q], $MachinePrecision]) * 2.0), $MachinePrecision] ^ 2 + (-(-N[Abs[N[(N[Max[p, r], $MachinePrecision] - N[Min[p, r], $MachinePrecision]), $MachinePrecision]], $MachinePrecision])) ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
                                      
                                      f(p, r, q):
                                      	p in [-inf, +inf],
                                      	r in [-inf, +inf],
                                      	q in [-inf, +inf]
                                      code: THEORY
                                      BEGIN
                                      f(p, r, q: real): real =
                                      	LET tmp = IF (p > r) THEN p ELSE r ENDIF IN
                                      	LET t_0 = (abs(tmp)) IN
                                      		LET tmp_1 = IF (p < r) THEN p ELSE r ENDIF IN
                                      		LET tmp_2 = IF (p > r) THEN p ELSE r ENDIF IN
                                      		LET t_1 = (abs((tmp_1 - tmp_2))) IN
                                      			LET tmp_3 = IF (p < r) THEN p ELSE r ENDIF IN
                                      			LET t_2 = (abs(tmp_3)) IN
                                      				LET t_3 = (- (sqrt(t_2))) IN
                                      					LET tmp_6 = IF (p < r) THEN p ELSE r ENDIF IN
                                      					LET tmp_8 = IF (p > r) THEN p ELSE r ENDIF IN
                                      					LET tmp_9 = IF (p < r) THEN p ELSE r ENDIF IN
                                      					LET tmp_7 = IF ((q ^ (2)) <= (40000000000000000530263959134296650722746244358345840142528125911769970907617012858463917672157449998909498554263568363952491898600028103138206953210986926743629581261021098587444232750232858470317984807330649410342155342294546390088430246843766074240114997507336380714205155856460222902042624)) THEN (- (((-5e-1) * ((t_0 + t_2) - t_1)) - ((q * q) / (- t_1)))) ELSE (((1) / (2)) * (((t_3 * t_3) + t_0) - (sqrt(((((- (abs(q))) * (2)) ^ (2)) + ((- (- (abs((tmp_8 - tmp_9))))) ^ (2))))))) ENDIF IN
                                      					LET tmp_5 = IF ((q ^ (2)) <= (0)) THEN (((5e-1) * tmp_6) + ((5e-1) * t_2)) ELSE tmp_7 ENDIF IN
                                      	tmp_5
                                      END code
                                      \begin{array}{l}
                                      t_0 := \left|\mathsf{max}\left(p, r\right)\right|\\
                                      t_1 := \left|\mathsf{min}\left(p, r\right) - \mathsf{max}\left(p, r\right)\right|\\
                                      t_2 := \left|\mathsf{min}\left(p, r\right)\right|\\
                                      t_3 := -\sqrt{t\_2}\\
                                      \mathbf{if}\;{q}^{2} \leq 0:\\
                                      \;\;\;\;\mathsf{fma}\left(0.5, \mathsf{min}\left(p, r\right), 0.5 \cdot t\_2\right)\\
                                      
                                      \mathbf{elif}\;{q}^{2} \leq 4 \cdot 10^{+292}:\\
                                      \;\;\;\;-\left(-0.5 \cdot \left(\left(t\_0 + t\_2\right) - t\_1\right) - \frac{q \cdot q}{-t\_1}\right)\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;\frac{1}{2} \cdot \left(\mathsf{fma}\left(t\_3, t\_3, t\_0\right) - \mathsf{hypot}\left(\left(-\left|q\right|\right) \cdot 2, -\left(-\left|\mathsf{max}\left(p, r\right) - \mathsf{min}\left(p, r\right)\right|\right)\right)\right)\\
                                      
                                      
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 3 regimes
                                      2. if (pow.f64 q #s(literal 2 binary64)) < 0.0

                                        1. Initial program 24.9%

                                          \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                        2. Taylor expanded in p around -inf

                                          \[\leadsto {p}^{2} \cdot \left(\frac{-1}{2} \cdot \left|\frac{-1}{p}\right| + \frac{1}{2} \cdot \frac{1}{p}\right) \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites9.6%

                                            \[\leadsto {p}^{2} \cdot \mathsf{fma}\left(-0.5, \left|\frac{-1}{p}\right|, 0.5 \cdot \frac{1}{p}\right) \]
                                          2. Taylor expanded in p around 0

                                            \[\leadsto \frac{1}{2} \cdot p + \frac{1}{2} \cdot \left|p\right| \]
                                          3. Step-by-step derivation
                                            1. Applied rewrites16.4%

                                              \[\leadsto \mathsf{fma}\left(0.5, p, 0.5 \cdot \left|p\right|\right) \]

                                            if 0.0 < (pow.f64 q #s(literal 2 binary64)) < 4.0000000000000001e292

                                            1. Initial program 24.9%

                                              \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                            2. Taylor expanded in q around 0

                                              \[\leadsto -1 \cdot \frac{{q}^{2}}{\sqrt{{\left(p - r\right)}^{2}}} + \frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2}}\right) \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites18.8%

                                                \[\leadsto \mathsf{fma}\left(-1, \frac{{q}^{2}}{\sqrt{{\left(p - r\right)}^{2}}}, 0.5 \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2}}\right)\right) \]
                                              2. Step-by-step derivation
                                                1. Applied rewrites38.8%

                                                  \[\leadsto -\left(-0.5 \cdot \left(\left(\left|r\right| + \left|p\right|\right) - \left|p - r\right|\right) - \frac{q \cdot q}{-\left|p - r\right|}\right) \]

                                                if 4.0000000000000001e292 < (pow.f64 q #s(literal 2 binary64))

                                                1. Initial program 24.9%

                                                  \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                2. Applied rewrites54.0%

                                                  \[\leadsto \frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \mathsf{hypot}\left(\left(-\left|q\right|\right) \cdot 2, -\left(-\left|r - p\right|\right)\right)\right) \]
                                                3. Step-by-step derivation
                                                  1. Applied rewrites49.8%

                                                    \[\leadsto \frac{1}{2} \cdot \left(\mathsf{fma}\left(-\sqrt{\left|p\right|}, -\sqrt{\left|p\right|}, \left|r\right|\right) - \mathsf{hypot}\left(\left(-\left|q\right|\right) \cdot 2, -\left(-\left|r - p\right|\right)\right)\right) \]
                                                4. Recombined 3 regimes into one program.
                                                5. Add Preprocessing

                                                Alternative 4: 61.7% accurate, 0.7× speedup?

                                                \[\begin{array}{l} t_0 := \left|\mathsf{min}\left(p, r\right) - \mathsf{max}\left(p, r\right)\right|\\ t_1 := \left|\mathsf{min}\left(p, r\right)\right|\\ t_2 := \left|\mathsf{max}\left(p, r\right)\right| + t\_1\\ t_3 := -t\_0\\ \mathbf{if}\;{q}^{2} \leq 0:\\ \;\;\;\;\mathsf{fma}\left(0.5, \mathsf{min}\left(p, r\right), 0.5 \cdot t\_1\right)\\ \mathbf{elif}\;{q}^{2} \leq 4 \cdot 10^{+292}:\\ \;\;\;\;-\left(-0.5 \cdot \left(t\_2 - t\_0\right) - \frac{q \cdot q}{t\_3}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t\_2 - \mathsf{hypot}\left(\left(-q\right) \cdot 2, t\_3\right)\right) \cdot 0.5\\ \end{array} \]
                                                (FPCore (p r q)
                                                  :precision binary64
                                                  :pre TRUE
                                                  (let* ((t_0 (fabs (- (fmin p r) (fmax p r))))
                                                       (t_1 (fabs (fmin p r)))
                                                       (t_2 (+ (fabs (fmax p r)) t_1))
                                                       (t_3 (- t_0)))
                                                  (if (<= (pow q 2.0) 0.0)
                                                    (fma 0.5 (fmin p r) (* 0.5 t_1))
                                                    (if (<= (pow q 2.0) 4e+292)
                                                      (- (- (* -0.5 (- t_2 t_0)) (/ (* q q) t_3)))
                                                      (* (- t_2 (hypot (* (- q) 2.0) t_3)) 0.5)))))
                                                double code(double p, double r, double q) {
                                                	double t_0 = fabs((fmin(p, r) - fmax(p, r)));
                                                	double t_1 = fabs(fmin(p, r));
                                                	double t_2 = fabs(fmax(p, r)) + t_1;
                                                	double t_3 = -t_0;
                                                	double tmp;
                                                	if (pow(q, 2.0) <= 0.0) {
                                                		tmp = fma(0.5, fmin(p, r), (0.5 * t_1));
                                                	} else if (pow(q, 2.0) <= 4e+292) {
                                                		tmp = -((-0.5 * (t_2 - t_0)) - ((q * q) / t_3));
                                                	} else {
                                                		tmp = (t_2 - hypot((-q * 2.0), t_3)) * 0.5;
                                                	}
                                                	return tmp;
                                                }
                                                
                                                function code(p, r, q)
                                                	t_0 = abs(Float64(fmin(p, r) - fmax(p, r)))
                                                	t_1 = abs(fmin(p, r))
                                                	t_2 = Float64(abs(fmax(p, r)) + t_1)
                                                	t_3 = Float64(-t_0)
                                                	tmp = 0.0
                                                	if ((q ^ 2.0) <= 0.0)
                                                		tmp = fma(0.5, fmin(p, r), Float64(0.5 * t_1));
                                                	elseif ((q ^ 2.0) <= 4e+292)
                                                		tmp = Float64(-Float64(Float64(-0.5 * Float64(t_2 - t_0)) - Float64(Float64(q * q) / t_3)));
                                                	else
                                                		tmp = Float64(Float64(t_2 - hypot(Float64(Float64(-q) * 2.0), t_3)) * 0.5);
                                                	end
                                                	return tmp
                                                end
                                                
                                                code[p_, r_, q_] := Block[{t$95$0 = N[Abs[N[(N[Min[p, r], $MachinePrecision] - N[Max[p, r], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[Min[p, r], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[N[Max[p, r], $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision]}, Block[{t$95$3 = (-t$95$0)}, If[LessEqual[N[Power[q, 2.0], $MachinePrecision], 0.0], N[(0.5 * N[Min[p, r], $MachinePrecision] + N[(0.5 * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[q, 2.0], $MachinePrecision], 4e+292], (-N[(N[(-0.5 * N[(t$95$2 - t$95$0), $MachinePrecision]), $MachinePrecision] - N[(N[(q * q), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision]), N[(N[(t$95$2 - N[Sqrt[N[((-q) * 2.0), $MachinePrecision] ^ 2 + t$95$3 ^ 2], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]]]]]]
                                                
                                                f(p, r, q):
                                                	p in [-inf, +inf],
                                                	r in [-inf, +inf],
                                                	q in [-inf, +inf]
                                                code: THEORY
                                                BEGIN
                                                f(p, r, q: real): real =
                                                	LET tmp = IF (p < r) THEN p ELSE r ENDIF IN
                                                	LET tmp_1 = IF (p > r) THEN p ELSE r ENDIF IN
                                                	LET t_0 = (abs((tmp - tmp_1))) IN
                                                		LET tmp_2 = IF (p < r) THEN p ELSE r ENDIF IN
                                                		LET t_1 = (abs(tmp_2)) IN
                                                			LET tmp_3 = IF (p > r) THEN p ELSE r ENDIF IN
                                                			LET t_2 = ((abs(tmp_3)) + t_1) IN
                                                				LET t_3 = (- t_0) IN
                                                					LET tmp_6 = IF (p < r) THEN p ELSE r ENDIF IN
                                                					LET tmp_7 = IF ((q ^ (2)) <= (40000000000000000530263959134296650722746244358345840142528125911769970907617012858463917672157449998909498554263568363952491898600028103138206953210986926743629581261021098587444232750232858470317984807330649410342155342294546390088430246843766074240114997507336380714205155856460222902042624)) THEN (- (((-5e-1) * (t_2 - t_0)) - ((q * q) / t_3))) ELSE ((t_2 - (sqrt(((((- q) * (2)) ^ (2)) + (t_3 ^ (2)))))) * (5e-1)) ENDIF IN
                                                					LET tmp_5 = IF ((q ^ (2)) <= (0)) THEN (((5e-1) * tmp_6) + ((5e-1) * t_1)) ELSE tmp_7 ENDIF IN
                                                	tmp_5
                                                END code
                                                \begin{array}{l}
                                                t_0 := \left|\mathsf{min}\left(p, r\right) - \mathsf{max}\left(p, r\right)\right|\\
                                                t_1 := \left|\mathsf{min}\left(p, r\right)\right|\\
                                                t_2 := \left|\mathsf{max}\left(p, r\right)\right| + t\_1\\
                                                t_3 := -t\_0\\
                                                \mathbf{if}\;{q}^{2} \leq 0:\\
                                                \;\;\;\;\mathsf{fma}\left(0.5, \mathsf{min}\left(p, r\right), 0.5 \cdot t\_1\right)\\
                                                
                                                \mathbf{elif}\;{q}^{2} \leq 4 \cdot 10^{+292}:\\
                                                \;\;\;\;-\left(-0.5 \cdot \left(t\_2 - t\_0\right) - \frac{q \cdot q}{t\_3}\right)\\
                                                
                                                \mathbf{else}:\\
                                                \;\;\;\;\left(t\_2 - \mathsf{hypot}\left(\left(-q\right) \cdot 2, t\_3\right)\right) \cdot 0.5\\
                                                
                                                
                                                \end{array}
                                                
                                                Derivation
                                                1. Split input into 3 regimes
                                                2. if (pow.f64 q #s(literal 2 binary64)) < 0.0

                                                  1. Initial program 24.9%

                                                    \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                  2. Taylor expanded in p around -inf

                                                    \[\leadsto {p}^{2} \cdot \left(\frac{-1}{2} \cdot \left|\frac{-1}{p}\right| + \frac{1}{2} \cdot \frac{1}{p}\right) \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites9.6%

                                                      \[\leadsto {p}^{2} \cdot \mathsf{fma}\left(-0.5, \left|\frac{-1}{p}\right|, 0.5 \cdot \frac{1}{p}\right) \]
                                                    2. Taylor expanded in p around 0

                                                      \[\leadsto \frac{1}{2} \cdot p + \frac{1}{2} \cdot \left|p\right| \]
                                                    3. Step-by-step derivation
                                                      1. Applied rewrites16.4%

                                                        \[\leadsto \mathsf{fma}\left(0.5, p, 0.5 \cdot \left|p\right|\right) \]

                                                      if 0.0 < (pow.f64 q #s(literal 2 binary64)) < 4.0000000000000001e292

                                                      1. Initial program 24.9%

                                                        \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                      2. Taylor expanded in q around 0

                                                        \[\leadsto -1 \cdot \frac{{q}^{2}}{\sqrt{{\left(p - r\right)}^{2}}} + \frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2}}\right) \]
                                                      3. Step-by-step derivation
                                                        1. Applied rewrites18.8%

                                                          \[\leadsto \mathsf{fma}\left(-1, \frac{{q}^{2}}{\sqrt{{\left(p - r\right)}^{2}}}, 0.5 \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2}}\right)\right) \]
                                                        2. Step-by-step derivation
                                                          1. Applied rewrites38.8%

                                                            \[\leadsto -\left(-0.5 \cdot \left(\left(\left|r\right| + \left|p\right|\right) - \left|p - r\right|\right) - \frac{q \cdot q}{-\left|p - r\right|}\right) \]

                                                          if 4.0000000000000001e292 < (pow.f64 q #s(literal 2 binary64))

                                                          1. Initial program 24.9%

                                                            \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                          2. Applied rewrites24.9%

                                                            \[\leadsto \left(\left(\left|r\right| + \left|p\right|\right) - \sqrt{\mathsf{fma}\left(q \cdot q, 4, \left(p - r\right) \cdot \left(p - r\right)\right)}\right) \cdot 0.5 \]
                                                          3. Applied rewrites54.0%

                                                            \[\leadsto \left(\left(\left|r\right| + \left|p\right|\right) - \mathsf{hypot}\left(\left(-q\right) \cdot 2, -\left|p - r\right|\right)\right) \cdot 0.5 \]
                                                        3. Recombined 3 regimes into one program.
                                                        4. Add Preprocessing

                                                        Alternative 5: 61.5% accurate, 0.7× speedup?

                                                        \[\begin{array}{l} t_0 := \left|\mathsf{max}\left(p, r\right)\right|\\ t_1 := \left|\mathsf{min}\left(p, r\right) - \mathsf{max}\left(p, r\right)\right|\\ t_2 := \left|\mathsf{min}\left(p, r\right)\right|\\ t_3 := -t\_1\\ \mathbf{if}\;{q}^{2} \leq 0:\\ \;\;\;\;\mathsf{fma}\left(0.5, \mathsf{min}\left(p, r\right), 0.5 \cdot t\_2\right)\\ \mathbf{elif}\;{q}^{2} \leq 5 \cdot 10^{+305}:\\ \;\;\;\;-\left(-0.5 \cdot \left(\left(t\_0 + t\_2\right) - t\_1\right) - \frac{q \cdot q}{t\_3}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(t\_0 + \mathsf{min}\left(p, r\right)\right) - \mathsf{hypot}\left(\left(-q\right) \cdot 2, t\_3\right)\right) \cdot 0.5\\ \end{array} \]
                                                        (FPCore (p r q)
                                                          :precision binary64
                                                          :pre TRUE
                                                          (let* ((t_0 (fabs (fmax p r)))
                                                               (t_1 (fabs (- (fmin p r) (fmax p r))))
                                                               (t_2 (fabs (fmin p r)))
                                                               (t_3 (- t_1)))
                                                          (if (<= (pow q 2.0) 0.0)
                                                            (fma 0.5 (fmin p r) (* 0.5 t_2))
                                                            (if (<= (pow q 2.0) 5e+305)
                                                              (- (- (* -0.5 (- (+ t_0 t_2) t_1)) (/ (* q q) t_3)))
                                                              (* (- (+ t_0 (fmin p r)) (hypot (* (- q) 2.0) t_3)) 0.5)))))
                                                        double code(double p, double r, double q) {
                                                        	double t_0 = fabs(fmax(p, r));
                                                        	double t_1 = fabs((fmin(p, r) - fmax(p, r)));
                                                        	double t_2 = fabs(fmin(p, r));
                                                        	double t_3 = -t_1;
                                                        	double tmp;
                                                        	if (pow(q, 2.0) <= 0.0) {
                                                        		tmp = fma(0.5, fmin(p, r), (0.5 * t_2));
                                                        	} else if (pow(q, 2.0) <= 5e+305) {
                                                        		tmp = -((-0.5 * ((t_0 + t_2) - t_1)) - ((q * q) / t_3));
                                                        	} else {
                                                        		tmp = ((t_0 + fmin(p, r)) - hypot((-q * 2.0), t_3)) * 0.5;
                                                        	}
                                                        	return tmp;
                                                        }
                                                        
                                                        function code(p, r, q)
                                                        	t_0 = abs(fmax(p, r))
                                                        	t_1 = abs(Float64(fmin(p, r) - fmax(p, r)))
                                                        	t_2 = abs(fmin(p, r))
                                                        	t_3 = Float64(-t_1)
                                                        	tmp = 0.0
                                                        	if ((q ^ 2.0) <= 0.0)
                                                        		tmp = fma(0.5, fmin(p, r), Float64(0.5 * t_2));
                                                        	elseif ((q ^ 2.0) <= 5e+305)
                                                        		tmp = Float64(-Float64(Float64(-0.5 * Float64(Float64(t_0 + t_2) - t_1)) - Float64(Float64(q * q) / t_3)));
                                                        	else
                                                        		tmp = Float64(Float64(Float64(t_0 + fmin(p, r)) - hypot(Float64(Float64(-q) * 2.0), t_3)) * 0.5);
                                                        	end
                                                        	return tmp
                                                        end
                                                        
                                                        code[p_, r_, q_] := Block[{t$95$0 = N[Abs[N[Max[p, r], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(N[Min[p, r], $MachinePrecision] - N[Max[p, r], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[Min[p, r], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = (-t$95$1)}, If[LessEqual[N[Power[q, 2.0], $MachinePrecision], 0.0], N[(0.5 * N[Min[p, r], $MachinePrecision] + N[(0.5 * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[q, 2.0], $MachinePrecision], 5e+305], (-N[(N[(-0.5 * N[(N[(t$95$0 + t$95$2), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[(q * q), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision]), N[(N[(N[(t$95$0 + N[Min[p, r], $MachinePrecision]), $MachinePrecision] - N[Sqrt[N[((-q) * 2.0), $MachinePrecision] ^ 2 + t$95$3 ^ 2], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]]]]]]
                                                        
                                                        f(p, r, q):
                                                        	p in [-inf, +inf],
                                                        	r in [-inf, +inf],
                                                        	q in [-inf, +inf]
                                                        code: THEORY
                                                        BEGIN
                                                        f(p, r, q: real): real =
                                                        	LET tmp = IF (p > r) THEN p ELSE r ENDIF IN
                                                        	LET t_0 = (abs(tmp)) IN
                                                        		LET tmp_1 = IF (p < r) THEN p ELSE r ENDIF IN
                                                        		LET tmp_2 = IF (p > r) THEN p ELSE r ENDIF IN
                                                        		LET t_1 = (abs((tmp_1 - tmp_2))) IN
                                                        			LET tmp_3 = IF (p < r) THEN p ELSE r ENDIF IN
                                                        			LET t_2 = (abs(tmp_3)) IN
                                                        				LET t_3 = (- t_1) IN
                                                        					LET tmp_6 = IF (p < r) THEN p ELSE r ENDIF IN
                                                        					LET tmp_8 = IF (p < r) THEN p ELSE r ENDIF IN
                                                        					LET tmp_7 = IF ((q ^ (2)) <= (500000000000000008608032298368227414415543912506619491164446008946190335622287523993960225937729797284303069430849145530155524612766474260348469402855720325061314257334714230178496312484014164775344612087642173365030358044414607127719847315059897273252756207808991071631335431459408181431059577374563631104)) THEN (- (((-5e-1) * ((t_0 + t_2) - t_1)) - ((q * q) / t_3))) ELSE (((t_0 + tmp_8) - (sqrt(((((- q) * (2)) ^ (2)) + (t_3 ^ (2)))))) * (5e-1)) ENDIF IN
                                                        					LET tmp_5 = IF ((q ^ (2)) <= (0)) THEN (((5e-1) * tmp_6) + ((5e-1) * t_2)) ELSE tmp_7 ENDIF IN
                                                        	tmp_5
                                                        END code
                                                        \begin{array}{l}
                                                        t_0 := \left|\mathsf{max}\left(p, r\right)\right|\\
                                                        t_1 := \left|\mathsf{min}\left(p, r\right) - \mathsf{max}\left(p, r\right)\right|\\
                                                        t_2 := \left|\mathsf{min}\left(p, r\right)\right|\\
                                                        t_3 := -t\_1\\
                                                        \mathbf{if}\;{q}^{2} \leq 0:\\
                                                        \;\;\;\;\mathsf{fma}\left(0.5, \mathsf{min}\left(p, r\right), 0.5 \cdot t\_2\right)\\
                                                        
                                                        \mathbf{elif}\;{q}^{2} \leq 5 \cdot 10^{+305}:\\
                                                        \;\;\;\;-\left(-0.5 \cdot \left(\left(t\_0 + t\_2\right) - t\_1\right) - \frac{q \cdot q}{t\_3}\right)\\
                                                        
                                                        \mathbf{else}:\\
                                                        \;\;\;\;\left(\left(t\_0 + \mathsf{min}\left(p, r\right)\right) - \mathsf{hypot}\left(\left(-q\right) \cdot 2, t\_3\right)\right) \cdot 0.5\\
                                                        
                                                        
                                                        \end{array}
                                                        
                                                        Derivation
                                                        1. Split input into 3 regimes
                                                        2. if (pow.f64 q #s(literal 2 binary64)) < 0.0

                                                          1. Initial program 24.9%

                                                            \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                          2. Taylor expanded in p around -inf

                                                            \[\leadsto {p}^{2} \cdot \left(\frac{-1}{2} \cdot \left|\frac{-1}{p}\right| + \frac{1}{2} \cdot \frac{1}{p}\right) \]
                                                          3. Step-by-step derivation
                                                            1. Applied rewrites9.6%

                                                              \[\leadsto {p}^{2} \cdot \mathsf{fma}\left(-0.5, \left|\frac{-1}{p}\right|, 0.5 \cdot \frac{1}{p}\right) \]
                                                            2. Taylor expanded in p around 0

                                                              \[\leadsto \frac{1}{2} \cdot p + \frac{1}{2} \cdot \left|p\right| \]
                                                            3. Step-by-step derivation
                                                              1. Applied rewrites16.4%

                                                                \[\leadsto \mathsf{fma}\left(0.5, p, 0.5 \cdot \left|p\right|\right) \]

                                                              if 0.0 < (pow.f64 q #s(literal 2 binary64)) < 5.0000000000000001e305

                                                              1. Initial program 24.9%

                                                                \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                              2. Taylor expanded in q around 0

                                                                \[\leadsto -1 \cdot \frac{{q}^{2}}{\sqrt{{\left(p - r\right)}^{2}}} + \frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2}}\right) \]
                                                              3. Step-by-step derivation
                                                                1. Applied rewrites18.8%

                                                                  \[\leadsto \mathsf{fma}\left(-1, \frac{{q}^{2}}{\sqrt{{\left(p - r\right)}^{2}}}, 0.5 \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2}}\right)\right) \]
                                                                2. Step-by-step derivation
                                                                  1. Applied rewrites38.8%

                                                                    \[\leadsto -\left(-0.5 \cdot \left(\left(\left|r\right| + \left|p\right|\right) - \left|p - r\right|\right) - \frac{q \cdot q}{-\left|p - r\right|}\right) \]

                                                                  if 5.0000000000000001e305 < (pow.f64 q #s(literal 2 binary64))

                                                                  1. Initial program 24.9%

                                                                    \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                                  2. Applied rewrites24.9%

                                                                    \[\leadsto \left(\left(\left|r\right| + \left|p\right|\right) - \sqrt{\mathsf{fma}\left(q \cdot q, 4, \left(p - r\right) \cdot \left(p - r\right)\right)}\right) \cdot 0.5 \]
                                                                  3. Applied rewrites54.0%

                                                                    \[\leadsto \left(\left(\left|r\right| + \left|p\right|\right) - \mathsf{hypot}\left(\left(-q\right) \cdot 2, -\left|p - r\right|\right)\right) \cdot 0.5 \]
                                                                  4. Step-by-step derivation
                                                                    1. Applied rewrites48.9%

                                                                      \[\leadsto \left(\left(\left|r\right| + p\right) - \mathsf{hypot}\left(\left(-q\right) \cdot 2, -\left|p - r\right|\right)\right) \cdot 0.5 \]
                                                                  5. Recombined 3 regimes into one program.
                                                                  6. Add Preprocessing

                                                                  Alternative 6: 61.4% accurate, 0.6× speedup?

                                                                  \[\begin{array}{l} t_0 := \left|\mathsf{min}\left(p, r\right)\right|\\ t_1 := {\left(\left|q\right|\right)}^{2}\\ t_2 := \left|\mathsf{min}\left(p, r\right) - \mathsf{max}\left(p, r\right)\right|\\ \mathbf{if}\;t\_1 \leq 0:\\ \;\;\;\;\mathsf{fma}\left(0.5, \mathsf{min}\left(p, r\right), 0.5 \cdot t\_0\right)\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+305}:\\ \;\;\;\;-\left(-0.5 \cdot \left(\left(\left|\mathsf{max}\left(p, r\right)\right| + t\_0\right) - t\_2\right) - \frac{\left|q\right| \cdot \left|q\right|}{-t\_2}\right)\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left|q\right|\\ \end{array} \]
                                                                  (FPCore (p r q)
                                                                    :precision binary64
                                                                    :pre TRUE
                                                                    (let* ((t_0 (fabs (fmin p r)))
                                                                         (t_1 (pow (fabs q) 2.0))
                                                                         (t_2 (fabs (- (fmin p r) (fmax p r)))))
                                                                    (if (<= t_1 0.0)
                                                                      (fma 0.5 (fmin p r) (* 0.5 t_0))
                                                                      (if (<= t_1 5e+305)
                                                                        (-
                                                                         (-
                                                                          (* -0.5 (- (+ (fabs (fmax p r)) t_0) t_2))
                                                                          (/ (* (fabs q) (fabs q)) (- t_2))))
                                                                        (* -1.0 (fabs q))))))
                                                                  double code(double p, double r, double q) {
                                                                  	double t_0 = fabs(fmin(p, r));
                                                                  	double t_1 = pow(fabs(q), 2.0);
                                                                  	double t_2 = fabs((fmin(p, r) - fmax(p, r)));
                                                                  	double tmp;
                                                                  	if (t_1 <= 0.0) {
                                                                  		tmp = fma(0.5, fmin(p, r), (0.5 * t_0));
                                                                  	} else if (t_1 <= 5e+305) {
                                                                  		tmp = -((-0.5 * ((fabs(fmax(p, r)) + t_0) - t_2)) - ((fabs(q) * fabs(q)) / -t_2));
                                                                  	} else {
                                                                  		tmp = -1.0 * fabs(q);
                                                                  	}
                                                                  	return tmp;
                                                                  }
                                                                  
                                                                  function code(p, r, q)
                                                                  	t_0 = abs(fmin(p, r))
                                                                  	t_1 = abs(q) ^ 2.0
                                                                  	t_2 = abs(Float64(fmin(p, r) - fmax(p, r)))
                                                                  	tmp = 0.0
                                                                  	if (t_1 <= 0.0)
                                                                  		tmp = fma(0.5, fmin(p, r), Float64(0.5 * t_0));
                                                                  	elseif (t_1 <= 5e+305)
                                                                  		tmp = Float64(-Float64(Float64(-0.5 * Float64(Float64(abs(fmax(p, r)) + t_0) - t_2)) - Float64(Float64(abs(q) * abs(q)) / Float64(-t_2))));
                                                                  	else
                                                                  		tmp = Float64(-1.0 * abs(q));
                                                                  	end
                                                                  	return tmp
                                                                  end
                                                                  
                                                                  code[p_, r_, q_] := Block[{t$95$0 = N[Abs[N[Min[p, r], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Abs[q], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(N[Min[p, r], $MachinePrecision] - N[Max[p, r], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(0.5 * N[Min[p, r], $MachinePrecision] + N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+305], (-N[(N[(-0.5 * N[(N[(N[Abs[N[Max[p, r], $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision] - N[(N[(N[Abs[q], $MachinePrecision] * N[Abs[q], $MachinePrecision]), $MachinePrecision] / (-t$95$2)), $MachinePrecision]), $MachinePrecision]), N[(-1.0 * N[Abs[q], $MachinePrecision]), $MachinePrecision]]]]]]
                                                                  
                                                                  f(p, r, q):
                                                                  	p in [-inf, +inf],
                                                                  	r in [-inf, +inf],
                                                                  	q in [-inf, +inf]
                                                                  code: THEORY
                                                                  BEGIN
                                                                  f(p, r, q: real): real =
                                                                  	LET tmp = IF (p < r) THEN p ELSE r ENDIF IN
                                                                  	LET t_0 = (abs(tmp)) IN
                                                                  		LET t_1 = ((abs(q)) ^ (2)) IN
                                                                  			LET tmp_1 = IF (p < r) THEN p ELSE r ENDIF IN
                                                                  			LET tmp_2 = IF (p > r) THEN p ELSE r ENDIF IN
                                                                  			LET t_2 = (abs((tmp_1 - tmp_2))) IN
                                                                  				LET tmp_5 = IF (p < r) THEN p ELSE r ENDIF IN
                                                                  				LET tmp_8 = IF (p > r) THEN p ELSE r ENDIF IN
                                                                  				LET tmp_7 = IF (t_1 <= (500000000000000008608032298368227414415543912506619491164446008946190335622287523993960225937729797284303069430849145530155524612766474260348469402855720325061314257334714230178496312484014164775344612087642173365030358044414607127719847315059897273252756207808991071631335431459408181431059577374563631104)) THEN (- (((-5e-1) * (((abs(tmp_8)) + t_0) - t_2)) - (((abs(q)) * (abs(q))) / (- t_2)))) ELSE ((-1) * (abs(q))) ENDIF IN
                                                                  				LET tmp_4 = IF (t_1 <= (0)) THEN (((5e-1) * tmp_5) + ((5e-1) * t_0)) ELSE tmp_7 ENDIF IN
                                                                  	tmp_4
                                                                  END code
                                                                  \begin{array}{l}
                                                                  t_0 := \left|\mathsf{min}\left(p, r\right)\right|\\
                                                                  t_1 := {\left(\left|q\right|\right)}^{2}\\
                                                                  t_2 := \left|\mathsf{min}\left(p, r\right) - \mathsf{max}\left(p, r\right)\right|\\
                                                                  \mathbf{if}\;t\_1 \leq 0:\\
                                                                  \;\;\;\;\mathsf{fma}\left(0.5, \mathsf{min}\left(p, r\right), 0.5 \cdot t\_0\right)\\
                                                                  
                                                                  \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+305}:\\
                                                                  \;\;\;\;-\left(-0.5 \cdot \left(\left(\left|\mathsf{max}\left(p, r\right)\right| + t\_0\right) - t\_2\right) - \frac{\left|q\right| \cdot \left|q\right|}{-t\_2}\right)\\
                                                                  
                                                                  \mathbf{else}:\\
                                                                  \;\;\;\;-1 \cdot \left|q\right|\\
                                                                  
                                                                  
                                                                  \end{array}
                                                                  
                                                                  Derivation
                                                                  1. Split input into 3 regimes
                                                                  2. if (pow.f64 q #s(literal 2 binary64)) < 0.0

                                                                    1. Initial program 24.9%

                                                                      \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                                    2. Taylor expanded in p around -inf

                                                                      \[\leadsto {p}^{2} \cdot \left(\frac{-1}{2} \cdot \left|\frac{-1}{p}\right| + \frac{1}{2} \cdot \frac{1}{p}\right) \]
                                                                    3. Step-by-step derivation
                                                                      1. Applied rewrites9.6%

                                                                        \[\leadsto {p}^{2} \cdot \mathsf{fma}\left(-0.5, \left|\frac{-1}{p}\right|, 0.5 \cdot \frac{1}{p}\right) \]
                                                                      2. Taylor expanded in p around 0

                                                                        \[\leadsto \frac{1}{2} \cdot p + \frac{1}{2} \cdot \left|p\right| \]
                                                                      3. Step-by-step derivation
                                                                        1. Applied rewrites16.4%

                                                                          \[\leadsto \mathsf{fma}\left(0.5, p, 0.5 \cdot \left|p\right|\right) \]

                                                                        if 0.0 < (pow.f64 q #s(literal 2 binary64)) < 5.0000000000000001e305

                                                                        1. Initial program 24.9%

                                                                          \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                                        2. Taylor expanded in q around 0

                                                                          \[\leadsto -1 \cdot \frac{{q}^{2}}{\sqrt{{\left(p - r\right)}^{2}}} + \frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2}}\right) \]
                                                                        3. Step-by-step derivation
                                                                          1. Applied rewrites18.8%

                                                                            \[\leadsto \mathsf{fma}\left(-1, \frac{{q}^{2}}{\sqrt{{\left(p - r\right)}^{2}}}, 0.5 \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2}}\right)\right) \]
                                                                          2. Step-by-step derivation
                                                                            1. Applied rewrites38.8%

                                                                              \[\leadsto -\left(-0.5 \cdot \left(\left(\left|r\right| + \left|p\right|\right) - \left|p - r\right|\right) - \frac{q \cdot q}{-\left|p - r\right|}\right) \]

                                                                            if 5.0000000000000001e305 < (pow.f64 q #s(literal 2 binary64))

                                                                            1. Initial program 24.9%

                                                                              \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                                            2. Taylor expanded in q around inf

                                                                              \[\leadsto -1 \cdot q \]
                                                                            3. Step-by-step derivation
                                                                              1. Applied rewrites19.9%

                                                                                \[\leadsto -1 \cdot q \]
                                                                            4. Recombined 3 regimes into one program.
                                                                            5. Add Preprocessing

                                                                            Alternative 7: 61.4% accurate, 0.7× speedup?

                                                                            \[\begin{array}{l} t_0 := {\left(\left|q\right|\right)}^{2}\\ t_1 := \left|\mathsf{max}\left(p, r\right) - \mathsf{min}\left(p, r\right)\right|\\ \mathbf{if}\;t\_0 \leq 0:\\ \;\;\;\;\mathsf{fma}\left(0.5, \mathsf{min}\left(p, r\right), 0.5 \cdot \left|\mathsf{min}\left(p, r\right)\right|\right)\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+305}:\\ \;\;\;\;\mathsf{fma}\left(\left|q\right|, \frac{-\left|q\right|}{t\_1}, \left(\left(\left|\mathsf{max}\left(p, r\right)\right| - \mathsf{min}\left(p, r\right)\right) - t\_1\right) \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left|q\right|\\ \end{array} \]
                                                                            (FPCore (p r q)
                                                                              :precision binary64
                                                                              :pre TRUE
                                                                              (let* ((t_0 (pow (fabs q) 2.0))
                                                                                   (t_1 (fabs (- (fmax p r) (fmin p r)))))
                                                                              (if (<= t_0 0.0)
                                                                                (fma 0.5 (fmin p r) (* 0.5 (fabs (fmin p r))))
                                                                                (if (<= t_0 5e+305)
                                                                                  (fma
                                                                                   (fabs q)
                                                                                   (/ (- (fabs q)) t_1)
                                                                                   (* (- (- (fabs (fmax p r)) (fmin p r)) t_1) 0.5))
                                                                                  (* -1.0 (fabs q))))))
                                                                            double code(double p, double r, double q) {
                                                                            	double t_0 = pow(fabs(q), 2.0);
                                                                            	double t_1 = fabs((fmax(p, r) - fmin(p, r)));
                                                                            	double tmp;
                                                                            	if (t_0 <= 0.0) {
                                                                            		tmp = fma(0.5, fmin(p, r), (0.5 * fabs(fmin(p, r))));
                                                                            	} else if (t_0 <= 5e+305) {
                                                                            		tmp = fma(fabs(q), (-fabs(q) / t_1), (((fabs(fmax(p, r)) - fmin(p, r)) - t_1) * 0.5));
                                                                            	} else {
                                                                            		tmp = -1.0 * fabs(q);
                                                                            	}
                                                                            	return tmp;
                                                                            }
                                                                            
                                                                            function code(p, r, q)
                                                                            	t_0 = abs(q) ^ 2.0
                                                                            	t_1 = abs(Float64(fmax(p, r) - fmin(p, r)))
                                                                            	tmp = 0.0
                                                                            	if (t_0 <= 0.0)
                                                                            		tmp = fma(0.5, fmin(p, r), Float64(0.5 * abs(fmin(p, r))));
                                                                            	elseif (t_0 <= 5e+305)
                                                                            		tmp = fma(abs(q), Float64(Float64(-abs(q)) / t_1), Float64(Float64(Float64(abs(fmax(p, r)) - fmin(p, r)) - t_1) * 0.5));
                                                                            	else
                                                                            		tmp = Float64(-1.0 * abs(q));
                                                                            	end
                                                                            	return tmp
                                                                            end
                                                                            
                                                                            code[p_, r_, q_] := Block[{t$95$0 = N[Power[N[Abs[q], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(N[Max[p, r], $MachinePrecision] - N[Min[p, r], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(0.5 * N[Min[p, r], $MachinePrecision] + N[(0.5 * N[Abs[N[Min[p, r], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+305], N[(N[Abs[q], $MachinePrecision] * N[((-N[Abs[q], $MachinePrecision]) / t$95$1), $MachinePrecision] + N[(N[(N[(N[Abs[N[Max[p, r], $MachinePrecision]], $MachinePrecision] - N[Min[p, r], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[Abs[q], $MachinePrecision]), $MachinePrecision]]]]]
                                                                            
                                                                            f(p, r, q):
                                                                            	p in [-inf, +inf],
                                                                            	r in [-inf, +inf],
                                                                            	q in [-inf, +inf]
                                                                            code: THEORY
                                                                            BEGIN
                                                                            f(p, r, q: real): real =
                                                                            	LET t_0 = ((abs(q)) ^ (2)) IN
                                                                            		LET tmp = IF (p > r) THEN p ELSE r ENDIF IN
                                                                            		LET tmp_1 = IF (p < r) THEN p ELSE r ENDIF IN
                                                                            		LET t_1 = (abs((tmp - tmp_1))) IN
                                                                            			LET tmp_5 = IF (p < r) THEN p ELSE r ENDIF IN
                                                                            			LET tmp_6 = IF (p < r) THEN p ELSE r ENDIF IN
                                                                            			LET tmp_10 = IF (p > r) THEN p ELSE r ENDIF IN
                                                                            			LET tmp_11 = IF (p < r) THEN p ELSE r ENDIF IN
                                                                            			LET tmp_9 = IF (t_0 <= (500000000000000008608032298368227414415543912506619491164446008946190335622287523993960225937729797284303069430849145530155524612766474260348469402855720325061314257334714230178496312484014164775344612087642173365030358044414607127719847315059897273252756207808991071631335431459408181431059577374563631104)) THEN (((abs(q)) * ((- (abs(q))) / t_1)) + ((((abs(tmp_10)) - tmp_11) - t_1) * (5e-1))) ELSE ((-1) * (abs(q))) ENDIF IN
                                                                            			LET tmp_4 = IF (t_0 <= (0)) THEN (((5e-1) * tmp_5) + ((5e-1) * (abs(tmp_6)))) ELSE tmp_9 ENDIF IN
                                                                            	tmp_4
                                                                            END code
                                                                            \begin{array}{l}
                                                                            t_0 := {\left(\left|q\right|\right)}^{2}\\
                                                                            t_1 := \left|\mathsf{max}\left(p, r\right) - \mathsf{min}\left(p, r\right)\right|\\
                                                                            \mathbf{if}\;t\_0 \leq 0:\\
                                                                            \;\;\;\;\mathsf{fma}\left(0.5, \mathsf{min}\left(p, r\right), 0.5 \cdot \left|\mathsf{min}\left(p, r\right)\right|\right)\\
                                                                            
                                                                            \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+305}:\\
                                                                            \;\;\;\;\mathsf{fma}\left(\left|q\right|, \frac{-\left|q\right|}{t\_1}, \left(\left(\left|\mathsf{max}\left(p, r\right)\right| - \mathsf{min}\left(p, r\right)\right) - t\_1\right) \cdot 0.5\right)\\
                                                                            
                                                                            \mathbf{else}:\\
                                                                            \;\;\;\;-1 \cdot \left|q\right|\\
                                                                            
                                                                            
                                                                            \end{array}
                                                                            
                                                                            Derivation
                                                                            1. Split input into 3 regimes
                                                                            2. if (pow.f64 q #s(literal 2 binary64)) < 0.0

                                                                              1. Initial program 24.9%

                                                                                \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                                              2. Taylor expanded in p around -inf

                                                                                \[\leadsto {p}^{2} \cdot \left(\frac{-1}{2} \cdot \left|\frac{-1}{p}\right| + \frac{1}{2} \cdot \frac{1}{p}\right) \]
                                                                              3. Step-by-step derivation
                                                                                1. Applied rewrites9.6%

                                                                                  \[\leadsto {p}^{2} \cdot \mathsf{fma}\left(-0.5, \left|\frac{-1}{p}\right|, 0.5 \cdot \frac{1}{p}\right) \]
                                                                                2. Taylor expanded in p around 0

                                                                                  \[\leadsto \frac{1}{2} \cdot p + \frac{1}{2} \cdot \left|p\right| \]
                                                                                3. Step-by-step derivation
                                                                                  1. Applied rewrites16.4%

                                                                                    \[\leadsto \mathsf{fma}\left(0.5, p, 0.5 \cdot \left|p\right|\right) \]

                                                                                  if 0.0 < (pow.f64 q #s(literal 2 binary64)) < 5.0000000000000001e305

                                                                                  1. Initial program 24.9%

                                                                                    \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                                                  2. Taylor expanded in q around 0

                                                                                    \[\leadsto -1 \cdot \frac{{q}^{2}}{\sqrt{{\left(p - r\right)}^{2}}} + \frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2}}\right) \]
                                                                                  3. Step-by-step derivation
                                                                                    1. Applied rewrites18.8%

                                                                                      \[\leadsto \mathsf{fma}\left(-1, \frac{{q}^{2}}{\sqrt{{\left(p - r\right)}^{2}}}, 0.5 \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2}}\right)\right) \]
                                                                                    2. Step-by-step derivation
                                                                                      1. Applied rewrites38.8%

                                                                                        \[\leadsto \mathsf{fma}\left(-q \cdot q, \frac{1}{\left|p - r\right|}, \left(\left(\left|r\right| + \left|p\right|\right) - \left|p - r\right|\right) \cdot 0.5\right) \]
                                                                                      2. Applied rewrites34.2%

                                                                                        \[\leadsto \mathsf{fma}\left(q, \frac{-q}{\left|r - p\right|}, \left(\left(\left|r\right| - p\right) - \left|r - p\right|\right) \cdot 0.5\right) \]

                                                                                      if 5.0000000000000001e305 < (pow.f64 q #s(literal 2 binary64))

                                                                                      1. Initial program 24.9%

                                                                                        \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                                                      2. Taylor expanded in q around inf

                                                                                        \[\leadsto -1 \cdot q \]
                                                                                      3. Step-by-step derivation
                                                                                        1. Applied rewrites19.9%

                                                                                          \[\leadsto -1 \cdot q \]
                                                                                      4. Recombined 3 regimes into one program.
                                                                                      5. Add Preprocessing

                                                                                      Alternative 8: 58.1% accurate, 2.8× speedup?

                                                                                      \[\begin{array}{l} \mathbf{if}\;\left|q\right| \leq 8.540790679651254 \cdot 10^{-15}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \mathsf{min}\left(p, r\right), 0.5 \cdot \left|\mathsf{min}\left(p, r\right)\right|\right)\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left|q\right|\\ \end{array} \]
                                                                                      (FPCore (p r q)
                                                                                        :precision binary64
                                                                                        :pre TRUE
                                                                                        (if (<= (fabs q) 8.540790679651254e-15)
                                                                                        (fma 0.5 (fmin p r) (* 0.5 (fabs (fmin p r))))
                                                                                        (* -1.0 (fabs q))))
                                                                                      double code(double p, double r, double q) {
                                                                                      	double tmp;
                                                                                      	if (fabs(q) <= 8.540790679651254e-15) {
                                                                                      		tmp = fma(0.5, fmin(p, r), (0.5 * fabs(fmin(p, r))));
                                                                                      	} else {
                                                                                      		tmp = -1.0 * fabs(q);
                                                                                      	}
                                                                                      	return tmp;
                                                                                      }
                                                                                      
                                                                                      function code(p, r, q)
                                                                                      	tmp = 0.0
                                                                                      	if (abs(q) <= 8.540790679651254e-15)
                                                                                      		tmp = fma(0.5, fmin(p, r), Float64(0.5 * abs(fmin(p, r))));
                                                                                      	else
                                                                                      		tmp = Float64(-1.0 * abs(q));
                                                                                      	end
                                                                                      	return tmp
                                                                                      end
                                                                                      
                                                                                      code[p_, r_, q_] := If[LessEqual[N[Abs[q], $MachinePrecision], 8.540790679651254e-15], N[(0.5 * N[Min[p, r], $MachinePrecision] + N[(0.5 * N[Abs[N[Min[p, r], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[Abs[q], $MachinePrecision]), $MachinePrecision]]
                                                                                      
                                                                                      f(p, r, q):
                                                                                      	p in [-inf, +inf],
                                                                                      	r in [-inf, +inf],
                                                                                      	q in [-inf, +inf]
                                                                                      code: THEORY
                                                                                      BEGIN
                                                                                      f(p, r, q: real): real =
                                                                                      	LET tmp_3 = IF (p < r) THEN p ELSE r ENDIF IN
                                                                                      	LET tmp_4 = IF (p < r) THEN p ELSE r ENDIF IN
                                                                                      	LET tmp_2 = IF ((abs(q)) <= (854079067965125441890263232474863775515994644693673620849949656985700130462646484375e-98)) THEN (((5e-1) * tmp_3) + ((5e-1) * (abs(tmp_4)))) ELSE ((-1) * (abs(q))) ENDIF IN
                                                                                      	tmp_2
                                                                                      END code
                                                                                      \begin{array}{l}
                                                                                      \mathbf{if}\;\left|q\right| \leq 8.540790679651254 \cdot 10^{-15}:\\
                                                                                      \;\;\;\;\mathsf{fma}\left(0.5, \mathsf{min}\left(p, r\right), 0.5 \cdot \left|\mathsf{min}\left(p, r\right)\right|\right)\\
                                                                                      
                                                                                      \mathbf{else}:\\
                                                                                      \;\;\;\;-1 \cdot \left|q\right|\\
                                                                                      
                                                                                      
                                                                                      \end{array}
                                                                                      
                                                                                      Derivation
                                                                                      1. Split input into 2 regimes
                                                                                      2. if q < 8.5407906796512544e-15

                                                                                        1. Initial program 24.9%

                                                                                          \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                                                        2. Taylor expanded in p around -inf

                                                                                          \[\leadsto {p}^{2} \cdot \left(\frac{-1}{2} \cdot \left|\frac{-1}{p}\right| + \frac{1}{2} \cdot \frac{1}{p}\right) \]
                                                                                        3. Step-by-step derivation
                                                                                          1. Applied rewrites9.6%

                                                                                            \[\leadsto {p}^{2} \cdot \mathsf{fma}\left(-0.5, \left|\frac{-1}{p}\right|, 0.5 \cdot \frac{1}{p}\right) \]
                                                                                          2. Taylor expanded in p around 0

                                                                                            \[\leadsto \frac{1}{2} \cdot p + \frac{1}{2} \cdot \left|p\right| \]
                                                                                          3. Step-by-step derivation
                                                                                            1. Applied rewrites16.4%

                                                                                              \[\leadsto \mathsf{fma}\left(0.5, p, 0.5 \cdot \left|p\right|\right) \]

                                                                                            if 8.5407906796512544e-15 < q

                                                                                            1. Initial program 24.9%

                                                                                              \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                                                            2. Taylor expanded in q around inf

                                                                                              \[\leadsto -1 \cdot q \]
                                                                                            3. Step-by-step derivation
                                                                                              1. Applied rewrites19.9%

                                                                                                \[\leadsto -1 \cdot q \]
                                                                                            4. Recombined 2 regimes into one program.
                                                                                            5. Add Preprocessing

                                                                                            Alternative 9: 58.0% accurate, 1.7× speedup?

                                                                                            \[\begin{array}{l} \mathbf{if}\;{\left(\left|q\right|\right)}^{2} \leq 5 \cdot 10^{-33}:\\ \;\;\;\;\left(\left|\mathsf{max}\left(p, r\right)\right| - \mathsf{max}\left(p, r\right)\right) \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left|q\right|\\ \end{array} \]
                                                                                            (FPCore (p r q)
                                                                                              :precision binary64
                                                                                              :pre TRUE
                                                                                              (if (<= (pow (fabs q) 2.0) 5e-33)
                                                                                              (* (- (fabs (fmax p r)) (fmax p r)) 0.5)
                                                                                              (* -1.0 (fabs q))))
                                                                                            double code(double p, double r, double q) {
                                                                                            	double tmp;
                                                                                            	if (pow(fabs(q), 2.0) <= 5e-33) {
                                                                                            		tmp = (fabs(fmax(p, r)) - fmax(p, r)) * 0.5;
                                                                                            	} else {
                                                                                            		tmp = -1.0 * fabs(q);
                                                                                            	}
                                                                                            	return tmp;
                                                                                            }
                                                                                            
                                                                                            real(8) function code(p, r, q)
                                                                                            use fmin_fmax_functions
                                                                                                real(8), intent (in) :: p
                                                                                                real(8), intent (in) :: r
                                                                                                real(8), intent (in) :: q
                                                                                                real(8) :: tmp
                                                                                                if ((abs(q) ** 2.0d0) <= 5d-33) then
                                                                                                    tmp = (abs(fmax(p, r)) - fmax(p, r)) * 0.5d0
                                                                                                else
                                                                                                    tmp = (-1.0d0) * abs(q)
                                                                                                end if
                                                                                                code = tmp
                                                                                            end function
                                                                                            
                                                                                            public static double code(double p, double r, double q) {
                                                                                            	double tmp;
                                                                                            	if (Math.pow(Math.abs(q), 2.0) <= 5e-33) {
                                                                                            		tmp = (Math.abs(fmax(p, r)) - fmax(p, r)) * 0.5;
                                                                                            	} else {
                                                                                            		tmp = -1.0 * Math.abs(q);
                                                                                            	}
                                                                                            	return tmp;
                                                                                            }
                                                                                            
                                                                                            def code(p, r, q):
                                                                                            	tmp = 0
                                                                                            	if math.pow(math.fabs(q), 2.0) <= 5e-33:
                                                                                            		tmp = (math.fabs(fmax(p, r)) - fmax(p, r)) * 0.5
                                                                                            	else:
                                                                                            		tmp = -1.0 * math.fabs(q)
                                                                                            	return tmp
                                                                                            
                                                                                            function code(p, r, q)
                                                                                            	tmp = 0.0
                                                                                            	if ((abs(q) ^ 2.0) <= 5e-33)
                                                                                            		tmp = Float64(Float64(abs(fmax(p, r)) - fmax(p, r)) * 0.5);
                                                                                            	else
                                                                                            		tmp = Float64(-1.0 * abs(q));
                                                                                            	end
                                                                                            	return tmp
                                                                                            end
                                                                                            
                                                                                            function tmp_2 = code(p, r, q)
                                                                                            	tmp = 0.0;
                                                                                            	if ((abs(q) ^ 2.0) <= 5e-33)
                                                                                            		tmp = (abs(max(p, r)) - max(p, r)) * 0.5;
                                                                                            	else
                                                                                            		tmp = -1.0 * abs(q);
                                                                                            	end
                                                                                            	tmp_2 = tmp;
                                                                                            end
                                                                                            
                                                                                            code[p_, r_, q_] := If[LessEqual[N[Power[N[Abs[q], $MachinePrecision], 2.0], $MachinePrecision], 5e-33], N[(N[(N[Abs[N[Max[p, r], $MachinePrecision]], $MachinePrecision] - N[Max[p, r], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(-1.0 * N[Abs[q], $MachinePrecision]), $MachinePrecision]]
                                                                                            
                                                                                            f(p, r, q):
                                                                                            	p in [-inf, +inf],
                                                                                            	r in [-inf, +inf],
                                                                                            	q in [-inf, +inf]
                                                                                            code: THEORY
                                                                                            BEGIN
                                                                                            f(p, r, q: real): real =
                                                                                            	LET tmp_3 = IF (p > r) THEN p ELSE r ENDIF IN
                                                                                            	LET tmp_4 = IF (p > r) THEN p ELSE r ENDIF IN
                                                                                            	LET tmp_2 = IF (((abs(q)) ^ (2)) <= (50000000000000002798365498812095096722612130161874003164844686563658192413998319444837052649699415951545233838260173797607421875e-160)) THEN (((abs(tmp_3)) - tmp_4) * (5e-1)) ELSE ((-1) * (abs(q))) ENDIF IN
                                                                                            	tmp_2
                                                                                            END code
                                                                                            \begin{array}{l}
                                                                                            \mathbf{if}\;{\left(\left|q\right|\right)}^{2} \leq 5 \cdot 10^{-33}:\\
                                                                                            \;\;\;\;\left(\left|\mathsf{max}\left(p, r\right)\right| - \mathsf{max}\left(p, r\right)\right) \cdot 0.5\\
                                                                                            
                                                                                            \mathbf{else}:\\
                                                                                            \;\;\;\;-1 \cdot \left|q\right|\\
                                                                                            
                                                                                            
                                                                                            \end{array}
                                                                                            
                                                                                            Derivation
                                                                                            1. Split input into 2 regimes
                                                                                            2. if (pow.f64 q #s(literal 2 binary64)) < 5.0000000000000003e-33

                                                                                              1. Initial program 24.9%

                                                                                                \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                                                              2. Taylor expanded in q around inf

                                                                                                \[\leadsto \frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - 2 \cdot q\right) \]
                                                                                              3. Step-by-step derivation
                                                                                                1. Applied rewrites18.9%

                                                                                                  \[\leadsto \frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - 2 \cdot q\right) \]
                                                                                                2. Applied rewrites18.9%

                                                                                                  \[\leadsto \left(\left(\left|r\right| + \left|p\right|\right) - \left(q + q\right)\right) \cdot 0.5 \]
                                                                                                3. Applied rewrites18.8%

                                                                                                  \[\leadsto \left(\left(\left|r\right| - p\right) - \left(q + q\right)\right) \cdot 0.5 \]
                                                                                                4. Taylor expanded in p around -inf

                                                                                                  \[\leadsto \left(\left|r\right| - r\right) \cdot 0.5 \]
                                                                                                5. Step-by-step derivation
                                                                                                  1. Applied rewrites16.5%

                                                                                                    \[\leadsto \left(\left|r\right| - r\right) \cdot 0.5 \]

                                                                                                  if 5.0000000000000003e-33 < (pow.f64 q #s(literal 2 binary64))

                                                                                                  1. Initial program 24.9%

                                                                                                    \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                                                                  2. Taylor expanded in q around inf

                                                                                                    \[\leadsto -1 \cdot q \]
                                                                                                  3. Step-by-step derivation
                                                                                                    1. Applied rewrites19.9%

                                                                                                      \[\leadsto -1 \cdot q \]
                                                                                                  4. Recombined 2 regimes into one program.
                                                                                                  5. Add Preprocessing

                                                                                                  Alternative 10: 48.8% accurate, 2.2× speedup?

                                                                                                  \[\begin{array}{l} \mathbf{if}\;{\left(\left|q\right|\right)}^{2} \leq 5 \cdot 10^{-33}:\\ \;\;\;\;p \cdot 0\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left|q\right|\\ \end{array} \]
                                                                                                  (FPCore (p r q)
                                                                                                    :precision binary64
                                                                                                    :pre TRUE
                                                                                                    (if (<= (pow (fabs q) 2.0) 5e-33) (* p 0.0) (* -1.0 (fabs q))))
                                                                                                  double code(double p, double r, double q) {
                                                                                                  	double tmp;
                                                                                                  	if (pow(fabs(q), 2.0) <= 5e-33) {
                                                                                                  		tmp = p * 0.0;
                                                                                                  	} else {
                                                                                                  		tmp = -1.0 * fabs(q);
                                                                                                  	}
                                                                                                  	return tmp;
                                                                                                  }
                                                                                                  
                                                                                                  real(8) function code(p, r, q)
                                                                                                  use fmin_fmax_functions
                                                                                                      real(8), intent (in) :: p
                                                                                                      real(8), intent (in) :: r
                                                                                                      real(8), intent (in) :: q
                                                                                                      real(8) :: tmp
                                                                                                      if ((abs(q) ** 2.0d0) <= 5d-33) then
                                                                                                          tmp = p * 0.0d0
                                                                                                      else
                                                                                                          tmp = (-1.0d0) * abs(q)
                                                                                                      end if
                                                                                                      code = tmp
                                                                                                  end function
                                                                                                  
                                                                                                  public static double code(double p, double r, double q) {
                                                                                                  	double tmp;
                                                                                                  	if (Math.pow(Math.abs(q), 2.0) <= 5e-33) {
                                                                                                  		tmp = p * 0.0;
                                                                                                  	} else {
                                                                                                  		tmp = -1.0 * Math.abs(q);
                                                                                                  	}
                                                                                                  	return tmp;
                                                                                                  }
                                                                                                  
                                                                                                  def code(p, r, q):
                                                                                                  	tmp = 0
                                                                                                  	if math.pow(math.fabs(q), 2.0) <= 5e-33:
                                                                                                  		tmp = p * 0.0
                                                                                                  	else:
                                                                                                  		tmp = -1.0 * math.fabs(q)
                                                                                                  	return tmp
                                                                                                  
                                                                                                  function code(p, r, q)
                                                                                                  	tmp = 0.0
                                                                                                  	if ((abs(q) ^ 2.0) <= 5e-33)
                                                                                                  		tmp = Float64(p * 0.0);
                                                                                                  	else
                                                                                                  		tmp = Float64(-1.0 * abs(q));
                                                                                                  	end
                                                                                                  	return tmp
                                                                                                  end
                                                                                                  
                                                                                                  function tmp_2 = code(p, r, q)
                                                                                                  	tmp = 0.0;
                                                                                                  	if ((abs(q) ^ 2.0) <= 5e-33)
                                                                                                  		tmp = p * 0.0;
                                                                                                  	else
                                                                                                  		tmp = -1.0 * abs(q);
                                                                                                  	end
                                                                                                  	tmp_2 = tmp;
                                                                                                  end
                                                                                                  
                                                                                                  code[p_, r_, q_] := If[LessEqual[N[Power[N[Abs[q], $MachinePrecision], 2.0], $MachinePrecision], 5e-33], N[(p * 0.0), $MachinePrecision], N[(-1.0 * N[Abs[q], $MachinePrecision]), $MachinePrecision]]
                                                                                                  
                                                                                                  f(p, r, q):
                                                                                                  	p in [-inf, +inf],
                                                                                                  	r in [-inf, +inf],
                                                                                                  	q in [-inf, +inf]
                                                                                                  code: THEORY
                                                                                                  BEGIN
                                                                                                  f(p, r, q: real): real =
                                                                                                  	LET tmp = IF (((abs(q)) ^ (2)) <= (50000000000000002798365498812095096722612130161874003164844686563658192413998319444837052649699415951545233838260173797607421875e-160)) THEN (p * (0)) ELSE ((-1) * (abs(q))) ENDIF IN
                                                                                                  	tmp
                                                                                                  END code
                                                                                                  \begin{array}{l}
                                                                                                  \mathbf{if}\;{\left(\left|q\right|\right)}^{2} \leq 5 \cdot 10^{-33}:\\
                                                                                                  \;\;\;\;p \cdot 0\\
                                                                                                  
                                                                                                  \mathbf{else}:\\
                                                                                                  \;\;\;\;-1 \cdot \left|q\right|\\
                                                                                                  
                                                                                                  
                                                                                                  \end{array}
                                                                                                  
                                                                                                  Derivation
                                                                                                  1. Split input into 2 regimes
                                                                                                  2. if (pow.f64 q #s(literal 2 binary64)) < 5.0000000000000003e-33

                                                                                                    1. Initial program 24.9%

                                                                                                      \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                                                                    2. Taylor expanded in p around inf

                                                                                                      \[\leadsto {p}^{2} \cdot \left(\frac{1}{2} \cdot \left|\frac{1}{p}\right| - \frac{1}{2} \cdot \frac{1}{p}\right) \]
                                                                                                    3. Step-by-step derivation
                                                                                                      1. Applied rewrites12.8%

                                                                                                        \[\leadsto {p}^{2} \cdot \left(0.5 \cdot \left|\frac{1}{p}\right| - 0.5 \cdot \frac{1}{p}\right) \]
                                                                                                      2. Taylor expanded in p around 0

                                                                                                        \[\leadsto \frac{-1}{2} \cdot p + \frac{1}{2} \cdot \left|p\right| \]
                                                                                                      3. Step-by-step derivation
                                                                                                        1. Applied rewrites16.9%

                                                                                                          \[\leadsto \mathsf{fma}\left(-0.5, p, 0.5 \cdot \left|p\right|\right) \]
                                                                                                        2. Step-by-step derivation
                                                                                                          1. Applied rewrites19.2%

                                                                                                            \[\leadsto \mathsf{fma}\left(-0.5, p, 0.5 \cdot p\right) \]
                                                                                                          2. Step-by-step derivation
                                                                                                            1. Applied rewrites19.2%

                                                                                                              \[\leadsto p \cdot 0 \]

                                                                                                            if 5.0000000000000003e-33 < (pow.f64 q #s(literal 2 binary64))

                                                                                                            1. Initial program 24.9%

                                                                                                              \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                                                                            2. Taylor expanded in q around inf

                                                                                                              \[\leadsto -1 \cdot q \]
                                                                                                            3. Step-by-step derivation
                                                                                                              1. Applied rewrites19.9%

                                                                                                                \[\leadsto -1 \cdot q \]
                                                                                                            4. Recombined 2 regimes into one program.
                                                                                                            5. Add Preprocessing

                                                                                                            Alternative 11: 20.8% accurate, 4.3× speedup?

                                                                                                            \[\begin{array}{l} \mathbf{if}\;\mathsf{min}\left(p, r\right) \leq 3.5975677817826244 \cdot 10^{-302}:\\ \;\;\;\;\mathsf{min}\left(p, r\right) \cdot 0\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \mathsf{min}\left(p, r\right)\\ \end{array} \]
                                                                                                            (FPCore (p r q)
                                                                                                              :precision binary64
                                                                                                              :pre TRUE
                                                                                                              (if (<= (fmin p r) 3.5975677817826244e-302)
                                                                                                              (* (fmin p r) 0.0)
                                                                                                              (* 0.5 (fmin p r))))
                                                                                                            double code(double p, double r, double q) {
                                                                                                            	double tmp;
                                                                                                            	if (fmin(p, r) <= 3.5975677817826244e-302) {
                                                                                                            		tmp = fmin(p, r) * 0.0;
                                                                                                            	} else {
                                                                                                            		tmp = 0.5 * fmin(p, r);
                                                                                                            	}
                                                                                                            	return tmp;
                                                                                                            }
                                                                                                            
                                                                                                            real(8) function code(p, r, q)
                                                                                                            use fmin_fmax_functions
                                                                                                                real(8), intent (in) :: p
                                                                                                                real(8), intent (in) :: r
                                                                                                                real(8), intent (in) :: q
                                                                                                                real(8) :: tmp
                                                                                                                if (fmin(p, r) <= 3.5975677817826244d-302) then
                                                                                                                    tmp = fmin(p, r) * 0.0d0
                                                                                                                else
                                                                                                                    tmp = 0.5d0 * fmin(p, r)
                                                                                                                end if
                                                                                                                code = tmp
                                                                                                            end function
                                                                                                            
                                                                                                            public static double code(double p, double r, double q) {
                                                                                                            	double tmp;
                                                                                                            	if (fmin(p, r) <= 3.5975677817826244e-302) {
                                                                                                            		tmp = fmin(p, r) * 0.0;
                                                                                                            	} else {
                                                                                                            		tmp = 0.5 * fmin(p, r);
                                                                                                            	}
                                                                                                            	return tmp;
                                                                                                            }
                                                                                                            
                                                                                                            def code(p, r, q):
                                                                                                            	tmp = 0
                                                                                                            	if fmin(p, r) <= 3.5975677817826244e-302:
                                                                                                            		tmp = fmin(p, r) * 0.0
                                                                                                            	else:
                                                                                                            		tmp = 0.5 * fmin(p, r)
                                                                                                            	return tmp
                                                                                                            
                                                                                                            function code(p, r, q)
                                                                                                            	tmp = 0.0
                                                                                                            	if (fmin(p, r) <= 3.5975677817826244e-302)
                                                                                                            		tmp = Float64(fmin(p, r) * 0.0);
                                                                                                            	else
                                                                                                            		tmp = Float64(0.5 * fmin(p, r));
                                                                                                            	end
                                                                                                            	return tmp
                                                                                                            end
                                                                                                            
                                                                                                            function tmp_2 = code(p, r, q)
                                                                                                            	tmp = 0.0;
                                                                                                            	if (min(p, r) <= 3.5975677817826244e-302)
                                                                                                            		tmp = min(p, r) * 0.0;
                                                                                                            	else
                                                                                                            		tmp = 0.5 * min(p, r);
                                                                                                            	end
                                                                                                            	tmp_2 = tmp;
                                                                                                            end
                                                                                                            
                                                                                                            code[p_, r_, q_] := If[LessEqual[N[Min[p, r], $MachinePrecision], 3.5975677817826244e-302], N[(N[Min[p, r], $MachinePrecision] * 0.0), $MachinePrecision], N[(0.5 * N[Min[p, r], $MachinePrecision]), $MachinePrecision]]
                                                                                                            
                                                                                                            f(p, r, q):
                                                                                                            	p in [-inf, +inf],
                                                                                                            	r in [-inf, +inf],
                                                                                                            	q in [-inf, +inf]
                                                                                                            code: THEORY
                                                                                                            BEGIN
                                                                                                            f(p, r, q: real): real =
                                                                                                            	LET tmp_2 = IF (p < r) THEN p ELSE r ENDIF IN
                                                                                                            	LET tmp_3 = IF (p < r) THEN p ELSE r ENDIF IN
                                                                                                            	LET tmp_4 = IF (p < r) THEN p ELSE r ENDIF IN
                                                                                                            	LET tmp_1 = IF (tmp_2 <= (3597567781782624432107317706206208662075978442551396267581661498946986779616303015504812228820800837059979732030029484617041221525247841637128026244294230311467433090494688848473681121476294083184682336627001145275234855799913044861596941614464332720113054478625993367422631318261478984088113852863018379386144649278279992415390330810316042711520931302978695588985388104741721633954166495169714593936520252242784248862390157951880704070980263744774437990521783519181608403575858482305631027952021777446091005163840942550162822819192863269865562016543908830728258026707275387287886826340051570601320186846837410723840526046244209656706243644670137666091907474161620981261067113383936700238376866614994464059983612924664697629850707016885280609130859375e-1052)) THEN (tmp_3 * (0)) ELSE ((5e-1) * tmp_4) ENDIF IN
                                                                                                            	tmp_1
                                                                                                            END code
                                                                                                            \begin{array}{l}
                                                                                                            \mathbf{if}\;\mathsf{min}\left(p, r\right) \leq 3.5975677817826244 \cdot 10^{-302}:\\
                                                                                                            \;\;\;\;\mathsf{min}\left(p, r\right) \cdot 0\\
                                                                                                            
                                                                                                            \mathbf{else}:\\
                                                                                                            \;\;\;\;0.5 \cdot \mathsf{min}\left(p, r\right)\\
                                                                                                            
                                                                                                            
                                                                                                            \end{array}
                                                                                                            
                                                                                                            Derivation
                                                                                                            1. Split input into 2 regimes
                                                                                                            2. if p < 3.5975677817826244e-302

                                                                                                              1. Initial program 24.9%

                                                                                                                \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                                                                              2. Taylor expanded in p around inf

                                                                                                                \[\leadsto {p}^{2} \cdot \left(\frac{1}{2} \cdot \left|\frac{1}{p}\right| - \frac{1}{2} \cdot \frac{1}{p}\right) \]
                                                                                                              3. Step-by-step derivation
                                                                                                                1. Applied rewrites12.8%

                                                                                                                  \[\leadsto {p}^{2} \cdot \left(0.5 \cdot \left|\frac{1}{p}\right| - 0.5 \cdot \frac{1}{p}\right) \]
                                                                                                                2. Taylor expanded in p around 0

                                                                                                                  \[\leadsto \frac{-1}{2} \cdot p + \frac{1}{2} \cdot \left|p\right| \]
                                                                                                                3. Step-by-step derivation
                                                                                                                  1. Applied rewrites16.9%

                                                                                                                    \[\leadsto \mathsf{fma}\left(-0.5, p, 0.5 \cdot \left|p\right|\right) \]
                                                                                                                  2. Step-by-step derivation
                                                                                                                    1. Applied rewrites19.2%

                                                                                                                      \[\leadsto \mathsf{fma}\left(-0.5, p, 0.5 \cdot p\right) \]
                                                                                                                    2. Step-by-step derivation
                                                                                                                      1. Applied rewrites19.2%

                                                                                                                        \[\leadsto p \cdot 0 \]

                                                                                                                      if 3.5975677817826244e-302 < p

                                                                                                                      1. Initial program 24.9%

                                                                                                                        \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                                                                                      2. Taylor expanded in p around -inf

                                                                                                                        \[\leadsto {p}^{2} \cdot \left(\frac{-1}{2} \cdot \left|\frac{-1}{p}\right| + \frac{1}{2} \cdot \frac{1}{p}\right) \]
                                                                                                                      3. Step-by-step derivation
                                                                                                                        1. Applied rewrites9.6%

                                                                                                                          \[\leadsto {p}^{2} \cdot \mathsf{fma}\left(-0.5, \left|\frac{-1}{p}\right|, 0.5 \cdot \frac{1}{p}\right) \]
                                                                                                                        2. Step-by-step derivation
                                                                                                                          1. Applied rewrites9.6%

                                                                                                                            \[\leadsto \left(\frac{0.5}{p} - \frac{0.5}{\left|p\right|}\right) \cdot \left(p \cdot p\right) \]
                                                                                                                          2. Taylor expanded in p around 0

                                                                                                                            \[\leadsto \frac{1}{2} \cdot p \]
                                                                                                                          3. Step-by-step derivation
                                                                                                                            1. Applied rewrites4.2%

                                                                                                                              \[\leadsto 0.5 \cdot p \]
                                                                                                                          4. Recombined 2 regimes into one program.
                                                                                                                          5. Add Preprocessing

                                                                                                                          Alternative 12: 5.6% accurate, 8.5× speedup?

                                                                                                                          \[0.5 \cdot \mathsf{min}\left(p, r\right) \]
                                                                                                                          (FPCore (p r q)
                                                                                                                            :precision binary64
                                                                                                                            :pre TRUE
                                                                                                                            (* 0.5 (fmin p r)))
                                                                                                                          double code(double p, double r, double q) {
                                                                                                                          	return 0.5 * fmin(p, r);
                                                                                                                          }
                                                                                                                          
                                                                                                                          real(8) function code(p, r, q)
                                                                                                                          use fmin_fmax_functions
                                                                                                                              real(8), intent (in) :: p
                                                                                                                              real(8), intent (in) :: r
                                                                                                                              real(8), intent (in) :: q
                                                                                                                              code = 0.5d0 * fmin(p, r)
                                                                                                                          end function
                                                                                                                          
                                                                                                                          public static double code(double p, double r, double q) {
                                                                                                                          	return 0.5 * fmin(p, r);
                                                                                                                          }
                                                                                                                          
                                                                                                                          def code(p, r, q):
                                                                                                                          	return 0.5 * fmin(p, r)
                                                                                                                          
                                                                                                                          function code(p, r, q)
                                                                                                                          	return Float64(0.5 * fmin(p, r))
                                                                                                                          end
                                                                                                                          
                                                                                                                          function tmp = code(p, r, q)
                                                                                                                          	tmp = 0.5 * min(p, r);
                                                                                                                          end
                                                                                                                          
                                                                                                                          code[p_, r_, q_] := N[(0.5 * N[Min[p, r], $MachinePrecision]), $MachinePrecision]
                                                                                                                          
                                                                                                                          f(p, r, q):
                                                                                                                          	p in [-inf, +inf],
                                                                                                                          	r in [-inf, +inf],
                                                                                                                          	q in [-inf, +inf]
                                                                                                                          code: THEORY
                                                                                                                          BEGIN
                                                                                                                          f(p, r, q: real): real =
                                                                                                                          	LET tmp = IF (p < r) THEN p ELSE r ENDIF IN
                                                                                                                          	(5e-1) * tmp
                                                                                                                          END code
                                                                                                                          0.5 \cdot \mathsf{min}\left(p, r\right)
                                                                                                                          
                                                                                                                          Derivation
                                                                                                                          1. Initial program 24.9%

                                                                                                                            \[\frac{1}{2} \cdot \left(\left(\left|p\right| + \left|r\right|\right) - \sqrt{{\left(p - r\right)}^{2} + 4 \cdot {q}^{2}}\right) \]
                                                                                                                          2. Taylor expanded in p around -inf

                                                                                                                            \[\leadsto {p}^{2} \cdot \left(\frac{-1}{2} \cdot \left|\frac{-1}{p}\right| + \frac{1}{2} \cdot \frac{1}{p}\right) \]
                                                                                                                          3. Step-by-step derivation
                                                                                                                            1. Applied rewrites9.6%

                                                                                                                              \[\leadsto {p}^{2} \cdot \mathsf{fma}\left(-0.5, \left|\frac{-1}{p}\right|, 0.5 \cdot \frac{1}{p}\right) \]
                                                                                                                            2. Step-by-step derivation
                                                                                                                              1. Applied rewrites9.6%

                                                                                                                                \[\leadsto \left(\frac{0.5}{p} - \frac{0.5}{\left|p\right|}\right) \cdot \left(p \cdot p\right) \]
                                                                                                                              2. Taylor expanded in p around 0

                                                                                                                                \[\leadsto \frac{1}{2} \cdot p \]
                                                                                                                              3. Step-by-step derivation
                                                                                                                                1. Applied rewrites4.2%

                                                                                                                                  \[\leadsto 0.5 \cdot p \]
                                                                                                                                2. Add Preprocessing

                                                                                                                                Reproduce

                                                                                                                                ?
                                                                                                                                herbie shell --seed 2026070 
                                                                                                                                (FPCore (p r q)
                                                                                                                                  :name "1/2(abs(p)+abs(r) - sqrt((p-r)^2 + 4q^2))"
                                                                                                                                  :precision binary64
                                                                                                                                  (* (/ 1.0 2.0) (- (+ (fabs p) (fabs r)) (sqrt (+ (pow (- p r) 2.0) (* 4.0 (pow q 2.0)))))))