
(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 11 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 (* z (+ z z)))))
double code(double x, double y, double z) {
return fma(z, z, fma(x, y, (z * (z + z))));
}
function code(x, y, z) return fma(z, z, fma(x, y, Float64(z * Float64(z + z)))) end
code[x_, y_, z_] := N[(z * z + N[(x * y + N[(z * N[(z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, z, \mathsf{fma}\left(x, y, z \cdot \left(z + z\right)\right)\right)
\end{array}
Initial program 98.8%
+-commutative98.8%
fma-def98.8%
associate-+l+98.8%
fma-def99.2%
distribute-lft-out99.2%
Simplified99.2%
Final simplification99.2%
(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 98.8%
associate-+l+98.8%
associate-+l+98.8%
fma-def99.2%
count-299.2%
distribute-lft1-in99.2%
metadata-eval99.2%
*-commutative99.2%
associate-*l*99.2%
metadata-eval99.2%
metadata-eval99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (or (<= (* x y) -5e-138) (not (<= (* x y) 2e-110))) (+ (* z z) (+ (* x y) (* z z))) (* 3.0 (* z z))))
double code(double x, double y, double z) {
double tmp;
if (((x * y) <= -5e-138) || !((x * y) <= 2e-110)) {
tmp = (z * z) + ((x * y) + (z * z));
} else {
tmp = 3.0 * (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 (((x * y) <= (-5d-138)) .or. (.not. ((x * y) <= 2d-110))) then
tmp = (z * z) + ((x * y) + (z * z))
else
tmp = 3.0d0 * (z * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((x * y) <= -5e-138) || !((x * y) <= 2e-110)) {
tmp = (z * z) + ((x * y) + (z * z));
} else {
tmp = 3.0 * (z * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((x * y) <= -5e-138) or not ((x * y) <= 2e-110): tmp = (z * z) + ((x * y) + (z * z)) else: tmp = 3.0 * (z * z) return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(x * y) <= -5e-138) || !(Float64(x * y) <= 2e-110)) tmp = Float64(Float64(z * z) + Float64(Float64(x * y) + Float64(z * z))); else tmp = Float64(3.0 * Float64(z * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((x * y) <= -5e-138) || ~(((x * y) <= 2e-110))) tmp = (z * z) + ((x * y) + (z * z)); else tmp = 3.0 * (z * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -5e-138], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e-110]], $MachinePrecision]], N[(N[(z * z), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 * N[(z * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{-138} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{-110}\right):\\
\;\;\;\;z \cdot z + \left(x \cdot y + z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;3 \cdot \left(z \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999989e-138 or 2.0000000000000001e-110 < (*.f64 x y) Initial program 98.4%
Applied egg-rr88.2%
if -4.99999999999999989e-138 < (*.f64 x y) < 2.0000000000000001e-110Initial program 99.9%
Taylor expanded in x around 0 99.9%
+-commutative99.9%
associate-+r+99.9%
distribute-lft1-in99.9%
metadata-eval99.9%
*-commutative99.9%
fma-def99.9%
unpow299.9%
Simplified99.9%
Taylor expanded in z around inf 88.4%
unpow288.4%
Simplified88.4%
Final simplification88.3%
(FPCore (x y z)
:precision binary64
(if (or (<= (* z z) 2.3e-50)
(and (not (<= (* z z) 2020000000000.0)) (<= (* z z) 2.35e+160)))
(* x y)
(* 3.0 (* z z))))
double code(double x, double y, double z) {
double tmp;
if (((z * z) <= 2.3e-50) || (!((z * z) <= 2020000000000.0) && ((z * z) <= 2.35e+160))) {
tmp = x * y;
} else {
tmp = 3.0 * (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) <= 2.3d-50) .or. (.not. ((z * z) <= 2020000000000.0d0)) .and. ((z * z) <= 2.35d+160)) then
tmp = x * y
else
tmp = 3.0d0 * (z * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((z * z) <= 2.3e-50) || (!((z * z) <= 2020000000000.0) && ((z * z) <= 2.35e+160))) {
tmp = x * y;
} else {
tmp = 3.0 * (z * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((z * z) <= 2.3e-50) or (not ((z * z) <= 2020000000000.0) and ((z * z) <= 2.35e+160)): tmp = x * y else: tmp = 3.0 * (z * z) return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(z * z) <= 2.3e-50) || (!(Float64(z * z) <= 2020000000000.0) && (Float64(z * z) <= 2.35e+160))) tmp = Float64(x * y); else tmp = Float64(3.0 * Float64(z * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((z * z) <= 2.3e-50) || (~(((z * z) <= 2020000000000.0)) && ((z * z) <= 2.35e+160))) tmp = x * y; else tmp = 3.0 * (z * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(z * z), $MachinePrecision], 2.3e-50], And[N[Not[LessEqual[N[(z * z), $MachinePrecision], 2020000000000.0]], $MachinePrecision], LessEqual[N[(z * z), $MachinePrecision], 2.35e+160]]], N[(x * y), $MachinePrecision], N[(3.0 * N[(z * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2.3 \cdot 10^{-50} \lor \neg \left(z \cdot z \leq 2020000000000\right) \land z \cdot z \leq 2.35 \cdot 10^{+160}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;3 \cdot \left(z \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2.3000000000000002e-50 or 2.02e12 < (*.f64 z z) < 2.34999999999999985e160Initial program 99.9%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
associate-+r+100.0%
distribute-lft1-in100.0%
metadata-eval100.0%
*-commutative100.0%
fma-def100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in z around 0 85.4%
if 2.3000000000000002e-50 < (*.f64 z z) < 2.02e12 or 2.34999999999999985e160 < (*.f64 z z) Initial program 97.3%
Taylor expanded in x around 0 97.3%
+-commutative97.3%
associate-+r+97.3%
distribute-lft1-in97.3%
metadata-eval97.3%
*-commutative97.3%
fma-def97.4%
unpow297.4%
Simplified97.4%
Taylor expanded in z around inf 88.0%
unpow288.0%
Simplified88.0%
Final simplification86.6%
(FPCore (x y z)
:precision binary64
(if (<= (* z z) 2e-57)
(* x y)
(if (<= (* z z) 1000000000.0)
(* z (* z 3.0))
(if (<= (* z z) 1e+159) (* x y) (* 3.0 (* z z))))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e-57) {
tmp = x * y;
} else if ((z * z) <= 1000000000.0) {
tmp = z * (z * 3.0);
} else if ((z * z) <= 1e+159) {
tmp = x * y;
} else {
tmp = 3.0 * (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) <= 2d-57) then
tmp = x * y
else if ((z * z) <= 1000000000.0d0) then
tmp = z * (z * 3.0d0)
else if ((z * z) <= 1d+159) then
tmp = x * y
else
tmp = 3.0d0 * (z * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e-57) {
tmp = x * y;
} else if ((z * z) <= 1000000000.0) {
tmp = z * (z * 3.0);
} else if ((z * z) <= 1e+159) {
tmp = x * y;
} else {
tmp = 3.0 * (z * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 2e-57: tmp = x * y elif (z * z) <= 1000000000.0: tmp = z * (z * 3.0) elif (z * z) <= 1e+159: tmp = x * y else: tmp = 3.0 * (z * z) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 2e-57) tmp = Float64(x * y); elseif (Float64(z * z) <= 1000000000.0) tmp = Float64(z * Float64(z * 3.0)); elseif (Float64(z * z) <= 1e+159) tmp = Float64(x * y); else tmp = Float64(3.0 * Float64(z * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 2e-57) tmp = x * y; elseif ((z * z) <= 1000000000.0) tmp = z * (z * 3.0); elseif ((z * z) <= 1e+159) tmp = x * y; else tmp = 3.0 * (z * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e-57], N[(x * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1000000000.0], N[(z * N[(z * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+159], N[(x * y), $MachinePrecision], N[(3.0 * N[(z * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-57}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;z \cdot z \leq 1000000000:\\
\;\;\;\;z \cdot \left(z \cdot 3\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+159}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;3 \cdot \left(z \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1.99999999999999991e-57 or 1e9 < (*.f64 z z) < 9.9999999999999993e158Initial program 99.9%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
associate-+r+100.0%
distribute-lft1-in100.0%
metadata-eval100.0%
*-commutative100.0%
fma-def100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in z around 0 85.4%
if 1.99999999999999991e-57 < (*.f64 z z) < 1e9Initial program 99.7%
Taylor expanded in x around 0 74.1%
distribute-lft1-in74.1%
metadata-eval74.1%
*-commutative74.1%
unpow274.1%
associate-*r*74.2%
Simplified74.2%
if 9.9999999999999993e158 < (*.f64 z z) Initial program 97.0%
Taylor expanded in x around 0 97.0%
+-commutative97.0%
associate-+r+97.0%
distribute-lft1-in97.0%
metadata-eval97.0%
*-commutative97.0%
fma-def97.0%
unpow297.0%
Simplified97.0%
Taylor expanded in z around inf 90.0%
unpow290.0%
Simplified90.0%
Final simplification86.6%
(FPCore (x y z)
:precision binary64
(if (<= (* z z) 2e-57)
(* x y)
(if (<= (* z z) 1000000000.0)
(* z (* z 3.0))
(if (<= (* z z) 1e+159) (+ (* x y) 0.75) (* 3.0 (* z z))))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e-57) {
tmp = x * y;
} else if ((z * z) <= 1000000000.0) {
tmp = z * (z * 3.0);
} else if ((z * z) <= 1e+159) {
tmp = (x * y) + 0.75;
} else {
tmp = 3.0 * (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) <= 2d-57) then
tmp = x * y
else if ((z * z) <= 1000000000.0d0) then
tmp = z * (z * 3.0d0)
else if ((z * z) <= 1d+159) then
tmp = (x * y) + 0.75d0
else
tmp = 3.0d0 * (z * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e-57) {
tmp = x * y;
} else if ((z * z) <= 1000000000.0) {
tmp = z * (z * 3.0);
} else if ((z * z) <= 1e+159) {
tmp = (x * y) + 0.75;
} else {
tmp = 3.0 * (z * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 2e-57: tmp = x * y elif (z * z) <= 1000000000.0: tmp = z * (z * 3.0) elif (z * z) <= 1e+159: tmp = (x * y) + 0.75 else: tmp = 3.0 * (z * z) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 2e-57) tmp = Float64(x * y); elseif (Float64(z * z) <= 1000000000.0) tmp = Float64(z * Float64(z * 3.0)); elseif (Float64(z * z) <= 1e+159) tmp = Float64(Float64(x * y) + 0.75); else tmp = Float64(3.0 * Float64(z * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 2e-57) tmp = x * y; elseif ((z * z) <= 1000000000.0) tmp = z * (z * 3.0); elseif ((z * z) <= 1e+159) tmp = (x * y) + 0.75; else tmp = 3.0 * (z * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e-57], N[(x * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1000000000.0], N[(z * N[(z * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+159], N[(N[(x * y), $MachinePrecision] + 0.75), $MachinePrecision], N[(3.0 * N[(z * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-57}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;z \cdot z \leq 1000000000:\\
\;\;\;\;z \cdot \left(z \cdot 3\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+159}:\\
\;\;\;\;x \cdot y + 0.75\\
\mathbf{else}:\\
\;\;\;\;3 \cdot \left(z \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1.99999999999999991e-57Initial program 100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
associate-+r+100.0%
distribute-lft1-in100.0%
metadata-eval100.0%
*-commutative100.0%
fma-def100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in z around 0 90.0%
if 1.99999999999999991e-57 < (*.f64 z z) < 1e9Initial program 99.7%
Taylor expanded in x around 0 74.1%
distribute-lft1-in74.1%
metadata-eval74.1%
*-commutative74.1%
unpow274.1%
associate-*r*74.2%
Simplified74.2%
if 1e9 < (*.f64 z z) < 9.9999999999999993e158Initial program 99.8%
associate-+l+99.9%
associate-+l+99.9%
fma-def99.9%
count-299.9%
distribute-lft1-in99.9%
metadata-eval99.9%
*-commutative99.9%
associate-*l*100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Applied egg-rr64.7%
if 9.9999999999999993e158 < (*.f64 z z) Initial program 97.0%
Taylor expanded in x around 0 97.0%
+-commutative97.0%
associate-+r+97.0%
distribute-lft1-in97.0%
metadata-eval97.0%
*-commutative97.0%
fma-def97.0%
unpow297.0%
Simplified97.0%
Taylor expanded in z around inf 90.0%
unpow290.0%
Simplified90.0%
Final simplification86.6%
(FPCore (x y z) :precision binary64 (+ (* z z) (+ (* z z) (+ (* x y) (* z z)))))
double code(double x, double y, double z) {
return (z * z) + ((z * z) + ((x * y) + (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 = (z * z) + ((z * z) + ((x * y) + (z * z)))
end function
public static double code(double x, double y, double z) {
return (z * z) + ((z * z) + ((x * y) + (z * z)));
}
def code(x, y, z): return (z * z) + ((z * z) + ((x * y) + (z * z)))
function code(x, y, z) return Float64(Float64(z * z) + Float64(Float64(z * z) + Float64(Float64(x * y) + Float64(z * z)))) end
function tmp = code(x, y, z) tmp = (z * z) + ((z * z) + ((x * y) + (z * z))); end
code[x_, y_, z_] := N[(N[(z * z), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot z + \left(z \cdot z + \left(x \cdot y + z \cdot z\right)\right)
\end{array}
Initial program 98.8%
Final simplification98.8%
(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 98.8%
Taylor expanded in x around 0 98.8%
+-commutative98.8%
associate-+r+98.8%
distribute-lft1-in98.8%
metadata-eval98.8%
*-commutative98.8%
fma-def98.8%
unpow298.8%
Simplified98.8%
Taylor expanded in z around 0 55.8%
Final simplification55.8%
(FPCore (x y z) :precision binary64 -4.0)
double code(double x, double y, double z) {
return -4.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = -4.0d0
end function
public static double code(double x, double y, double z) {
return -4.0;
}
def code(x, y, z): return -4.0
function code(x, y, z) return -4.0 end
function tmp = code(x, y, z) tmp = -4.0; end
code[x_, y_, z_] := -4.0
\begin{array}{l}
\\
-4
\end{array}
Initial program 98.8%
Taylor expanded in x around 0 98.8%
+-commutative98.8%
associate-+r+98.8%
distribute-lft1-in98.8%
metadata-eval98.8%
*-commutative98.8%
fma-def98.8%
unpow298.8%
Simplified98.8%
Applied egg-rr1.9%
fma-udef1.9%
*-commutative1.9%
associate-*r*1.9%
fma-def1.9%
associate-+r+1.9%
associate-+r+1.9%
associate-*r*1.9%
*-commutative1.9%
distribute-lft1-in1.9%
metadata-eval1.9%
neg-mul-11.9%
neg-sub01.9%
metadata-eval1.9%
associate--r+1.9%
+-commutative1.9%
fma-def1.9%
sub-neg1.9%
+-commutative1.9%
associate-+r+1.9%
sub-neg1.9%
+-inverses2.2%
metadata-eval2.2%
Simplified2.2%
Final simplification2.2%
(FPCore (x y z) :precision binary64 -0.177978515625)
double code(double x, double y, double z) {
return -0.177978515625;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = -0.177978515625d0
end function
public static double code(double x, double y, double z) {
return -0.177978515625;
}
def code(x, y, z): return -0.177978515625
function code(x, y, z) return -0.177978515625 end
function tmp = code(x, y, z) tmp = -0.177978515625; end
code[x_, y_, z_] := -0.177978515625
\begin{array}{l}
\\
-0.177978515625
\end{array}
Initial program 98.8%
Taylor expanded in x around 0 52.5%
unpow252.5%
associate-*r*52.5%
count-252.5%
*-commutative52.5%
Simplified52.5%
Applied egg-rr2.2%
Final simplification2.2%
(FPCore (x y z) :precision binary64 0.0)
double code(double x, double y, double z) {
return 0.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 0.0d0
end function
public static double code(double x, double y, double z) {
return 0.0;
}
def code(x, y, z): return 0.0
function code(x, y, z) return 0.0 end
function tmp = code(x, y, z) tmp = 0.0; end
code[x_, y_, z_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 98.8%
Taylor expanded in x around 0 98.8%
+-commutative98.8%
associate-+r+98.8%
distribute-lft1-in98.8%
metadata-eval98.8%
*-commutative98.8%
fma-def98.8%
unpow298.8%
Simplified98.8%
Applied egg-rr4.9%
fma-udef4.8%
*-commutative4.8%
distribute-lft1-in4.9%
metadata-eval4.9%
neg-mul-14.9%
sub-neg4.9%
+-inverses5.1%
Simplified5.1%
Final simplification5.1%
(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 2023297
(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)))