Diagrams.Solve.Polynomial:quadForm from diagrams-solve-0.1, B

Percentage Accurate: 99.8% → 99.8%
Time: 6.5s
Alternatives: 6
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right) \end{array} \]
(FPCore (x y z) :precision binary64 (* (/ 1.0 2.0) (+ x (* y (sqrt z)))))
double code(double x, double y, double z) {
	return (1.0 / 2.0) * (x + (y * sqrt(z)));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (1.0d0 / 2.0d0) * (x + (y * sqrt(z)))
end function
public static double code(double x, double y, double z) {
	return (1.0 / 2.0) * (x + (y * Math.sqrt(z)));
}
def code(x, y, z):
	return (1.0 / 2.0) * (x + (y * math.sqrt(z)))
function code(x, y, z)
	return Float64(Float64(1.0 / 2.0) * Float64(x + Float64(y * sqrt(z))))
end
function tmp = code(x, y, z)
	tmp = (1.0 / 2.0) * (x + (y * sqrt(z)));
end
code[x_, y_, z_] := N[(N[(1.0 / 2.0), $MachinePrecision] * N[(x + N[(y * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 6 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right) \end{array} \]
(FPCore (x y z) :precision binary64 (* (/ 1.0 2.0) (+ x (* y (sqrt z)))))
double code(double x, double y, double z) {
	return (1.0 / 2.0) * (x + (y * sqrt(z)));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (1.0d0 / 2.0d0) * (x + (y * sqrt(z)))
end function
public static double code(double x, double y, double z) {
	return (1.0 / 2.0) * (x + (y * Math.sqrt(z)));
}
def code(x, y, z):
	return (1.0 / 2.0) * (x + (y * math.sqrt(z)))
function code(x, y, z)
	return Float64(Float64(1.0 / 2.0) * Float64(x + Float64(y * sqrt(z))))
end
function tmp = code(x, y, z)
	tmp = (1.0 / 2.0) * (x + (y * sqrt(z)));
end
code[x_, y_, z_] := N[(N[(1.0 / 2.0), $MachinePrecision] * N[(x + N[(y * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

\\
0.5 \cdot \left(x + y \cdot \sqrt{z}\right)
\end{array}
Derivation
  1. Initial program 99.9%

    \[\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right) \]
  2. Step-by-step derivation
    1. metadata-eval99.9%

      \[\leadsto \color{blue}{0.5} \cdot \left(x + y \cdot \sqrt{z}\right) \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
  4. Final simplification99.9%

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

Alternative 2: 74.8% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \sqrt{z}\\ \mathbf{if}\;t_0 \leq -2 \cdot 10^{+144} \lor \neg \left(t_0 \leq -1 \cdot 10^{+93}\right) \land \left(t_0 \leq -4 \cdot 10^{-23} \lor \neg \left(t_0 \leq 10^{+34}\right)\right):\\ \;\;\;\;0.5 \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (sqrt z))))
   (if (or (<= t_0 -2e+144)
           (and (not (<= t_0 -1e+93))
                (or (<= t_0 -4e-23) (not (<= t_0 1e+34)))))
     (* 0.5 t_0)
     (* 0.5 x))))
double code(double x, double y, double z) {
	double t_0 = y * sqrt(z);
	double tmp;
	if ((t_0 <= -2e+144) || (!(t_0 <= -1e+93) && ((t_0 <= -4e-23) || !(t_0 <= 1e+34)))) {
		tmp = 0.5 * t_0;
	} else {
		tmp = 0.5 * x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = y * sqrt(z)
    if ((t_0 <= (-2d+144)) .or. (.not. (t_0 <= (-1d+93))) .and. (t_0 <= (-4d-23)) .or. (.not. (t_0 <= 1d+34))) then
        tmp = 0.5d0 * t_0
    else
        tmp = 0.5d0 * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y * Math.sqrt(z);
	double tmp;
	if ((t_0 <= -2e+144) || (!(t_0 <= -1e+93) && ((t_0 <= -4e-23) || !(t_0 <= 1e+34)))) {
		tmp = 0.5 * t_0;
	} else {
		tmp = 0.5 * x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * math.sqrt(z)
	tmp = 0
	if (t_0 <= -2e+144) or (not (t_0 <= -1e+93) and ((t_0 <= -4e-23) or not (t_0 <= 1e+34))):
		tmp = 0.5 * t_0
	else:
		tmp = 0.5 * x
	return tmp
function code(x, y, z)
	t_0 = Float64(y * sqrt(z))
	tmp = 0.0
	if ((t_0 <= -2e+144) || (!(t_0 <= -1e+93) && ((t_0 <= -4e-23) || !(t_0 <= 1e+34))))
		tmp = Float64(0.5 * t_0);
	else
		tmp = Float64(0.5 * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y * sqrt(z);
	tmp = 0.0;
	if ((t_0 <= -2e+144) || (~((t_0 <= -1e+93)) && ((t_0 <= -4e-23) || ~((t_0 <= 1e+34)))))
		tmp = 0.5 * t_0;
	else
		tmp = 0.5 * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -2e+144], And[N[Not[LessEqual[t$95$0, -1e+93]], $MachinePrecision], Or[LessEqual[t$95$0, -4e-23], N[Not[LessEqual[t$95$0, 1e+34]], $MachinePrecision]]]], N[(0.5 * t$95$0), $MachinePrecision], N[(0.5 * x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \sqrt{z}\\
\mathbf{if}\;t_0 \leq -2 \cdot 10^{+144} \lor \neg \left(t_0 \leq -1 \cdot 10^{+93}\right) \land \left(t_0 \leq -4 \cdot 10^{-23} \lor \neg \left(t_0 \leq 10^{+34}\right)\right):\\
\;\;\;\;0.5 \cdot t_0\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y (sqrt.f64 z)) < -2.00000000000000005e144 or -1.00000000000000004e93 < (*.f64 y (sqrt.f64 z)) < -3.99999999999999984e-23 or 9.99999999999999946e33 < (*.f64 y (sqrt.f64 z))

    1. Initial program 99.8%

      \[\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.8%

        \[\leadsto \color{blue}{0.5} \cdot \left(x + y \cdot \sqrt{z}\right) \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Taylor expanded in x around 0 82.3%

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

    if -2.00000000000000005e144 < (*.f64 y (sqrt.f64 z)) < -1.00000000000000004e93 or -3.99999999999999984e-23 < (*.f64 y (sqrt.f64 z)) < 9.99999999999999946e33

    1. Initial program 99.9%

      \[\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.9%

        \[\leadsto \color{blue}{0.5} \cdot \left(x + y \cdot \sqrt{z}\right) \]
    3. Simplified99.9%

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

      \[\leadsto 0.5 \cdot \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification80.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \sqrt{z} \leq -2 \cdot 10^{+144} \lor \neg \left(y \cdot \sqrt{z} \leq -1 \cdot 10^{+93}\right) \land \left(y \cdot \sqrt{z} \leq -4 \cdot 10^{-23} \lor \neg \left(y \cdot \sqrt{z} \leq 10^{+34}\right)\right):\\ \;\;\;\;0.5 \cdot \left(y \cdot \sqrt{z}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot x\\ \end{array} \]

Alternative 3: 51.2% accurate, 9.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 3 \cdot 10^{+164}:\\ \;\;\;\;0.5 \cdot x\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{y}{\frac{x}{y}}\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 3e+164) (* 0.5 x) (* -0.5 (* z (/ y (/ x y))))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 3e+164) {
		tmp = 0.5 * x;
	} else {
		tmp = -0.5 * (z * (y / (x / y)));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= 3d+164) then
        tmp = 0.5d0 * x
    else
        tmp = (-0.5d0) * (z * (y / (x / y)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 3e+164) {
		tmp = 0.5 * x;
	} else {
		tmp = -0.5 * (z * (y / (x / y)));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 3e+164:
		tmp = 0.5 * x
	else:
		tmp = -0.5 * (z * (y / (x / y)))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 3e+164)
		tmp = Float64(0.5 * x);
	else
		tmp = Float64(-0.5 * Float64(z * Float64(y / Float64(x / y))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 3e+164)
		tmp = 0.5 * x;
	else
		tmp = -0.5 * (z * (y / (x / y)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 3e+164], N[(0.5 * x), $MachinePrecision], N[(-0.5 * N[(z * N[(y / N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3 \cdot 10^{+164}:\\
\;\;\;\;0.5 \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 3.00000000000000001e164

    1. Initial program 99.9%

      \[\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.9%

        \[\leadsto \color{blue}{0.5} \cdot \left(x + y \cdot \sqrt{z}\right) \]
    3. Simplified99.9%

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

      \[\leadsto 0.5 \cdot \color{blue}{x} \]

    if 3.00000000000000001e164 < y

    1. Initial program 99.8%

      \[\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.8%

        \[\leadsto \color{blue}{0.5} \cdot \left(x + y \cdot \sqrt{z}\right) \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Step-by-step derivation
      1. flip-+20.9%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x \cdot x - \left(y \cdot \sqrt{z}\right) \cdot \left(y \cdot \sqrt{z}\right)}{x - y \cdot \sqrt{z}}} \]
      2. div-sub20.9%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{\left(y \cdot \sqrt{z}\right) \cdot \left(y \cdot \sqrt{z}\right)}{x - y \cdot \sqrt{z}}\right)} \]
      3. *-commutative20.9%

        \[\leadsto 0.5 \cdot \left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{\color{blue}{\left(\sqrt{z} \cdot y\right)} \cdot \left(y \cdot \sqrt{z}\right)}{x - y \cdot \sqrt{z}}\right) \]
      4. *-commutative20.9%

        \[\leadsto 0.5 \cdot \left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{\left(\sqrt{z} \cdot y\right) \cdot \color{blue}{\left(\sqrt{z} \cdot y\right)}}{x - y \cdot \sqrt{z}}\right) \]
      5. swap-sqr3.5%

        \[\leadsto 0.5 \cdot \left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{\color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right) \cdot \left(y \cdot y\right)}}{x - y \cdot \sqrt{z}}\right) \]
      6. add-sqr-sqrt3.5%

        \[\leadsto 0.5 \cdot \left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{\color{blue}{z} \cdot \left(y \cdot y\right)}{x - y \cdot \sqrt{z}}\right) \]
    5. Applied egg-rr3.5%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{z \cdot \left(y \cdot y\right)}{x - y \cdot \sqrt{z}}\right)} \]
    6. Step-by-step derivation
      1. +-rgt-identity3.5%

        \[\leadsto 0.5 \cdot \left(\frac{\color{blue}{x \cdot x + 0}}{x - y \cdot \sqrt{z}} - \frac{z \cdot \left(y \cdot y\right)}{x - y \cdot \sqrt{z}}\right) \]
      2. div-sub3.5%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{\left(x \cdot x + 0\right) - z \cdot \left(y \cdot y\right)}{x - y \cdot \sqrt{z}}} \]
      3. +-rgt-identity3.5%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x} - z \cdot \left(y \cdot y\right)}{x - y \cdot \sqrt{z}} \]
      4. *-commutative3.5%

        \[\leadsto 0.5 \cdot \frac{x \cdot x - \color{blue}{\left(y \cdot y\right) \cdot z}}{x - y \cdot \sqrt{z}} \]
      5. associate-*l*20.9%

        \[\leadsto 0.5 \cdot \frac{x \cdot x - \color{blue}{y \cdot \left(y \cdot z\right)}}{x - y \cdot \sqrt{z}} \]
    7. Simplified20.9%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x \cdot x - y \cdot \left(y \cdot z\right)}{x - y \cdot \sqrt{z}}} \]
    8. Taylor expanded in x around 0 4.2%

      \[\leadsto 0.5 \cdot \frac{\color{blue}{-1 \cdot \left({y}^{2} \cdot z\right)}}{x - y \cdot \sqrt{z}} \]
    9. Step-by-step derivation
      1. mul-1-neg4.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{-{y}^{2} \cdot z}}{x - y \cdot \sqrt{z}} \]
      2. unpow24.2%

        \[\leadsto 0.5 \cdot \frac{-\color{blue}{\left(y \cdot y\right)} \cdot z}{x - y \cdot \sqrt{z}} \]
      3. associate-*r*21.2%

        \[\leadsto 0.5 \cdot \frac{-\color{blue}{y \cdot \left(y \cdot z\right)}}{x - y \cdot \sqrt{z}} \]
      4. *-commutative21.2%

        \[\leadsto 0.5 \cdot \frac{-\color{blue}{\left(y \cdot z\right) \cdot y}}{x - y \cdot \sqrt{z}} \]
      5. distribute-rgt-neg-out21.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\left(y \cdot z\right) \cdot \left(-y\right)}}{x - y \cdot \sqrt{z}} \]
      6. associate-*l*21.2%

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

      \[\leadsto 0.5 \cdot \frac{\color{blue}{y \cdot \left(z \cdot \left(-y\right)\right)}}{x - y \cdot \sqrt{z}} \]
    11. Taylor expanded in y around 0 21.4%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{{y}^{2} \cdot z}{x}} \]
    12. Step-by-step derivation
      1. *-commutative21.4%

        \[\leadsto \color{blue}{\frac{{y}^{2} \cdot z}{x} \cdot -0.5} \]
      2. unpow221.4%

        \[\leadsto \frac{\color{blue}{\left(y \cdot y\right)} \cdot z}{x} \cdot -0.5 \]
      3. *-commutative21.4%

        \[\leadsto \frac{\color{blue}{z \cdot \left(y \cdot y\right)}}{x} \cdot -0.5 \]
      4. associate-*r*21.4%

        \[\leadsto \frac{\color{blue}{\left(z \cdot y\right) \cdot y}}{x} \cdot -0.5 \]
      5. *-commutative21.4%

        \[\leadsto \frac{\color{blue}{\left(y \cdot z\right)} \cdot y}{x} \cdot -0.5 \]
    13. Simplified21.4%

      \[\leadsto \color{blue}{\frac{\left(y \cdot z\right) \cdot y}{x} \cdot -0.5} \]
    14. Taylor expanded in y around 0 21.4%

      \[\leadsto \color{blue}{\frac{{y}^{2} \cdot z}{x}} \cdot -0.5 \]
    15. Step-by-step derivation
      1. unpow221.4%

        \[\leadsto \frac{\color{blue}{\left(y \cdot y\right)} \cdot z}{x} \cdot -0.5 \]
      2. *-commutative21.4%

        \[\leadsto \frac{\color{blue}{z \cdot \left(y \cdot y\right)}}{x} \cdot -0.5 \]
      3. associate-*r*21.4%

        \[\leadsto \frac{\color{blue}{\left(z \cdot y\right) \cdot y}}{x} \cdot -0.5 \]
      4. associate-/l*21.4%

        \[\leadsto \color{blue}{\frac{z \cdot y}{\frac{x}{y}}} \cdot -0.5 \]
      5. *-commutative21.4%

        \[\leadsto \frac{\color{blue}{y \cdot z}}{\frac{x}{y}} \cdot -0.5 \]
      6. associate-*l/21.4%

        \[\leadsto \color{blue}{\left(\frac{y}{\frac{x}{y}} \cdot z\right)} \cdot -0.5 \]
      7. *-commutative21.4%

        \[\leadsto \color{blue}{\left(z \cdot \frac{y}{\frac{x}{y}}\right)} \cdot -0.5 \]
    16. Simplified21.4%

      \[\leadsto \color{blue}{\left(z \cdot \frac{y}{\frac{x}{y}}\right)} \cdot -0.5 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification55.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3 \cdot 10^{+164}:\\ \;\;\;\;0.5 \cdot x\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \left(z \cdot \frac{y}{\frac{x}{y}}\right)\\ \end{array} \]

