Diagrams.TwoD.Apollonian:descartes from diagrams-contrib-1.3.0.5

Percentage Accurate: 70.3% → 99.3%
Time: 5.1s
Alternatives: 15
Speedup: 0.3×

Specification

?
\[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
(FPCore (x y z)
 :precision binary64
 (* 2.0 (sqrt (+ (+ (* x y) (* x z)) (* y z)))))
double code(double x, double y, double z) {
	return 2.0 * sqrt((((x * y) + (x * z)) + (y * z)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = 2.0d0 * sqrt((((x * y) + (x * z)) + (y * z)))
end function
public static double code(double x, double y, double z) {
	return 2.0 * Math.sqrt((((x * y) + (x * z)) + (y * z)));
}
def code(x, y, z):
	return 2.0 * math.sqrt((((x * y) + (x * z)) + (y * z)))
function code(x, y, z)
	return Float64(2.0 * sqrt(Float64(Float64(Float64(x * y) + Float64(x * z)) + Float64(y * z))))
end
function tmp = code(x, y, z)
	tmp = 2.0 * sqrt((((x * y) + (x * z)) + (y * z)));
end
code[x_, y_, z_] := N[(2.0 * N[Sqrt[N[(N[(N[(x * y), $MachinePrecision] + N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(y * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}

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

\[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
(FPCore (x y z)
 :precision binary64
 (* 2.0 (sqrt (+ (+ (* x y) (* x z)) (* y z)))))
double code(double x, double y, double z) {
	return 2.0 * sqrt((((x * y) + (x * z)) + (y * z)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = 2.0d0 * sqrt((((x * y) + (x * z)) + (y * z)))
end function
public static double code(double x, double y, double z) {
	return 2.0 * Math.sqrt((((x * y) + (x * z)) + (y * z)));
}
def code(x, y, z):
	return 2.0 * math.sqrt((((x * y) + (x * z)) + (y * z)))
function code(x, y, z)
	return Float64(2.0 * sqrt(Float64(Float64(Float64(x * y) + Float64(x * z)) + Float64(y * z))))
end
function tmp = code(x, y, z)
	tmp = 2.0 * sqrt((((x * y) + (x * z)) + (y * z)));
end
code[x_, y_, z_] := N[(2.0 * N[Sqrt[N[(N[(N[(x * y), $MachinePrecision] + N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(y * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}

Alternative 1: 99.3% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ \mathbf{if}\;t\_2 \leq -1.4 \cdot 10^{-300}:\\ \;\;\;\;-2 \cdot \left(t\_0 \cdot \frac{\sqrt{\left(-t\_3\right) - t\_2}}{\sqrt{-t\_0}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{t\_2 + \frac{t\_2 + t\_3}{t\_3} \cdot t\_0} \cdot \sqrt{t\_3}\right) \cdot 2\\ \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (fmin (fmin x y) z))
        (t_1 (fmax (fmin x y) z))
        (t_2 (fmin (fmax x y) t_1))
        (t_3 (fmax (fmax x y) t_1)))
   (if (<= t_2 -1.4e-300)
     (* -2.0 (* t_0 (/ (sqrt (- (- t_3) t_2)) (sqrt (- t_0)))))
     (* (* (sqrt (+ t_2 (* (/ (+ t_2 t_3) t_3) t_0))) (sqrt t_3)) 2.0))))
double code(double x, double y, double z) {
	double t_0 = fmin(fmin(x, y), z);
	double t_1 = fmax(fmin(x, y), z);
	double t_2 = fmin(fmax(x, y), t_1);
	double t_3 = fmax(fmax(x, y), t_1);
	double tmp;
	if (t_2 <= -1.4e-300) {
		tmp = -2.0 * (t_0 * (sqrt((-t_3 - t_2)) / sqrt(-t_0)));
	} else {
		tmp = (sqrt((t_2 + (((t_2 + t_3) / t_3) * t_0))) * sqrt(t_3)) * 2.0;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = fmin(fmin(x, y), z)
    t_1 = fmax(fmin(x, y), z)
    t_2 = fmin(fmax(x, y), t_1)
    t_3 = fmax(fmax(x, y), t_1)
    if (t_2 <= (-1.4d-300)) then
        tmp = (-2.0d0) * (t_0 * (sqrt((-t_3 - t_2)) / sqrt(-t_0)))
    else
        tmp = (sqrt((t_2 + (((t_2 + t_3) / t_3) * t_0))) * sqrt(t_3)) * 2.0d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = fmin(fmin(x, y), z);
	double t_1 = fmax(fmin(x, y), z);
	double t_2 = fmin(fmax(x, y), t_1);
	double t_3 = fmax(fmax(x, y), t_1);
	double tmp;
	if (t_2 <= -1.4e-300) {
		tmp = -2.0 * (t_0 * (Math.sqrt((-t_3 - t_2)) / Math.sqrt(-t_0)));
	} else {
		tmp = (Math.sqrt((t_2 + (((t_2 + t_3) / t_3) * t_0))) * Math.sqrt(t_3)) * 2.0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = fmin(fmin(x, y), z)
	t_1 = fmax(fmin(x, y), z)
	t_2 = fmin(fmax(x, y), t_1)
	t_3 = fmax(fmax(x, y), t_1)
	tmp = 0
	if t_2 <= -1.4e-300:
		tmp = -2.0 * (t_0 * (math.sqrt((-t_3 - t_2)) / math.sqrt(-t_0)))
	else:
		tmp = (math.sqrt((t_2 + (((t_2 + t_3) / t_3) * t_0))) * math.sqrt(t_3)) * 2.0
	return tmp
function code(x, y, z)
	t_0 = fmin(fmin(x, y), z)
	t_1 = fmax(fmin(x, y), z)
	t_2 = fmin(fmax(x, y), t_1)
	t_3 = fmax(fmax(x, y), t_1)
	tmp = 0.0
	if (t_2 <= -1.4e-300)
		tmp = Float64(-2.0 * Float64(t_0 * Float64(sqrt(Float64(Float64(-t_3) - t_2)) / sqrt(Float64(-t_0)))));
	else
		tmp = Float64(Float64(sqrt(Float64(t_2 + Float64(Float64(Float64(t_2 + t_3) / t_3) * t_0))) * sqrt(t_3)) * 2.0);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = min(min(x, y), z);
	t_1 = max(min(x, y), z);
	t_2 = min(max(x, y), t_1);
	t_3 = max(max(x, y), t_1);
	tmp = 0.0;
	if (t_2 <= -1.4e-300)
		tmp = -2.0 * (t_0 * (sqrt((-t_3 - t_2)) / sqrt(-t_0)));
	else
		tmp = (sqrt((t_2 + (((t_2 + t_3) / t_3) * t_0))) * sqrt(t_3)) * 2.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, If[LessEqual[t$95$2, -1.4e-300], N[(-2.0 * N[(t$95$0 * N[(N[Sqrt[N[((-t$95$3) - t$95$2), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-t$95$0)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(t$95$2 + N[(N[(N[(t$95$2 + t$95$3), $MachinePrecision] / t$95$3), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[t$95$3], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
\mathbf{if}\;t\_2 \leq -1.4 \cdot 10^{-300}:\\
\;\;\;\;-2 \cdot \left(t\_0 \cdot \frac{\sqrt{\left(-t\_3\right) - t\_2}}{\sqrt{-t\_0}}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\sqrt{t\_2 + \frac{t\_2 + t\_3}{t\_3} \cdot t\_0} \cdot \sqrt{t\_3}\right) \cdot 2\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.4e-300

    1. Initial program 70.3%

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
    2. Taylor expanded in x around -inf

      \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -2 \cdot \color{blue}{\left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
      2. lower-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \color{blue}{\sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}}\right) \]
      3. lower-sqrt.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      4. lower-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      5. lower-/.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      6. lower-fma.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
      7. lower-*.f6430.1%

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
    4. Applied rewrites30.1%

      \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right)} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
      2. lift-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
      3. mul-1-negN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\mathsf{neg}\left(\frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}\right)}\right) \]
      4. lift-/.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\mathsf{neg}\left(\frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}\right)}\right) \]
      5. distribute-neg-frac2N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{\mathsf{neg}\left(x\right)}}\right) \]
      6. sqrt-divN/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}}{\color{blue}{\sqrt{\mathsf{neg}\left(x\right)}}}\right) \]
      7. lower-unsound-/.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}}{\color{blue}{\sqrt{\mathsf{neg}\left(x\right)}}}\right) \]
      8. lower-unsound-sqrt.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}}{\sqrt{\color{blue}{\mathsf{neg}\left(x\right)}}}\right) \]
      9. lift-fma.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot y + -1 \cdot z}}{\sqrt{\mathsf{neg}\left(\color{blue}{x}\right)}}\right) \]
      10. +-commutativeN/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot z + -1 \cdot y}}{\sqrt{\mathsf{neg}\left(\color{blue}{x}\right)}}\right) \]
      11. mul-1-negN/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot z + \left(\mathsf{neg}\left(y\right)\right)}}{\sqrt{\mathsf{neg}\left(x\right)}}\right) \]
      12. sub-flip-reverseN/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot z - y}}{\sqrt{\mathsf{neg}\left(\color{blue}{x}\right)}}\right) \]
      13. lower--.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot z - y}}{\sqrt{\mathsf{neg}\left(\color{blue}{x}\right)}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot z - y}}{\sqrt{\mathsf{neg}\left(x\right)}}\right) \]
      15. mul-1-negN/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\left(\mathsf{neg}\left(z\right)\right) - y}}{\sqrt{\mathsf{neg}\left(x\right)}}\right) \]
      16. lower-neg.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\left(-z\right) - y}}{\sqrt{\mathsf{neg}\left(x\right)}}\right) \]
      17. lower-unsound-sqrt.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\left(-z\right) - y}}{\sqrt{\mathsf{neg}\left(x\right)}}\right) \]
      18. lower-neg.f6433.4%

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\left(-z\right) - y}}{\sqrt{-x}}\right) \]
    6. Applied rewrites33.4%

      \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\left(-z\right) - y}}{\color{blue}{\sqrt{-x}}}\right) \]

    if -1.4e-300 < y

    1. Initial program 70.3%

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
      3. lower-*.f6470.3%

        \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
    3. Applied rewrites70.4%

      \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(z + x, y, z \cdot x\right)} \cdot 2} \]
    4. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(z + x, y, z \cdot x\right)}} \cdot 2 \]
      2. lift-fma.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(z + x\right) \cdot y + z \cdot x}} \cdot 2 \]
      3. *-commutativeN/A

        \[\leadsto \sqrt{\color{blue}{y \cdot \left(z + x\right)} + z \cdot x} \cdot 2 \]
      4. lift-+.f64N/A

        \[\leadsto \sqrt{y \cdot \color{blue}{\left(z + x\right)} + z \cdot x} \cdot 2 \]
      5. distribute-rgt-inN/A

        \[\leadsto \sqrt{\color{blue}{\left(z \cdot y + x \cdot y\right)} + z \cdot x} \cdot 2 \]
      6. lift-*.f64N/A

        \[\leadsto \sqrt{\left(\color{blue}{z \cdot y} + x \cdot y\right) + z \cdot x} \cdot 2 \]
      7. lift-*.f64N/A

        \[\leadsto \sqrt{\left(z \cdot y + \color{blue}{x \cdot y}\right) + z \cdot x} \cdot 2 \]
      8. associate-+r+N/A

        \[\leadsto \sqrt{\color{blue}{z \cdot y + \left(x \cdot y + z \cdot x\right)}} \cdot 2 \]
      9. lift-*.f64N/A

        \[\leadsto \sqrt{z \cdot y + \left(\color{blue}{x \cdot y} + z \cdot x\right)} \cdot 2 \]
      10. lift-*.f64N/A

        \[\leadsto \sqrt{z \cdot y + \left(x \cdot y + \color{blue}{z \cdot x}\right)} \cdot 2 \]
      11. *-commutativeN/A

        \[\leadsto \sqrt{z \cdot y + \left(x \cdot y + \color{blue}{x \cdot z}\right)} \cdot 2 \]
      12. sum-to-mult-revN/A

        \[\leadsto \sqrt{\color{blue}{\left(1 + \frac{x \cdot y + x \cdot z}{z \cdot y}\right) \cdot \left(z \cdot y\right)}} \cdot 2 \]
      13. distribute-lft-outN/A

        \[\leadsto \sqrt{\left(1 + \frac{\color{blue}{x \cdot \left(y + z\right)}}{z \cdot y}\right) \cdot \left(z \cdot y\right)} \cdot 2 \]
      14. +-commutativeN/A

        \[\leadsto \sqrt{\left(1 + \frac{x \cdot \color{blue}{\left(z + y\right)}}{z \cdot y}\right) \cdot \left(z \cdot y\right)} \cdot 2 \]
      15. lift-+.f64N/A

        \[\leadsto \sqrt{\left(1 + \frac{x \cdot \color{blue}{\left(z + y\right)}}{z \cdot y}\right) \cdot \left(z \cdot y\right)} \cdot 2 \]
      16. *-commutativeN/A

        \[\leadsto \sqrt{\left(1 + \frac{\color{blue}{\left(z + y\right) \cdot x}}{z \cdot y}\right) \cdot \left(z \cdot y\right)} \cdot 2 \]
      17. lift-*.f64N/A

        \[\leadsto \sqrt{\left(1 + \frac{\color{blue}{\left(z + y\right) \cdot x}}{z \cdot y}\right) \cdot \left(z \cdot y\right)} \cdot 2 \]
      18. lift-/.f64N/A

        \[\leadsto \sqrt{\left(1 + \color{blue}{\frac{\left(z + y\right) \cdot x}{z \cdot y}}\right) \cdot \left(z \cdot y\right)} \cdot 2 \]
      19. lift-+.f64N/A

        \[\leadsto \sqrt{\color{blue}{\left(1 + \frac{\left(z + y\right) \cdot x}{z \cdot y}\right)} \cdot \left(z \cdot y\right)} \cdot 2 \]
      20. lift-*.f64N/A

        \[\leadsto \sqrt{\left(1 + \frac{\left(z + y\right) \cdot x}{z \cdot y}\right) \cdot \color{blue}{\left(z \cdot y\right)}} \cdot 2 \]
      21. *-commutativeN/A

        \[\leadsto \sqrt{\left(1 + \frac{\left(z + y\right) \cdot x}{z \cdot y}\right) \cdot \color{blue}{\left(y \cdot z\right)}} \cdot 2 \]
      22. associate-*r*N/A

        \[\leadsto \sqrt{\color{blue}{\left(\left(1 + \frac{\left(z + y\right) \cdot x}{z \cdot y}\right) \cdot y\right) \cdot z}} \cdot 2 \]
    5. Applied rewrites39.9%

      \[\leadsto \color{blue}{\left(\sqrt{y + \frac{y + z}{z} \cdot x} \cdot \sqrt{z}\right)} \cdot 2 \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 97.9% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{-293}:\\ \;\;\;\;-2 \cdot \left(t\_0 \cdot \frac{\sqrt{\left(-t\_3\right) - t\_2}}{\sqrt{-t\_0}}\right)\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+35}:\\ \;\;\;\;2 \cdot \sqrt{\left(t\_0 \cdot t\_2 + t\_0 \cdot t\_3\right) + t\_2 \cdot t\_3}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(t\_3 \cdot \sqrt{\frac{t\_0 + t\_2}{t\_3}}\right)\\ \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (fmin (fmin x y) z))
        (t_1 (fmax (fmin x y) z))
        (t_2 (fmin (fmax x y) t_1))
        (t_3 (fmax (fmax x y) t_1)))
   (if (<= t_2 -2e-293)
     (* -2.0 (* t_0 (/ (sqrt (- (- t_3) t_2)) (sqrt (- t_0)))))
     (if (<= t_2 2e+35)
       (* 2.0 (sqrt (+ (+ (* t_0 t_2) (* t_0 t_3)) (* t_2 t_3))))
       (* 2.0 (* t_3 (sqrt (/ (+ t_0 t_2) t_3))))))))
