
(FPCore (x y z) :precision binary64 (+ (+ (+ (* x y) (* z z)) (* z z)) (* z z)))
double code(double x, double y, double z) {
return (((x * y) + (z * z)) + (z * z)) + (z * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((x * y) + (z * z)) + (z * z)) + (z * z)
end function
public static double code(double x, double y, double z) {
return (((x * y) + (z * z)) + (z * z)) + (z * z);
}
def code(x, y, z): return (((x * y) + (z * z)) + (z * z)) + (z * z)
function code(x, y, z) return Float64(Float64(Float64(Float64(x * y) + Float64(z * z)) + Float64(z * z)) + Float64(z * z)) end
function tmp = code(x, y, z) tmp = (((x * y) + (z * z)) + (z * z)) + (z * z); end
code[x_, y_, z_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot z\right) + z \cdot z\right) + z \cdot z
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ (+ (* x y) (* z z)) (* z z)) (* z z)))
double code(double x, double y, double z) {
return (((x * y) + (z * z)) + (z * z)) + (z * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((x * y) + (z * z)) + (z * z)) + (z * z)
end function
public static double code(double x, double y, double z) {
return (((x * y) + (z * z)) + (z * z)) + (z * z);
}
def code(x, y, z): return (((x * y) + (z * z)) + (z * z)) + (z * z)
function code(x, y, z) return Float64(Float64(Float64(Float64(x * y) + Float64(z * z)) + Float64(z * z)) + Float64(z * z)) end
function tmp = code(x, y, z) tmp = (((x * y) + (z * z)) + (z * z)) + (z * z); end
code[x_, y_, z_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot z\right) + z \cdot z\right) + z \cdot z
\end{array}
(FPCore (x y z) :precision binary64 (fma z z (fma x y (* 2.0 (* z z)))))
double code(double x, double y, double z) {
return fma(z, z, fma(x, y, (2.0 * (z * z))));
}
function code(x, y, z) return fma(z, z, fma(x, y, Float64(2.0 * Float64(z * z)))) end
code[x_, y_, z_] := N[(z * z + N[(x * y + N[(2.0 * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, z, \mathsf{fma}\left(x, y, 2 \cdot \left(z \cdot z\right)\right)\right)
\end{array}
Initial program 97.9%
+-commutative97.9%
fma-def98.0%
associate-+l+98.0%
fma-def99.6%
count-299.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (fma x y (* z (* z 3.0))))
double code(double x, double y, double z) {
return fma(x, y, (z * (z * 3.0)));
}
function code(x, y, z) return fma(x, y, Float64(z * Float64(z * 3.0))) end
code[x_, y_, z_] := N[(x * y + N[(z * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, z \cdot \left(z \cdot 3\right)\right)
\end{array}
Initial program 97.9%
associate-+l+97.9%
associate-+l+97.9%
fma-def99.5%
count-299.5%
distribute-rgt1-in99.5%
metadata-eval99.5%
metadata-eval99.5%
metadata-eval99.5%
*-commutative99.5%
associate-*l*99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (* z z) (* x y))))
(if (<= (* z z) 2e-84)
t_0
(if (<= (* z z) 1e-23)
(* (* z z) 3.0)
(if (<= (* z z) 2e+30) t_0 (* z (* z 3.0)))))))
double code(double x, double y, double z) {
double t_0 = (z * z) + (x * y);
double tmp;
if ((z * z) <= 2e-84) {
tmp = t_0;
} else if ((z * z) <= 1e-23) {
tmp = (z * z) * 3.0;
} else if ((z * z) <= 2e+30) {
tmp = t_0;
} else {
tmp = z * (z * 3.0);
}
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 = (z * z) + (x * y)
if ((z * z) <= 2d-84) then
tmp = t_0
else if ((z * z) <= 1d-23) then
tmp = (z * z) * 3.0d0
else if ((z * z) <= 2d+30) then
tmp = t_0
else
tmp = z * (z * 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (z * z) + (x * y);
double tmp;
if ((z * z) <= 2e-84) {
tmp = t_0;
} else if ((z * z) <= 1e-23) {
tmp = (z * z) * 3.0;
} else if ((z * z) <= 2e+30) {
tmp = t_0;
} else {
tmp = z * (z * 3.0);
}
return tmp;
}
def code(x, y, z): t_0 = (z * z) + (x * y) tmp = 0 if (z * z) <= 2e-84: tmp = t_0 elif (z * z) <= 1e-23: tmp = (z * z) * 3.0 elif (z * z) <= 2e+30: tmp = t_0 else: tmp = z * (z * 3.0) return tmp
function code(x, y, z) t_0 = Float64(Float64(z * z) + Float64(x * y)) tmp = 0.0 if (Float64(z * z) <= 2e-84) tmp = t_0; elseif (Float64(z * z) <= 1e-23) tmp = Float64(Float64(z * z) * 3.0); elseif (Float64(z * z) <= 2e+30) tmp = t_0; else tmp = Float64(z * Float64(z * 3.0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z * z) + (x * y); tmp = 0.0; if ((z * z) <= 2e-84) tmp = t_0; elseif ((z * z) <= 1e-23) tmp = (z * z) * 3.0; elseif ((z * z) <= 2e+30) tmp = t_0; else tmp = z * (z * 3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * z), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 2e-84], t$95$0, If[LessEqual[N[(z * z), $MachinePrecision], 1e-23], N[(N[(z * z), $MachinePrecision] * 3.0), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+30], t$95$0, N[(z * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot z + x \cdot y\\
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-84}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \cdot z \leq 10^{-23}:\\
\;\;\;\;\left(z \cdot z\right) \cdot 3\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+30}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot 3\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2.0000000000000001e-84 or 9.9999999999999996e-24 < (*.f64 z z) < 2e30Initial program 99.9%
Taylor expanded in x around 0 99.9%
Simplified100.0%
fma-def100.0%
metadata-eval100.0%
distribute-rgt-out100.0%
*-commutative100.0%
*-un-lft-identity100.0%
+-commutative100.0%
distribute-lft-out99.9%
associate-+r+99.9%
+-commutative99.9%
fma-def99.9%
add-log-exp88.7%
exp-lft-sqr88.7%
log-prod88.7%
add-log-exp88.9%
add-log-exp99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 91.9%
if 2.0000000000000001e-84 < (*.f64 z z) < 9.9999999999999996e-24Initial program 100.0%
Taylor expanded in x around 0 84.4%
Simplified84.4%
distribute-lft-out84.2%
*-commutative84.2%
*-un-lft-identity84.2%
distribute-rgt-out84.2%
metadata-eval84.2%
associate-*r*84.4%
Applied egg-rr84.4%
if 2e30 < (*.f64 z z) Initial program 95.6%
Taylor expanded in x around 0 88.3%
Simplified88.3%
Final simplification90.0%
(FPCore (x y z) :precision binary64 (if (or (<= (* z z) 2e-84) (and (not (<= (* z z) 1e-23)) (<= (* z z) 2e+30))) (* x y) (* z (* z 3.0))))
double code(double x, double y, double z) {
double tmp;
if (((z * z) <= 2e-84) || (!((z * z) <= 1e-23) && ((z * z) <= 2e+30))) {
tmp = x * y;
} else {
tmp = z * (z * 3.0);
}
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 (((z * z) <= 2d-84) .or. (.not. ((z * z) <= 1d-23)) .and. ((z * z) <= 2d+30)) then
tmp = x * y
else
tmp = z * (z * 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((z * z) <= 2e-84) || (!((z * z) <= 1e-23) && ((z * z) <= 2e+30))) {
tmp = x * y;
} else {
tmp = z * (z * 3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((z * z) <= 2e-84) or (not ((z * z) <= 1e-23) and ((z * z) <= 2e+30)): tmp = x * y else: tmp = z * (z * 3.0) return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(z * z) <= 2e-84) || (!(Float64(z * z) <= 1e-23) && (Float64(z * z) <= 2e+30))) tmp = Float64(x * y); else tmp = Float64(z * Float64(z * 3.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((z * z) <= 2e-84) || (~(((z * z) <= 1e-23)) && ((z * z) <= 2e+30))) tmp = x * y; else tmp = z * (z * 3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(z * z), $MachinePrecision], 2e-84], And[N[Not[LessEqual[N[(z * z), $MachinePrecision], 1e-23]], $MachinePrecision], LessEqual[N[(z * z), $MachinePrecision], 2e+30]]], N[(x * y), $MachinePrecision], N[(z * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-84} \lor \neg \left(z \cdot z \leq 10^{-23}\right) \land z \cdot z \leq 2 \cdot 10^{+30}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot 3\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2.0000000000000001e-84 or 9.9999999999999996e-24 < (*.f64 z z) < 2e30Initial program 99.9%
Taylor expanded in x around 0 99.9%
Simplified100.0%
Taylor expanded in z around 0 90.7%
if 2.0000000000000001e-84 < (*.f64 z z) < 9.9999999999999996e-24 or 2e30 < (*.f64 z z) Initial program 95.8%
Taylor expanded in x around 0 88.0%
Simplified88.0%
Final simplification89.4%
(FPCore (x y z)
:precision binary64
(if (<= (* z z) 2e-84)
(* x y)
(if (<= (* z z) 1e-23)
(* (* z z) 3.0)
(if (<= (* z z) 2e+30) (* x y) (* z (* z 3.0))))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e-84) {
tmp = x * y;
} else if ((z * z) <= 1e-23) {
tmp = (z * z) * 3.0;
} else if ((z * z) <= 2e+30) {
tmp = x * y;
} else {
tmp = z * (z * 3.0);
}
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 ((z * z) <= 2d-84) then
tmp = x * y
else if ((z * z) <= 1d-23) then
tmp = (z * z) * 3.0d0
else if ((z * z) <= 2d+30) then
tmp = x * y
else
tmp = z * (z * 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e-84) {
tmp = x * y;
} else if ((z * z) <= 1e-23) {
tmp = (z * z) * 3.0;
} else if ((z * z) <= 2e+30) {
tmp = x * y;
} else {
tmp = z * (z * 3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 2e-84: tmp = x * y elif (z * z) <= 1e-23: tmp = (z * z) * 3.0 elif (z * z) <= 2e+30: tmp = x * y else: tmp = z * (z * 3.0) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 2e-84) tmp = Float64(x * y); elseif (Float64(z * z) <= 1e-23) tmp = Float64(Float64(z * z) * 3.0); elseif (Float64(z * z) <= 2e+30) tmp = Float64(x * y); else tmp = Float64(z * Float64(z * 3.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 2e-84) tmp = x * y; elseif ((z * z) <= 1e-23) tmp = (z * z) * 3.0; elseif ((z * z) <= 2e+30) tmp = x * y; else tmp = z * (z * 3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e-84], N[(x * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e-23], N[(N[(z * z), $MachinePrecision] * 3.0), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+30], N[(x * y), $MachinePrecision], N[(z * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-84}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;z \cdot z \leq 10^{-23}:\\
\;\;\;\;\left(z \cdot z\right) \cdot 3\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+30}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot 3\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2.0000000000000001e-84 or 9.9999999999999996e-24 < (*.f64 z z) < 2e30Initial program 99.9%
Taylor expanded in x around 0 99.9%
Simplified100.0%
Taylor expanded in z around 0 90.7%
if 2.0000000000000001e-84 < (*.f64 z z) < 9.9999999999999996e-24Initial program 100.0%
Taylor expanded in x around 0 84.4%
Simplified84.4%
distribute-lft-out84.2%
*-commutative84.2%
*-un-lft-identity84.2%
distribute-rgt-out84.2%
metadata-eval84.2%
associate-*r*84.4%
Applied egg-rr84.4%
if 2e30 < (*.f64 z z) Initial program 95.6%
Taylor expanded in x around 0 88.3%
Simplified88.3%
Final simplification89.4%
(FPCore (x y z) :precision binary64 (if (<= (* z z) 2e+245) (+ (* z (* z 3.0)) (* x y)) (* (* z z) 3.0)))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e+245) {
tmp = (z * (z * 3.0)) + (x * y);
} else {
tmp = (z * z) * 3.0;
}
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 ((z * z) <= 2d+245) then
tmp = (z * (z * 3.0d0)) + (x * y)
else
tmp = (z * z) * 3.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e+245) {
tmp = (z * (z * 3.0)) + (x * y);
} else {
tmp = (z * z) * 3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 2e+245: tmp = (z * (z * 3.0)) + (x * y) else: tmp = (z * z) * 3.0 return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 2e+245) tmp = Float64(Float64(z * Float64(z * 3.0)) + Float64(x * y)); else tmp = Float64(Float64(z * z) * 3.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 2e+245) tmp = (z * (z * 3.0)) + (x * y); else tmp = (z * z) * 3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+245], N[(N[(z * N[(z * 3.0), $MachinePrecision]), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(z * z), $MachinePrecision] * 3.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+245}:\\
\;\;\;\;z \cdot \left(z \cdot 3\right) + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot z\right) \cdot 3\\
\end{array}
\end{array}
if (*.f64 z z) < 2.00000000000000009e245Initial program 99.8%
associate-+l+99.8%
associate-+l+99.8%
fma-def99.8%
count-299.8%
distribute-rgt1-in99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
*-commutative99.8%
associate-*l*99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
fma-udef99.9%
+-commutative99.9%
Applied egg-rr99.9%
if 2.00000000000000009e245 < (*.f64 z z) Initial program 92.7%
Taylor expanded in x around 0 98.5%
Simplified98.5%
distribute-lft-out98.5%
*-commutative98.5%
*-un-lft-identity98.5%
distribute-rgt-out98.5%
metadata-eval98.5%
associate-*r*98.5%
Applied egg-rr98.5%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (<= (* z z) 4.2e+248) (* x y) (* z z)))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 4.2e+248) {
tmp = x * y;
} else {
tmp = z * z;
}
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 ((z * z) <= 4.2d+248) then
tmp = x * y
else
tmp = z * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 4.2e+248) {
tmp = x * y;
} else {
tmp = z * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 4.2e+248: tmp = x * y else: tmp = z * z return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 4.2e+248) tmp = Float64(x * y); else tmp = Float64(z * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 4.2e+248) tmp = x * y; else tmp = z * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 4.2e+248], N[(x * y), $MachinePrecision], N[(z * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4.2 \cdot 10^{+248}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot z\\
\end{array}
\end{array}
if (*.f64 z z) < 4.19999999999999977e248Initial program 99.8%
Taylor expanded in x around 0 99.8%
Simplified99.9%
Taylor expanded in z around 0 70.6%
if 4.19999999999999977e248 < (*.f64 z z) Initial program 92.7%
Taylor expanded in x around 0 92.7%
Simplified94.1%
fma-def92.7%
metadata-eval92.7%
distribute-rgt-out92.7%
*-commutative92.7%
*-un-lft-identity92.7%
+-commutative92.7%
distribute-lft-out92.7%
associate-+r+92.7%
+-commutative92.7%
fma-def92.7%
add-log-exp81.1%
exp-lft-sqr81.1%
log-prod81.1%
add-log-exp81.1%
add-log-exp92.7%
Applied egg-rr92.7%
Taylor expanded in z around 0 82.0%
Taylor expanded in x around 0 87.8%
Simplified87.8%
Final simplification75.2%
(FPCore (x y z) :precision binary64 (* x y))
double code(double x, double y, double z) {
return x * y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x * y
end function
public static double code(double x, double y, double z) {
return x * y;
}
def code(x, y, z): return x * y
function code(x, y, z) return Float64(x * y) end
function tmp = code(x, y, z) tmp = x * y; end
code[x_, y_, z_] := N[(x * y), $MachinePrecision]
\begin{array}{l}
\\
x \cdot y
\end{array}
Initial program 97.9%
Taylor expanded in x around 0 97.9%
Simplified98.3%
Taylor expanded in z around 0 52.8%
Final simplification52.8%
(FPCore (x y z) :precision binary64 (+ (* (* 3.0 z) z) (* y x)))
double code(double x, double y, double z) {
return ((3.0 * z) * z) + (y * x);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((3.0d0 * z) * z) + (y * x)
end function
public static double code(double x, double y, double z) {
return ((3.0 * z) * z) + (y * x);
}
def code(x, y, z): return ((3.0 * z) * z) + (y * x)
function code(x, y, z) return Float64(Float64(Float64(3.0 * z) * z) + Float64(y * x)) end
function tmp = code(x, y, z) tmp = ((3.0 * z) * z) + (y * x); end
code[x_, y_, z_] := N[(N[(N[(3.0 * z), $MachinePrecision] * z), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 \cdot z\right) \cdot z + y \cdot x
\end{array}
herbie shell --seed 2023293
(FPCore (x y z)
:name "Linear.Quaternion:$c/ from linear-1.19.1.3, A"
:precision binary64
:herbie-target
(+ (* (* 3.0 z) z) (* y x))
(+ (+ (+ (* x y) (* z z)) (* z z)) (* z z)))