Alternative 4: 51.2% accurate, 9.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 3 \cdot 10^{+164}:\\ \;\;\;\;0.5 \cdot x\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \left(\left(y \cdot z\right) \cdot \frac{y}{x}\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 3e+164) (* 0.5 x) (* -0.5 (* (* y z) (/ y x)))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 3e+164) {
		tmp = 0.5 * x;
	} else {
		tmp = -0.5 * ((y * z) * (y / x));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= 3d+164) then
        tmp = 0.5d0 * x
    else
        tmp = (-0.5d0) * ((y * z) * (y / x))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 3e+164) {
		tmp = 0.5 * x;
	} else {
		tmp = -0.5 * ((y * z) * (y / x));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 3e+164:
		tmp = 0.5 * x
	else:
		tmp = -0.5 * ((y * z) * (y / x))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 3e+164)
		tmp = Float64(0.5 * x);
	else
		tmp = Float64(-0.5 * Float64(Float64(y * z) * Float64(y / x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 3e+164)
		tmp = 0.5 * x;
	else
		tmp = -0.5 * ((y * z) * (y / x));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 3e+164], N[(0.5 * x), $MachinePrecision], N[(-0.5 * N[(N[(y * z), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3 \cdot 10^{+164}:\\
\;\;\;\;0.5 \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 3.00000000000000001e164

    1. Initial program 99.9%

      \[\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.9%

        \[\leadsto \color{blue}{0.5} \cdot \left(x + y \cdot \sqrt{z}\right) \]
    3. Simplified99.9%

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

      \[\leadsto 0.5 \cdot \color{blue}{x} \]

    if 3.00000000000000001e164 < y

    1. Initial program 99.8%

      \[\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.8%

        \[\leadsto \color{blue}{0.5} \cdot \left(x + y \cdot \sqrt{z}\right) \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Step-by-step derivation
      1. flip-+20.9%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x \cdot x - \left(y \cdot \sqrt{z}\right) \cdot \left(y \cdot \sqrt{z}\right)}{x - y \cdot \sqrt{z}}} \]
      2. div-sub20.9%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{\left(y \cdot \sqrt{z}\right) \cdot \left(y \cdot \sqrt{z}\right)}{x - y \cdot \sqrt{z}}\right)} \]
      3. *-commutative20.9%

        \[\leadsto 0.5 \cdot \left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{\color{blue}{\left(\sqrt{z} \cdot y\right)} \cdot \left(y \cdot \sqrt{z}\right)}{x - y \cdot \sqrt{z}}\right) \]
      4. *-commutative20.9%

        \[\leadsto 0.5 \cdot \left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{\left(\sqrt{z} \cdot y\right) \cdot \color{blue}{\left(\sqrt{z} \cdot y\right)}}{x - y \cdot \sqrt{z}}\right) \]
      5. swap-sqr3.5%

        \[\leadsto 0.5 \cdot \left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{\color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right) \cdot \left(y \cdot y\right)}}{x - y \cdot \sqrt{z}}\right) \]
      6. add-sqr-sqrt3.5%

        \[\leadsto 0.5 \cdot \left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{\color{blue}{z} \cdot \left(y \cdot y\right)}{x - y \cdot \sqrt{z}}\right) \]
    5. Applied egg-rr3.5%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{z \cdot \left(y \cdot y\right)}{x - y \cdot \sqrt{z}}\right)} \]
    6. Step-by-step derivation
      1. +-rgt-identity3.5%

        \[\leadsto 0.5 \cdot \left(\frac{\color{blue}{x \cdot x + 0}}{x - y \cdot \sqrt{z}} - \frac{z \cdot \left(y \cdot y\right)}{x - y \cdot \sqrt{z}}\right) \]
      2. div-sub3.5%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{\left(x \cdot x + 0\right) - z \cdot \left(y \cdot y\right)}{x - y \cdot \sqrt{z}}} \]
      3. +-rgt-identity3.5%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x} - z \cdot \left(y \cdot y\right)}{x - y \cdot \sqrt{z}} \]
      4. *-commutative3.5%

        \[\leadsto 0.5 \cdot \frac{x \cdot x - \color{blue}{\left(y \cdot y\right) \cdot z}}{x - y \cdot \sqrt{z}} \]
      5. associate-*l*20.9%

        \[\leadsto 0.5 \cdot \frac{x \cdot x - \color{blue}{y \cdot \left(y \cdot z\right)}}{x - y \cdot \sqrt{z}} \]
    7. Simplified20.9%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x \cdot x - y \cdot \left(y \cdot z\right)}{x - y \cdot \sqrt{z}}} \]
    8. Taylor expanded in x around 0 4.2%

      \[\leadsto 0.5 \cdot \frac{\color{blue}{-1 \cdot \left({y}^{2} \cdot z\right)}}{x - y \cdot \sqrt{z}} \]
    9. Step-by-step derivation
      1. mul-1-neg4.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{-{y}^{2} \cdot z}}{x - y \cdot \sqrt{z}} \]
      2. unpow24.2%

        \[\leadsto 0.5 \cdot \frac{-\color{blue}{\left(y \cdot y\right)} \cdot z}{x - y \cdot \sqrt{z}} \]
      3. associate-*r*21.2%

        \[\leadsto 0.5 \cdot \frac{-\color{blue}{y \cdot \left(y \cdot z\right)}}{x - y \cdot \sqrt{z}} \]
      4. *-commutative21.2%

        \[\leadsto 0.5 \cdot \frac{-\color{blue}{\left(y \cdot z\right) \cdot y}}{x - y \cdot \sqrt{z}} \]
      5. distribute-rgt-neg-out21.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\left(y \cdot z\right) \cdot \left(-y\right)}}{x - y \cdot \sqrt{z}} \]
      6. associate-*l*21.2%

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

      \[\leadsto 0.5 \cdot \frac{\color{blue}{y \cdot \left(z \cdot \left(-y\right)\right)}}{x - y \cdot \sqrt{z}} \]
    11. Taylor expanded in y around 0 21.4%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{{y}^{2} \cdot z}{x}} \]
    12. Step-by-step derivation
      1. *-commutative21.4%

        \[\leadsto \color{blue}{\frac{{y}^{2} \cdot z}{x} \cdot -0.5} \]
      2. unpow221.4%

        \[\leadsto \frac{\color{blue}{\left(y \cdot y\right)} \cdot z}{x} \cdot -0.5 \]
      3. *-commutative21.4%

        \[\leadsto \frac{\color{blue}{z \cdot \left(y \cdot y\right)}}{x} \cdot -0.5 \]
      4. associate-*r*21.4%

        \[\leadsto \frac{\color{blue}{\left(z \cdot y\right) \cdot y}}{x} \cdot -0.5 \]
      5. *-commutative21.4%

        \[\leadsto \frac{\color{blue}{\left(y \cdot z\right)} \cdot y}{x} \cdot -0.5 \]
    13. Simplified21.4%

      \[\leadsto \color{blue}{\frac{\left(y \cdot z\right) \cdot y}{x} \cdot -0.5} \]
    14. Taylor expanded in y around 0 21.4%

      \[\leadsto \color{blue}{\frac{{y}^{2} \cdot z}{x}} \cdot -0.5 \]
    15. Step-by-step derivation
      1. unpow221.4%

        \[\leadsto \frac{\color{blue}{\left(y \cdot y\right)} \cdot z}{x} \cdot -0.5 \]
      2. *-commutative21.4%

        \[\leadsto \frac{\color{blue}{z \cdot \left(y \cdot y\right)}}{x} \cdot -0.5 \]
      3. associate-*r*21.4%

        \[\leadsto \frac{\color{blue}{\left(z \cdot y\right) \cdot y}}{x} \cdot -0.5 \]
      4. associate-*r/21.4%

        \[\leadsto \color{blue}{\left(\left(z \cdot y\right) \cdot \frac{y}{x}\right)} \cdot -0.5 \]
      5. *-commutative21.4%

        \[\leadsto \left(\color{blue}{\left(y \cdot z\right)} \cdot \frac{y}{x}\right) \cdot -0.5 \]
    16. Simplified21.4%

      \[\leadsto \color{blue}{\left(\left(y \cdot z\right) \cdot \frac{y}{x}\right)} \cdot -0.5 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification55.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3 \cdot 10^{+164}:\\ \;\;\;\;0.5 \cdot x\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \left(\left(y \cdot z\right) \cdot \frac{y}{x}\right)\\ \end{array} \]