double code(double x, double y, double z) {
	double t_0 = fmin(fmin(x, y), z);
	double t_1 = fmax(fmin(x, y), z);
	double t_2 = fmin(fmax(x, y), t_1);
	double t_3 = fmax(fmax(x, y), t_1);
	double tmp;
	if (t_2 <= -2e-293) {
		tmp = -2.0 * (t_0 * (sqrt((-t_3 - t_2)) / sqrt(-t_0)));
	} else if (t_2 <= 2e+35) {
		tmp = 2.0 * sqrt((((t_0 * t_2) + (t_0 * t_3)) + (t_2 * t_3)));
	} else {
		tmp = 2.0 * (t_3 * sqrt(((t_0 + t_2) / t_3)));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = fmin(fmin(x, y), z)
    t_1 = fmax(fmin(x, y), z)
    t_2 = fmin(fmax(x, y), t_1)
    t_3 = fmax(fmax(x, y), t_1)
    if (t_2 <= (-2d-293)) then
        tmp = (-2.0d0) * (t_0 * (sqrt((-t_3 - t_2)) / sqrt(-t_0)))
    else if (t_2 <= 2d+35) then
        tmp = 2.0d0 * sqrt((((t_0 * t_2) + (t_0 * t_3)) + (t_2 * t_3)))
    else
        tmp = 2.0d0 * (t_3 * sqrt(((t_0 + t_2) / t_3)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = fmin(fmin(x, y), z);
	double t_1 = fmax(fmin(x, y), z);
	double t_2 = fmin(fmax(x, y), t_1);
	double t_3 = fmax(fmax(x, y), t_1);
	double tmp;
	if (t_2 <= -2e-293) {
		tmp = -2.0 * (t_0 * (Math.sqrt((-t_3 - t_2)) / Math.sqrt(-t_0)));
	} else if (t_2 <= 2e+35) {
		tmp = 2.0 * Math.sqrt((((t_0 * t_2) + (t_0 * t_3)) + (t_2 * t_3)));
	} else {
		tmp = 2.0 * (t_3 * Math.sqrt(((t_0 + t_2) / t_3)));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = fmin(fmin(x, y), z)
	t_1 = fmax(fmin(x, y), z)
	t_2 = fmin(fmax(x, y), t_1)
	t_3 = fmax(fmax(x, y), t_1)
	tmp = 0
	if t_2 <= -2e-293:
		tmp = -2.0 * (t_0 * (math.sqrt((-t_3 - t_2)) / math.sqrt(-t_0)))
	elif t_2 <= 2e+35:
		tmp = 2.0 * math.sqrt((((t_0 * t_2) + (t_0 * t_3)) + (t_2 * t_3)))
	else:
		tmp = 2.0 * (t_3 * math.sqrt(((t_0 + t_2) / t_3)))
	return tmp
function code(x, y, z)
	t_0 = fmin(fmin(x, y), z)
	t_1 = fmax(fmin(x, y), z)
	t_2 = fmin(fmax(x, y), t_1)
	t_3 = fmax(fmax(x, y), t_1)
	tmp = 0.0
	if (t_2 <= -2e-293)
		tmp = Float64(-2.0 * Float64(t_0 * Float64(sqrt(Float64(Float64(-t_3) - t_2)) / sqrt(Float64(-t_0)))));
	elseif (t_2 <= 2e+35)
		tmp = Float64(2.0 * sqrt(Float64(Float64(Float64(t_0 * t_2) + Float64(t_0 * t_3)) + Float64(t_2 * t_3))));
	else
		tmp = Float64(2.0 * Float64(t_3 * sqrt(Float64(Float64(t_0 + t_2) / t_3))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = min(min(x, y), z);
	t_1 = max(min(x, y), z);
	t_2 = min(max(x, y), t_1);
	t_3 = max(max(x, y), t_1);
	tmp = 0.0;
	if (t_2 <= -2e-293)
		tmp = -2.0 * (t_0 * (sqrt((-t_3 - t_2)) / sqrt(-t_0)));
	elseif (t_2 <= 2e+35)
		tmp = 2.0 * sqrt((((t_0 * t_2) + (t_0 * t_3)) + (t_2 * t_3)));
	else
		tmp = 2.0 * (t_3 * sqrt(((t_0 + t_2) / t_3)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, If[LessEqual[t$95$2, -2e-293], N[(-2.0 * N[(t$95$0 * N[(N[Sqrt[N[((-t$95$3) - t$95$2), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-t$95$0)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+35], N[(2.0 * N[Sqrt[N[(N[(N[(t$95$0 * t$95$2), $MachinePrecision] + N[(t$95$0 * t$95$3), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 * t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$3 * N[Sqrt[N[(N[(t$95$0 + t$95$2), $MachinePrecision] / t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-293}:\\
\;\;\;\;-2 \cdot \left(t\_0 \cdot \frac{\sqrt{\left(-t\_3\right) - t\_2}}{\sqrt{-t\_0}}\right)\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+35}:\\
\;\;\;\;2 \cdot \sqrt{\left(t\_0 \cdot t\_2 + t\_0 \cdot t\_3\right) + t\_2 \cdot t\_3}\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t\_3 \cdot \sqrt{\frac{t\_0 + t\_2}{t\_3}}\right)\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.0000000000000001e-293

    1. Initial program 70.3%

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
    2. Taylor expanded in x around -inf

      \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -2 \cdot \color{blue}{\left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
      2. lower-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \color{blue}{\sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}}\right) \]
      3. lower-sqrt.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      4. lower-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      5. lower-/.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      6. lower-fma.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
      7. lower-*.f6430.1%

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
    4. Applied rewrites30.1%

      \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right)} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
      2. lift-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
      3. mul-1-negN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\mathsf{neg}\left(\frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}\right)}\right) \]
      4. lift-/.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\mathsf{neg}\left(\frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}\right)}\right) \]
      5. distribute-neg-frac2N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{\mathsf{neg}\left(x\right)}}\right) \]
      6. sqrt-divN/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}}{\color{blue}{\sqrt{\mathsf{neg}\left(x\right)}}}\right) \]
      7. lower-unsound-/.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}}{\color{blue}{\sqrt{\mathsf{neg}\left(x\right)}}}\right) \]
      8. lower-unsound-sqrt.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}}{\sqrt{\color{blue}{\mathsf{neg}\left(x\right)}}}\right) \]
      9. lift-fma.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot y + -1 \cdot z}}{\sqrt{\mathsf{neg}\left(\color{blue}{x}\right)}}\right) \]
      10. +-commutativeN/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot z + -1 \cdot y}}{\sqrt{\mathsf{neg}\left(\color{blue}{x}\right)}}\right) \]
      11. mul-1-negN/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot z + \left(\mathsf{neg}\left(y\right)\right)}}{\sqrt{\mathsf{neg}\left(x\right)}}\right) \]
      12. sub-flip-reverseN/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot z - y}}{\sqrt{\mathsf{neg}\left(\color{blue}{x}\right)}}\right) \]
      13. lower--.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot z - y}}{\sqrt{\mathsf{neg}\left(\color{blue}{x}\right)}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot z - y}}{\sqrt{\mathsf{neg}\left(x\right)}}\right) \]
      15. mul-1-negN/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\left(\mathsf{neg}\left(z\right)\right) - y}}{\sqrt{\mathsf{neg}\left(x\right)}}\right) \]
      16. lower-neg.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\left(-z\right) - y}}{\sqrt{\mathsf{neg}\left(x\right)}}\right) \]
      17. lower-unsound-sqrt.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\left(-z\right) - y}}{\sqrt{\mathsf{neg}\left(x\right)}}\right) \]
      18. lower-neg.f6433.4%

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\left(-z\right) - y}}{\sqrt{-x}}\right) \]
    6. Applied rewrites33.4%

      \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\left(-z\right) - y}}{\color{blue}{\sqrt{-x}}}\right) \]

    if -2.0000000000000001e-293 < y < 1.9999999999999999e35

    1. Initial program 70.3%

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]

    if 1.9999999999999999e35 < y

    1. Initial program 70.3%

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
    2. Taylor expanded in z around inf

      \[\leadsto 2 \cdot \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(z \cdot \color{blue}{\sqrt{\frac{x + y}{z}}}\right) \]
      2. lower-sqrt.f64N/A

        \[\leadsto 2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \]
      3. lower-/.f64N/A

        \[\leadsto 2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \]
      4. lower-+.f6429.8%

        \[\leadsto 2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \]
    4. Applied rewrites29.8%

      \[\leadsto 2 \cdot \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 97.9% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{-293}:\\ \;\;\;\;-2 \cdot \left(t\_0 \cdot \frac{\sqrt{\left(-t\_3\right) - t\_2}}{\sqrt{-t\_0}}\right)\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+35}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(t\_3 + t\_0, t\_2, t\_3 \cdot t\_0\right)} \cdot 2\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(t\_3 \cdot \sqrt{\frac{t\_0 + t\_2}{t\_3}}\right)\\ \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (fmin (fmin x y) z))
        (t_1 (fmax (fmin x y) z))
        (t_2 (fmin (fmax x y) t_1))
        (t_3 (fmax (fmax x y) t_1)))
   (if (<= t_2 -2e-293)
     (* -2.0 (* t_0 (/ (sqrt (- (- t_3) t_2)) (sqrt (- t_0)))))
     (if (<= t_2 2e+35)
       (* (sqrt (fma (+ t_3 t_0) t_2 (* t_3 t_0))) 2.0)
       (* 2.0 (* t_3 (sqrt (/ (+ t_0 t_2) t_3))))))))
double code(double x, double y, double z) {
	double t_0 = fmin(fmin(x, y), z);
	double t_1 = fmax(fmin(x, y), z);
	double t_2 = fmin(fmax(x, y), t_1);
	double t_3 = fmax(fmax(x, y), t_1);
	double tmp;
	if (t_2 <= -2e-293) {
		tmp = -2.0 * (t_0 * (sqrt((-t_3 - t_2)) / sqrt(-t_0)));
	} else if (t_2 <= 2e+35) {
		tmp = sqrt(fma((t_3 + t_0), t_2, (t_3 * t_0))) * 2.0;
	} else {
		tmp = 2.0 * (t_3 * sqrt(((t_0 + t_2) / t_3)));
	}
	return tmp;
}
function code(x, y, z)
	t_0 = fmin(fmin(x, y), z)
	t_1 = fmax(fmin(x, y), z)
	t_2 = fmin(fmax(x, y), t_1)
	t_3 = fmax(fmax(x, y), t_1)
	tmp = 0.0
	if (t_2 <= -2e-293)
		tmp = Float64(-2.0 * Float64(t_0 * Float64(sqrt(Float64(Float64(-t_3) - t_2)) / sqrt(Float64(-t_0)))));
	elseif (t_2 <= 2e+35)
		tmp = Float64(sqrt(fma(Float64(t_3 + t_0), t_2, Float64(t_3 * t_0))) * 2.0);
	else
		tmp = Float64(2.0 * Float64(t_3 * sqrt(Float64(Float64(t_0 + t_2) / t_3))));
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, If[LessEqual[t$95$2, -2e-293], N[(-2.0 * N[(t$95$0 * N[(N[Sqrt[N[((-t$95$3) - t$95$2), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-t$95$0)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+35], N[(N[Sqrt[N[(N[(t$95$3 + t$95$0), $MachinePrecision] * t$95$2 + N[(t$95$3 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision], N[(2.0 * N[(t$95$3 * N[Sqrt[N[(N[(t$95$0 + t$95$2), $MachinePrecision] / t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-293}:\\
\;\;\;\;-2 \cdot \left(t\_0 \cdot \frac{\sqrt{\left(-t\_3\right) - t\_2}}{\sqrt{-t\_0}}\right)\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+35}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(t\_3 + t\_0, t\_2, t\_3 \cdot t\_0\right)} \cdot 2\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t\_3 \cdot \sqrt{\frac{t\_0 + t\_2}{t\_3}}\right)\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.0000000000000001e-293

    1. Initial program 70.3%

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
    2. Taylor expanded in x around -inf

      \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -2 \cdot \color{blue}{\left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
      2. lower-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \color{blue}{\sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}}\right) \]
      3. lower-sqrt.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      4. lower-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      5. lower-/.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      6. lower-fma.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
      7. lower-*.f6430.1%

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
    4. Applied rewrites30.1%

      \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right)} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
      2. lift-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
      3. mul-1-negN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\mathsf{neg}\left(\frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}\right)}\right) \]
      4. lift-/.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\mathsf{neg}\left(\frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}\right)}\right) \]
      5. distribute-neg-frac2N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{\mathsf{neg}\left(x\right)}}\right) \]
      6. sqrt-divN/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}}{\color{blue}{\sqrt{\mathsf{neg}\left(x\right)}}}\right) \]
      7. lower-unsound-/.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}}{\color{blue}{\sqrt{\mathsf{neg}\left(x\right)}}}\right) \]
      8. lower-unsound-sqrt.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}}{\sqrt{\color{blue}{\mathsf{neg}\left(x\right)}}}\right) \]
      9. lift-fma.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot y + -1 \cdot z}}{\sqrt{\mathsf{neg}\left(\color{blue}{x}\right)}}\right) \]
      10. +-commutativeN/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot z + -1 \cdot y}}{\sqrt{\mathsf{neg}\left(\color{blue}{x}\right)}}\right) \]
      11. mul-1-negN/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot z + \left(\mathsf{neg}\left(y\right)\right)}}{\sqrt{\mathsf{neg}\left(x\right)}}\right) \]
      12. sub-flip-reverseN/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot z - y}}{\sqrt{\mathsf{neg}\left(\color{blue}{x}\right)}}\right) \]
      13. lower--.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot z - y}}{\sqrt{\mathsf{neg}\left(\color{blue}{x}\right)}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{-1 \cdot z - y}}{\sqrt{\mathsf{neg}\left(x\right)}}\right) \]
      15. mul-1-negN/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\left(\mathsf{neg}\left(z\right)\right) - y}}{\sqrt{\mathsf{neg}\left(x\right)}}\right) \]
      16. lower-neg.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\left(-z\right) - y}}{\sqrt{\mathsf{neg}\left(x\right)}}\right) \]
      17. lower-unsound-sqrt.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\left(-z\right) - y}}{\sqrt{\mathsf{neg}\left(x\right)}}\right) \]
      18. lower-neg.f6433.4%

        \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\left(-z\right) - y}}{\sqrt{-x}}\right) \]
    6. Applied rewrites33.4%

      \[\leadsto -2 \cdot \left(x \cdot \frac{\sqrt{\left(-z\right) - y}}{\color{blue}{\sqrt{-x}}}\right) \]

    if -2.0000000000000001e-293 < y < 1.9999999999999999e35

    1. Initial program 70.3%

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
      3. lower-*.f6470.3%

        \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
    3. Applied rewrites70.4%

      \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(z + x, y, z \cdot x\right)} \cdot 2} \]

    if 1.9999999999999999e35 < y

    1. Initial program 70.3%

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
    2. Taylor expanded in z around inf

      \[\leadsto 2 \cdot \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(z \cdot \color{blue}{\sqrt{\frac{x + y}{z}}}\right) \]
      2. lower-sqrt.f64N/A

        \[\leadsto 2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \]
      3. lower-/.f64N/A

        \[\leadsto 2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \]
      4. lower-+.f6429.8%

        \[\leadsto 2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \]
    4. Applied rewrites29.8%

      \[\leadsto 2 \cdot \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 96.4% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_2 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ t_3 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ \mathbf{if}\;t\_3 \leq -1.22 \cdot 10^{+45}:\\ \;\;\;\;-2 \cdot \left(t\_0 \cdot \sqrt{\left(t\_3 + t\_2\right) \cdot \frac{1}{t\_0}}\right)\\ \mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+35}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(t\_2 + t\_0, t\_3, t\_2 \cdot t\_0\right)} \cdot 2\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(t\_2 \cdot \sqrt{\frac{t\_0 + t\_3}{t\_2}}\right)\\ \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (fmin (fmin x y) z))
        (t_1 (fmax (fmin x y) z))
        (t_2 (fmax (fmax x y) t_1))
        (t_3 (fmin (fmax x y) t_1)))
   (if (<= t_3 -1.22e+45)
     (* -2.0 (* t_0 (sqrt (* (+ t_3 t_2) (/ 1.0 t_0)))))
     (if (<= t_3 2e+35)
       (* (sqrt (fma (+ t_2 t_0) t_3 (* t_2 t_0))) 2.0)
       (* 2.0 (* t_2 (sqrt (/ (+ t_0 t_3) t_2))))))))
