
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * 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 - x) * 6.0d0) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * 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 - x) * 6.0d0) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
(FPCore (x y z) :precision binary64 (fma (- y x) (* 6.0 z) x))
double code(double x, double y, double z) {
return fma((y - x), (6.0 * z), x);
}
function code(x, y, z) return fma(Float64(y - x), Float64(6.0 * z), x) end
code[x_, y_, z_] := N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - x, 6 \cdot z, x\right)
\end{array}
Initial program 99.3%
+-commutative99.3%
associate-*l*99.8%
fma-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.34e+14) (not (<= x 5.2e-24))) (* x (+ 1.0 (* z -6.0))) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.34e+14) || !(x <= 5.2e-24)) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = x + (6.0 * (y * 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 <= (-1.34d+14)) .or. (.not. (x <= 5.2d-24))) then
tmp = x * (1.0d0 + (z * (-6.0d0)))
else
tmp = x + (6.0d0 * (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.34e+14) || !(x <= 5.2e-24)) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.34e+14) or not (x <= 5.2e-24): tmp = x * (1.0 + (z * -6.0)) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.34e+14) || !(x <= 5.2e-24)) tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); else tmp = Float64(x + Float64(6.0 * Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.34e+14) || ~((x <= 5.2e-24))) tmp = x * (1.0 + (z * -6.0)); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.34e+14], N[Not[LessEqual[x, 5.2e-24]], $MachinePrecision]], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.34 \cdot 10^{+14} \lor \neg \left(x \leq 5.2 \cdot 10^{-24}\right):\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if x < -1.34e14 or 5.2e-24 < x Initial program 99.1%
Taylor expanded in x around inf 91.1%
if -1.34e14 < x < 5.2e-24Initial program 99.6%
Taylor expanded in y around inf 91.2%
Final simplification91.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.5e+14) (not (<= x 5.5e-24))) (* x (+ 1.0 (* z -6.0))) (+ x (* y (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.5e+14) || !(x <= 5.5e-24)) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = x + (y * (6.0 * 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 <= (-4.5d+14)) .or. (.not. (x <= 5.5d-24))) then
tmp = x * (1.0d0 + (z * (-6.0d0)))
else
tmp = x + (y * (6.0d0 * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -4.5e+14) || !(x <= 5.5e-24)) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = x + (y * (6.0 * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.5e+14) or not (x <= 5.5e-24): tmp = x * (1.0 + (z * -6.0)) else: tmp = x + (y * (6.0 * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.5e+14) || !(x <= 5.5e-24)) tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); else tmp = Float64(x + Float64(y * Float64(6.0 * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -4.5e+14) || ~((x <= 5.5e-24))) tmp = x * (1.0 + (z * -6.0)); else tmp = x + (y * (6.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.5e+14], N[Not[LessEqual[x, 5.5e-24]], $MachinePrecision]], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{+14} \lor \neg \left(x \leq 5.5 \cdot 10^{-24}\right):\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if x < -4.5e14 or 5.4999999999999999e-24 < x Initial program 99.1%
Taylor expanded in x around inf 91.1%
if -4.5e14 < x < 5.4999999999999999e-24Initial program 99.6%
associate-*r*99.7%
*-commutative99.7%
flip--71.3%
associate-*r/66.0%
Applied egg-rr66.0%
associate-/l*71.2%
*-commutative71.2%
associate-/l*71.2%
difference-of-squares71.2%
associate-/r*99.7%
*-inverses99.7%
Simplified99.7%
Taylor expanded in y around inf 91.2%
associate-*r*91.1%
*-commutative91.1%
associate-*r*91.2%
Simplified91.2%
Final simplification91.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -5.45e+14) (not (<= x 6.2e-24))) (+ x (* -6.0 (* x z))) (+ x (* y (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5.45e+14) || !(x <= 6.2e-24)) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = x + (y * (6.0 * 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 <= (-5.45d+14)) .or. (.not. (x <= 6.2d-24))) then
tmp = x + ((-6.0d0) * (x * z))
else
tmp = x + (y * (6.0d0 * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -5.45e+14) || !(x <= 6.2e-24)) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = x + (y * (6.0 * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5.45e+14) or not (x <= 6.2e-24): tmp = x + (-6.0 * (x * z)) else: tmp = x + (y * (6.0 * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -5.45e+14) || !(x <= 6.2e-24)) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); else tmp = Float64(x + Float64(y * Float64(6.0 * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -5.45e+14) || ~((x <= 6.2e-24))) tmp = x + (-6.0 * (x * z)); else tmp = x + (y * (6.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -5.45e+14], N[Not[LessEqual[x, 6.2e-24]], $MachinePrecision]], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.45 \cdot 10^{+14} \lor \neg \left(x \leq 6.2 \cdot 10^{-24}\right):\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if x < -5.45e14 or 6.2000000000000001e-24 < x Initial program 99.1%
Taylor expanded in y around 0 91.1%
if -5.45e14 < x < 6.2000000000000001e-24Initial program 99.6%
associate-*r*99.7%
*-commutative99.7%
flip--71.3%
associate-*r/66.0%
Applied egg-rr66.0%
associate-/l*71.2%
*-commutative71.2%
associate-/l*71.2%
difference-of-squares71.2%
associate-/r*99.7%
*-inverses99.7%
Simplified99.7%
Taylor expanded in y around inf 91.2%
associate-*r*91.1%
*-commutative91.1%
associate-*r*91.2%
Simplified91.2%
Final simplification91.2%
(FPCore (x y z) :precision binary64 (if (<= x -2.7e+14) (+ x (/ z (/ -0.16666666666666666 x))) (if (<= x 6e-24) (+ x (* y (* 6.0 z))) (* x (+ 1.0 (* z -6.0))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.7e+14) {
tmp = x + (z / (-0.16666666666666666 / x));
} else if (x <= 6e-24) {
tmp = x + (y * (6.0 * z));
} else {
tmp = x * (1.0 + (z * -6.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 (x <= (-2.7d+14)) then
tmp = x + (z / ((-0.16666666666666666d0) / x))
else if (x <= 6d-24) then
tmp = x + (y * (6.0d0 * z))
else
tmp = x * (1.0d0 + (z * (-6.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.7e+14) {
tmp = x + (z / (-0.16666666666666666 / x));
} else if (x <= 6e-24) {
tmp = x + (y * (6.0 * z));
} else {
tmp = x * (1.0 + (z * -6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.7e+14: tmp = x + (z / (-0.16666666666666666 / x)) elif x <= 6e-24: tmp = x + (y * (6.0 * z)) else: tmp = x * (1.0 + (z * -6.0)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.7e+14) tmp = Float64(x + Float64(z / Float64(-0.16666666666666666 / x))); elseif (x <= 6e-24) tmp = Float64(x + Float64(y * Float64(6.0 * z))); else tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.7e+14) tmp = x + (z / (-0.16666666666666666 / x)); elseif (x <= 6e-24) tmp = x + (y * (6.0 * z)); else tmp = x * (1.0 + (z * -6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.7e+14], N[(x + N[(z / N[(-0.16666666666666666 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6e-24], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{+14}:\\
\;\;\;\;x + \frac{z}{\frac{-0.16666666666666666}{x}}\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-24}:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\end{array}
\end{array}
if x < -2.7e14Initial program 98.1%
associate-*r*99.9%
*-commutative99.9%
flip--60.1%
associate-*r/55.4%
Applied egg-rr55.4%
associate-/l*60.1%
*-commutative60.1%
associate-/l*60.1%
difference-of-squares63.7%
associate-/r*99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in y around 0 89.8%
if -2.7e14 < x < 5.99999999999999991e-24Initial program 99.6%
associate-*r*99.7%
*-commutative99.7%
flip--71.3%
associate-*r/66.0%
Applied egg-rr66.0%
associate-/l*71.2%
*-commutative71.2%
associate-/l*71.2%
difference-of-squares71.2%
associate-/r*99.7%
*-inverses99.7%
Simplified99.7%
Taylor expanded in y around inf 91.2%
associate-*r*91.1%
*-commutative91.1%
associate-*r*91.2%
Simplified91.2%
if 5.99999999999999991e-24 < x Initial program 99.9%
Taylor expanded in x around inf 92.1%
Final simplification91.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.17) (not (<= z 0.165))) (* z (* x -6.0)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.17) || !(z <= 0.165)) {
tmp = z * (x * -6.0);
} else {
tmp = 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 ((z <= (-0.17d0)) .or. (.not. (z <= 0.165d0))) then
tmp = z * (x * (-6.0d0))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.17) || !(z <= 0.165)) {
tmp = z * (x * -6.0);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.17) or not (z <= 0.165): tmp = z * (x * -6.0) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.17) || !(z <= 0.165)) tmp = Float64(z * Float64(x * -6.0)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.17) || ~((z <= 0.165))) tmp = z * (x * -6.0); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.17], N[Not[LessEqual[z, 0.165]], $MachinePrecision]], N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.17 \lor \neg \left(z \leq 0.165\right):\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.170000000000000012 or 0.165000000000000008 < z Initial program 99.6%
Taylor expanded in x around inf 55.1%
Taylor expanded in z around inf 55.1%
*-commutative55.1%
Simplified55.1%
metadata-eval55.1%
div-inv55.1%
associate-/r/55.1%
clear-num55.0%
Applied egg-rr55.0%
associate-/r/55.1%
clear-num55.2%
div-inv55.1%
metadata-eval55.1%
Applied egg-rr55.1%
if -0.170000000000000012 < z < 0.165000000000000008Initial program 99.1%
Taylor expanded in z around 0 69.6%
Final simplification62.7%
(FPCore (x y z) :precision binary64 (if (<= z -0.17) (* -6.0 (* x z)) (if (<= z 0.165) x (* z (* x -6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.17) {
tmp = -6.0 * (x * z);
} else if (z <= 0.165) {
tmp = x;
} else {
tmp = z * (x * -6.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 <= (-0.17d0)) then
tmp = (-6.0d0) * (x * z)
else if (z <= 0.165d0) then
tmp = x
else
tmp = z * (x * (-6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.17) {
tmp = -6.0 * (x * z);
} else if (z <= 0.165) {
tmp = x;
} else {
tmp = z * (x * -6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.17: tmp = -6.0 * (x * z) elif z <= 0.165: tmp = x else: tmp = z * (x * -6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.17) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= 0.165) tmp = x; else tmp = Float64(z * Float64(x * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.17) tmp = -6.0 * (x * z); elseif (z <= 0.165) tmp = x; else tmp = z * (x * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.17], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.165], x, N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.17:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq 0.165:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\end{array}
\end{array}
if z < -0.170000000000000012Initial program 99.6%
Taylor expanded in x around inf 53.6%
Taylor expanded in z around inf 53.6%
*-commutative53.6%
Simplified53.6%
metadata-eval53.6%
div-inv53.7%
associate-/r/53.6%
Applied egg-rr53.6%
div-inv53.6%
clear-num53.7%
div-inv53.6%
metadata-eval53.6%
associate-*r*53.7%
Applied egg-rr53.7%
if -0.170000000000000012 < z < 0.165000000000000008Initial program 99.1%
Taylor expanded in z around 0 69.6%
if 0.165000000000000008 < z Initial program 99.7%
Taylor expanded in x around inf 56.4%
Taylor expanded in z around inf 56.4%
*-commutative56.4%
Simplified56.4%
metadata-eval56.4%
div-inv56.4%
associate-/r/56.3%
clear-num56.2%
Applied egg-rr56.2%
associate-/r/56.3%
clear-num56.4%
div-inv56.4%
metadata-eval56.4%
Applied egg-rr56.4%
Final simplification62.7%
(FPCore (x y z) :precision binary64 (+ x (* z (* (- y x) 6.0))))
double code(double x, double y, double z) {
return x + (z * ((y - x) * 6.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (z * ((y - x) * 6.0d0))
end function
public static double code(double x, double y, double z) {
return x + (z * ((y - x) * 6.0));
}
def code(x, y, z): return x + (z * ((y - x) * 6.0))
function code(x, y, z) return Float64(x + Float64(z * Float64(Float64(y - x) * 6.0))) end
function tmp = code(x, y, z) tmp = x + (z * ((y - x) * 6.0)); end
code[x_, y_, z_] := N[(x + N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + z \cdot \left(\left(y - x\right) \cdot 6\right)
\end{array}
Initial program 99.3%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (+ x (* (- y x) (* 6.0 z))))
double code(double x, double y, double z) {
return x + ((y - x) * (6.0 * 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 - x) * (6.0d0 * z))
end function
public static double code(double x, double y, double z) {
return x + ((y - x) * (6.0 * z));
}
def code(x, y, z): return x + ((y - x) * (6.0 * z))
function code(x, y, z) return Float64(x + Float64(Float64(y - x) * Float64(6.0 * z))) end
function tmp = code(x, y, z) tmp = x + ((y - x) * (6.0 * z)); end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \left(6 \cdot z\right)
\end{array}
Initial program 99.3%
associate-*l*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (* x (+ 1.0 (* z -6.0))))
double code(double x, double y, double z) {
return x * (1.0 + (z * -6.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x * (1.0d0 + (z * (-6.0d0)))
end function
public static double code(double x, double y, double z) {
return x * (1.0 + (z * -6.0));
}
def code(x, y, z): return x * (1.0 + (z * -6.0))
function code(x, y, z) return Float64(x * Float64(1.0 + Float64(z * -6.0))) end
function tmp = code(x, y, z) tmp = x * (1.0 + (z * -6.0)); end
code[x_, y_, z_] := N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 + z \cdot -6\right)
\end{array}
Initial program 99.3%
Taylor expanded in x around inf 63.1%
Final simplification63.1%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.3%
Taylor expanded in z around 0 37.6%
Final simplification37.6%
(FPCore (x y z) :precision binary64 (- x (* (* 6.0 z) (- x y))))
double code(double x, double y, double z) {
return x - ((6.0 * z) * (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 - ((6.0d0 * z) * (x - y))
end function
public static double code(double x, double y, double z) {
return x - ((6.0 * z) * (x - y));
}
def code(x, y, z): return x - ((6.0 * z) * (x - y))
function code(x, y, z) return Float64(x - Float64(Float64(6.0 * z) * Float64(x - y))) end
function tmp = code(x, y, z) tmp = x - ((6.0 * z) * (x - y)); end
code[x_, y_, z_] := N[(x - N[(N[(6.0 * z), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(6 \cdot z\right) \cdot \left(x - y\right)
\end{array}
herbie shell --seed 2023214
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:herbie-target
(- x (* (* 6.0 z) (- x y)))
(+ x (* (* (- y x) 6.0) z)))