Alternative 5: 51.2% accurate, 9.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 3 \cdot 10^{+164}:\\ \;\;\;\;0.5 \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot \frac{y \cdot z}{x}\right) \cdot -0.5\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 3e+164) (* 0.5 x) (* (* y (/ (* y z) x)) -0.5)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 3e+164) {
		tmp = 0.5 * x;
	} else {
		tmp = (y * ((y * z) / x)) * -0.5;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= 3d+164) then
        tmp = 0.5d0 * x
    else
        tmp = (y * ((y * z) / x)) * (-0.5d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 3e+164) {
		tmp = 0.5 * x;
	} else {
		tmp = (y * ((y * z) / x)) * -0.5;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 3e+164:
		tmp = 0.5 * x
	else:
		tmp = (y * ((y * z) / x)) * -0.5
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 3e+164)
		tmp = Float64(0.5 * x);
	else
		tmp = Float64(Float64(y * Float64(Float64(y * z) / x)) * -0.5);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 3e+164)
		tmp = 0.5 * x;
	else
		tmp = (y * ((y * z) / x)) * -0.5;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 3e+164], N[(0.5 * x), $MachinePrecision], N[(N[(y * N[(N[(y * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3 \cdot 10^{+164}:\\
\;\;\;\;0.5 \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 3.00000000000000001e164

    1. Initial program 99.9%

      \[\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.9%

        \[\leadsto \color{blue}{0.5} \cdot \left(x + y \cdot \sqrt{z}\right) \]
    3. Simplified99.9%

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

      \[\leadsto 0.5 \cdot \color{blue}{x} \]

    if 3.00000000000000001e164 < y

    1. Initial program 99.8%

      \[\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.8%

        \[\leadsto \color{blue}{0.5} \cdot \left(x + y \cdot \sqrt{z}\right) \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{0.5 \cdot \left(x + y \cdot \sqrt{z}\right)} \]
    4. Step-by-step derivation
      1. flip-+20.9%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{x \cdot x - \left(y \cdot \sqrt{z}\right) \cdot \left(y \cdot \sqrt{z}\right)}{x - y \cdot \sqrt{z}}} \]
      2. div-sub20.9%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{\left(y \cdot \sqrt{z}\right) \cdot \left(y \cdot \sqrt{z}\right)}{x - y \cdot \sqrt{z}}\right)} \]
      3. *-commutative20.9%

        \[\leadsto 0.5 \cdot \left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{\color{blue}{\left(\sqrt{z} \cdot y\right)} \cdot \left(y \cdot \sqrt{z}\right)}{x - y \cdot \sqrt{z}}\right) \]
      4. *-commutative20.9%

        \[\leadsto 0.5 \cdot \left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{\left(\sqrt{z} \cdot y\right) \cdot \color{blue}{\left(\sqrt{z} \cdot y\right)}}{x - y \cdot \sqrt{z}}\right) \]
      5. swap-sqr3.5%

        \[\leadsto 0.5 \cdot \left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{\color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right) \cdot \left(y \cdot y\right)}}{x - y \cdot \sqrt{z}}\right) \]
      6. add-sqr-sqrt3.5%

        \[\leadsto 0.5 \cdot \left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{\color{blue}{z} \cdot \left(y \cdot y\right)}{x - y \cdot \sqrt{z}}\right) \]
    5. Applied egg-rr3.5%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{x \cdot x}{x - y \cdot \sqrt{z}} - \frac{z \cdot \left(y \cdot y\right)}{x - y \cdot \sqrt{z}}\right)} \]
    6. Step-by-step derivation
      1. +-rgt-identity3.5%

        \[\leadsto 0.5 \cdot \left(\frac{\color{blue}{x \cdot x + 0}}{x - y \cdot \sqrt{z}} - \frac{z \cdot \left(y \cdot y\right)}{x - y \cdot \sqrt{z}}\right) \]
      2. div-sub3.5%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{\left(x \cdot x + 0\right) - z \cdot \left(y \cdot y\right)}{x - y \cdot \sqrt{z}}} \]
      3. +-rgt-identity3.5%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{x \cdot x} - z \cdot \left(y \cdot y\right)}{x - y \cdot \sqrt{z}} \]
      4. *-commutative3.5%

        \[\leadsto 0.5 \cdot \frac{x \cdot x - \color{blue}{\left(y \cdot y\right) \cdot z}}{x - y \cdot \sqrt{z}} \]
      5. associate-*l*20.9%

        \[\leadsto 0.5 \cdot \frac{x \cdot x - \color{blue}{y \cdot \left(y \cdot z\right)}}{x - y \cdot \sqrt{z}} \]
    7. Simplified20.9%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x \cdot x - y \cdot \left(y \cdot z\right)}{x - y \cdot \sqrt{z}}} \]
    8. Taylor expanded in x around 0 4.2%

      \[\leadsto 0.5 \cdot \frac{\color{blue}{-1 \cdot \left({y}^{2} \cdot z\right)}}{x - y \cdot \sqrt{z}} \]
    9. Step-by-step derivation
      1. mul-1-neg4.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{-{y}^{2} \cdot z}}{x - y \cdot \sqrt{z}} \]
      2. unpow24.2%

        \[\leadsto 0.5 \cdot \frac{-\color{blue}{\left(y \cdot y\right)} \cdot z}{x - y \cdot \sqrt{z}} \]
      3. associate-*r*21.2%

        \[\leadsto 0.5 \cdot \frac{-\color{blue}{y \cdot \left(y \cdot z\right)}}{x - y \cdot \sqrt{z}} \]
      4. *-commutative21.2%

        \[\leadsto 0.5 \cdot \frac{-\color{blue}{\left(y \cdot z\right) \cdot y}}{x - y \cdot \sqrt{z}} \]
      5. distribute-rgt-neg-out21.2%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{\left(y \cdot z\right) \cdot \left(-y\right)}}{x - y \cdot \sqrt{z}} \]
      6. associate-*l*21.2%

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

      \[\leadsto 0.5 \cdot \frac{\color{blue}{y \cdot \left(z \cdot \left(-y\right)\right)}}{x - y \cdot \sqrt{z}} \]
    11. Taylor expanded in y around 0 21.4%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{{y}^{2} \cdot z}{x}} \]
    12. Step-by-step derivation
      1. *-commutative21.4%

        \[\leadsto \color{blue}{\frac{{y}^{2} \cdot z}{x} \cdot -0.5} \]
      2. unpow221.4%

        \[\leadsto \frac{\color{blue}{\left(y \cdot y\right)} \cdot z}{x} \cdot -0.5 \]
      3. *-commutative21.4%

        \[\leadsto \frac{\color{blue}{z \cdot \left(y \cdot y\right)}}{x} \cdot -0.5 \]
      4. associate-*r*21.4%

        \[\leadsto \frac{\color{blue}{\left(z \cdot y\right) \cdot y}}{x} \cdot -0.5 \]
      5. *-commutative21.4%

        \[\leadsto \frac{\color{blue}{\left(y \cdot z\right)} \cdot y}{x} \cdot -0.5 \]
    13. Simplified21.4%

      \[\leadsto \color{blue}{\frac{\left(y \cdot z\right) \cdot y}{x} \cdot -0.5} \]
    14. Step-by-step derivation
      1. associate-/l*21.4%

        \[\leadsto \color{blue}{\frac{y \cdot z}{\frac{x}{y}}} \cdot -0.5 \]
      2. associate-/r/21.4%

        \[\leadsto \color{blue}{\left(\frac{y \cdot z}{x} \cdot y\right)} \cdot -0.5 \]
      3. *-commutative21.4%

        \[\leadsto \left(\frac{\color{blue}{z \cdot y}}{x} \cdot y\right) \cdot -0.5 \]
    15. Applied egg-rr21.4%

      \[\leadsto \color{blue}{\left(\frac{z \cdot y}{x} \cdot y\right)} \cdot -0.5 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification55.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3 \cdot 10^{+164}:\\ \;\;\;\;0.5 \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot \frac{y \cdot z}{x}\right) \cdot -0.5\\ \end{array} \]