double code(double x, double y, double z) {
	double t_0 = fmin(fmin(x, y), z);
	double t_1 = fmax(fmin(x, y), z);
	double t_2 = fmax(fmax(x, y), t_1);
	double t_3 = fmin(fmax(x, y), t_1);
	double tmp;
	if (t_3 <= -1.22e+45) {
		tmp = -2.0 * (t_0 * sqrt(((t_3 + t_2) * (1.0 / t_0))));
	} else if (t_3 <= 2e+35) {
		tmp = sqrt(fma((t_2 + t_0), t_3, (t_2 * t_0))) * 2.0;
	} else {
		tmp = 2.0 * (t_2 * sqrt(((t_0 + t_3) / t_2)));
	}
	return tmp;
}
function code(x, y, z)
	t_0 = fmin(fmin(x, y), z)
	t_1 = fmax(fmin(x, y), z)
	t_2 = fmax(fmax(x, y), t_1)
	t_3 = fmin(fmax(x, y), t_1)
	tmp = 0.0
	if (t_3 <= -1.22e+45)
		tmp = Float64(-2.0 * Float64(t_0 * sqrt(Float64(Float64(t_3 + t_2) * Float64(1.0 / t_0)))));
	elseif (t_3 <= 2e+35)
		tmp = Float64(sqrt(fma(Float64(t_2 + t_0), t_3, Float64(t_2 * t_0))) * 2.0);
	else
		tmp = Float64(2.0 * Float64(t_2 * sqrt(Float64(Float64(t_0 + t_3) / t_2))));
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Min[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, If[LessEqual[t$95$3, -1.22e+45], N[(-2.0 * N[(t$95$0 * N[Sqrt[N[(N[(t$95$3 + t$95$2), $MachinePrecision] * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e+35], N[(N[Sqrt[N[(N[(t$95$2 + t$95$0), $MachinePrecision] * t$95$3 + N[(t$95$2 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision], N[(2.0 * N[(t$95$2 * N[Sqrt[N[(N[(t$95$0 + t$95$3), $MachinePrecision] / t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
t_3 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
\mathbf{if}\;t\_3 \leq -1.22 \cdot 10^{+45}:\\
\;\;\;\;-2 \cdot \left(t\_0 \cdot \sqrt{\left(t\_3 + t\_2\right) \cdot \frac{1}{t\_0}}\right)\\

\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+35}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(t\_2 + t\_0, t\_3, t\_2 \cdot t\_0\right)} \cdot 2\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t\_2 \cdot \sqrt{\frac{t\_0 + t\_3}{t\_2}}\right)\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.22e45

    1. Initial program 70.3%

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
    2. Taylor expanded in x around -inf

      \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -2 \cdot \color{blue}{\left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
      2. lower-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \color{blue}{\sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}}\right) \]
      3. lower-sqrt.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      4. lower-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      5. lower-/.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      6. lower-fma.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
      7. lower-*.f6430.1%

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
    4. Applied rewrites30.1%

      \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right)} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
      2. *-commutativeN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x} \cdot -1}\right) \]
      3. lift-/.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x} \cdot -1}\right) \]
      4. associate-*l/N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right) \cdot -1}{x}}\right) \]
      5. *-commutativeN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{-1 \cdot \mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
      6. mul-1-negN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{\mathsf{neg}\left(\mathsf{fma}\left(-1, y, -1 \cdot z\right)\right)}{x}}\right) \]
      7. lift-fma.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{\mathsf{neg}\left(\left(-1 \cdot y + -1 \cdot z\right)\right)}{x}}\right) \]
      8. distribute-neg-inN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{\left(\mathsf{neg}\left(-1 \cdot y\right)\right) + \left(\mathsf{neg}\left(-1 \cdot z\right)\right)}{x}}\right) \]
      9. sub-flip-reverseN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{\left(\mathsf{neg}\left(-1 \cdot y\right)\right) - -1 \cdot z}{x}}\right) \]
      10. sub-negateN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{\mathsf{neg}\left(\left(-1 \cdot z - \left(\mathsf{neg}\left(-1 \cdot y\right)\right)\right)\right)}{x}}\right) \]
      11. add-flipN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{\mathsf{neg}\left(\left(-1 \cdot z + -1 \cdot y\right)\right)}{x}}\right) \]
      12. +-commutativeN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{\mathsf{neg}\left(\left(-1 \cdot y + -1 \cdot z\right)\right)}{x}}\right) \]
      13. lift-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{\mathsf{neg}\left(\left(-1 \cdot y + -1 \cdot z\right)\right)}{x}}\right) \]
      14. mul-1-negN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{\mathsf{neg}\left(\left(-1 \cdot y + \left(\mathsf{neg}\left(z\right)\right)\right)\right)}{x}}\right) \]
      15. sub-flip-reverseN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{\mathsf{neg}\left(\left(-1 \cdot y - z\right)\right)}{x}}\right) \]
      16. sub-negate-revN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{z - -1 \cdot y}{x}}\right) \]
      17. mul-1-negN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{z - \left(\mathsf{neg}\left(y\right)\right)}{x}}\right) \]
      18. add-flipN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{z + y}{x}}\right) \]
      19. lift-+.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{z + y}{x}}\right) \]
      20. mult-flip-revN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\left(z + y\right) \cdot \frac{1}{x}}\right) \]
      21. lower-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\left(z + y\right) \cdot \frac{1}{x}}\right) \]
      22. lift-+.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\left(z + y\right) \cdot \frac{1}{x}}\right) \]
      23. +-commutativeN/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\left(y + z\right) \cdot \frac{1}{x}}\right) \]
      24. lower-+.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\left(y + z\right) \cdot \frac{1}{x}}\right) \]
      25. lower-/.f6430.1%

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\left(y + z\right) \cdot \frac{1}{x}}\right) \]
    6. Applied rewrites30.1%

      \[\leadsto -2 \cdot \left(x \cdot \sqrt{\left(y + z\right) \cdot \frac{1}{x}}\right) \]

    if -1.22e45 < y < 1.9999999999999999e35

    1. Initial program 70.3%

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
      3. lower-*.f6470.3%

        \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
    3. Applied rewrites70.4%

      \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(z + x, y, z \cdot x\right)} \cdot 2} \]

    if 1.9999999999999999e35 < y

    1. Initial program 70.3%

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
    2. Taylor expanded in z around inf

      \[\leadsto 2 \cdot \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(z \cdot \color{blue}{\sqrt{\frac{x + y}{z}}}\right) \]
      2. lower-sqrt.f64N/A

        \[\leadsto 2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \]
      3. lower-/.f64N/A

        \[\leadsto 2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \]
      4. lower-+.f6429.8%

        \[\leadsto 2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \]
    4. Applied rewrites29.8%

      \[\leadsto 2 \cdot \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 96.4% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_2 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ t_3 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ \mathbf{if}\;t\_3 \leq -1.22 \cdot 10^{+45}:\\ \;\;\;\;\left(\sqrt{\frac{t\_3 + t\_2}{t\_0}} \cdot t\_0\right) \cdot -2\\ \mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+35}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(t\_2 + t\_0, t\_3, t\_2 \cdot t\_0\right)} \cdot 2\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(t\_2 \cdot \sqrt{\frac{t\_0 + t\_3}{t\_2}}\right)\\ \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (fmin (fmin x y) z))
        (t_1 (fmax (fmin x y) z))
        (t_2 (fmax (fmax x y) t_1))
        (t_3 (fmin (fmax x y) t_1)))
   (if (<= t_3 -1.22e+45)
     (* (* (sqrt (/ (+ t_3 t_2) t_0)) t_0) -2.0)
     (if (<= t_3 2e+35)
       (* (sqrt (fma (+ t_2 t_0) t_3 (* t_2 t_0))) 2.0)
       (* 2.0 (* t_2 (sqrt (/ (+ t_0 t_3) t_2))))))))
