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

Percentage Accurate: 70.9% → 96.2%
Time: 6.3s
Alternatives: 15
Speedup: N/A×

Specification

?
\[\begin{array}{l} \\ 2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \end{array} \]
(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]
\begin{array}{l}

\\
2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}
\end{array}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 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.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ 2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z} \end{array} \]
(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]
\begin{array}{l}

\\
2 \cdot \sqrt{\left(x \cdot y + x \cdot z\right) + y \cdot z}
\end{array}

Alternative 1: 96.2% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -5.4 \cdot 10^{+44}:\\ \;\;\;\;2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{0.5} \cdot -1\right) \cdot y\right)\\ \mathbf{elif}\;y \leq 0.0095:\\ \;\;\;\;2 \cdot \sqrt{\mathsf{fma}\left(y, x, \left(y + x\right) \cdot z\right)}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left({y}^{0.5}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= y -5.4e+44)
   (* 2.0 (* (* (pow (/ (+ x z) y) 0.5) -1.0) y))
   (if (<= y 0.0095)
     (* 2.0 (sqrt (fma y x (* (+ y x) z))))
     (*
      2.0
      (fma
       (pow y 0.5)
       (sqrt z)
       (*
        x
        (*
         y
         (fma
          0.5
          (pow (pow (* y z) -1.0) 0.5)
          (* 0.5 (pow (/ z (pow y 3.0)) 0.5))))))))))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double tmp;
	if (y <= -5.4e+44) {
		tmp = 2.0 * ((pow(((x + z) / y), 0.5) * -1.0) * y);
	} else if (y <= 0.0095) {
		tmp = 2.0 * sqrt(fma(y, x, ((y + x) * z)));
	} else {
		tmp = 2.0 * fma(pow(y, 0.5), sqrt(z), (x * (y * fma(0.5, pow(pow((y * z), -1.0), 0.5), (0.5 * pow((z / pow(y, 3.0)), 0.5))))));
	}
	return tmp;
}
x, y, z = sort([x, y, z])
function code(x, y, z)
	tmp = 0.0
	if (y <= -5.4e+44)
		tmp = Float64(2.0 * Float64(Float64((Float64(Float64(x + z) / y) ^ 0.5) * -1.0) * y));
	elseif (y <= 0.0095)
		tmp = Float64(2.0 * sqrt(fma(y, x, Float64(Float64(y + x) * z))));
	else
		tmp = Float64(2.0 * fma((y ^ 0.5), sqrt(z), Float64(x * Float64(y * fma(0.5, ((Float64(y * z) ^ -1.0) ^ 0.5), Float64(0.5 * (Float64(z / (y ^ 3.0)) ^ 0.5)))))));
	end
	return tmp
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[y, -5.4e+44], N[(2.0 * N[(N[(N[Power[N[(N[(x + z), $MachinePrecision] / y), $MachinePrecision], 0.5], $MachinePrecision] * -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.0095], N[(2.0 * N[Sqrt[N[(y * x + N[(N[(y + x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Power[y, 0.5], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(y * N[(0.5 * N[Power[N[Power[N[(y * z), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.5 * N[Power[N[(z / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.4 \cdot 10^{+44}:\\
\;\;\;\;2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{0.5} \cdot -1\right) \cdot y\right)\\

\mathbf{elif}\;y \leq 0.0095:\\
\;\;\;\;2 \cdot \sqrt{\mathsf{fma}\left(y, x, \left(y + x\right) \cdot z\right)}\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left({y}^{0.5}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right)\\


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

    1. Initial program 35.6%

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\left(\sqrt{\frac{x + z}{y}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot y\right) \]
    6. Step-by-step derivation
      1. sqrt-pow2N/A

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

        \[\leadsto 2 \cdot \left(\left(\sqrt{\frac{x + z}{y}} \cdot {-1}^{1}\right) \cdot y\right) \]
      3. metadata-evalN/A

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

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

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

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

        \[\leadsto 2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{\frac{1}{2}} \cdot -1\right) \cdot y\right) \]
      8. lower-+.f6498.1

        \[\leadsto 2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{0.5} \cdot -1\right) \cdot y\right) \]
    7. Applied rewrites98.1%

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

    if -5.4e44 < y < 0.00949999999999999976

    1. Initial program 94.5%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \sqrt{\mathsf{fma}\left(y, x, \color{blue}{\left(y + x\right)} \cdot z\right)} \]
      13. lower-+.f6494.5

        \[\leadsto 2 \cdot \sqrt{\mathsf{fma}\left(y, x, \color{blue}{\left(y + x\right)} \cdot z\right)} \]
    3. Applied rewrites94.5%

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

    if 0.00949999999999999976 < y

    1. Initial program 47.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \mathsf{fma}\left({y}^{\frac{1}{2}}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(\frac{1}{2}, \sqrt{\frac{1}{y \cdot z}}, \frac{1}{2} \cdot \sqrt{\frac{z}{{y}^{3}}}\right)\right)\right) \]
    7. Applied rewrites98.1%

      \[\leadsto 2 \cdot \mathsf{fma}\left({y}^{0.5}, \color{blue}{\sqrt{z}}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 2: 96.1% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -5.4 \cdot 10^{+44}:\\ \;\;\;\;2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{0.5} \cdot -1\right) \cdot y\right)\\ \mathbf{elif}\;y \leq 0.0095:\\ \;\;\;\;2 \cdot \sqrt{\mathsf{fma}\left(x, 2 \cdot z - -1 \cdot \left(y - z\right), y \cdot z\right)}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left({y}^{0.5}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= y -5.4e+44)
   (* 2.0 (* (* (pow (/ (+ x z) y) 0.5) -1.0) y))
   (if (<= y 0.0095)
     (* 2.0 (sqrt (fma x (- (* 2.0 z) (* -1.0 (- y z))) (* y z))))
     (*
      2.0
      (fma
       (pow y 0.5)
       (sqrt z)
       (*
        x
        (*
         y
         (fma
          0.5
          (pow (pow (* y z) -1.0) 0.5)
          (* 0.5 (pow (/ z (pow y 3.0)) 0.5))))))))))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double tmp;
	if (y <= -5.4e+44) {
		tmp = 2.0 * ((pow(((x + z) / y), 0.5) * -1.0) * y);
	} else if (y <= 0.0095) {
		tmp = 2.0 * sqrt(fma(x, ((2.0 * z) - (-1.0 * (y - z))), (y * z)));
	} else {
		tmp = 2.0 * fma(pow(y, 0.5), sqrt(z), (x * (y * fma(0.5, pow(pow((y * z), -1.0), 0.5), (0.5 * pow((z / pow(y, 3.0)), 0.5))))));
	}
	return tmp;
}
x, y, z = sort([x, y, z])
function code(x, y, z)
	tmp = 0.0
	if (y <= -5.4e+44)
		tmp = Float64(2.0 * Float64(Float64((Float64(Float64(x + z) / y) ^ 0.5) * -1.0) * y));
	elseif (y <= 0.0095)
		tmp = Float64(2.0 * sqrt(fma(x, Float64(Float64(2.0 * z) - Float64(-1.0 * Float64(y - z))), Float64(y * z))));
	else
		tmp = Float64(2.0 * fma((y ^ 0.5), sqrt(z), Float64(x * Float64(y * fma(0.5, ((Float64(y * z) ^ -1.0) ^ 0.5), Float64(0.5 * (Float64(z / (y ^ 3.0)) ^ 0.5)))))));
	end
	return tmp
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[y, -5.4e+44], N[(2.0 * N[(N[(N[Power[N[(N[(x + z), $MachinePrecision] / y), $MachinePrecision], 0.5], $MachinePrecision] * -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.0095], N[(2.0 * N[Sqrt[N[(x * N[(N[(2.0 * z), $MachinePrecision] - N[(-1.0 * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Power[y, 0.5], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(y * N[(0.5 * N[Power[N[Power[N[(y * z), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.5 * N[Power[N[(z / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.4 \cdot 10^{+44}:\\
\;\;\;\;2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{0.5} \cdot -1\right) \cdot y\right)\\

\mathbf{elif}\;y \leq 0.0095:\\
\;\;\;\;2 \cdot \sqrt{\mathsf{fma}\left(x, 2 \cdot z - -1 \cdot \left(y - z\right), y \cdot z\right)}\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left({y}^{0.5}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right)\\


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

    1. Initial program 35.6%

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\left(\sqrt{\frac{x + z}{y}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot y\right) \]
    6. Step-by-step derivation
      1. sqrt-pow2N/A

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

        \[\leadsto 2 \cdot \left(\left(\sqrt{\frac{x + z}{y}} \cdot {-1}^{1}\right) \cdot y\right) \]
      3. metadata-evalN/A

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

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

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

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

        \[\leadsto 2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{\frac{1}{2}} \cdot -1\right) \cdot y\right) \]
      8. lower-+.f6498.1

        \[\leadsto 2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{0.5} \cdot -1\right) \cdot y\right) \]
    7. Applied rewrites98.1%

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

    if -5.4e44 < y < 0.00949999999999999976

    1. Initial program 94.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \sqrt{\color{blue}{\frac{\left(x \cdot y\right) \cdot \left(x \cdot y\right) - \left(z \cdot \left(x + y\right)\right) \cdot \left(z \cdot \left(x + y\right)\right)}{x \cdot y - z \cdot \left(x + y\right)}}} \]
    3. Applied rewrites63.8%

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

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

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

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

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

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

        \[\leadsto 2 \cdot \sqrt{\mathsf{fma}\left(x, 2 \cdot z - -1 \cdot \left(y - \color{blue}{z}\right), y \cdot z\right)} \]
      6. lower-*.f6494.5

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

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

    if 0.00949999999999999976 < y

    1. Initial program 47.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \mathsf{fma}\left({y}^{\frac{1}{2}}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(\frac{1}{2}, \sqrt{\frac{1}{y \cdot z}}, \frac{1}{2} \cdot \sqrt{\frac{z}{{y}^{3}}}\right)\right)\right) \]
    7. Applied rewrites98.1%

      \[\leadsto 2 \cdot \mathsf{fma}\left({y}^{0.5}, \color{blue}{\sqrt{z}}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 87.2% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} t_0 := {\left(\frac{x + z}{y}\right)}^{0.5}\\ t_1 := 2 \cdot \left(\left(t\_0 \cdot -1\right) \cdot y\right)\\ \mathbf{if}\;y \leq -5 \cdot 10^{+16}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -1.15 \cdot 10^{-159}:\\ \;\;\;\;2 \cdot \sqrt{\frac{x \cdot \left(y \cdot y - z \cdot z\right)}{y - z}}\\ \mathbf{elif}\;y \leq -4 \cdot 10^{-310}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(t\_0 \cdot y\right)\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (pow (/ (+ x z) y) 0.5)) (t_1 (* 2.0 (* (* t_0 -1.0) y))))
   (if (<= y -5e+16)
     t_1
     (if (<= y -1.15e-159)
       (* 2.0 (sqrt (/ (* x (- (* y y) (* z z))) (- y z))))
       (if (<= y -4e-310) t_1 (* 2.0 (* t_0 y)))))))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double t_0 = pow(((x + z) / y), 0.5);
	double t_1 = 2.0 * ((t_0 * -1.0) * y);
	double tmp;
	if (y <= -5e+16) {
		tmp = t_1;
	} else if (y <= -1.15e-159) {
		tmp = 2.0 * sqrt(((x * ((y * y) - (z * z))) / (y - z)));
	} else if (y <= -4e-310) {
		tmp = t_1;
	} else {
		tmp = 2.0 * (t_0 * y);
	}
	return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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 = ((x + z) / y) ** 0.5d0
    t_1 = 2.0d0 * ((t_0 * (-1.0d0)) * y)
    if (y <= (-5d+16)) then
        tmp = t_1
    else if (y <= (-1.15d-159)) then
        tmp = 2.0d0 * sqrt(((x * ((y * y) - (z * z))) / (y - z)))
    else if (y <= (-4d-310)) then
        tmp = t_1
    else
        tmp = 2.0d0 * (t_0 * y)
    end if
    code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
	double t_0 = Math.pow(((x + z) / y), 0.5);
	double t_1 = 2.0 * ((t_0 * -1.0) * y);
	double tmp;
	if (y <= -5e+16) {
		tmp = t_1;
	} else if (y <= -1.15e-159) {
		tmp = 2.0 * Math.sqrt(((x * ((y * y) - (z * z))) / (y - z)));
	} else if (y <= -4e-310) {
		tmp = t_1;
	} else {
		tmp = 2.0 * (t_0 * y);
	}
	return tmp;
}
[x, y, z] = sort([x, y, z])
def code(x, y, z):
	t_0 = math.pow(((x + z) / y), 0.5)
	t_1 = 2.0 * ((t_0 * -1.0) * y)
	tmp = 0
	if y <= -5e+16:
		tmp = t_1
	elif y <= -1.15e-159:
		tmp = 2.0 * math.sqrt(((x * ((y * y) - (z * z))) / (y - z)))
	elif y <= -4e-310:
		tmp = t_1
	else:
		tmp = 2.0 * (t_0 * y)
	return tmp
x, y, z = sort([x, y, z])
function code(x, y, z)
	t_0 = Float64(Float64(x + z) / y) ^ 0.5
	t_1 = Float64(2.0 * Float64(Float64(t_0 * -1.0) * y))
	tmp = 0.0
	if (y <= -5e+16)
		tmp = t_1;
	elseif (y <= -1.15e-159)
		tmp = Float64(2.0 * sqrt(Float64(Float64(x * Float64(Float64(y * y) - Float64(z * z))) / Float64(y - z))));
	elseif (y <= -4e-310)
		tmp = t_1;
	else
		tmp = Float64(2.0 * Float64(t_0 * y));
	end
	return tmp
end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
	t_0 = ((x + z) / y) ^ 0.5;
	t_1 = 2.0 * ((t_0 * -1.0) * y);
	tmp = 0.0;
	if (y <= -5e+16)
		tmp = t_1;
	elseif (y <= -1.15e-159)
		tmp = 2.0 * sqrt(((x * ((y * y) - (z * z))) / (y - z)));
	elseif (y <= -4e-310)
		tmp = t_1;
	else
		tmp = 2.0 * (t_0 * y);
	end
	tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[Power[N[(N[(x + z), $MachinePrecision] / y), $MachinePrecision], 0.5], $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(N[(t$95$0 * -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5e+16], t$95$1, If[LessEqual[y, -1.15e-159], N[(2.0 * N[Sqrt[N[(N[(x * N[(N[(y * y), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -4e-310], t$95$1, N[(2.0 * N[(t$95$0 * y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{x + z}{y}\right)}^{0.5}\\
t_1 := 2 \cdot \left(\left(t\_0 \cdot -1\right) \cdot y\right)\\
\mathbf{if}\;y \leq -5 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq -1.15 \cdot 10^{-159}:\\
\;\;\;\;2 \cdot \sqrt{\frac{x \cdot \left(y \cdot y - z \cdot z\right)}{y - z}}\\

\mathbf{elif}\;y \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t\_0 \cdot y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5e16 or -1.14999999999999989e-159 < y < -3.999999999999988e-310

    1. Initial program 51.5%

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\left(\sqrt{\frac{x + z}{y}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot y\right) \]
    6. Step-by-step derivation
      1. sqrt-pow2N/A

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

        \[\leadsto 2 \cdot \left(\left(\sqrt{\frac{x + z}{y}} \cdot {-1}^{1}\right) \cdot y\right) \]
      3. metadata-evalN/A

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

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

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

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

        \[\leadsto 2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{\frac{1}{2}} \cdot -1\right) \cdot y\right) \]
      8. lower-+.f6487.5

        \[\leadsto 2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{0.5} \cdot -1\right) \cdot y\right) \]
    7. Applied rewrites87.5%

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

    if -5e16 < y < -1.14999999999999989e-159

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \sqrt{\frac{x \cdot \left({y}^{2} - {z}^{2}\right)}{y - z}} \]
      4. unpow2N/A

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

        \[\leadsto 2 \cdot \sqrt{\frac{x \cdot \left(y \cdot y - {z}^{2}\right)}{y - z}} \]
      6. unpow2N/A

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

        \[\leadsto 2 \cdot \sqrt{\frac{x \cdot \left(y \cdot y - z \cdot z\right)}{y - z}} \]
      8. lower--.f6494.1

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

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

    if -3.999999999999988e-310 < y

    1. Initial program 71.1%

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\sqrt{\frac{x + z}{y}} \cdot y\right) \]
    6. Step-by-step derivation
      1. pow1/2N/A

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

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

        \[\leadsto 2 \cdot \left({\left(\frac{x + z}{y}\right)}^{\frac{1}{2}} \cdot y\right) \]
      4. lower-+.f6484.3

        \[\leadsto 2 \cdot \left({\left(\frac{x + z}{y}\right)}^{0.5} \cdot y\right) \]
    7. Applied rewrites84.3%

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

Alternative 4: 84.6% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} t_0 := {\left(\frac{x + z}{y}\right)}^{0.5}\\ \mathbf{if}\;y \leq -4 \cdot 10^{-310}:\\ \;\;\;\;2 \cdot \left(\left(t\_0 \cdot -1\right) \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(t\_0 \cdot y\right)\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (pow (/ (+ x z) y) 0.5)))
   (if (<= y -4e-310) (* 2.0 (* (* t_0 -1.0) y)) (* 2.0 (* t_0 y)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double t_0 = pow(((x + z) / y), 0.5);
	double tmp;
	if (y <= -4e-310) {
		tmp = 2.0 * ((t_0 * -1.0) * y);
	} else {
		tmp = 2.0 * (t_0 * y);
	}
	return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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) :: tmp
    t_0 = ((x + z) / y) ** 0.5d0
    if (y <= (-4d-310)) then
        tmp = 2.0d0 * ((t_0 * (-1.0d0)) * y)
    else
        tmp = 2.0d0 * (t_0 * y)
    end if
    code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
	double t_0 = Math.pow(((x + z) / y), 0.5);
	double tmp;
	if (y <= -4e-310) {
		tmp = 2.0 * ((t_0 * -1.0) * y);
	} else {
		tmp = 2.0 * (t_0 * y);
	}
	return tmp;
}
[x, y, z] = sort([x, y, z])
def code(x, y, z):
	t_0 = math.pow(((x + z) / y), 0.5)
	tmp = 0
	if y <= -4e-310:
		tmp = 2.0 * ((t_0 * -1.0) * y)
	else:
		tmp = 2.0 * (t_0 * y)
	return tmp
x, y, z = sort([x, y, z])
function code(x, y, z)
	t_0 = Float64(Float64(x + z) / y) ^ 0.5
	tmp = 0.0
	if (y <= -4e-310)
		tmp = Float64(2.0 * Float64(Float64(t_0 * -1.0) * y));
	else
		tmp = Float64(2.0 * Float64(t_0 * y));
	end
	return tmp
end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
	t_0 = ((x + z) / y) ^ 0.5;
	tmp = 0.0;
	if (y <= -4e-310)
		tmp = 2.0 * ((t_0 * -1.0) * y);
	else
		tmp = 2.0 * (t_0 * y);
	end
	tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[Power[N[(N[(x + z), $MachinePrecision] / y), $MachinePrecision], 0.5], $MachinePrecision]}, If[LessEqual[y, -4e-310], N[(2.0 * N[(N[(t$95$0 * -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$0 * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{x + z}{y}\right)}^{0.5}\\
\mathbf{if}\;y \leq -4 \cdot 10^{-310}:\\
\;\;\;\;2 \cdot \left(\left(t\_0 \cdot -1\right) \cdot y\right)\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t\_0 \cdot y\right)\\


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

    1. Initial program 70.6%

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\left(\sqrt{\frac{x + z}{y}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot y\right) \]
    6. Step-by-step derivation
      1. sqrt-pow2N/A

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

        \[\leadsto 2 \cdot \left(\left(\sqrt{\frac{x + z}{y}} \cdot {-1}^{1}\right) \cdot y\right) \]
      3. metadata-evalN/A

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

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

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

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

        \[\leadsto 2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{\frac{1}{2}} \cdot -1\right) \cdot y\right) \]
      8. lower-+.f6485.0

        \[\leadsto 2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{0.5} \cdot -1\right) \cdot y\right) \]
    7. Applied rewrites85.0%

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

    if -3.999999999999988e-310 < y

    1. Initial program 71.1%

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\sqrt{\frac{x + z}{y}} \cdot y\right) \]
    6. Step-by-step derivation
      1. pow1/2N/A

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

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

        \[\leadsto 2 \cdot \left({\left(\frac{x + z}{y}\right)}^{\frac{1}{2}} \cdot y\right) \]
      4. lower-+.f6484.3

        \[\leadsto 2 \cdot \left({\left(\frac{x + z}{y}\right)}^{0.5} \cdot y\right) \]
    7. Applied rewrites84.3%

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

Alternative 5: 78.8% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} t_0 := {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}\\ \mathbf{if}\;y \leq 1.95 \cdot 10^{-177}:\\ \;\;\;\;2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{0.5} \cdot -1\right) \cdot y\right)\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-12}:\\ \;\;\;\;2 \cdot \left(\left(-1 \cdot \left(z \cdot \mathsf{fma}\left(-0.5, \left(x \cdot -1\right) \cdot {\left({\left({y}^{3} \cdot z\right)}^{-1}\right)}^{0.5}, t\_0 \cdot -1\right)\right)\right) \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left({y}^{0.5}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, t\_0, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (pow (pow (* y z) -1.0) 0.5)))
   (if (<= y 1.95e-177)
     (* 2.0 (* (* (pow (/ (+ x z) y) 0.5) -1.0) y))
     (if (<= y 2.4e-12)
       (*
        2.0
        (*
         (*
          -1.0
          (*
           z
           (fma
            -0.5
            (* (* x -1.0) (pow (pow (* (pow y 3.0) z) -1.0) 0.5))
            (* t_0 -1.0))))
         y))
       (*
        2.0
        (fma
         (pow y 0.5)
         (sqrt z)
         (* x (* y (fma 0.5 t_0 (* 0.5 (pow (/ z (pow y 3.0)) 0.5)))))))))))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double t_0 = pow(pow((y * z), -1.0), 0.5);
	double tmp;
	if (y <= 1.95e-177) {
		tmp = 2.0 * ((pow(((x + z) / y), 0.5) * -1.0) * y);
	} else if (y <= 2.4e-12) {
		tmp = 2.0 * ((-1.0 * (z * fma(-0.5, ((x * -1.0) * pow(pow((pow(y, 3.0) * z), -1.0), 0.5)), (t_0 * -1.0)))) * y);
	} else {
		tmp = 2.0 * fma(pow(y, 0.5), sqrt(z), (x * (y * fma(0.5, t_0, (0.5 * pow((z / pow(y, 3.0)), 0.5))))));
	}
	return tmp;
}
x, y, z = sort([x, y, z])
function code(x, y, z)
	t_0 = (Float64(y * z) ^ -1.0) ^ 0.5
	tmp = 0.0
	if (y <= 1.95e-177)
		tmp = Float64(2.0 * Float64(Float64((Float64(Float64(x + z) / y) ^ 0.5) * -1.0) * y));
	elseif (y <= 2.4e-12)
		tmp = Float64(2.0 * Float64(Float64(-1.0 * Float64(z * fma(-0.5, Float64(Float64(x * -1.0) * ((Float64((y ^ 3.0) * z) ^ -1.0) ^ 0.5)), Float64(t_0 * -1.0)))) * y));
	else
		tmp = Float64(2.0 * fma((y ^ 0.5), sqrt(z), Float64(x * Float64(y * fma(0.5, t_0, Float64(0.5 * (Float64(z / (y ^ 3.0)) ^ 0.5)))))));
	end
	return tmp
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[Power[N[Power[N[(y * z), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]}, If[LessEqual[y, 1.95e-177], N[(2.0 * N[(N[(N[Power[N[(N[(x + z), $MachinePrecision] / y), $MachinePrecision], 0.5], $MachinePrecision] * -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.4e-12], N[(2.0 * N[(N[(-1.0 * N[(z * N[(-0.5 * N[(N[(x * -1.0), $MachinePrecision] * N[Power[N[Power[N[(N[Power[y, 3.0], $MachinePrecision] * z), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Power[y, 0.5], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(y * N[(0.5 * t$95$0 + N[(0.5 * N[Power[N[(z / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}\\
\mathbf{if}\;y \leq 1.95 \cdot 10^{-177}:\\
\;\;\;\;2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{0.5} \cdot -1\right) \cdot y\right)\\

\mathbf{elif}\;y \leq 2.4 \cdot 10^{-12}:\\
\;\;\;\;2 \cdot \left(\left(-1 \cdot \left(z \cdot \mathsf{fma}\left(-0.5, \left(x \cdot -1\right) \cdot {\left({\left({y}^{3} \cdot z\right)}^{-1}\right)}^{0.5}, t\_0 \cdot -1\right)\right)\right) \cdot y\right)\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left({y}^{0.5}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, t\_0, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right)\\


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

    1. Initial program 71.8%

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\left(\sqrt{\frac{x + z}{y}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot y\right) \]
    6. Step-by-step derivation
      1. sqrt-pow2N/A

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

        \[\leadsto 2 \cdot \left(\left(\sqrt{\frac{x + z}{y}} \cdot {-1}^{1}\right) \cdot y\right) \]
      3. metadata-evalN/A

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

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

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

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

        \[\leadsto 2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{\frac{1}{2}} \cdot -1\right) \cdot y\right) \]
      8. lower-+.f6476.6

        \[\leadsto 2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{0.5} \cdot -1\right) \cdot y\right) \]
    7. Applied rewrites76.6%

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

    if 1.95000000000000007e-177 < y < 2.39999999999999987e-12

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\left(-1 \cdot \left(z \cdot \mathsf{fma}\left(\frac{-1}{2}, \left(x \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{{y}^{3} \cdot z}}, \sqrt{\frac{1}{y \cdot z}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)\right) \cdot y\right) \]
    7. Applied rewrites58.0%

      \[\leadsto 2 \cdot \left(\left(-1 \cdot \left(z \cdot \mathsf{fma}\left(-0.5, \left(x \cdot -1\right) \cdot {\left({\left({y}^{3} \cdot z\right)}^{-1}\right)}^{0.5}, {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5} \cdot -1\right)\right)\right) \cdot y\right) \]

    if 2.39999999999999987e-12 < y

    1. Initial program 49.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \mathsf{fma}\left({y}^{\frac{1}{2}}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(\frac{1}{2}, \sqrt{\frac{1}{y \cdot z}}, \frac{1}{2} \cdot \sqrt{\frac{z}{{y}^{3}}}\right)\right)\right) \]
    7. Applied rewrites97.9%

      \[\leadsto 2 \cdot \mathsf{fma}\left({y}^{0.5}, \color{blue}{\sqrt{z}}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 78.6% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} t_0 := {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}\\ t_1 := {\left(\frac{x + z}{y}\right)}^{0.25}\\ \mathbf{if}\;y \leq 1.95 \cdot 10^{-177}:\\ \;\;\;\;2 \cdot \left(\left(\left(t\_1 \cdot t\_1\right) \cdot -1\right) \cdot y\right)\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-12}:\\ \;\;\;\;2 \cdot \left(\left(-1 \cdot \left(z \cdot \mathsf{fma}\left(-0.5, \left(x \cdot -1\right) \cdot {\left({\left({y}^{3} \cdot z\right)}^{-1}\right)}^{0.5}, t\_0 \cdot -1\right)\right)\right) \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left({y}^{0.5}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, t\_0, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (pow (pow (* y z) -1.0) 0.5)) (t_1 (pow (/ (+ x z) y) 0.25)))
   (if (<= y 1.95e-177)
     (* 2.0 (* (* (* t_1 t_1) -1.0) y))
     (if (<= y 2.4e-12)
       (*
        2.0
        (*
         (*
          -1.0
          (*
           z
           (fma
            -0.5
            (* (* x -1.0) (pow (pow (* (pow y 3.0) z) -1.0) 0.5))
            (* t_0 -1.0))))
         y))
       (*
        2.0
        (fma
         (pow y 0.5)
         (sqrt z)
         (* x (* y (fma 0.5 t_0 (* 0.5 (pow (/ z (pow y 3.0)) 0.5)))))))))))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double t_0 = pow(pow((y * z), -1.0), 0.5);
	double t_1 = pow(((x + z) / y), 0.25);
	double tmp;
	if (y <= 1.95e-177) {
		tmp = 2.0 * (((t_1 * t_1) * -1.0) * y);
	} else if (y <= 2.4e-12) {
		tmp = 2.0 * ((-1.0 * (z * fma(-0.5, ((x * -1.0) * pow(pow((pow(y, 3.0) * z), -1.0), 0.5)), (t_0 * -1.0)))) * y);
	} else {
		tmp = 2.0 * fma(pow(y, 0.5), sqrt(z), (x * (y * fma(0.5, t_0, (0.5 * pow((z / pow(y, 3.0)), 0.5))))));
	}
	return tmp;
}
x, y, z = sort([x, y, z])
function code(x, y, z)
	t_0 = (Float64(y * z) ^ -1.0) ^ 0.5
	t_1 = Float64(Float64(x + z) / y) ^ 0.25
	tmp = 0.0
	if (y <= 1.95e-177)
		tmp = Float64(2.0 * Float64(Float64(Float64(t_1 * t_1) * -1.0) * y));
	elseif (y <= 2.4e-12)
		tmp = Float64(2.0 * Float64(Float64(-1.0 * Float64(z * fma(-0.5, Float64(Float64(x * -1.0) * ((Float64((y ^ 3.0) * z) ^ -1.0) ^ 0.5)), Float64(t_0 * -1.0)))) * y));
	else
		tmp = Float64(2.0 * fma((y ^ 0.5), sqrt(z), Float64(x * Float64(y * fma(0.5, t_0, Float64(0.5 * (Float64(z / (y ^ 3.0)) ^ 0.5)))))));
	end
	return tmp
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[Power[N[Power[N[(y * z), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(x + z), $MachinePrecision] / y), $MachinePrecision], 0.25], $MachinePrecision]}, If[LessEqual[y, 1.95e-177], N[(2.0 * N[(N[(N[(t$95$1 * t$95$1), $MachinePrecision] * -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.4e-12], N[(2.0 * N[(N[(-1.0 * N[(z * N[(-0.5 * N[(N[(x * -1.0), $MachinePrecision] * N[Power[N[Power[N[(N[Power[y, 3.0], $MachinePrecision] * z), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Power[y, 0.5], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(y * N[(0.5 * t$95$0 + N[(0.5 * N[Power[N[(z / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}\\
t_1 := {\left(\frac{x + z}{y}\right)}^{0.25}\\
\mathbf{if}\;y \leq 1.95 \cdot 10^{-177}:\\
\;\;\;\;2 \cdot \left(\left(\left(t\_1 \cdot t\_1\right) \cdot -1\right) \cdot y\right)\\

\mathbf{elif}\;y \leq 2.4 \cdot 10^{-12}:\\
\;\;\;\;2 \cdot \left(\left(-1 \cdot \left(z \cdot \mathsf{fma}\left(-0.5, \left(x \cdot -1\right) \cdot {\left({\left({y}^{3} \cdot z\right)}^{-1}\right)}^{0.5}, t\_0 \cdot -1\right)\right)\right) \cdot y\right)\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left({y}^{0.5}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, t\_0, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right)\\


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

    1. Initial program 71.8%

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\left(\sqrt{\frac{x + z}{y}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot y\right) \]
    6. Step-by-step derivation
      1. sqrt-pow2N/A

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

        \[\leadsto 2 \cdot \left(\left(\sqrt{\frac{x + z}{y}} \cdot {-1}^{1}\right) \cdot y\right) \]
      3. metadata-evalN/A

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

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

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

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

        \[\leadsto 2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{\frac{1}{2}} \cdot -1\right) \cdot y\right) \]
      8. lower-+.f6476.6

        \[\leadsto 2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{0.5} \cdot -1\right) \cdot y\right) \]
    7. Applied rewrites76.6%

      \[\leadsto 2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{0.5} \cdot -1\right) \cdot y\right) \]
    8. Step-by-step derivation
      1. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\left({\left(\frac{x + z}{y}\right)}^{\frac{1}{2}} \cdot -1\right) \cdot y\right) \]
      4. sqr-powN/A

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

        \[\leadsto 2 \cdot \left(\left(\left({\left(\frac{x + z}{y}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot {\left(\frac{x + z}{y}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)}\right) \cdot -1\right) \cdot y\right) \]
      6. metadata-evalN/A

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

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

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

        \[\leadsto 2 \cdot \left(\left(\left({\left(\frac{x + z}{y}\right)}^{\frac{1}{4}} \cdot {\left(\frac{x + z}{y}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)}\right) \cdot -1\right) \cdot y\right) \]
      10. metadata-evalN/A

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

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

        \[\leadsto 2 \cdot \left(\left(\left({\left(\frac{x + z}{y}\right)}^{\frac{1}{4}} \cdot {\left(\frac{x + z}{y}\right)}^{\frac{1}{4}}\right) \cdot -1\right) \cdot y\right) \]
      13. lift-+.f6476.3

        \[\leadsto 2 \cdot \left(\left(\left({\left(\frac{x + z}{y}\right)}^{0.25} \cdot {\left(\frac{x + z}{y}\right)}^{0.25}\right) \cdot -1\right) \cdot y\right) \]
    9. Applied rewrites76.3%

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

    if 1.95000000000000007e-177 < y < 2.39999999999999987e-12

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\left(-1 \cdot \left(z \cdot \mathsf{fma}\left(\frac{-1}{2}, \left(x \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{{y}^{3} \cdot z}}, \sqrt{\frac{1}{y \cdot z}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)\right) \cdot y\right) \]
    7. Applied rewrites58.0%

      \[\leadsto 2 \cdot \left(\left(-1 \cdot \left(z \cdot \mathsf{fma}\left(-0.5, \left(x \cdot -1\right) \cdot {\left({\left({y}^{3} \cdot z\right)}^{-1}\right)}^{0.5}, {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5} \cdot -1\right)\right)\right) \cdot y\right) \]

    if 2.39999999999999987e-12 < y

    1. Initial program 49.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \mathsf{fma}\left({y}^{\frac{1}{2}}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(\frac{1}{2}, \sqrt{\frac{1}{y \cdot z}}, \frac{1}{2} \cdot \sqrt{\frac{z}{{y}^{3}}}\right)\right)\right) \]
    7. Applied rewrites97.9%

      \[\leadsto 2 \cdot \mathsf{fma}\left({y}^{0.5}, \color{blue}{\sqrt{z}}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 7: 58.6% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} t_0 := {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}\\ \mathbf{if}\;y \leq -2 \cdot 10^{-110}:\\ \;\;\;\;2 \cdot \left(-1 \cdot \left(x \cdot \left(y \cdot \mathsf{fma}\left(-0.5, {\left({\left(x \cdot {y}^{3}\right)}^{-1}\right)}^{0.5} \cdot \left(z \cdot -1\right), {\left({\left(x \cdot y\right)}^{-1}\right)}^{0.5} \cdot -1\right)\right)\right)\right)\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-12}:\\ \;\;\;\;2 \cdot \left(\left(-1 \cdot \left(z \cdot \mathsf{fma}\left(-0.5, \left(x \cdot -1\right) \cdot {\left({\left({y}^{3} \cdot z\right)}^{-1}\right)}^{0.5}, t\_0 \cdot -1\right)\right)\right) \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left({y}^{0.5}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, t\_0, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (pow (pow (* y z) -1.0) 0.5)))
   (if (<= y -2e-110)
     (*
      2.0
      (*
       -1.0
       (*
        x
        (*
         y
         (fma
          -0.5
          (* (pow (pow (* x (pow y 3.0)) -1.0) 0.5) (* z -1.0))
          (* (pow (pow (* x y) -1.0) 0.5) -1.0))))))
     (if (<= y 2.4e-12)
       (*
        2.0
        (*
         (*
          -1.0
          (*
           z
           (fma
            -0.5
            (* (* x -1.0) (pow (pow (* (pow y 3.0) z) -1.0) 0.5))
            (* t_0 -1.0))))
         y))
       (*
        2.0
        (fma
         (pow y 0.5)
         (sqrt z)
         (* x (* y (fma 0.5 t_0 (* 0.5 (pow (/ z (pow y 3.0)) 0.5)))))))))))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double t_0 = pow(pow((y * z), -1.0), 0.5);
	double tmp;
	if (y <= -2e-110) {
		tmp = 2.0 * (-1.0 * (x * (y * fma(-0.5, (pow(pow((x * pow(y, 3.0)), -1.0), 0.5) * (z * -1.0)), (pow(pow((x * y), -1.0), 0.5) * -1.0)))));
	} else if (y <= 2.4e-12) {
		tmp = 2.0 * ((-1.0 * (z * fma(-0.5, ((x * -1.0) * pow(pow((pow(y, 3.0) * z), -1.0), 0.5)), (t_0 * -1.0)))) * y);
	} else {
		tmp = 2.0 * fma(pow(y, 0.5), sqrt(z), (x * (y * fma(0.5, t_0, (0.5 * pow((z / pow(y, 3.0)), 0.5))))));
	}
	return tmp;
}
x, y, z = sort([x, y, z])
function code(x, y, z)
	t_0 = (Float64(y * z) ^ -1.0) ^ 0.5
	tmp = 0.0
	if (y <= -2e-110)
		tmp = Float64(2.0 * Float64(-1.0 * Float64(x * Float64(y * fma(-0.5, Float64(((Float64(x * (y ^ 3.0)) ^ -1.0) ^ 0.5) * Float64(z * -1.0)), Float64(((Float64(x * y) ^ -1.0) ^ 0.5) * -1.0))))));
	elseif (y <= 2.4e-12)
		tmp = Float64(2.0 * Float64(Float64(-1.0 * Float64(z * fma(-0.5, Float64(Float64(x * -1.0) * ((Float64((y ^ 3.0) * z) ^ -1.0) ^ 0.5)), Float64(t_0 * -1.0)))) * y));
	else
		tmp = Float64(2.0 * fma((y ^ 0.5), sqrt(z), Float64(x * Float64(y * fma(0.5, t_0, Float64(0.5 * (Float64(z / (y ^ 3.0)) ^ 0.5)))))));
	end
	return tmp
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[Power[N[Power[N[(y * z), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]}, If[LessEqual[y, -2e-110], N[(2.0 * N[(-1.0 * N[(x * N[(y * N[(-0.5 * N[(N[Power[N[Power[N[(x * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] * N[(z * -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[Power[N[(x * y), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.4e-12], N[(2.0 * N[(N[(-1.0 * N[(z * N[(-0.5 * N[(N[(x * -1.0), $MachinePrecision] * N[Power[N[Power[N[(N[Power[y, 3.0], $MachinePrecision] * z), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Power[y, 0.5], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(y * N[(0.5 * t$95$0 + N[(0.5 * N[Power[N[(z / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}\\
\mathbf{if}\;y \leq -2 \cdot 10^{-110}:\\
\;\;\;\;2 \cdot \left(-1 \cdot \left(x \cdot \left(y \cdot \mathsf{fma}\left(-0.5, {\left({\left(x \cdot {y}^{3}\right)}^{-1}\right)}^{0.5} \cdot \left(z \cdot -1\right), {\left({\left(x \cdot y\right)}^{-1}\right)}^{0.5} \cdot -1\right)\right)\right)\right)\\

\mathbf{elif}\;y \leq 2.4 \cdot 10^{-12}:\\
\;\;\;\;2 \cdot \left(\left(-1 \cdot \left(z \cdot \mathsf{fma}\left(-0.5, \left(x \cdot -1\right) \cdot {\left({\left({y}^{3} \cdot z\right)}^{-1}\right)}^{0.5}, t\_0 \cdot -1\right)\right)\right) \cdot y\right)\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left({y}^{0.5}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, t\_0, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right)\\


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

    1. Initial program 64.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(-1 \cdot \color{blue}{\left(x \cdot \left(y \cdot \mathsf{fma}\left(-0.5, {\left({\left(x \cdot {y}^{3}\right)}^{-1}\right)}^{0.5} \cdot \left(z \cdot -1\right), {\left({\left(x \cdot y\right)}^{-1}\right)}^{0.5} \cdot -1\right)\right)\right)}\right) \]

    if -2.0000000000000001e-110 < y < 2.39999999999999987e-12

    1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\left(-1 \cdot \left(z \cdot \mathsf{fma}\left(-0.5, \left(x \cdot -1\right) \cdot {\left({\left({y}^{3} \cdot z\right)}^{-1}\right)}^{0.5}, {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5} \cdot -1\right)\right)\right) \cdot y\right) \]

    if 2.39999999999999987e-12 < y

    1. Initial program 49.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \mathsf{fma}\left({y}^{\frac{1}{2}}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(\frac{1}{2}, \sqrt{\frac{1}{y \cdot z}}, \frac{1}{2} \cdot \sqrt{\frac{z}{{y}^{3}}}\right)\right)\right) \]
    7. Applied rewrites97.9%

      \[\leadsto 2 \cdot \mathsf{fma}\left({y}^{0.5}, \color{blue}{\sqrt{z}}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 8: 54.3% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -3.1 \cdot 10^{-280}:\\ \;\;\;\;2 \cdot \left(-1 \cdot \left(x \cdot \left(y \cdot \mathsf{fma}\left(-0.5, {\left({\left(x \cdot {y}^{3}\right)}^{-1}\right)}^{0.5} \cdot \left(z \cdot -1\right), {\left({\left(x \cdot y\right)}^{-1}\right)}^{0.5} \cdot -1\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left({y}^{0.5}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= y -3.1e-280)
   (*
    2.0
    (*
     -1.0
     (*
      x
      (*
       y
       (fma
        -0.5
        (* (pow (pow (* x (pow y 3.0)) -1.0) 0.5) (* z -1.0))
        (* (pow (pow (* x y) -1.0) 0.5) -1.0))))))
   (*
    2.0
    (fma
     (pow y 0.5)
     (sqrt z)
     (*
      x
      (*
       y
       (fma
        0.5
        (pow (pow (* y z) -1.0) 0.5)
        (* 0.5 (pow (/ z (pow y 3.0)) 0.5)))))))))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double tmp;
	if (y <= -3.1e-280) {
		tmp = 2.0 * (-1.0 * (x * (y * fma(-0.5, (pow(pow((x * pow(y, 3.0)), -1.0), 0.5) * (z * -1.0)), (pow(pow((x * y), -1.0), 0.5) * -1.0)))));
	} else {
		tmp = 2.0 * fma(pow(y, 0.5), sqrt(z), (x * (y * fma(0.5, pow(pow((y * z), -1.0), 0.5), (0.5 * pow((z / pow(y, 3.0)), 0.5))))));
	}
	return tmp;
}
x, y, z = sort([x, y, z])
function code(x, y, z)
	tmp = 0.0
	if (y <= -3.1e-280)
		tmp = Float64(2.0 * Float64(-1.0 * Float64(x * Float64(y * fma(-0.5, Float64(((Float64(x * (y ^ 3.0)) ^ -1.0) ^ 0.5) * Float64(z * -1.0)), Float64(((Float64(x * y) ^ -1.0) ^ 0.5) * -1.0))))));
	else
		tmp = Float64(2.0 * fma((y ^ 0.5), sqrt(z), Float64(x * Float64(y * fma(0.5, ((Float64(y * z) ^ -1.0) ^ 0.5), Float64(0.5 * (Float64(z / (y ^ 3.0)) ^ 0.5)))))));
	end
	return tmp
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[y, -3.1e-280], N[(2.0 * N[(-1.0 * N[(x * N[(y * N[(-0.5 * N[(N[Power[N[Power[N[(x * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] * N[(z * -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[Power[N[(x * y), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Power[y, 0.5], $MachinePrecision] * N[Sqrt[z], $MachinePrecision] + N[(x * N[(y * N[(0.5 * N[Power[N[Power[N[(y * z), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.5 * N[Power[N[(z / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{-280}:\\
\;\;\;\;2 \cdot \left(-1 \cdot \left(x \cdot \left(y \cdot \mathsf{fma}\left(-0.5, {\left({\left(x \cdot {y}^{3}\right)}^{-1}\right)}^{0.5} \cdot \left(z \cdot -1\right), {\left({\left(x \cdot y\right)}^{-1}\right)}^{0.5} \cdot -1\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left({y}^{0.5}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right)\\


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

    1. Initial program 70.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(-1 \cdot \color{blue}{\left(x \cdot \left(y \cdot \mathsf{fma}\left(-0.5, {\left({\left(x \cdot {y}^{3}\right)}^{-1}\right)}^{0.5} \cdot \left(z \cdot -1\right), {\left({\left(x \cdot y\right)}^{-1}\right)}^{0.5} \cdot -1\right)\right)\right)}\right) \]

    if -3.10000000000000021e-280 < y

    1. Initial program 71.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \mathsf{fma}\left({y}^{\frac{1}{2}}, \sqrt{z}, x \cdot \left(y \cdot \mathsf{fma}\left(\frac{1}{2}, \sqrt{\frac{1}{y \cdot z}}, \frac{1}{2} \cdot \sqrt{\frac{z}{{y}^{3}}}\right)\right)\right) \]
    7. Applied rewrites63.0%

      \[\leadsto 2 \cdot \mathsf{fma}\left({y}^{0.5}, \color{blue}{\sqrt{z}}, x \cdot \left(y \cdot \mathsf{fma}\left(0.5, {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5}, 0.5 \cdot {\left(\frac{z}{{y}^{3}}\right)}^{0.5}\right)\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 25.2% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -4.4 \cdot 10^{-109}:\\ \;\;\;\;2 \cdot \left(-1 \cdot \left(x \cdot \left(y \cdot \mathsf{fma}\left(-0.5, {\left({\left(x \cdot {y}^{3}\right)}^{-1}\right)}^{0.5} \cdot \left(z \cdot -1\right), {\left({\left(x \cdot y\right)}^{-1}\right)}^{0.5} \cdot -1\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{z}{x}\right)}^{0.5} \cdot y\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= y -4.4e-109)
   (*
    2.0
    (*
     -1.0
     (*
      x
      (*
       y
       (fma
        -0.5
        (* (pow (pow (* x (pow y 3.0)) -1.0) 0.5) (* z -1.0))
        (* (pow (pow (* x y) -1.0) 0.5) -1.0))))))
   (* (pow (/ z x) 0.5) y)))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double tmp;
	if (y <= -4.4e-109) {
		tmp = 2.0 * (-1.0 * (x * (y * fma(-0.5, (pow(pow((x * pow(y, 3.0)), -1.0), 0.5) * (z * -1.0)), (pow(pow((x * y), -1.0), 0.5) * -1.0)))));
	} else {
		tmp = pow((z / x), 0.5) * y;
	}
	return tmp;
}
x, y, z = sort([x, y, z])
function code(x, y, z)
	tmp = 0.0
	if (y <= -4.4e-109)
		tmp = Float64(2.0 * Float64(-1.0 * Float64(x * Float64(y * fma(-0.5, Float64(((Float64(x * (y ^ 3.0)) ^ -1.0) ^ 0.5) * Float64(z * -1.0)), Float64(((Float64(x * y) ^ -1.0) ^ 0.5) * -1.0))))));
	else
		tmp = Float64((Float64(z / x) ^ 0.5) * y);
	end
	return tmp
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[y, -4.4e-109], N[(2.0 * N[(-1.0 * N[(x * N[(y * N[(-0.5 * N[(N[Power[N[Power[N[(x * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] * N[(z * -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[Power[N[(x * y), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(z / x), $MachinePrecision], 0.5], $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{-109}:\\
\;\;\;\;2 \cdot \left(-1 \cdot \left(x \cdot \left(y \cdot \mathsf{fma}\left(-0.5, {\left({\left(x \cdot {y}^{3}\right)}^{-1}\right)}^{0.5} \cdot \left(z \cdot -1\right), {\left({\left(x \cdot y\right)}^{-1}\right)}^{0.5} \cdot -1\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;{\left(\frac{z}{x}\right)}^{0.5} \cdot y\\


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

    1. Initial program 64.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(-1 \cdot \left(x \cdot \left(y \cdot \mathsf{fma}\left(\frac{-1}{2}, \sqrt{\frac{1}{x \cdot {y}^{3}}} \cdot \color{blue}{\left(z \cdot {\left(\sqrt{-1}\right)}^{2}\right)}, \sqrt{\frac{1}{x \cdot y}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)\right)\right) \]
    7. Applied rewrites60.5%

      \[\leadsto 2 \cdot \left(-1 \cdot \color{blue}{\left(x \cdot \left(y \cdot \mathsf{fma}\left(-0.5, {\left({\left(x \cdot {y}^{3}\right)}^{-1}\right)}^{0.5} \cdot \left(z \cdot -1\right), {\left({\left(x \cdot y\right)}^{-1}\right)}^{0.5} \cdot -1\right)\right)\right)}\right) \]

    if -4.3999999999999999e-109 < y

    1. Initial program 74.8%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\sqrt{\frac{1}{x \cdot z}} \cdot y, \color{blue}{x} + z, 2 \cdot \sqrt{x \cdot z}\right) \]
      5. pow1/2N/A

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

        \[\leadsto \mathsf{fma}\left({\left(\frac{1}{x \cdot z}\right)}^{\frac{1}{2}} \cdot y, x + z, 2 \cdot \sqrt{x \cdot z}\right) \]
      7. inv-powN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, \sqrt{x \cdot z} \cdot 2\right) \]
      15. pow1/2N/A

        \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, {\left(x \cdot z\right)}^{\frac{1}{2}} \cdot 2\right) \]
      16. lower-pow.f64N/A

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

        \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, {\left(z \cdot x\right)}^{\frac{1}{2}} \cdot 2\right) \]
      18. lower-*.f643.9

        \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{0.5} \cdot y, z + x, {\left(z \cdot x\right)}^{0.5} \cdot 2\right) \]
    4. Applied rewrites3.9%

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

      \[\leadsto \sqrt{\frac{z}{x}} \cdot \color{blue}{y} \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{z}{x}} \cdot y \]
      2. pow1/2N/A

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

        \[\leadsto {\left(\frac{z}{x}\right)}^{\frac{1}{2}} \cdot y \]
      4. lower-/.f643.8

        \[\leadsto {\left(\frac{z}{x}\right)}^{0.5} \cdot y \]
    7. Applied rewrites3.8%

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

Alternative 10: 24.1% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ 2 \cdot \left(x \cdot \left(y \cdot \left({\left({\left(x \cdot y\right)}^{-1}\right)}^{0.5} + 0.5 \cdot \left({\left({\left(x \cdot {y}^{3}\right)}^{-1}\right)}^{0.5} \cdot z\right)\right)\right)\right) \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (*
  2.0
  (*
   x
   (*
    y
    (+
     (pow (pow (* x y) -1.0) 0.5)
     (* 0.5 (* (pow (pow (* x (pow y 3.0)) -1.0) 0.5) z)))))))
assert(x < y && y < z);
double code(double x, double y, double z) {
	return 2.0 * (x * (y * (pow(pow((x * y), -1.0), 0.5) + (0.5 * (pow(pow((x * pow(y, 3.0)), -1.0), 0.5) * z)))));
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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 * (x * (y * ((((x * y) ** (-1.0d0)) ** 0.5d0) + (0.5d0 * ((((x * (y ** 3.0d0)) ** (-1.0d0)) ** 0.5d0) * z)))))
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
	return 2.0 * (x * (y * (Math.pow(Math.pow((x * y), -1.0), 0.5) + (0.5 * (Math.pow(Math.pow((x * Math.pow(y, 3.0)), -1.0), 0.5) * z)))));
}
[x, y, z] = sort([x, y, z])
def code(x, y, z):
	return 2.0 * (x * (y * (math.pow(math.pow((x * y), -1.0), 0.5) + (0.5 * (math.pow(math.pow((x * math.pow(y, 3.0)), -1.0), 0.5) * z)))))
x, y, z = sort([x, y, z])
function code(x, y, z)
	return Float64(2.0 * Float64(x * Float64(y * Float64(((Float64(x * y) ^ -1.0) ^ 0.5) + Float64(0.5 * Float64(((Float64(x * (y ^ 3.0)) ^ -1.0) ^ 0.5) * z))))))
end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
	tmp = 2.0 * (x * (y * ((((x * y) ^ -1.0) ^ 0.5) + (0.5 * ((((x * (y ^ 3.0)) ^ -1.0) ^ 0.5) * z)))));
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(2.0 * N[(x * N[(y * N[(N[Power[N[Power[N[(x * y), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] + N[(0.5 * N[(N[Power[N[Power[N[(x * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
2 \cdot \left(x \cdot \left(y \cdot \left({\left({\left(x \cdot y\right)}^{-1}\right)}^{0.5} + 0.5 \cdot \left({\left({\left(x \cdot {y}^{3}\right)}^{-1}\right)}^{0.5} \cdot z\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 70.9%

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\left(-1 \cdot \left(z \cdot \mathsf{fma}\left(\frac{-1}{2}, \left(x \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{{y}^{3} \cdot z}}, \sqrt{\frac{1}{y \cdot z}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)\right) \cdot y\right) \]
  7. Applied rewrites23.6%

    \[\leadsto 2 \cdot \left(\left(-1 \cdot \left(z \cdot \mathsf{fma}\left(-0.5, \left(x \cdot -1\right) \cdot {\left({\left({y}^{3} \cdot z\right)}^{-1}\right)}^{0.5}, {\left({\left(y \cdot z\right)}^{-1}\right)}^{0.5} \cdot -1\right)\right)\right) \cdot y\right) \]
  8. Taylor expanded in x around inf

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

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

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

      \[\leadsto 2 \cdot \left(x \cdot \left(y \cdot \left(\sqrt{\frac{1}{x \cdot y}} + \frac{1}{2} \cdot \color{blue}{\left(\sqrt{\frac{1}{x \cdot {y}^{3}}} \cdot z\right)}\right)\right)\right) \]
    4. pow1/2N/A

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(x \cdot \left(y \cdot \left({\left({\left(x \cdot y\right)}^{-1}\right)}^{\frac{1}{2}} + \frac{1}{2} \cdot \left(\sqrt{\frac{1}{x \cdot {y}^{3}}} \cdot z\right)\right)\right)\right) \]
  10. Applied rewrites24.1%

    \[\leadsto 2 \cdot \left(x \cdot \color{blue}{\left(y \cdot \left({\left({\left(x \cdot y\right)}^{-1}\right)}^{0.5} + 0.5 \cdot \left({\left({\left(x \cdot {y}^{3}\right)}^{-1}\right)}^{0.5} \cdot z\right)\right)\right)}\right) \]
  11. Add Preprocessing

Alternative 11: 3.8% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \mathsf{fma}\left({\left(z \cdot x\right)}^{-0.5} \cdot y, z + x, {\left(z \cdot x\right)}^{0.5} \cdot 2\right) \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (fma (* (pow (* z x) -0.5) y) (+ z x) (* (pow (* z x) 0.5) 2.0)))
assert(x < y && y < z);
double code(double x, double y, double z) {
	return fma((pow((z * x), -0.5) * y), (z + x), (pow((z * x), 0.5) * 2.0));
}
x, y, z = sort([x, y, z])
function code(x, y, z)
	return fma(Float64((Float64(z * x) ^ -0.5) * y), Float64(z + x), Float64((Float64(z * x) ^ 0.5) * 2.0))
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(N[(N[Power[N[(z * x), $MachinePrecision], -0.5], $MachinePrecision] * y), $MachinePrecision] * N[(z + x), $MachinePrecision] + N[(N[Power[N[(z * x), $MachinePrecision], 0.5], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\mathsf{fma}\left({\left(z \cdot x\right)}^{-0.5} \cdot y, z + x, {\left(z \cdot x\right)}^{0.5} \cdot 2\right)
\end{array}
Derivation
  1. Initial program 70.9%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\sqrt{\frac{1}{x \cdot z}} \cdot y, \color{blue}{x} + z, 2 \cdot \sqrt{x \cdot z}\right) \]
    5. pow1/2N/A

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

      \[\leadsto \mathsf{fma}\left({\left(\frac{1}{x \cdot z}\right)}^{\frac{1}{2}} \cdot y, x + z, 2 \cdot \sqrt{x \cdot z}\right) \]
    7. inv-powN/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, \sqrt{x \cdot z} \cdot 2\right) \]
    15. pow1/2N/A

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, {\left(x \cdot z\right)}^{\frac{1}{2}} \cdot 2\right) \]
    16. lower-pow.f64N/A

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

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, {\left(z \cdot x\right)}^{\frac{1}{2}} \cdot 2\right) \]
    18. lower-*.f643.8

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{0.5} \cdot y, z + x, {\left(z \cdot x\right)}^{0.5} \cdot 2\right) \]
  4. Applied rewrites3.8%

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

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

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

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, {\left(z \cdot x\right)}^{\frac{1}{2}} \cdot 2\right) \]
    4. pow-powN/A

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

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

      \[\leadsto \mathsf{fma}\left({\left(z \cdot x\right)}^{\frac{-1}{2}} \cdot y, z + x, {\left(z \cdot x\right)}^{\frac{1}{2}} \cdot 2\right) \]
    7. lift-*.f643.8

      \[\leadsto \mathsf{fma}\left({\left(z \cdot x\right)}^{-0.5} \cdot y, z + x, {\left(z \cdot x\right)}^{0.5} \cdot 2\right) \]
  6. Applied rewrites3.8%

    \[\leadsto \mathsf{fma}\left({\left(z \cdot x\right)}^{-0.5} \cdot y, z + x, {\left(z \cdot x\right)}^{0.5} \cdot 2\right) \]
  7. Add Preprocessing

Alternative 12: 3.0% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ {\left(\frac{z}{x}\right)}^{0.5} \cdot y \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (* (pow (/ z x) 0.5) y))
assert(x < y && y < z);
double code(double x, double y, double z) {
	return pow((z / x), 0.5) * y;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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 = ((z / x) ** 0.5d0) * y
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
	return Math.pow((z / x), 0.5) * y;
}
[x, y, z] = sort([x, y, z])
def code(x, y, z):
	return math.pow((z / x), 0.5) * y
x, y, z = sort([x, y, z])
function code(x, y, z)
	return Float64((Float64(z / x) ^ 0.5) * y)
end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
	tmp = ((z / x) ^ 0.5) * y;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(N[Power[N[(z / x), $MachinePrecision], 0.5], $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
{\left(\frac{z}{x}\right)}^{0.5} \cdot y
\end{array}
Derivation
  1. Initial program 70.9%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\sqrt{\frac{1}{x \cdot z}} \cdot y, \color{blue}{x} + z, 2 \cdot \sqrt{x \cdot z}\right) \]
    5. pow1/2N/A

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

      \[\leadsto \mathsf{fma}\left({\left(\frac{1}{x \cdot z}\right)}^{\frac{1}{2}} \cdot y, x + z, 2 \cdot \sqrt{x \cdot z}\right) \]
    7. inv-powN/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, \sqrt{x \cdot z} \cdot 2\right) \]
    15. pow1/2N/A

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, {\left(x \cdot z\right)}^{\frac{1}{2}} \cdot 2\right) \]
    16. lower-pow.f64N/A

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

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, {\left(z \cdot x\right)}^{\frac{1}{2}} \cdot 2\right) \]
    18. lower-*.f643.8

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{0.5} \cdot y, z + x, {\left(z \cdot x\right)}^{0.5} \cdot 2\right) \]
  4. Applied rewrites3.8%

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

    \[\leadsto \sqrt{\frac{z}{x}} \cdot \color{blue}{y} \]
  6. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \sqrt{\frac{z}{x}} \cdot y \]
    2. pow1/2N/A

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

      \[\leadsto {\left(\frac{z}{x}\right)}^{\frac{1}{2}} \cdot y \]
    4. lower-/.f643.0

      \[\leadsto {\left(\frac{z}{x}\right)}^{0.5} \cdot y \]
  7. Applied rewrites3.0%

    \[\leadsto {\left(\frac{z}{x}\right)}^{0.5} \cdot \color{blue}{y} \]
  8. Add Preprocessing

Alternative 13: 2.9% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ x \cdot \mathsf{fma}\left(2, {\left(\frac{z}{x}\right)}^{0.5}, \mathsf{fma}\left({\left({\left(x \cdot z\right)}^{-1}\right)}^{0.5}, y, {\left(\frac{z}{{x}^{3}}\right)}^{0.5} \cdot y\right)\right) \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (*
  x
  (fma
   2.0
   (pow (/ z x) 0.5)
   (fma (pow (pow (* x z) -1.0) 0.5) y (* (pow (/ z (pow x 3.0)) 0.5) y)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
	return x * fma(2.0, pow((z / x), 0.5), fma(pow(pow((x * z), -1.0), 0.5), y, (pow((z / pow(x, 3.0)), 0.5) * y)));
}
x, y, z = sort([x, y, z])
function code(x, y, z)
	return Float64(x * fma(2.0, (Float64(z / x) ^ 0.5), fma(((Float64(x * z) ^ -1.0) ^ 0.5), y, Float64((Float64(z / (x ^ 3.0)) ^ 0.5) * y))))
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(x * N[(2.0 * N[Power[N[(z / x), $MachinePrecision], 0.5], $MachinePrecision] + N[(N[Power[N[Power[N[(x * z), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] * y + N[(N[Power[N[(z / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
x \cdot \mathsf{fma}\left(2, {\left(\frac{z}{x}\right)}^{0.5}, \mathsf{fma}\left({\left({\left(x \cdot z\right)}^{-1}\right)}^{0.5}, y, {\left(\frac{z}{{x}^{3}}\right)}^{0.5} \cdot y\right)\right)
\end{array}
Derivation
  1. Initial program 70.9%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\sqrt{\frac{1}{x \cdot z}} \cdot y, \color{blue}{x} + z, 2 \cdot \sqrt{x \cdot z}\right) \]
    5. pow1/2N/A

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

      \[\leadsto \mathsf{fma}\left({\left(\frac{1}{x \cdot z}\right)}^{\frac{1}{2}} \cdot y, x + z, 2 \cdot \sqrt{x \cdot z}\right) \]
    7. inv-powN/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, \sqrt{x \cdot z} \cdot 2\right) \]
    15. pow1/2N/A

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, {\left(x \cdot z\right)}^{\frac{1}{2}} \cdot 2\right) \]
    16. lower-pow.f64N/A

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

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, {\left(z \cdot x\right)}^{\frac{1}{2}} \cdot 2\right) \]
    18. lower-*.f643.8

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{0.5} \cdot y, z + x, {\left(z \cdot x\right)}^{0.5} \cdot 2\right) \]
  4. Applied rewrites3.8%

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

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

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

      \[\leadsto x \cdot \mathsf{fma}\left(2, \sqrt{\frac{z}{x}}, \sqrt{\frac{1}{x \cdot z}} \cdot y + \sqrt{\frac{z}{{x}^{3}}} \cdot y\right) \]
    3. pow1/2N/A

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

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

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

      \[\leadsto x \cdot \mathsf{fma}\left(2, {\left(\frac{z}{x}\right)}^{\frac{1}{2}}, \mathsf{fma}\left(\sqrt{\frac{1}{x \cdot z}}, y, \sqrt{\frac{z}{{x}^{3}}} \cdot y\right)\right) \]
    7. pow1/2N/A

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

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

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

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

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

      \[\leadsto x \cdot \mathsf{fma}\left(2, {\left(\frac{z}{x}\right)}^{\frac{1}{2}}, \mathsf{fma}\left({\left({\left(x \cdot z\right)}^{-1}\right)}^{\frac{1}{2}}, y, \sqrt{\frac{z}{{x}^{3}}} \cdot y\right)\right) \]
  7. Applied rewrites2.9%

    \[\leadsto x \cdot \color{blue}{\mathsf{fma}\left(2, {\left(\frac{z}{x}\right)}^{0.5}, \mathsf{fma}\left({\left({\left(x \cdot z\right)}^{-1}\right)}^{0.5}, y, {\left(\frac{z}{{x}^{3}}\right)}^{0.5} \cdot y\right)\right)} \]
  8. Add Preprocessing

Alternative 14: 2.3% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ x \cdot \mathsf{fma}\left(2, {\left(\frac{z}{x}\right)}^{0.5} \cdot -1, \mathsf{fma}\left({\left({\left(x \cdot z\right)}^{-1}\right)}^{0.5}, y, {\left(\frac{z}{{x}^{3}}\right)}^{0.5} \cdot y\right)\right) \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (*
  x
  (fma
   2.0
   (* (pow (/ z x) 0.5) -1.0)
   (fma (pow (pow (* x z) -1.0) 0.5) y (* (pow (/ z (pow x 3.0)) 0.5) y)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
	return x * fma(2.0, (pow((z / x), 0.5) * -1.0), fma(pow(pow((x * z), -1.0), 0.5), y, (pow((z / pow(x, 3.0)), 0.5) * y)));
}
x, y, z = sort([x, y, z])
function code(x, y, z)
	return Float64(x * fma(2.0, Float64((Float64(z / x) ^ 0.5) * -1.0), fma(((Float64(x * z) ^ -1.0) ^ 0.5), y, Float64((Float64(z / (x ^ 3.0)) ^ 0.5) * y))))
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(x * N[(2.0 * N[(N[Power[N[(z / x), $MachinePrecision], 0.5], $MachinePrecision] * -1.0), $MachinePrecision] + N[(N[Power[N[Power[N[(x * z), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] * y + N[(N[Power[N[(z / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
x \cdot \mathsf{fma}\left(2, {\left(\frac{z}{x}\right)}^{0.5} \cdot -1, \mathsf{fma}\left({\left({\left(x \cdot z\right)}^{-1}\right)}^{0.5}, y, {\left(\frac{z}{{x}^{3}}\right)}^{0.5} \cdot y\right)\right)
\end{array}
Derivation
  1. Initial program 70.9%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\sqrt{\frac{1}{x \cdot z}} \cdot y, \color{blue}{x} + z, 2 \cdot \sqrt{x \cdot z}\right) \]
    5. pow1/2N/A

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

      \[\leadsto \mathsf{fma}\left({\left(\frac{1}{x \cdot z}\right)}^{\frac{1}{2}} \cdot y, x + z, 2 \cdot \sqrt{x \cdot z}\right) \]
    7. inv-powN/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, \sqrt{x \cdot z} \cdot 2\right) \]
    15. pow1/2N/A

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, {\left(x \cdot z\right)}^{\frac{1}{2}} \cdot 2\right) \]
    16. lower-pow.f64N/A

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

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, {\left(z \cdot x\right)}^{\frac{1}{2}} \cdot 2\right) \]
    18. lower-*.f643.8

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{0.5} \cdot y, z + x, {\left(z \cdot x\right)}^{0.5} \cdot 2\right) \]
  4. Applied rewrites3.8%

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

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

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

      \[\leadsto x \cdot \mathsf{fma}\left(2, \sqrt{\frac{z}{x}}, \sqrt{\frac{1}{x \cdot z}} \cdot y + \sqrt{\frac{z}{{x}^{3}}} \cdot y\right) \]
    3. pow1/2N/A

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

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

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

      \[\leadsto x \cdot \mathsf{fma}\left(2, {\left(\frac{z}{x}\right)}^{\frac{1}{2}}, \mathsf{fma}\left(\sqrt{\frac{1}{x \cdot z}}, y, \sqrt{\frac{z}{{x}^{3}}} \cdot y\right)\right) \]
    7. pow1/2N/A

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

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

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

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

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

      \[\leadsto x \cdot \mathsf{fma}\left(2, {\left(\frac{z}{x}\right)}^{\frac{1}{2}}, \mathsf{fma}\left({\left({\left(x \cdot z\right)}^{-1}\right)}^{\frac{1}{2}}, y, \sqrt{\frac{z}{{x}^{3}}} \cdot y\right)\right) \]
  7. Applied rewrites2.9%

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

    \[\leadsto x \cdot \mathsf{fma}\left(2, \sqrt{\frac{z}{x}} \cdot {\left(\sqrt{-1}\right)}^{\color{blue}{2}}, \mathsf{fma}\left({\left({\left(x \cdot z\right)}^{-1}\right)}^{\frac{1}{2}}, y, {\left(\frac{z}{{x}^{3}}\right)}^{\frac{1}{2}} \cdot y\right)\right) \]
  9. Step-by-step derivation
    1. pow1/2N/A

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

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

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

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

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

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

      \[\leadsto x \cdot \mathsf{fma}\left(2, {\left(\frac{z}{x}\right)}^{0.5} \cdot -1, \mathsf{fma}\left({\left({\left(x \cdot z\right)}^{-1}\right)}^{0.5}, y, {\left(\frac{z}{{x}^{3}}\right)}^{0.5} \cdot y\right)\right) \]
  10. Applied rewrites2.3%

    \[\leadsto x \cdot \mathsf{fma}\left(2, {\left(\frac{z}{x}\right)}^{0.5} \cdot -1, \mathsf{fma}\left({\left({\left(x \cdot z\right)}^{-1}\right)}^{0.5}, y, {\left(\frac{z}{{x}^{3}}\right)}^{0.5} \cdot y\right)\right) \]
  11. Add Preprocessing

Alternative 15: 2.0% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} t_0 := {\left(\frac{z}{x}\right)}^{0.5}\\ x \cdot \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(2, t\_0, {\left(\frac{z}{{x}^{3}}\right)}^{0.5} \cdot y\right), t\_0 \cdot y\right)}{z} \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (pow (/ z x) 0.5)))
   (*
    x
    (/ (fma z (fma 2.0 t_0 (* (pow (/ z (pow x 3.0)) 0.5) y)) (* t_0 y)) z))))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double t_0 = pow((z / x), 0.5);
	return x * (fma(z, fma(2.0, t_0, (pow((z / pow(x, 3.0)), 0.5) * y)), (t_0 * y)) / z);
}
x, y, z = sort([x, y, z])
function code(x, y, z)
	t_0 = Float64(z / x) ^ 0.5
	return Float64(x * Float64(fma(z, fma(2.0, t_0, Float64((Float64(z / (x ^ 3.0)) ^ 0.5) * y)), Float64(t_0 * y)) / z))
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[Power[N[(z / x), $MachinePrecision], 0.5], $MachinePrecision]}, N[(x * N[(N[(z * N[(2.0 * t$95$0 + N[(N[Power[N[(z / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{z}{x}\right)}^{0.5}\\
x \cdot \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(2, t\_0, {\left(\frac{z}{{x}^{3}}\right)}^{0.5} \cdot y\right), t\_0 \cdot y\right)}{z}
\end{array}
\end{array}
Derivation
  1. Initial program 70.9%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\sqrt{\frac{1}{x \cdot z}} \cdot y, \color{blue}{x} + z, 2 \cdot \sqrt{x \cdot z}\right) \]
    5. pow1/2N/A

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

      \[\leadsto \mathsf{fma}\left({\left(\frac{1}{x \cdot z}\right)}^{\frac{1}{2}} \cdot y, x + z, 2 \cdot \sqrt{x \cdot z}\right) \]
    7. inv-powN/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, \sqrt{x \cdot z} \cdot 2\right) \]
    15. pow1/2N/A

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, {\left(x \cdot z\right)}^{\frac{1}{2}} \cdot 2\right) \]
    16. lower-pow.f64N/A

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

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{\frac{1}{2}} \cdot y, z + x, {\left(z \cdot x\right)}^{\frac{1}{2}} \cdot 2\right) \]
    18. lower-*.f643.8

      \[\leadsto \mathsf{fma}\left({\left({\left(z \cdot x\right)}^{-1}\right)}^{0.5} \cdot y, z + x, {\left(z \cdot x\right)}^{0.5} \cdot 2\right) \]
  4. Applied rewrites3.8%

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

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

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

      \[\leadsto x \cdot \mathsf{fma}\left(2, \sqrt{\frac{z}{x}}, \sqrt{\frac{1}{x \cdot z}} \cdot y + \sqrt{\frac{z}{{x}^{3}}} \cdot y\right) \]
    3. pow1/2N/A

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

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

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

      \[\leadsto x \cdot \mathsf{fma}\left(2, {\left(\frac{z}{x}\right)}^{\frac{1}{2}}, \mathsf{fma}\left(\sqrt{\frac{1}{x \cdot z}}, y, \sqrt{\frac{z}{{x}^{3}}} \cdot y\right)\right) \]
    7. pow1/2N/A

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

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

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

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

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

      \[\leadsto x \cdot \mathsf{fma}\left(2, {\left(\frac{z}{x}\right)}^{\frac{1}{2}}, \mathsf{fma}\left({\left({\left(x \cdot z\right)}^{-1}\right)}^{\frac{1}{2}}, y, \sqrt{\frac{z}{{x}^{3}}} \cdot y\right)\right) \]
  7. Applied rewrites2.9%

    \[\leadsto x \cdot \color{blue}{\mathsf{fma}\left(2, {\left(\frac{z}{x}\right)}^{0.5}, \mathsf{fma}\left({\left({\left(x \cdot z\right)}^{-1}\right)}^{0.5}, y, {\left(\frac{z}{{x}^{3}}\right)}^{0.5} \cdot y\right)\right)} \]
  8. Taylor expanded in z around 0

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

      \[\leadsto x \cdot \frac{z \cdot \left(2 \cdot \sqrt{\frac{z}{x}} + \sqrt{\frac{z}{{x}^{3}}} \cdot y\right) + \sqrt{\frac{z}{x}} \cdot y}{z} \]
  10. Applied rewrites2.0%

    \[\leadsto x \cdot \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(2, {\left(\frac{z}{x}\right)}^{0.5}, {\left(\frac{z}{{x}^{3}}\right)}^{0.5} \cdot y\right), {\left(\frac{z}{x}\right)}^{0.5} \cdot y\right)}{z} \]
  11. Add Preprocessing

Reproduce

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