Alternative 6: 51.0% accurate, 36.3× speedup?

\[\begin{array}{l} \\ 0.5 \cdot x \end{array} \]
(FPCore (x y z) :precision binary64 (* 0.5 x))
double code(double x, double y, double z) {
	return 0.5 * x;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = 0.5d0 * x
end function
public static double code(double x, double y, double z) {
	return 0.5 * x;
}
def code(x, y, z):
	return 0.5 * x
function code(x, y, z)
	return Float64(0.5 * x)
end
function tmp = code(x, y, z)
	tmp = 0.5 * x;
end
code[x_, y_, z_] := N[(0.5 * x), $MachinePrecision]
\begin{array}{l}

\\
0.5 \cdot x
\end{array}
Derivation
  1. Initial program 99.9%

    \[\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right) \]
  2. Step-by-step derivation
    1. metadata-eval99.9%

      \[\leadsto \color{blue}{0.5} \cdot \left(x + y \cdot \sqrt{z}\right) \]
  3. Simplified99.9%

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

    \[\leadsto 0.5 \cdot \color{blue}{x} \]
  5. Final simplification53.3%

    \[\leadsto 0.5 \cdot x \]

Reproduce

?
herbie shell --seed 2023271 
(FPCore (x y z)
  :name "Diagrams.Solve.Polynomial:quadForm from diagrams-solve-0.1, B"
  :precision binary64
  (* (/ 1.0 2.0) (+ x (* y (sqrt z)))))