double code(double x, double y, double z) {
	double t_0 = fmin(fmin(x, y), z);
	double t_1 = fmax(fmin(x, y), z);
	double t_2 = fmax(fmax(x, y), t_1);
	double t_3 = fmin(fmax(x, y), t_1);
	double tmp;
	if (t_3 <= -1.22e+45) {
		tmp = (sqrt(((t_3 + t_2) / t_0)) * t_0) * -2.0;
	} else if (t_3 <= 2e+35) {
		tmp = sqrt(fma((t_2 + t_0), t_3, (t_2 * t_0))) * 2.0;
	} else {
		tmp = 2.0 * (t_2 * sqrt(((t_0 + t_3) / t_2)));
	}
	return tmp;
}
function code(x, y, z)
	t_0 = fmin(fmin(x, y), z)
	t_1 = fmax(fmin(x, y), z)
	t_2 = fmax(fmax(x, y), t_1)
	t_3 = fmin(fmax(x, y), t_1)
	tmp = 0.0
	if (t_3 <= -1.22e+45)
		tmp = Float64(Float64(sqrt(Float64(Float64(t_3 + t_2) / t_0)) * t_0) * -2.0);
	elseif (t_3 <= 2e+35)
		tmp = Float64(sqrt(fma(Float64(t_2 + t_0), t_3, Float64(t_2 * t_0))) * 2.0);
	else
		tmp = Float64(2.0 * Float64(t_2 * sqrt(Float64(Float64(t_0 + t_3) / t_2))));
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Min[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, If[LessEqual[t$95$3, -1.22e+45], N[(N[(N[Sqrt[N[(N[(t$95$3 + t$95$2), $MachinePrecision] / t$95$0), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * -2.0), $MachinePrecision], If[LessEqual[t$95$3, 2e+35], N[(N[Sqrt[N[(N[(t$95$2 + t$95$0), $MachinePrecision] * t$95$3 + N[(t$95$2 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision], N[(2.0 * N[(t$95$2 * N[Sqrt[N[(N[(t$95$0 + t$95$3), $MachinePrecision] / t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
t_3 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
\mathbf{if}\;t\_3 \leq -1.22 \cdot 10^{+45}:\\
\;\;\;\;\left(\sqrt{\frac{t\_3 + t\_2}{t\_0}} \cdot t\_0\right) \cdot -2\\

\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+35}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(t\_2 + t\_0, t\_3, t\_2 \cdot t\_0\right)} \cdot 2\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t\_2 \cdot \sqrt{\frac{t\_0 + t\_3}{t\_2}}\right)\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.22e45

    1. Initial program 70.3%

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
    2. Taylor expanded in x around -inf

      \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -2 \cdot \color{blue}{\left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
      2. lower-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \color{blue}{\sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}}\right) \]
      3. lower-sqrt.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      4. lower-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      5. lower-/.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      6. lower-fma.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
      7. lower-*.f6430.1%

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
    4. Applied rewrites30.1%

      \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right)} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto -2 \cdot \color{blue}{\left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right)} \]
      2. *-commutativeN/A

        \[\leadsto \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \cdot \color{blue}{-2} \]
      3. lower-*.f6430.1%

        \[\leadsto \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \cdot \color{blue}{-2} \]
    6. Applied rewrites30.1%

      \[\leadsto \left(\sqrt{\frac{y + z}{x}} \cdot x\right) \cdot \color{blue}{-2} \]

    if -1.22e45 < y < 1.9999999999999999e35

    1. Initial program 70.3%

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
      3. lower-*.f6470.3%

        \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
    3. Applied rewrites70.4%

      \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(z + x, y, z \cdot x\right)} \cdot 2} \]

    if 1.9999999999999999e35 < y

    1. Initial program 70.3%

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
    2. Taylor expanded in z around inf

      \[\leadsto 2 \cdot \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(z \cdot \color{blue}{\sqrt{\frac{x + y}{z}}}\right) \]
      2. lower-sqrt.f64N/A

        \[\leadsto 2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \]
      3. lower-/.f64N/A

        \[\leadsto 2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \]
      4. lower-+.f6429.8%

        \[\leadsto 2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \]
    4. Applied rewrites29.8%

      \[\leadsto 2 \cdot \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 95.7% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ \mathbf{if}\;t\_2 \leq -7.6 \cdot 10^{+45}:\\ \;\;\;\;-2 \cdot \left(t\_0 \cdot \sqrt{\frac{t\_2}{t\_0}}\right)\\ \mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-293}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(t\_3, t\_0, t\_2 \cdot t\_0\right)} \cdot 2\\ \mathbf{elif}\;t\_2 \leq 4.6 \cdot 10^{+35}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(t\_3, t\_2, t\_3 \cdot t\_0\right)} \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\left(t\_3 \cdot \sqrt{\frac{t\_2}{t\_3}}\right) \cdot 2\\ \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (fmin (fmin x y) z))
        (t_1 (fmax (fmin x y) z))
        (t_2 (fmin (fmax x y) t_1))
        (t_3 (fmax (fmax x y) t_1)))
   (if (<= t_2 -7.6e+45)
     (* -2.0 (* t_0 (sqrt (/ t_2 t_0))))
     (if (<= t_2 -2e-293)
       (* (sqrt (fma t_3 t_0 (* t_2 t_0))) 2.0)
       (if (<= t_2 4.6e+35)
         (* (sqrt (fma t_3 t_2 (* t_3 t_0))) 2.0)
         (* (* t_3 (sqrt (/ t_2 t_3))) 2.0))))))
double code(double x, double y, double z) {
	double t_0 = fmin(fmin(x, y), z);
	double t_1 = fmax(fmin(x, y), z);
	double t_2 = fmin(fmax(x, y), t_1);
	double t_3 = fmax(fmax(x, y), t_1);
	double tmp;
	if (t_2 <= -7.6e+45) {
		tmp = -2.0 * (t_0 * sqrt((t_2 / t_0)));
	} else if (t_2 <= -2e-293) {
		tmp = sqrt(fma(t_3, t_0, (t_2 * t_0))) * 2.0;
	} else if (t_2 <= 4.6e+35) {
		tmp = sqrt(fma(t_3, t_2, (t_3 * t_0))) * 2.0;
	} else {
		tmp = (t_3 * sqrt((t_2 / t_3))) * 2.0;
	}
	return tmp;
}
function code(x, y, z)
	t_0 = fmin(fmin(x, y), z)
	t_1 = fmax(fmin(x, y), z)
	t_2 = fmin(fmax(x, y), t_1)
	t_3 = fmax(fmax(x, y), t_1)
	tmp = 0.0
	if (t_2 <= -7.6e+45)
		tmp = Float64(-2.0 * Float64(t_0 * sqrt(Float64(t_2 / t_0))));
	elseif (t_2 <= -2e-293)
		tmp = Float64(sqrt(fma(t_3, t_0, Float64(t_2 * t_0))) * 2.0);
	elseif (t_2 <= 4.6e+35)
		tmp = Float64(sqrt(fma(t_3, t_2, Float64(t_3 * t_0))) * 2.0);
	else
		tmp = Float64(Float64(t_3 * sqrt(Float64(t_2 / t_3))) * 2.0);
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, If[LessEqual[t$95$2, -7.6e+45], N[(-2.0 * N[(t$95$0 * N[Sqrt[N[(t$95$2 / t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -2e-293], N[(N[Sqrt[N[(t$95$3 * t$95$0 + N[(t$95$2 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[t$95$2, 4.6e+35], N[(N[Sqrt[N[(t$95$3 * t$95$2 + N[(t$95$3 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision], N[(N[(t$95$3 * N[Sqrt[N[(t$95$2 / t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
\mathbf{if}\;t\_2 \leq -7.6 \cdot 10^{+45}:\\
\;\;\;\;-2 \cdot \left(t\_0 \cdot \sqrt{\frac{t\_2}{t\_0}}\right)\\

\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-293}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(t\_3, t\_0, t\_2 \cdot t\_0\right)} \cdot 2\\

\mathbf{elif}\;t\_2 \leq 4.6 \cdot 10^{+35}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(t\_3, t\_2, t\_3 \cdot t\_0\right)} \cdot 2\\

\mathbf{else}:\\
\;\;\;\;\left(t\_3 \cdot \sqrt{\frac{t\_2}{t\_3}}\right) \cdot 2\\


\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -7.6000000000000004e45

    1. Initial program 70.3%

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
    2. Taylor expanded in x around -inf

      \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -2 \cdot \color{blue}{\left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
      2. lower-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \color{blue}{\sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}}\right) \]
      3. lower-sqrt.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      4. lower-*.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      5. lower-/.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
      6. lower-fma.f64N/A

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
      7. lower-*.f6430.1%

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
    4. Applied rewrites30.1%

      \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right)} \]
    5. Taylor expanded in y around inf

      \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{y}{x}}\right) \]
    6. Step-by-step derivation
      1. lower-/.f6415.7%

        \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{y}{x}}\right) \]
    7. Applied rewrites15.7%

      \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{y}{x}}\right) \]

    if -7.6000000000000004e45 < y < -2.0000000000000001e-293

    1. Initial program 70.3%

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
      3. lower-*.f6470.3%

        \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
    3. Applied rewrites70.4%

      \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(z + x, y, z \cdot x\right)} \cdot 2} \]
    4. Taylor expanded in y around inf

      \[\leadsto \sqrt{\color{blue}{y \cdot \left(x + z\right)}} \cdot 2 \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \sqrt{y \cdot \color{blue}{\left(x + z\right)}} \cdot 2 \]
      2. lower-+.f6447.3%

        \[\leadsto \sqrt{y \cdot \left(x + \color{blue}{z}\right)} \cdot 2 \]
    6. Applied rewrites47.3%

      \[\leadsto \sqrt{\color{blue}{y \cdot \left(x + z\right)}} \cdot 2 \]
    7. Taylor expanded in x around inf

      \[\leadsto \sqrt{\color{blue}{x \cdot \left(y + z\right)}} \cdot 2 \]
    8. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \sqrt{x \cdot \color{blue}{\left(y + z\right)}} \cdot 2 \]
      2. lower-+.f6447.7%

        \[\leadsto \sqrt{x \cdot \left(y + \color{blue}{z}\right)} \cdot 2 \]
    9. Applied rewrites47.7%

      \[\leadsto \sqrt{\color{blue}{x \cdot \left(y + z\right)}} \cdot 2 \]
    10. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \sqrt{x \cdot \color{blue}{\left(y + z\right)}} \cdot 2 \]
      2. lift-+.f64N/A

        \[\leadsto \sqrt{x \cdot \left(y + \color{blue}{z}\right)} \cdot 2 \]
      3. distribute-lft-outN/A

        \[\leadsto \sqrt{x \cdot y + \color{blue}{x \cdot z}} \cdot 2 \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{x \cdot y + z \cdot \color{blue}{x}} \cdot 2 \]
      5. +-commutativeN/A

        \[\leadsto \sqrt{z \cdot x + \color{blue}{x \cdot y}} \cdot 2 \]
      6. lower-fma.f64N/A

        \[\leadsto \sqrt{\mathsf{fma}\left(z, \color{blue}{x}, x \cdot y\right)} \cdot 2 \]
      7. *-commutativeN/A

        \[\leadsto \sqrt{\mathsf{fma}\left(z, x, y \cdot x\right)} \cdot 2 \]
      8. *-lft-identityN/A

        \[\leadsto \sqrt{\mathsf{fma}\left(z, x, \left(1 \cdot y\right) \cdot x\right)} \cdot 2 \]
      9. metadata-evalN/A

        \[\leadsto \sqrt{\mathsf{fma}\left(z, x, \left(\left(\mathsf{neg}\left(-1\right)\right) \cdot y\right) \cdot x\right)} \cdot 2 \]
      10. distribute-lft-neg-outN/A

        \[\leadsto \sqrt{\mathsf{fma}\left(z, x, \left(\mathsf{neg}\left(-1 \cdot y\right)\right) \cdot x\right)} \cdot 2 \]
      11. lower-*.f64N/A

        \[\leadsto \sqrt{\mathsf{fma}\left(z, x, \left(\mathsf{neg}\left(-1 \cdot y\right)\right) \cdot x\right)} \cdot 2 \]
      12. distribute-lft-neg-outN/A

        \[\leadsto \sqrt{\mathsf{fma}\left(z, x, \left(\left(\mathsf{neg}\left(-1\right)\right) \cdot y\right) \cdot x\right)} \cdot 2 \]
      13. metadata-evalN/A

        \[\leadsto \sqrt{\mathsf{fma}\left(z, x, \left(1 \cdot y\right) \cdot x\right)} \cdot 2 \]
      14. *-lft-identity47.7%

        \[\leadsto \sqrt{\mathsf{fma}\left(z, x, y \cdot x\right)} \cdot 2 \]
    11. Applied rewrites47.7%

      \[\leadsto \sqrt{\mathsf{fma}\left(z, \color{blue}{x}, y \cdot x\right)} \cdot 2 \]

    if -2.0000000000000001e-293 < y < 4.5999999999999996e35

    1. Initial program 70.3%

      \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
      3. lower-*.f6470.3%

        \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
    3. Applied rewrites70.4%

      \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(z + x, y, z \cdot x\right)} \cdot 2} \]
    4. Taylor expanded in x around 0

      \[\leadsto \sqrt{\mathsf{fma}\left(\color{blue}{z}, y, z \cdot x\right)} \cdot 2 \]
    5. Step-by-step derivation
      1. Applied rewrites47.2%

        \[\leadsto \sqrt{\mathsf{fma}\left(\color{blue}{z}, y, z \cdot x\right)} \cdot 2 \]

      if 4.5999999999999996e35 < y

      1. Initial program 70.3%

        \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
      2. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \color{blue}{2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}} \]
        2. *-commutativeN/A

          \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
        3. lower-*.f6470.3%

          \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
      3. Applied rewrites70.4%

        \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(z + x, y, z \cdot x\right)} \cdot 2} \]
      4. Taylor expanded in z around inf

        \[\leadsto \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \cdot 2 \]
      5. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \left(z \cdot \color{blue}{\sqrt{\frac{x + y}{z}}}\right) \cdot 2 \]
        2. lower-sqrt.f64N/A

          \[\leadsto \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \cdot 2 \]
        3. lower-/.f64N/A

          \[\leadsto \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \cdot 2 \]
        4. lower-+.f6429.8%

          \[\leadsto \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \cdot 2 \]
      6. Applied rewrites29.8%

        \[\leadsto \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \cdot 2 \]
      7. Taylor expanded in x around 0

        \[\leadsto \left(z \cdot \sqrt{\frac{y}{z}}\right) \cdot 2 \]
      8. Step-by-step derivation
        1. Applied rewrites15.8%

          \[\leadsto \left(z \cdot \sqrt{\frac{y}{z}}\right) \cdot 2 \]
      9. Recombined 4 regimes into one program.
      10. Add Preprocessing

      Alternative 7: 95.7% accurate, 0.2× speedup?

      \[\begin{array}{l} t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ \mathbf{if}\;t\_2 \leq -7.6 \cdot 10^{+45}:\\ \;\;\;\;-2 \cdot \left(t\_0 \cdot \sqrt{\frac{t\_2}{t\_0}}\right)\\ \mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-293}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(t\_3, t\_0, t\_2 \cdot t\_0\right)} \cdot 2\\ \mathbf{elif}\;t\_2 \leq 4.6 \cdot 10^{+35}:\\ \;\;\;\;2 \cdot \sqrt{t\_3 \cdot \left(t\_0 + t\_2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(t\_3 \cdot \sqrt{\frac{t\_2}{t\_3}}\right) \cdot 2\\ \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (fmin (fmin x y) z))
              (t_1 (fmax (fmin x y) z))
              (t_2 (fmin (fmax x y) t_1))
              (t_3 (fmax (fmax x y) t_1)))
         (if (<= t_2 -7.6e+45)
           (* -2.0 (* t_0 (sqrt (/ t_2 t_0))))
           (if (<= t_2 -2e-293)
             (* (sqrt (fma t_3 t_0 (* t_2 t_0))) 2.0)
             (if (<= t_2 4.6e+35)
               (* 2.0 (sqrt (* t_3 (+ t_0 t_2))))
               (* (* t_3 (sqrt (/ t_2 t_3))) 2.0))))))
      double code(double x, double y, double z) {
      	double t_0 = fmin(fmin(x, y), z);
      	double t_1 = fmax(fmin(x, y), z);
      	double t_2 = fmin(fmax(x, y), t_1);
      	double t_3 = fmax(fmax(x, y), t_1);
      	double tmp;
      	if (t_2 <= -7.6e+45) {
      		tmp = -2.0 * (t_0 * sqrt((t_2 / t_0)));
      	} else if (t_2 <= -2e-293) {
      		tmp = sqrt(fma(t_3, t_0, (t_2 * t_0))) * 2.0;
      	} else if (t_2 <= 4.6e+35) {
      		tmp = 2.0 * sqrt((t_3 * (t_0 + t_2)));
      	} else {
      		tmp = (t_3 * sqrt((t_2 / t_3))) * 2.0;
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	t_0 = fmin(fmin(x, y), z)
      	t_1 = fmax(fmin(x, y), z)
      	t_2 = fmin(fmax(x, y), t_1)
      	t_3 = fmax(fmax(x, y), t_1)
      	tmp = 0.0
      	if (t_2 <= -7.6e+45)
      		tmp = Float64(-2.0 * Float64(t_0 * sqrt(Float64(t_2 / t_0))));
      	elseif (t_2 <= -2e-293)
      		tmp = Float64(sqrt(fma(t_3, t_0, Float64(t_2 * t_0))) * 2.0);
      	elseif (t_2 <= 4.6e+35)
      		tmp = Float64(2.0 * sqrt(Float64(t_3 * Float64(t_0 + t_2))));
      	else
      		tmp = Float64(Float64(t_3 * sqrt(Float64(t_2 / t_3))) * 2.0);
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, If[LessEqual[t$95$2, -7.6e+45], N[(-2.0 * N[(t$95$0 * N[Sqrt[N[(t$95$2 / t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -2e-293], N[(N[Sqrt[N[(t$95$3 * t$95$0 + N[(t$95$2 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[t$95$2, 4.6e+35], N[(2.0 * N[Sqrt[N[(t$95$3 * N[(t$95$0 + t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$3 * N[Sqrt[N[(t$95$2 / t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]]]]]]]
      
      \begin{array}{l}
      t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
      t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
      t_2 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
      t_3 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
      \mathbf{if}\;t\_2 \leq -7.6 \cdot 10^{+45}:\\
      \;\;\;\;-2 \cdot \left(t\_0 \cdot \sqrt{\frac{t\_2}{t\_0}}\right)\\
      
      \mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-293}:\\
      \;\;\;\;\sqrt{\mathsf{fma}\left(t\_3, t\_0, t\_2 \cdot t\_0\right)} \cdot 2\\
      
      \mathbf{elif}\;t\_2 \leq 4.6 \cdot 10^{+35}:\\
      \;\;\;\;2 \cdot \sqrt{t\_3 \cdot \left(t\_0 + t\_2\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(t\_3 \cdot \sqrt{\frac{t\_2}{t\_3}}\right) \cdot 2\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if y < -7.6000000000000004e45

        1. Initial program 70.3%

          \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
        2. Taylor expanded in x around -inf

          \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
        3. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto -2 \cdot \color{blue}{\left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
          2. lower-*.f64N/A

            \[\leadsto -2 \cdot \left(x \cdot \color{blue}{\sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}}\right) \]
          3. lower-sqrt.f64N/A

            \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
          4. lower-*.f64N/A

            \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
          5. lower-/.f64N/A

            \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
          6. lower-fma.f64N/A

            \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
          7. lower-*.f6430.1%

            \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
        4. Applied rewrites30.1%

          \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right)} \]
        5. Taylor expanded in y around inf

          \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{y}{x}}\right) \]
        6. Step-by-step derivation
          1. lower-/.f6415.7%

            \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{y}{x}}\right) \]
        7. Applied rewrites15.7%

          \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{y}{x}}\right) \]

        if -7.6000000000000004e45 < y < -2.0000000000000001e-293

        1. Initial program 70.3%

          \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
        2. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}} \]
          2. *-commutativeN/A

            \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
          3. lower-*.f6470.3%

            \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
        3. Applied rewrites70.4%

          \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(z + x, y, z \cdot x\right)} \cdot 2} \]
        4. Taylor expanded in y around inf

          \[\leadsto \sqrt{\color{blue}{y \cdot \left(x + z\right)}} \cdot 2 \]
        5. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto \sqrt{y \cdot \color{blue}{\left(x + z\right)}} \cdot 2 \]
          2. lower-+.f6447.3%

            \[\leadsto \sqrt{y \cdot \left(x + \color{blue}{z}\right)} \cdot 2 \]
        6. Applied rewrites47.3%

          \[\leadsto \sqrt{\color{blue}{y \cdot \left(x + z\right)}} \cdot 2 \]
        7. Taylor expanded in x around inf

          \[\leadsto \sqrt{\color{blue}{x \cdot \left(y + z\right)}} \cdot 2 \]
        8. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto \sqrt{x \cdot \color{blue}{\left(y + z\right)}} \cdot 2 \]
          2. lower-+.f6447.7%

            \[\leadsto \sqrt{x \cdot \left(y + \color{blue}{z}\right)} \cdot 2 \]
        9. Applied rewrites47.7%

          \[\leadsto \sqrt{\color{blue}{x \cdot \left(y + z\right)}} \cdot 2 \]
        10. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \sqrt{x \cdot \color{blue}{\left(y + z\right)}} \cdot 2 \]
          2. lift-+.f64N/A

            \[\leadsto \sqrt{x \cdot \left(y + \color{blue}{z}\right)} \cdot 2 \]
          3. distribute-lft-outN/A

            \[\leadsto \sqrt{x \cdot y + \color{blue}{x \cdot z}} \cdot 2 \]
          4. *-commutativeN/A

            \[\leadsto \sqrt{x \cdot y + z \cdot \color{blue}{x}} \cdot 2 \]
          5. +-commutativeN/A

            \[\leadsto \sqrt{z \cdot x + \color{blue}{x \cdot y}} \cdot 2 \]
          6. lower-fma.f64N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(z, \color{blue}{x}, x \cdot y\right)} \cdot 2 \]
          7. *-commutativeN/A

            \[\leadsto \sqrt{\mathsf{fma}\left(z, x, y \cdot x\right)} \cdot 2 \]
          8. *-lft-identityN/A

            \[\leadsto \sqrt{\mathsf{fma}\left(z, x, \left(1 \cdot y\right) \cdot x\right)} \cdot 2 \]
          9. metadata-evalN/A

            \[\leadsto \sqrt{\mathsf{fma}\left(z, x, \left(\left(\mathsf{neg}\left(-1\right)\right) \cdot y\right) \cdot x\right)} \cdot 2 \]
          10. distribute-lft-neg-outN/A

            \[\leadsto \sqrt{\mathsf{fma}\left(z, x, \left(\mathsf{neg}\left(-1 \cdot y\right)\right) \cdot x\right)} \cdot 2 \]
          11. lower-*.f64N/A

            \[\leadsto \sqrt{\mathsf{fma}\left(z, x, \left(\mathsf{neg}\left(-1 \cdot y\right)\right) \cdot x\right)} \cdot 2 \]
          12. distribute-lft-neg-outN/A

            \[\leadsto \sqrt{\mathsf{fma}\left(z, x, \left(\left(\mathsf{neg}\left(-1\right)\right) \cdot y\right) \cdot x\right)} \cdot 2 \]
          13. metadata-evalN/A

            \[\leadsto \sqrt{\mathsf{fma}\left(z, x, \left(1 \cdot y\right) \cdot x\right)} \cdot 2 \]
          14. *-lft-identity47.7%

            \[\leadsto \sqrt{\mathsf{fma}\left(z, x, y \cdot x\right)} \cdot 2 \]
        11. Applied rewrites47.7%

          \[\leadsto \sqrt{\mathsf{fma}\left(z, \color{blue}{x}, y \cdot x\right)} \cdot 2 \]

        if -2.0000000000000001e-293 < y < 4.5999999999999996e35

        1. Initial program 70.3%

          \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
        2. Taylor expanded in z around inf

          \[\leadsto 2 \cdot \sqrt{\color{blue}{z \cdot \left(x + y\right)}} \]
        3. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto 2 \cdot \sqrt{z \cdot \color{blue}{\left(x + y\right)}} \]
          2. lower-+.f6447.2%

            \[\leadsto 2 \cdot \sqrt{z \cdot \left(x + \color{blue}{y}\right)} \]
        4. Applied rewrites47.2%

          \[\leadsto 2 \cdot \sqrt{\color{blue}{z \cdot \left(x + y\right)}} \]

        if 4.5999999999999996e35 < y

        1. Initial program 70.3%

          \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
        2. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}} \]
          2. *-commutativeN/A

            \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
          3. lower-*.f6470.3%

            \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
        3. Applied rewrites70.4%

          \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(z + x, y, z \cdot x\right)} \cdot 2} \]
        4. Taylor expanded in z around inf

          \[\leadsto \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \cdot 2 \]
        5. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto \left(z \cdot \color{blue}{\sqrt{\frac{x + y}{z}}}\right) \cdot 2 \]
          2. lower-sqrt.f64N/A

            \[\leadsto \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \cdot 2 \]
          3. lower-/.f64N/A

            \[\leadsto \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \cdot 2 \]
          4. lower-+.f6429.8%

            \[\leadsto \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \cdot 2 \]
        6. Applied rewrites29.8%

          \[\leadsto \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \cdot 2 \]
        7. Taylor expanded in x around 0

          \[\leadsto \left(z \cdot \sqrt{\frac{y}{z}}\right) \cdot 2 \]
        8. Step-by-step derivation
          1. Applied rewrites15.8%

            \[\leadsto \left(z \cdot \sqrt{\frac{y}{z}}\right) \cdot 2 \]
        9. Recombined 4 regimes into one program.
        10. Add Preprocessing

        Alternative 8: 95.7% accurate, 0.2× speedup?

        \[\begin{array}{l} t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ \mathbf{if}\;t\_2 \leq -7.6 \cdot 10^{+45}:\\ \;\;\;\;-2 \cdot \left(t\_0 \cdot \sqrt{\frac{t\_2}{t\_0}}\right)\\ \mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-293}:\\ \;\;\;\;\sqrt{t\_0 \cdot \left(t\_2 + t\_3\right)} \cdot 2\\ \mathbf{elif}\;t\_2 \leq 4.6 \cdot 10^{+35}:\\ \;\;\;\;2 \cdot \sqrt{t\_3 \cdot \left(t\_0 + t\_2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(t\_3 \cdot \sqrt{\frac{t\_2}{t\_3}}\right) \cdot 2\\ \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (let* ((t_0 (fmin (fmin x y) z))
                (t_1 (fmax (fmin x y) z))
                (t_2 (fmin (fmax x y) t_1))
                (t_3 (fmax (fmax x y) t_1)))
           (if (<= t_2 -7.6e+45)
             (* -2.0 (* t_0 (sqrt (/ t_2 t_0))))
             (if (<= t_2 -2e-293)
               (* (sqrt (* t_0 (+ t_2 t_3))) 2.0)
               (if (<= t_2 4.6e+35)
                 (* 2.0 (sqrt (* t_3 (+ t_0 t_2))))
                 (* (* t_3 (sqrt (/ t_2 t_3))) 2.0))))))
        double code(double x, double y, double z) {
        	double t_0 = fmin(fmin(x, y), z);
        	double t_1 = fmax(fmin(x, y), z);
        	double t_2 = fmin(fmax(x, y), t_1);
        	double t_3 = fmax(fmax(x, y), t_1);
        	double tmp;
        	if (t_2 <= -7.6e+45) {
        		tmp = -2.0 * (t_0 * sqrt((t_2 / t_0)));
        	} else if (t_2 <= -2e-293) {
        		tmp = sqrt((t_0 * (t_2 + t_3))) * 2.0;
        	} else if (t_2 <= 4.6e+35) {
        		tmp = 2.0 * sqrt((t_3 * (t_0 + t_2)));
        	} else {
        		tmp = (t_3 * sqrt((t_2 / t_3))) * 2.0;
        	}
        	return tmp;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(x, y, z)
        use fmin_fmax_functions
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: t_0
            real(8) :: t_1
            real(8) :: t_2
            real(8) :: t_3
            real(8) :: tmp
            t_0 = fmin(fmin(x, y), z)
            t_1 = fmax(fmin(x, y), z)
            t_2 = fmin(fmax(x, y), t_1)
            t_3 = fmax(fmax(x, y), t_1)
            if (t_2 <= (-7.6d+45)) then
                tmp = (-2.0d0) * (t_0 * sqrt((t_2 / t_0)))
            else if (t_2 <= (-2d-293)) then
                tmp = sqrt((t_0 * (t_2 + t_3))) * 2.0d0
            else if (t_2 <= 4.6d+35) then
                tmp = 2.0d0 * sqrt((t_3 * (t_0 + t_2)))
            else
                tmp = (t_3 * sqrt((t_2 / t_3))) * 2.0d0
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double t_0 = fmin(fmin(x, y), z);
        	double t_1 = fmax(fmin(x, y), z);
        	double t_2 = fmin(fmax(x, y), t_1);
        	double t_3 = fmax(fmax(x, y), t_1);
        	double tmp;
        	if (t_2 <= -7.6e+45) {
        		tmp = -2.0 * (t_0 * Math.sqrt((t_2 / t_0)));
        	} else if (t_2 <= -2e-293) {
        		tmp = Math.sqrt((t_0 * (t_2 + t_3))) * 2.0;
        	} else if (t_2 <= 4.6e+35) {
        		tmp = 2.0 * Math.sqrt((t_3 * (t_0 + t_2)));
        	} else {
        		tmp = (t_3 * Math.sqrt((t_2 / t_3))) * 2.0;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	t_0 = fmin(fmin(x, y), z)
        	t_1 = fmax(fmin(x, y), z)
        	t_2 = fmin(fmax(x, y), t_1)
        	t_3 = fmax(fmax(x, y), t_1)
        	tmp = 0
        	if t_2 <= -7.6e+45:
        		tmp = -2.0 * (t_0 * math.sqrt((t_2 / t_0)))
        	elif t_2 <= -2e-293:
        		tmp = math.sqrt((t_0 * (t_2 + t_3))) * 2.0
        	elif t_2 <= 4.6e+35:
        		tmp = 2.0 * math.sqrt((t_3 * (t_0 + t_2)))
        	else:
        		tmp = (t_3 * math.sqrt((t_2 / t_3))) * 2.0
        	return tmp
        
        function code(x, y, z)
        	t_0 = fmin(fmin(x, y), z)
        	t_1 = fmax(fmin(x, y), z)
        	t_2 = fmin(fmax(x, y), t_1)
        	t_3 = fmax(fmax(x, y), t_1)
        	tmp = 0.0
        	if (t_2 <= -7.6e+45)
        		tmp = Float64(-2.0 * Float64(t_0 * sqrt(Float64(t_2 / t_0))));
        	elseif (t_2 <= -2e-293)
        		tmp = Float64(sqrt(Float64(t_0 * Float64(t_2 + t_3))) * 2.0);
        	elseif (t_2 <= 4.6e+35)
        		tmp = Float64(2.0 * sqrt(Float64(t_3 * Float64(t_0 + t_2))));
        	else
        		tmp = Float64(Float64(t_3 * sqrt(Float64(t_2 / t_3))) * 2.0);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	t_0 = min(min(x, y), z);
        	t_1 = max(min(x, y), z);
        	t_2 = min(max(x, y), t_1);
        	t_3 = max(max(x, y), t_1);
        	tmp = 0.0;
        	if (t_2 <= -7.6e+45)
        		tmp = -2.0 * (t_0 * sqrt((t_2 / t_0)));
        	elseif (t_2 <= -2e-293)
        		tmp = sqrt((t_0 * (t_2 + t_3))) * 2.0;
        	elseif (t_2 <= 4.6e+35)
        		tmp = 2.0 * sqrt((t_3 * (t_0 + t_2)));
        	else
        		tmp = (t_3 * sqrt((t_2 / t_3))) * 2.0;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := Block[{t$95$0 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, If[LessEqual[t$95$2, -7.6e+45], N[(-2.0 * N[(t$95$0 * N[Sqrt[N[(t$95$2 / t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -2e-293], N[(N[Sqrt[N[(t$95$0 * N[(t$95$2 + t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[t$95$2, 4.6e+35], N[(2.0 * N[Sqrt[N[(t$95$3 * N[(t$95$0 + t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$3 * N[Sqrt[N[(t$95$2 / t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]]]]]]]
        
        \begin{array}{l}
        t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
        t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
        t_2 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
        t_3 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
        \mathbf{if}\;t\_2 \leq -7.6 \cdot 10^{+45}:\\
        \;\;\;\;-2 \cdot \left(t\_0 \cdot \sqrt{\frac{t\_2}{t\_0}}\right)\\
        
        \mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-293}:\\
        \;\;\;\;\sqrt{t\_0 \cdot \left(t\_2 + t\_3\right)} \cdot 2\\
        
        \mathbf{elif}\;t\_2 \leq 4.6 \cdot 10^{+35}:\\
        \;\;\;\;2 \cdot \sqrt{t\_3 \cdot \left(t\_0 + t\_2\right)}\\
        
        \mathbf{else}:\\
        \;\;\;\;\left(t\_3 \cdot \sqrt{\frac{t\_2}{t\_3}}\right) \cdot 2\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 4 regimes
        2. if y < -7.6000000000000004e45

          1. Initial program 70.3%

            \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
          2. Taylor expanded in x around -inf

            \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
          3. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto -2 \cdot \color{blue}{\left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
            2. lower-*.f64N/A

              \[\leadsto -2 \cdot \left(x \cdot \color{blue}{\sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}}\right) \]
            3. lower-sqrt.f64N/A

              \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
            4. lower-*.f64N/A

              \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
            5. lower-/.f64N/A

              \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
            6. lower-fma.f64N/A

              \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
            7. lower-*.f6430.1%

              \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
          4. Applied rewrites30.1%

            \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right)} \]
          5. Taylor expanded in y around inf

            \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{y}{x}}\right) \]
          6. Step-by-step derivation
            1. lower-/.f6415.7%

              \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{y}{x}}\right) \]
          7. Applied rewrites15.7%

            \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{y}{x}}\right) \]

          if -7.6000000000000004e45 < y < -2.0000000000000001e-293

          1. Initial program 70.3%

            \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
          2. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \color{blue}{2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}} \]
            2. *-commutativeN/A

              \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
            3. lower-*.f6470.3%

              \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
          3. Applied rewrites70.4%

            \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(z + x, y, z \cdot x\right)} \cdot 2} \]
          4. Taylor expanded in y around inf

            \[\leadsto \sqrt{\color{blue}{y \cdot \left(x + z\right)}} \cdot 2 \]
          5. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto \sqrt{y \cdot \color{blue}{\left(x + z\right)}} \cdot 2 \]
            2. lower-+.f6447.3%

              \[\leadsto \sqrt{y \cdot \left(x + \color{blue}{z}\right)} \cdot 2 \]
          6. Applied rewrites47.3%

            \[\leadsto \sqrt{\color{blue}{y \cdot \left(x + z\right)}} \cdot 2 \]
          7. Taylor expanded in x around inf

            \[\leadsto \sqrt{\color{blue}{x \cdot \left(y + z\right)}} \cdot 2 \]
          8. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto \sqrt{x \cdot \color{blue}{\left(y + z\right)}} \cdot 2 \]
            2. lower-+.f6447.7%

              \[\leadsto \sqrt{x \cdot \left(y + \color{blue}{z}\right)} \cdot 2 \]
          9. Applied rewrites47.7%

            \[\leadsto \sqrt{\color{blue}{x \cdot \left(y + z\right)}} \cdot 2 \]

          if -2.0000000000000001e-293 < y < 4.5999999999999996e35

          1. Initial program 70.3%

            \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
          2. Taylor expanded in z around inf

            \[\leadsto 2 \cdot \sqrt{\color{blue}{z \cdot \left(x + y\right)}} \]
          3. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto 2 \cdot \sqrt{z \cdot \color{blue}{\left(x + y\right)}} \]
            2. lower-+.f6447.2%

              \[\leadsto 2 \cdot \sqrt{z \cdot \left(x + \color{blue}{y}\right)} \]
          4. Applied rewrites47.2%

            \[\leadsto 2 \cdot \sqrt{\color{blue}{z \cdot \left(x + y\right)}} \]

          if 4.5999999999999996e35 < y

          1. Initial program 70.3%

            \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
          2. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \color{blue}{2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}} \]
            2. *-commutativeN/A

              \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
            3. lower-*.f6470.3%

              \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
          3. Applied rewrites70.4%

            \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(z + x, y, z \cdot x\right)} \cdot 2} \]
          4. Taylor expanded in z around inf

            \[\leadsto \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \cdot 2 \]
          5. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto \left(z \cdot \color{blue}{\sqrt{\frac{x + y}{z}}}\right) \cdot 2 \]
            2. lower-sqrt.f64N/A

              \[\leadsto \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \cdot 2 \]
            3. lower-/.f64N/A

              \[\leadsto \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \cdot 2 \]
            4. lower-+.f6429.8%

              \[\leadsto \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \cdot 2 \]
          6. Applied rewrites29.8%

            \[\leadsto \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \cdot 2 \]
          7. Taylor expanded in x around 0

            \[\leadsto \left(z \cdot \sqrt{\frac{y}{z}}\right) \cdot 2 \]
          8. Step-by-step derivation
            1. Applied rewrites15.8%

              \[\leadsto \left(z \cdot \sqrt{\frac{y}{z}}\right) \cdot 2 \]
          9. Recombined 4 regimes into one program.
          10. Add Preprocessing

          Alternative 9: 94.8% accurate, 0.2× speedup?

          \[\begin{array}{l} t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_2 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ t_3 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ \mathbf{if}\;t\_3 \leq -3.2 \cdot 10^{-10}:\\ \;\;\;\;\left(\sqrt{\frac{t\_3 + t\_2}{t\_0}} \cdot t\_0\right) \cdot -2\\ \mathbf{elif}\;t\_3 \leq 1.05 \cdot 10^{-85}:\\ \;\;\;\;2 \cdot \sqrt{t\_3 \cdot \left(t\_0 + t\_2\right)}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(t\_2 \cdot \sqrt{\frac{t\_0 + t\_3}{t\_2}}\right)\\ \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (let* ((t_0 (fmin (fmin x y) z))
                  (t_1 (fmax (fmin x y) z))
                  (t_2 (fmax (fmax x y) t_1))
                  (t_3 (fmin (fmax x y) t_1)))
             (if (<= t_3 -3.2e-10)
               (* (* (sqrt (/ (+ t_3 t_2) t_0)) t_0) -2.0)
               (if (<= t_3 1.05e-85)
                 (* 2.0 (sqrt (* t_3 (+ t_0 t_2))))
                 (* 2.0 (* t_2 (sqrt (/ (+ t_0 t_3) t_2))))))))
          double code(double x, double y, double z) {
          	double t_0 = fmin(fmin(x, y), z);
          	double t_1 = fmax(fmin(x, y), z);
          	double t_2 = fmax(fmax(x, y), t_1);
          	double t_3 = fmin(fmax(x, y), t_1);
          	double tmp;
          	if (t_3 <= -3.2e-10) {
          		tmp = (sqrt(((t_3 + t_2) / t_0)) * t_0) * -2.0;
          	} else if (t_3 <= 1.05e-85) {
          		tmp = 2.0 * sqrt((t_3 * (t_0 + t_2)));
          	} else {
          		tmp = 2.0 * (t_2 * sqrt(((t_0 + t_3) / t_2)));
          	}
          	return tmp;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(x, y, z)
          use fmin_fmax_functions
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              real(8) :: t_0
              real(8) :: t_1
              real(8) :: t_2
              real(8) :: t_3
              real(8) :: tmp
              t_0 = fmin(fmin(x, y), z)
              t_1 = fmax(fmin(x, y), z)
              t_2 = fmax(fmax(x, y), t_1)
              t_3 = fmin(fmax(x, y), t_1)
              if (t_3 <= (-3.2d-10)) then
                  tmp = (sqrt(((t_3 + t_2) / t_0)) * t_0) * (-2.0d0)
              else if (t_3 <= 1.05d-85) then
                  tmp = 2.0d0 * sqrt((t_3 * (t_0 + t_2)))
              else
                  tmp = 2.0d0 * (t_2 * sqrt(((t_0 + t_3) / t_2)))
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z) {
          	double t_0 = fmin(fmin(x, y), z);
          	double t_1 = fmax(fmin(x, y), z);
          	double t_2 = fmax(fmax(x, y), t_1);
          	double t_3 = fmin(fmax(x, y), t_1);
          	double tmp;
          	if (t_3 <= -3.2e-10) {
          		tmp = (Math.sqrt(((t_3 + t_2) / t_0)) * t_0) * -2.0;
          	} else if (t_3 <= 1.05e-85) {
          		tmp = 2.0 * Math.sqrt((t_3 * (t_0 + t_2)));
          	} else {
          		tmp = 2.0 * (t_2 * Math.sqrt(((t_0 + t_3) / t_2)));
          	}
          	return tmp;
          }
          
          def code(x, y, z):
          	t_0 = fmin(fmin(x, y), z)
          	t_1 = fmax(fmin(x, y), z)
          	t_2 = fmax(fmax(x, y), t_1)
          	t_3 = fmin(fmax(x, y), t_1)
          	tmp = 0
          	if t_3 <= -3.2e-10:
          		tmp = (math.sqrt(((t_3 + t_2) / t_0)) * t_0) * -2.0
          	elif t_3 <= 1.05e-85:
          		tmp = 2.0 * math.sqrt((t_3 * (t_0 + t_2)))
          	else:
          		tmp = 2.0 * (t_2 * math.sqrt(((t_0 + t_3) / t_2)))
          	return tmp
          
          function code(x, y, z)
          	t_0 = fmin(fmin(x, y), z)
          	t_1 = fmax(fmin(x, y), z)
          	t_2 = fmax(fmax(x, y), t_1)
          	t_3 = fmin(fmax(x, y), t_1)
          	tmp = 0.0
          	if (t_3 <= -3.2e-10)
          		tmp = Float64(Float64(sqrt(Float64(Float64(t_3 + t_2) / t_0)) * t_0) * -2.0);
          	elseif (t_3 <= 1.05e-85)
          		tmp = Float64(2.0 * sqrt(Float64(t_3 * Float64(t_0 + t_2))));
          	else
          		tmp = Float64(2.0 * Float64(t_2 * sqrt(Float64(Float64(t_0 + t_3) / t_2))));
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z)
          	t_0 = min(min(x, y), z);
          	t_1 = max(min(x, y), z);
          	t_2 = max(max(x, y), t_1);
          	t_3 = min(max(x, y), t_1);
          	tmp = 0.0;
          	if (t_3 <= -3.2e-10)
          		tmp = (sqrt(((t_3 + t_2) / t_0)) * t_0) * -2.0;
          	elseif (t_3 <= 1.05e-85)
          		tmp = 2.0 * sqrt((t_3 * (t_0 + t_2)));
          	else
          		tmp = 2.0 * (t_2 * sqrt(((t_0 + t_3) / t_2)));
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_] := Block[{t$95$0 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Min[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, If[LessEqual[t$95$3, -3.2e-10], N[(N[(N[Sqrt[N[(N[(t$95$3 + t$95$2), $MachinePrecision] / t$95$0), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * -2.0), $MachinePrecision], If[LessEqual[t$95$3, 1.05e-85], N[(2.0 * N[Sqrt[N[(t$95$3 * N[(t$95$0 + t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$2 * N[Sqrt[N[(N[(t$95$0 + t$95$3), $MachinePrecision] / t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
          
          \begin{array}{l}
          t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
          t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
          t_2 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
          t_3 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
          \mathbf{if}\;t\_3 \leq -3.2 \cdot 10^{-10}:\\
          \;\;\;\;\left(\sqrt{\frac{t\_3 + t\_2}{t\_0}} \cdot t\_0\right) \cdot -2\\
          
          \mathbf{elif}\;t\_3 \leq 1.05 \cdot 10^{-85}:\\
          \;\;\;\;2 \cdot \sqrt{t\_3 \cdot \left(t\_0 + t\_2\right)}\\
          
          \mathbf{else}:\\
          \;\;\;\;2 \cdot \left(t\_2 \cdot \sqrt{\frac{t\_0 + t\_3}{t\_2}}\right)\\
          
          
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if y < -3.1999999999999998e-10

            1. Initial program 70.3%

              \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
            2. Taylor expanded in x around -inf

              \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
            3. Step-by-step derivation
              1. lower-*.f64N/A

                \[\leadsto -2 \cdot \color{blue}{\left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
              2. lower-*.f64N/A

                \[\leadsto -2 \cdot \left(x \cdot \color{blue}{\sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}}\right) \]
              3. lower-sqrt.f64N/A

                \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
              4. lower-*.f64N/A

                \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
              5. lower-/.f64N/A

                \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
              6. lower-fma.f64N/A

                \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
              7. lower-*.f6430.1%

                \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
            4. Applied rewrites30.1%

              \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right)} \]
            5. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto -2 \cdot \color{blue}{\left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right)} \]
              2. *-commutativeN/A

                \[\leadsto \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \cdot \color{blue}{-2} \]
              3. lower-*.f6430.1%

                \[\leadsto \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \cdot \color{blue}{-2} \]
            6. Applied rewrites30.1%

              \[\leadsto \left(\sqrt{\frac{y + z}{x}} \cdot x\right) \cdot \color{blue}{-2} \]

            if -3.1999999999999998e-10 < y < 1.05e-85

            1. Initial program 70.3%

              \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
            2. Taylor expanded in y around inf

              \[\leadsto 2 \cdot \sqrt{\color{blue}{y \cdot \left(x + z\right)}} \]
            3. Step-by-step derivation
              1. lower-*.f64N/A

                \[\leadsto 2 \cdot \sqrt{y \cdot \color{blue}{\left(x + z\right)}} \]
              2. lower-+.f6447.3%

                \[\leadsto 2 \cdot \sqrt{y \cdot \left(x + \color{blue}{z}\right)} \]
            4. Applied rewrites47.3%

              \[\leadsto 2 \cdot \sqrt{\color{blue}{y \cdot \left(x + z\right)}} \]

            if 1.05e-85 < y

            1. Initial program 70.3%

              \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
            2. Taylor expanded in z around inf

              \[\leadsto 2 \cdot \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \]
            3. Step-by-step derivation
              1. lower-*.f64N/A

                \[\leadsto 2 \cdot \left(z \cdot \color{blue}{\sqrt{\frac{x + y}{z}}}\right) \]
              2. lower-sqrt.f64N/A

                \[\leadsto 2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \]
              3. lower-/.f64N/A

                \[\leadsto 2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \]
              4. lower-+.f6429.8%

                \[\leadsto 2 \cdot \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \]
            4. Applied rewrites29.8%

              \[\leadsto 2 \cdot \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \]
          3. Recombined 3 regimes into one program.
          4. Add Preprocessing

          Alternative 10: 94.6% accurate, 0.2× speedup?

          \[\begin{array}{l} t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_2 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ t_3 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ \mathbf{if}\;t\_3 \leq -3.2 \cdot 10^{-10}:\\ \;\;\;\;\left(\sqrt{\frac{t\_3 + t\_2}{t\_0}} \cdot t\_0\right) \cdot -2\\ \mathbf{elif}\;t\_3 \leq 4.9 \cdot 10^{+31}:\\ \;\;\;\;2 \cdot \sqrt{t\_3 \cdot \left(t\_0 + t\_2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(t\_2 \cdot \sqrt{\frac{t\_3}{t\_2}}\right) \cdot 2\\ \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (let* ((t_0 (fmin (fmin x y) z))
                  (t_1 (fmax (fmin x y) z))
                  (t_2 (fmax (fmax x y) t_1))
                  (t_3 (fmin (fmax x y) t_1)))
             (if (<= t_3 -3.2e-10)
               (* (* (sqrt (/ (+ t_3 t_2) t_0)) t_0) -2.0)
               (if (<= t_3 4.9e+31)
                 (* 2.0 (sqrt (* t_3 (+ t_0 t_2))))
                 (* (* t_2 (sqrt (/ t_3 t_2))) 2.0)))))
          double code(double x, double y, double z) {
          	double t_0 = fmin(fmin(x, y), z);
          	double t_1 = fmax(fmin(x, y), z);
          	double t_2 = fmax(fmax(x, y), t_1);
          	double t_3 = fmin(fmax(x, y), t_1);
          	double tmp;
          	if (t_3 <= -3.2e-10) {
          		tmp = (sqrt(((t_3 + t_2) / t_0)) * t_0) * -2.0;
          	} else if (t_3 <= 4.9e+31) {
          		tmp = 2.0 * sqrt((t_3 * (t_0 + t_2)));
          	} else {
          		tmp = (t_2 * sqrt((t_3 / t_2))) * 2.0;
          	}
          	return tmp;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(x, y, z)
          use fmin_fmax_functions
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              real(8) :: t_0
              real(8) :: t_1
              real(8) :: t_2
              real(8) :: t_3
              real(8) :: tmp
              t_0 = fmin(fmin(x, y), z)
              t_1 = fmax(fmin(x, y), z)
              t_2 = fmax(fmax(x, y), t_1)
              t_3 = fmin(fmax(x, y), t_1)
              if (t_3 <= (-3.2d-10)) then
                  tmp = (sqrt(((t_3 + t_2) / t_0)) * t_0) * (-2.0d0)
              else if (t_3 <= 4.9d+31) then
                  tmp = 2.0d0 * sqrt((t_3 * (t_0 + t_2)))
              else
                  tmp = (t_2 * sqrt((t_3 / t_2))) * 2.0d0
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z) {
          	double t_0 = fmin(fmin(x, y), z);
          	double t_1 = fmax(fmin(x, y), z);
          	double t_2 = fmax(fmax(x, y), t_1);
          	double t_3 = fmin(fmax(x, y), t_1);
          	double tmp;
          	if (t_3 <= -3.2e-10) {
          		tmp = (Math.sqrt(((t_3 + t_2) / t_0)) * t_0) * -2.0;
          	} else if (t_3 <= 4.9e+31) {
          		tmp = 2.0 * Math.sqrt((t_3 * (t_0 + t_2)));
          	} else {
          		tmp = (t_2 * Math.sqrt((t_3 / t_2))) * 2.0;
          	}
          	return tmp;
          }
          
          def code(x, y, z):
          	t_0 = fmin(fmin(x, y), z)
          	t_1 = fmax(fmin(x, y), z)
          	t_2 = fmax(fmax(x, y), t_1)
          	t_3 = fmin(fmax(x, y), t_1)
          	tmp = 0
          	if t_3 <= -3.2e-10:
          		tmp = (math.sqrt(((t_3 + t_2) / t_0)) * t_0) * -2.0
          	elif t_3 <= 4.9e+31:
          		tmp = 2.0 * math.sqrt((t_3 * (t_0 + t_2)))
          	else:
          		tmp = (t_2 * math.sqrt((t_3 / t_2))) * 2.0
          	return tmp
          
          function code(x, y, z)
          	t_0 = fmin(fmin(x, y), z)
          	t_1 = fmax(fmin(x, y), z)
          	t_2 = fmax(fmax(x, y), t_1)
          	t_3 = fmin(fmax(x, y), t_1)
          	tmp = 0.0
          	if (t_3 <= -3.2e-10)
          		tmp = Float64(Float64(sqrt(Float64(Float64(t_3 + t_2) / t_0)) * t_0) * -2.0);
          	elseif (t_3 <= 4.9e+31)
          		tmp = Float64(2.0 * sqrt(Float64(t_3 * Float64(t_0 + t_2))));
          	else
          		tmp = Float64(Float64(t_2 * sqrt(Float64(t_3 / t_2))) * 2.0);
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z)
          	t_0 = min(min(x, y), z);
          	t_1 = max(min(x, y), z);
          	t_2 = max(max(x, y), t_1);
          	t_3 = min(max(x, y), t_1);
          	tmp = 0.0;
          	if (t_3 <= -3.2e-10)
          		tmp = (sqrt(((t_3 + t_2) / t_0)) * t_0) * -2.0;
          	elseif (t_3 <= 4.9e+31)
          		tmp = 2.0 * sqrt((t_3 * (t_0 + t_2)));
          	else
          		tmp = (t_2 * sqrt((t_3 / t_2))) * 2.0;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_] := Block[{t$95$0 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Min[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, If[LessEqual[t$95$3, -3.2e-10], N[(N[(N[Sqrt[N[(N[(t$95$3 + t$95$2), $MachinePrecision] / t$95$0), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * -2.0), $MachinePrecision], If[LessEqual[t$95$3, 4.9e+31], N[(2.0 * N[Sqrt[N[(t$95$3 * N[(t$95$0 + t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 * N[Sqrt[N[(t$95$3 / t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]]]]]]
          
          \begin{array}{l}
          t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
          t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
          t_2 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
          t_3 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
          \mathbf{if}\;t\_3 \leq -3.2 \cdot 10^{-10}:\\
          \;\;\;\;\left(\sqrt{\frac{t\_3 + t\_2}{t\_0}} \cdot t\_0\right) \cdot -2\\
          
          \mathbf{elif}\;t\_3 \leq 4.9 \cdot 10^{+31}:\\
          \;\;\;\;2 \cdot \sqrt{t\_3 \cdot \left(t\_0 + t\_2\right)}\\
          
          \mathbf{else}:\\
          \;\;\;\;\left(t\_2 \cdot \sqrt{\frac{t\_3}{t\_2}}\right) \cdot 2\\
          
          
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if y < -3.1999999999999998e-10

            1. Initial program 70.3%

              \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
            2. Taylor expanded in x around -inf

              \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
            3. Step-by-step derivation
              1. lower-*.f64N/A

                \[\leadsto -2 \cdot \color{blue}{\left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
              2. lower-*.f64N/A

                \[\leadsto -2 \cdot \left(x \cdot \color{blue}{\sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}}\right) \]
              3. lower-sqrt.f64N/A

                \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
              4. lower-*.f64N/A

                \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
              5. lower-/.f64N/A

                \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
              6. lower-fma.f64N/A

                \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
              7. lower-*.f6430.1%

                \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
            4. Applied rewrites30.1%

              \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right)} \]
            5. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto -2 \cdot \color{blue}{\left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right)} \]
              2. *-commutativeN/A

                \[\leadsto \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \cdot \color{blue}{-2} \]
              3. lower-*.f6430.1%

                \[\leadsto \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \cdot \color{blue}{-2} \]
            6. Applied rewrites30.1%

              \[\leadsto \left(\sqrt{\frac{y + z}{x}} \cdot x\right) \cdot \color{blue}{-2} \]

            if -3.1999999999999998e-10 < y < 4.9e31

            1. Initial program 70.3%

              \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
            2. Taylor expanded in y around inf

              \[\leadsto 2 \cdot \sqrt{\color{blue}{y \cdot \left(x + z\right)}} \]
            3. Step-by-step derivation
              1. lower-*.f64N/A

                \[\leadsto 2 \cdot \sqrt{y \cdot \color{blue}{\left(x + z\right)}} \]
              2. lower-+.f6447.3%

                \[\leadsto 2 \cdot \sqrt{y \cdot \left(x + \color{blue}{z}\right)} \]
            4. Applied rewrites47.3%

              \[\leadsto 2 \cdot \sqrt{\color{blue}{y \cdot \left(x + z\right)}} \]

            if 4.9e31 < y

            1. Initial program 70.3%

              \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
            2. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \color{blue}{2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}} \]
              2. *-commutativeN/A

                \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
              3. lower-*.f6470.3%

                \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
            3. Applied rewrites70.4%

              \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(z + x, y, z \cdot x\right)} \cdot 2} \]
            4. Taylor expanded in z around inf

              \[\leadsto \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \cdot 2 \]
            5. Step-by-step derivation
              1. lower-*.f64N/A

                \[\leadsto \left(z \cdot \color{blue}{\sqrt{\frac{x + y}{z}}}\right) \cdot 2 \]
              2. lower-sqrt.f64N/A

                \[\leadsto \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \cdot 2 \]
              3. lower-/.f64N/A

                \[\leadsto \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \cdot 2 \]
              4. lower-+.f6429.8%

                \[\leadsto \left(z \cdot \sqrt{\frac{x + y}{z}}\right) \cdot 2 \]
            6. Applied rewrites29.8%

              \[\leadsto \color{blue}{\left(z \cdot \sqrt{\frac{x + y}{z}}\right)} \cdot 2 \]
            7. Taylor expanded in x around 0

              \[\leadsto \left(z \cdot \sqrt{\frac{y}{z}}\right) \cdot 2 \]
            8. Step-by-step derivation
              1. Applied rewrites15.8%

                \[\leadsto \left(z \cdot \sqrt{\frac{y}{z}}\right) \cdot 2 \]
            9. Recombined 3 regimes into one program.
            10. Add Preprocessing

            Alternative 11: 83.2% accurate, 0.3× speedup?

            \[\begin{array}{l} t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ \mathbf{if}\;t\_2 \leq -7.6 \cdot 10^{+45}:\\ \;\;\;\;-2 \cdot \left(t\_0 \cdot \sqrt{\frac{t\_2}{t\_0}}\right)\\ \mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-293}:\\ \;\;\;\;\sqrt{t\_0 \cdot \left(t\_2 + t\_3\right)} \cdot 2\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \sqrt{t\_3 \cdot \left(t\_0 + t\_2\right)}\\ \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (let* ((t_0 (fmin (fmin x y) z))
                    (t_1 (fmax (fmin x y) z))
                    (t_2 (fmin (fmax x y) t_1))
                    (t_3 (fmax (fmax x y) t_1)))
               (if (<= t_2 -7.6e+45)
                 (* -2.0 (* t_0 (sqrt (/ t_2 t_0))))
                 (if (<= t_2 -2e-293)
                   (* (sqrt (* t_0 (+ t_2 t_3))) 2.0)
                   (* 2.0 (sqrt (* t_3 (+ t_0 t_2))))))))
            double code(double x, double y, double z) {
            	double t_0 = fmin(fmin(x, y), z);
            	double t_1 = fmax(fmin(x, y), z);
            	double t_2 = fmin(fmax(x, y), t_1);
            	double t_3 = fmax(fmax(x, y), t_1);
            	double tmp;
            	if (t_2 <= -7.6e+45) {
            		tmp = -2.0 * (t_0 * sqrt((t_2 / t_0)));
            	} else if (t_2 <= -2e-293) {
            		tmp = sqrt((t_0 * (t_2 + t_3))) * 2.0;
            	} else {
            		tmp = 2.0 * sqrt((t_3 * (t_0 + t_2)));
            	}
            	return tmp;
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(x, y, z)
            use fmin_fmax_functions
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8) :: t_0
                real(8) :: t_1
                real(8) :: t_2
                real(8) :: t_3
                real(8) :: tmp
                t_0 = fmin(fmin(x, y), z)
                t_1 = fmax(fmin(x, y), z)
                t_2 = fmin(fmax(x, y), t_1)
                t_3 = fmax(fmax(x, y), t_1)
                if (t_2 <= (-7.6d+45)) then
                    tmp = (-2.0d0) * (t_0 * sqrt((t_2 / t_0)))
                else if (t_2 <= (-2d-293)) then
                    tmp = sqrt((t_0 * (t_2 + t_3))) * 2.0d0
                else
                    tmp = 2.0d0 * sqrt((t_3 * (t_0 + t_2)))
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double t_0 = fmin(fmin(x, y), z);
            	double t_1 = fmax(fmin(x, y), z);
            	double t_2 = fmin(fmax(x, y), t_1);
            	double t_3 = fmax(fmax(x, y), t_1);
            	double tmp;
            	if (t_2 <= -7.6e+45) {
            		tmp = -2.0 * (t_0 * Math.sqrt((t_2 / t_0)));
            	} else if (t_2 <= -2e-293) {
            		tmp = Math.sqrt((t_0 * (t_2 + t_3))) * 2.0;
            	} else {
            		tmp = 2.0 * Math.sqrt((t_3 * (t_0 + t_2)));
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	t_0 = fmin(fmin(x, y), z)
            	t_1 = fmax(fmin(x, y), z)
            	t_2 = fmin(fmax(x, y), t_1)
            	t_3 = fmax(fmax(x, y), t_1)
            	tmp = 0
            	if t_2 <= -7.6e+45:
            		tmp = -2.0 * (t_0 * math.sqrt((t_2 / t_0)))
            	elif t_2 <= -2e-293:
            		tmp = math.sqrt((t_0 * (t_2 + t_3))) * 2.0
            	else:
            		tmp = 2.0 * math.sqrt((t_3 * (t_0 + t_2)))
            	return tmp
            
            function code(x, y, z)
            	t_0 = fmin(fmin(x, y), z)
            	t_1 = fmax(fmin(x, y), z)
            	t_2 = fmin(fmax(x, y), t_1)
            	t_3 = fmax(fmax(x, y), t_1)
            	tmp = 0.0
            	if (t_2 <= -7.6e+45)
            		tmp = Float64(-2.0 * Float64(t_0 * sqrt(Float64(t_2 / t_0))));
            	elseif (t_2 <= -2e-293)
            		tmp = Float64(sqrt(Float64(t_0 * Float64(t_2 + t_3))) * 2.0);
            	else
            		tmp = Float64(2.0 * sqrt(Float64(t_3 * Float64(t_0 + t_2))));
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	t_0 = min(min(x, y), z);
            	t_1 = max(min(x, y), z);
            	t_2 = min(max(x, y), t_1);
            	t_3 = max(max(x, y), t_1);
            	tmp = 0.0;
            	if (t_2 <= -7.6e+45)
            		tmp = -2.0 * (t_0 * sqrt((t_2 / t_0)));
            	elseif (t_2 <= -2e-293)
            		tmp = sqrt((t_0 * (t_2 + t_3))) * 2.0;
            	else
            		tmp = 2.0 * sqrt((t_3 * (t_0 + t_2)));
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := Block[{t$95$0 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, If[LessEqual[t$95$2, -7.6e+45], N[(-2.0 * N[(t$95$0 * N[Sqrt[N[(t$95$2 / t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -2e-293], N[(N[Sqrt[N[(t$95$0 * N[(t$95$2 + t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision], N[(2.0 * N[Sqrt[N[(t$95$3 * N[(t$95$0 + t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
            
            \begin{array}{l}
            t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
            t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
            t_2 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
            t_3 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
            \mathbf{if}\;t\_2 \leq -7.6 \cdot 10^{+45}:\\
            \;\;\;\;-2 \cdot \left(t\_0 \cdot \sqrt{\frac{t\_2}{t\_0}}\right)\\
            
            \mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-293}:\\
            \;\;\;\;\sqrt{t\_0 \cdot \left(t\_2 + t\_3\right)} \cdot 2\\
            
            \mathbf{else}:\\
            \;\;\;\;2 \cdot \sqrt{t\_3 \cdot \left(t\_0 + t\_2\right)}\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if y < -7.6000000000000004e45

              1. Initial program 70.3%

                \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
              2. Taylor expanded in x around -inf

                \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
              3. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto -2 \cdot \color{blue}{\left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right)} \]
                2. lower-*.f64N/A

                  \[\leadsto -2 \cdot \left(x \cdot \color{blue}{\sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}}\right) \]
                3. lower-sqrt.f64N/A

                  \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
                4. lower-*.f64N/A

                  \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
                5. lower-/.f64N/A

                  \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{-1 \cdot y + -1 \cdot z}{x}}\right) \]
                6. lower-fma.f64N/A

                  \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
                7. lower-*.f6430.1%

                  \[\leadsto -2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right) \]
              4. Applied rewrites30.1%

                \[\leadsto \color{blue}{-2 \cdot \left(x \cdot \sqrt{-1 \cdot \frac{\mathsf{fma}\left(-1, y, -1 \cdot z\right)}{x}}\right)} \]
              5. Taylor expanded in y around inf

                \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{y}{x}}\right) \]
              6. Step-by-step derivation
                1. lower-/.f6415.7%

                  \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{y}{x}}\right) \]
              7. Applied rewrites15.7%

                \[\leadsto -2 \cdot \left(x \cdot \sqrt{\frac{y}{x}}\right) \]

              if -7.6000000000000004e45 < y < -2.0000000000000001e-293

              1. Initial program 70.3%

                \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
              2. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \color{blue}{2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}} \]
                2. *-commutativeN/A

                  \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
                3. lower-*.f6470.3%

                  \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
              3. Applied rewrites70.4%

                \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(z + x, y, z \cdot x\right)} \cdot 2} \]
              4. Taylor expanded in y around inf

                \[\leadsto \sqrt{\color{blue}{y \cdot \left(x + z\right)}} \cdot 2 \]
              5. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto \sqrt{y \cdot \color{blue}{\left(x + z\right)}} \cdot 2 \]
                2. lower-+.f6447.3%

                  \[\leadsto \sqrt{y \cdot \left(x + \color{blue}{z}\right)} \cdot 2 \]
              6. Applied rewrites47.3%

                \[\leadsto \sqrt{\color{blue}{y \cdot \left(x + z\right)}} \cdot 2 \]
              7. Taylor expanded in x around inf

                \[\leadsto \sqrt{\color{blue}{x \cdot \left(y + z\right)}} \cdot 2 \]
              8. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto \sqrt{x \cdot \color{blue}{\left(y + z\right)}} \cdot 2 \]
                2. lower-+.f6447.7%

                  \[\leadsto \sqrt{x \cdot \left(y + \color{blue}{z}\right)} \cdot 2 \]
              9. Applied rewrites47.7%

                \[\leadsto \sqrt{\color{blue}{x \cdot \left(y + z\right)}} \cdot 2 \]

              if -2.0000000000000001e-293 < y

              1. Initial program 70.3%

                \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
              2. Taylor expanded in z around inf

                \[\leadsto 2 \cdot \sqrt{\color{blue}{z \cdot \left(x + y\right)}} \]
              3. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto 2 \cdot \sqrt{z \cdot \color{blue}{\left(x + y\right)}} \]
                2. lower-+.f6447.2%

                  \[\leadsto 2 \cdot \sqrt{z \cdot \left(x + \color{blue}{y}\right)} \]
              4. Applied rewrites47.2%

                \[\leadsto 2 \cdot \sqrt{\color{blue}{z \cdot \left(x + y\right)}} \]
            3. Recombined 3 regimes into one program.
            4. Add Preprocessing

            Alternative 12: 70.4% accurate, 0.3× speedup?

            \[\begin{array}{l} t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_2 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ t_3 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\ \mathbf{if}\;t\_3 \leq -2 \cdot 10^{-293}:\\ \;\;\;\;\sqrt{t\_0 \cdot \left(t\_3 + t\_2\right)} \cdot 2\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \sqrt{t\_2 \cdot \left(t\_0 + t\_3\right)}\\ \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (let* ((t_0 (fmin (fmin x y) z))
                    (t_1 (fmax (fmin x y) z))
                    (t_2 (fmax (fmax x y) t_1))
                    (t_3 (fmin (fmax x y) t_1)))
               (if (<= t_3 -2e-293)
                 (* (sqrt (* t_0 (+ t_3 t_2))) 2.0)
                 (* 2.0 (sqrt (* t_2 (+ t_0 t_3)))))))
            double code(double x, double y, double z) {
            	double t_0 = fmin(fmin(x, y), z);
            	double t_1 = fmax(fmin(x, y), z);
            	double t_2 = fmax(fmax(x, y), t_1);
            	double t_3 = fmin(fmax(x, y), t_1);
            	double tmp;
            	if (t_3 <= -2e-293) {
            		tmp = sqrt((t_0 * (t_3 + t_2))) * 2.0;
            	} else {
            		tmp = 2.0 * sqrt((t_2 * (t_0 + t_3)));
            	}
            	return tmp;
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(x, y, z)
            use fmin_fmax_functions
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8) :: t_0
                real(8) :: t_1
                real(8) :: t_2
                real(8) :: t_3
                real(8) :: tmp
                t_0 = fmin(fmin(x, y), z)
                t_1 = fmax(fmin(x, y), z)
                t_2 = fmax(fmax(x, y), t_1)
                t_3 = fmin(fmax(x, y), t_1)
                if (t_3 <= (-2d-293)) then
                    tmp = sqrt((t_0 * (t_3 + t_2))) * 2.0d0
                else
                    tmp = 2.0d0 * sqrt((t_2 * (t_0 + t_3)))
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double t_0 = fmin(fmin(x, y), z);
            	double t_1 = fmax(fmin(x, y), z);
            	double t_2 = fmax(fmax(x, y), t_1);
            	double t_3 = fmin(fmax(x, y), t_1);
            	double tmp;
            	if (t_3 <= -2e-293) {
            		tmp = Math.sqrt((t_0 * (t_3 + t_2))) * 2.0;
            	} else {
            		tmp = 2.0 * Math.sqrt((t_2 * (t_0 + t_3)));
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	t_0 = fmin(fmin(x, y), z)
            	t_1 = fmax(fmin(x, y), z)
            	t_2 = fmax(fmax(x, y), t_1)
            	t_3 = fmin(fmax(x, y), t_1)
            	tmp = 0
            	if t_3 <= -2e-293:
            		tmp = math.sqrt((t_0 * (t_3 + t_2))) * 2.0
            	else:
            		tmp = 2.0 * math.sqrt((t_2 * (t_0 + t_3)))
            	return tmp
            
            function code(x, y, z)
            	t_0 = fmin(fmin(x, y), z)
            	t_1 = fmax(fmin(x, y), z)
            	t_2 = fmax(fmax(x, y), t_1)
            	t_3 = fmin(fmax(x, y), t_1)
            	tmp = 0.0
            	if (t_3 <= -2e-293)
            		tmp = Float64(sqrt(Float64(t_0 * Float64(t_3 + t_2))) * 2.0);
            	else
            		tmp = Float64(2.0 * sqrt(Float64(t_2 * Float64(t_0 + t_3))));
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	t_0 = min(min(x, y), z);
            	t_1 = max(min(x, y), z);
            	t_2 = max(max(x, y), t_1);
            	t_3 = min(max(x, y), t_1);
            	tmp = 0.0;
            	if (t_3 <= -2e-293)
            		tmp = sqrt((t_0 * (t_3 + t_2))) * 2.0;
            	else
            		tmp = 2.0 * sqrt((t_2 * (t_0 + t_3)));
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := Block[{t$95$0 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Min[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, If[LessEqual[t$95$3, -2e-293], N[(N[Sqrt[N[(t$95$0 * N[(t$95$3 + t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision], N[(2.0 * N[Sqrt[N[(t$95$2 * N[(t$95$0 + t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
            
            \begin{array}{l}
            t_0 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
            t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
            t_2 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
            t_3 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
            \mathbf{if}\;t\_3 \leq -2 \cdot 10^{-293}:\\
            \;\;\;\;\sqrt{t\_0 \cdot \left(t\_3 + t\_2\right)} \cdot 2\\
            
            \mathbf{else}:\\
            \;\;\;\;2 \cdot \sqrt{t\_2 \cdot \left(t\_0 + t\_3\right)}\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < -2.0000000000000001e-293

              1. Initial program 70.3%

                \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
              2. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \color{blue}{2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}} \]
                2. *-commutativeN/A

                  \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
                3. lower-*.f6470.3%

                  \[\leadsto \color{blue}{\sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \cdot 2} \]
              3. Applied rewrites70.4%

                \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(z + x, y, z \cdot x\right)} \cdot 2} \]
              4. Taylor expanded in y around inf

                \[\leadsto \sqrt{\color{blue}{y \cdot \left(x + z\right)}} \cdot 2 \]
              5. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto \sqrt{y \cdot \color{blue}{\left(x + z\right)}} \cdot 2 \]
                2. lower-+.f6447.3%

                  \[\leadsto \sqrt{y \cdot \left(x + \color{blue}{z}\right)} \cdot 2 \]
              6. Applied rewrites47.3%

                \[\leadsto \sqrt{\color{blue}{y \cdot \left(x + z\right)}} \cdot 2 \]
              7. Taylor expanded in x around inf

                \[\leadsto \sqrt{\color{blue}{x \cdot \left(y + z\right)}} \cdot 2 \]
              8. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto \sqrt{x \cdot \color{blue}{\left(y + z\right)}} \cdot 2 \]
                2. lower-+.f6447.7%

                  \[\leadsto \sqrt{x \cdot \left(y + \color{blue}{z}\right)} \cdot 2 \]
              9. Applied rewrites47.7%

                \[\leadsto \sqrt{\color{blue}{x \cdot \left(y + z\right)}} \cdot 2 \]

              if -2.0000000000000001e-293 < y

              1. Initial program 70.3%

                \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
              2. Taylor expanded in z around inf

                \[\leadsto 2 \cdot \sqrt{\color{blue}{z \cdot \left(x + y\right)}} \]
              3. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto 2 \cdot \sqrt{z \cdot \color{blue}{\left(x + y\right)}} \]
                2. lower-+.f6447.2%

                  \[\leadsto 2 \cdot \sqrt{z \cdot \left(x + \color{blue}{y}\right)} \]
              4. Applied rewrites47.2%

                \[\leadsto 2 \cdot \sqrt{\color{blue}{z \cdot \left(x + y\right)}} \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 13: 68.3% accurate, 0.5× speedup?

            \[\begin{array}{l} t_0 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\ 2 \cdot \sqrt{\mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_0\right) \cdot \left(\mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right) + \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_0\right)\right)} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (let* ((t_0 (fmax (fmin x y) z)))
               (*
                2.0
                (sqrt
                 (*
                  (fmin (fmax x y) t_0)
                  (+ (fmin (fmin x y) z) (fmax (fmax x y) t_0)))))))
            double code(double x, double y, double z) {
            	double t_0 = fmax(fmin(x, y), z);
            	return 2.0 * sqrt((fmin(fmax(x, y), t_0) * (fmin(fmin(x, y), z) + fmax(fmax(x, y), t_0))));
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(x, y, z)
            use fmin_fmax_functions
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8) :: t_0
                t_0 = fmax(fmin(x, y), z)
                code = 2.0d0 * sqrt((fmin(fmax(x, y), t_0) * (fmin(fmin(x, y), z) + fmax(fmax(x, y), t_0))))
            end function
            
            public static double code(double x, double y, double z) {
            	double t_0 = fmax(fmin(x, y), z);
            	return 2.0 * Math.sqrt((fmin(fmax(x, y), t_0) * (fmin(fmin(x, y), z) + fmax(fmax(x, y), t_0))));
            }
            
            def code(x, y, z):
            	t_0 = fmax(fmin(x, y), z)
            	return 2.0 * math.sqrt((fmin(fmax(x, y), t_0) * (fmin(fmin(x, y), z) + fmax(fmax(x, y), t_0))))
            
            function code(x, y, z)
            	t_0 = fmax(fmin(x, y), z)
            	return Float64(2.0 * sqrt(Float64(fmin(fmax(x, y), t_0) * Float64(fmin(fmin(x, y), z) + fmax(fmax(x, y), t_0)))))
            end
            
            function tmp = code(x, y, z)
            	t_0 = max(min(x, y), z);
            	tmp = 2.0 * sqrt((min(max(x, y), t_0) * (min(min(x, y), z) + max(max(x, y), t_0))));
            end
            
            code[x_, y_, z_] := Block[{t$95$0 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, N[(2.0 * N[Sqrt[N[(N[Min[N[Max[x, y], $MachinePrecision], t$95$0], $MachinePrecision] * N[(N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision] + N[Max[N[Max[x, y], $MachinePrecision], t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            t_0 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
            2 \cdot \sqrt{\mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_0\right) \cdot \left(\mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right) + \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_0\right)\right)}
            \end{array}
            
            Derivation
            1. Initial program 70.3%

              \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
            2. Taylor expanded in y around inf

              \[\leadsto 2 \cdot \sqrt{\color{blue}{y \cdot \left(x + z\right)}} \]
            3. Step-by-step derivation
              1. lower-*.f64N/A

                \[\leadsto 2 \cdot \sqrt{y \cdot \color{blue}{\left(x + z\right)}} \]
              2. lower-+.f6447.3%

                \[\leadsto 2 \cdot \sqrt{y \cdot \left(x + \color{blue}{z}\right)} \]
            4. Applied rewrites47.3%

              \[\leadsto 2 \cdot \sqrt{\color{blue}{y \cdot \left(x + z\right)}} \]
            5. Add Preprocessing

            Alternative 14: 68.3% accurate, 0.4× speedup?

            \[\begin{array}{l} t_0 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\ t_1 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_0\right)\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{-310}:\\ \;\;\;\;2 \cdot \sqrt{\mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right) \cdot t\_1}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \sqrt{t\_1 \cdot \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_0\right)}\\ \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (let* ((t_0 (fmax (fmin x y) z)) (t_1 (fmin (fmax x y) t_0)))
               (if (<= t_1 -5e-310)
                 (* 2.0 (sqrt (* (fmin (fmin x y) z) t_1)))
                 (* 2.0 (sqrt (* t_1 (fmax (fmax x y) t_0)))))))
            double code(double x, double y, double z) {
            	double t_0 = fmax(fmin(x, y), z);
            	double t_1 = fmin(fmax(x, y), t_0);
            	double tmp;
            	if (t_1 <= -5e-310) {
            		tmp = 2.0 * sqrt((fmin(fmin(x, y), z) * t_1));
            	} else {
            		tmp = 2.0 * sqrt((t_1 * fmax(fmax(x, y), t_0)));
            	}
            	return tmp;
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(x, y, z)
            use fmin_fmax_functions
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8) :: t_0
                real(8) :: t_1
                real(8) :: tmp
                t_0 = fmax(fmin(x, y), z)
                t_1 = fmin(fmax(x, y), t_0)
                if (t_1 <= (-5d-310)) then
                    tmp = 2.0d0 * sqrt((fmin(fmin(x, y), z) * t_1))
                else
                    tmp = 2.0d0 * sqrt((t_1 * fmax(fmax(x, y), t_0)))
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double t_0 = fmax(fmin(x, y), z);
            	double t_1 = fmin(fmax(x, y), t_0);
            	double tmp;
            	if (t_1 <= -5e-310) {
            		tmp = 2.0 * Math.sqrt((fmin(fmin(x, y), z) * t_1));
            	} else {
            		tmp = 2.0 * Math.sqrt((t_1 * fmax(fmax(x, y), t_0)));
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	t_0 = fmax(fmin(x, y), z)
            	t_1 = fmin(fmax(x, y), t_0)
            	tmp = 0
            	if t_1 <= -5e-310:
            		tmp = 2.0 * math.sqrt((fmin(fmin(x, y), z) * t_1))
            	else:
            		tmp = 2.0 * math.sqrt((t_1 * fmax(fmax(x, y), t_0)))
            	return tmp
            
            function code(x, y, z)
            	t_0 = fmax(fmin(x, y), z)
            	t_1 = fmin(fmax(x, y), t_0)
            	tmp = 0.0
            	if (t_1 <= -5e-310)
            		tmp = Float64(2.0 * sqrt(Float64(fmin(fmin(x, y), z) * t_1)));
            	else
            		tmp = Float64(2.0 * sqrt(Float64(t_1 * fmax(fmax(x, y), t_0))));
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	t_0 = max(min(x, y), z);
            	t_1 = min(max(x, y), t_0);
            	tmp = 0.0;
            	if (t_1 <= -5e-310)
            		tmp = 2.0 * sqrt((min(min(x, y), z) * t_1));
            	else
            		tmp = 2.0 * sqrt((t_1 * max(max(x, y), t_0)));
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := Block[{t$95$0 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Max[x, y], $MachinePrecision], t$95$0], $MachinePrecision]}, If[LessEqual[t$95$1, -5e-310], N[(2.0 * N[Sqrt[N[(N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[Sqrt[N[(t$95$1 * N[Max[N[Max[x, y], $MachinePrecision], t$95$0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
            
            \begin{array}{l}
            t_0 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
            t_1 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_0\right)\\
            \mathbf{if}\;t\_1 \leq -5 \cdot 10^{-310}:\\
            \;\;\;\;2 \cdot \sqrt{\mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right) \cdot t\_1}\\
            
            \mathbf{else}:\\
            \;\;\;\;2 \cdot \sqrt{t\_1 \cdot \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_0\right)}\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < -4.9999999999999847e-310

              1. Initial program 70.3%

                \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
              2. Taylor expanded in z around 0

                \[\leadsto 2 \cdot \color{blue}{\sqrt{x \cdot y}} \]
              3. Step-by-step derivation
                1. lower-sqrt.f64N/A

                  \[\leadsto 2 \cdot \sqrt{x \cdot y} \]
                2. lower-*.f6425.0%

                  \[\leadsto 2 \cdot \sqrt{x \cdot y} \]
              4. Applied rewrites25.0%

                \[\leadsto 2 \cdot \color{blue}{\sqrt{x \cdot y}} \]

              if -4.9999999999999847e-310 < y

              1. Initial program 70.3%

                \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
              2. Taylor expanded in x around 0

                \[\leadsto 2 \cdot \sqrt{\color{blue}{y \cdot z}} \]
              3. Step-by-step derivation
                1. lower-*.f6424.6%

                  \[\leadsto 2 \cdot \sqrt{y \cdot \color{blue}{z}} \]
              4. Applied rewrites24.6%

                \[\leadsto 2 \cdot \sqrt{\color{blue}{y \cdot z}} \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 15: 35.2% accurate, 1.1× speedup?

            \[2 \cdot \sqrt{\mathsf{min}\left(x, z\right) \cdot \mathsf{min}\left(y, \mathsf{max}\left(x, z\right)\right)} \]
            (FPCore (x y z)
             :precision binary64
             (* 2.0 (sqrt (* (fmin x z) (fmin y (fmax x z))))))
            double code(double x, double y, double z) {
            	return 2.0 * sqrt((fmin(x, z) * fmin(y, fmax(x, z))));
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(x, y, z)
            use fmin_fmax_functions
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                code = 2.0d0 * sqrt((fmin(x, z) * fmin(y, fmax(x, z))))
            end function
            
            public static double code(double x, double y, double z) {
            	return 2.0 * Math.sqrt((fmin(x, z) * fmin(y, fmax(x, z))));
            }
            
            def code(x, y, z):
            	return 2.0 * math.sqrt((fmin(x, z) * fmin(y, fmax(x, z))))
            
            function code(x, y, z)
            	return Float64(2.0 * sqrt(Float64(fmin(x, z) * fmin(y, fmax(x, z)))))
            end
            
            function tmp = code(x, y, z)
            	tmp = 2.0 * sqrt((min(x, z) * min(y, max(x, z))));
            end
            
            code[x_, y_, z_] := N[(2.0 * N[Sqrt[N[(N[Min[x, z], $MachinePrecision] * N[Min[y, N[Max[x, z], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
            
            2 \cdot \sqrt{\mathsf{min}\left(x, z\right) \cdot \mathsf{min}\left(y, \mathsf{max}\left(x, z\right)\right)}
            
            Derivation
            1. Initial program 70.3%

              \[2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \]
            2. Taylor expanded in z around 0

              \[\leadsto 2 \cdot \color{blue}{\sqrt{x \cdot y}} \]
            3. Step-by-step derivation
              1. lower-sqrt.f64N/A

                \[\leadsto 2 \cdot \sqrt{x \cdot y} \]
              2. lower-*.f6425.0%

                \[\leadsto 2 \cdot \sqrt{x \cdot y} \]
            4. Applied rewrites25.0%

              \[\leadsto 2 \cdot \color{blue}{\sqrt{x \cdot y}} \]
            5. Add Preprocessing

            Reproduce

            ?
            herbie shell --seed 2025191 
            (FPCore (x y z)
              :name "Diagrams.TwoD.Apollonian:descartes from diagrams-contrib-1.3.0.5"
              :precision binary64
              (* 2.0 (sqrt (+ (+ (* x y) (* x z)) (* y z)))))