
(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 10 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 (+ 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}
Initial program 99.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.55e+28) (not (<= x 1.45e+52))) (+ x (* -6.0 (* x z))) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.55e+28) || !(x <= 1.45e+52)) {
tmp = x + (-6.0 * (x * z));
} 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 <= (-2.55d+28)) .or. (.not. (x <= 1.45d+52))) then
tmp = x + ((-6.0d0) * (x * z))
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 <= -2.55e+28) || !(x <= 1.45e+52)) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.55e+28) or not (x <= 1.45e+52): tmp = x + (-6.0 * (x * z)) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.55e+28) || !(x <= 1.45e+52)) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); 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 <= -2.55e+28) || ~((x <= 1.45e+52))) tmp = x + (-6.0 * (x * z)); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.55e+28], N[Not[LessEqual[x, 1.45e+52]], $MachinePrecision]], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.55 \cdot 10^{+28} \lor \neg \left(x \leq 1.45 \cdot 10^{+52}\right):\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if x < -2.5500000000000002e28 or 1.45e52 < x Initial program 99.9%
Taylor expanded in y around 0 89.8%
if -2.5500000000000002e28 < x < 1.45e52Initial program 99.8%
Taylor expanded in y around inf 86.8%
*-commutative86.8%
Simplified86.8%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -5.5e-68) (not (<= x 2e-107))) (+ x (* -6.0 (* x z))) (* 6.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5.5e-68) || !(x <= 2e-107)) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = 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 <= (-5.5d-68)) .or. (.not. (x <= 2d-107))) then
tmp = x + ((-6.0d0) * (x * z))
else
tmp = 6.0d0 * (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -5.5e-68) || !(x <= 2e-107)) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5.5e-68) or not (x <= 2e-107): tmp = x + (-6.0 * (x * z)) else: tmp = 6.0 * (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -5.5e-68) || !(x <= 2e-107)) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); else tmp = Float64(6.0 * Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -5.5e-68) || ~((x <= 2e-107))) tmp = x + (-6.0 * (x * z)); else tmp = 6.0 * (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -5.5e-68], N[Not[LessEqual[x, 2e-107]], $MachinePrecision]], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-68} \lor \neg \left(x \leq 2 \cdot 10^{-107}\right):\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if x < -5.5000000000000003e-68 or 2e-107 < x Initial program 99.9%
Taylor expanded in y around 0 80.9%
if -5.5000000000000003e-68 < x < 2e-107Initial program 99.7%
Taylor expanded in y around inf 90.8%
*-commutative90.8%
Simplified90.8%
Taylor expanded in x around inf 78.4%
+-commutative78.4%
fma-define78.4%
*-commutative78.4%
associate-/l*65.1%
Simplified65.1%
Taylor expanded in x around 0 72.7%
Final simplification77.9%
(FPCore (x y z) :precision binary64 (if (<= x -1.85e+27) (+ x (* x (* z -6.0))) (if (<= x 3.3e+52) (+ x (* z (* y 6.0))) (+ x (* -6.0 (* x z))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.85e+27) {
tmp = x + (x * (z * -6.0));
} else if (x <= 3.3e+52) {
tmp = x + (z * (y * 6.0));
} else {
tmp = x + (-6.0 * (x * 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.85d+27)) then
tmp = x + (x * (z * (-6.0d0)))
else if (x <= 3.3d+52) then
tmp = x + (z * (y * 6.0d0))
else
tmp = x + ((-6.0d0) * (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.85e+27) {
tmp = x + (x * (z * -6.0));
} else if (x <= 3.3e+52) {
tmp = x + (z * (y * 6.0));
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.85e+27: tmp = x + (x * (z * -6.0)) elif x <= 3.3e+52: tmp = x + (z * (y * 6.0)) else: tmp = x + (-6.0 * (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.85e+27) tmp = Float64(x + Float64(x * Float64(z * -6.0))); elseif (x <= 3.3e+52) tmp = Float64(x + Float64(z * Float64(y * 6.0))); else tmp = Float64(x + Float64(-6.0 * Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.85e+27) tmp = x + (x * (z * -6.0)); elseif (x <= 3.3e+52) tmp = x + (z * (y * 6.0)); else tmp = x + (-6.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.85e+27], N[(x + N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.3e+52], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{+27}:\\
\;\;\;\;x + x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{+52}:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -1.85000000000000001e27Initial program 99.9%
Taylor expanded in y around 0 88.8%
*-commutative88.8%
associate-*r*88.9%
*-commutative88.9%
Simplified88.9%
if -1.85000000000000001e27 < x < 3.3e52Initial program 99.8%
Taylor expanded in y around inf 86.8%
if 3.3e52 < x Initial program 99.8%
Taylor expanded in y around 0 90.9%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (<= x -1.25e+27) (+ x (* x (* z -6.0))) (if (<= x 8e+53) (+ x (* 6.0 (* y z))) (+ x (* -6.0 (* x z))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.25e+27) {
tmp = x + (x * (z * -6.0));
} else if (x <= 8e+53) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x + (-6.0 * (x * 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.25d+27)) then
tmp = x + (x * (z * (-6.0d0)))
else if (x <= 8d+53) then
tmp = x + (6.0d0 * (y * z))
else
tmp = x + ((-6.0d0) * (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.25e+27) {
tmp = x + (x * (z * -6.0));
} else if (x <= 8e+53) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.25e+27: tmp = x + (x * (z * -6.0)) elif x <= 8e+53: tmp = x + (6.0 * (y * z)) else: tmp = x + (-6.0 * (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.25e+27) tmp = Float64(x + Float64(x * Float64(z * -6.0))); elseif (x <= 8e+53) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(x + Float64(-6.0 * Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.25e+27) tmp = x + (x * (z * -6.0)); elseif (x <= 8e+53) tmp = x + (6.0 * (y * z)); else tmp = x + (-6.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.25e+27], N[(x + N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8e+53], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{+27}:\\
\;\;\;\;x + x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+53}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -1.24999999999999995e27Initial program 99.9%
Taylor expanded in y around 0 88.8%
*-commutative88.8%
associate-*r*88.9%
*-commutative88.9%
Simplified88.9%
if -1.24999999999999995e27 < x < 7.9999999999999999e53Initial program 99.8%
Taylor expanded in y around inf 86.8%
*-commutative86.8%
Simplified86.8%
if 7.9999999999999999e53 < x Initial program 99.8%
Taylor expanded in y around 0 90.9%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -7.2e-13) (not (<= z 3.9e-16))) (* z (* y 6.0)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7.2e-13) || !(z <= 3.9e-16)) {
tmp = z * (y * 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 <= (-7.2d-13)) .or. (.not. (z <= 3.9d-16))) then
tmp = z * (y * 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 <= -7.2e-13) || !(z <= 3.9e-16)) {
tmp = z * (y * 6.0);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -7.2e-13) or not (z <= 3.9e-16): tmp = z * (y * 6.0) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -7.2e-13) || !(z <= 3.9e-16)) tmp = Float64(z * Float64(y * 6.0)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -7.2e-13) || ~((z <= 3.9e-16))) tmp = z * (y * 6.0); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -7.2e-13], N[Not[LessEqual[z, 3.9e-16]], $MachinePrecision]], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-13} \lor \neg \left(z \leq 3.9 \cdot 10^{-16}\right):\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -7.1999999999999996e-13 or 3.89999999999999977e-16 < z Initial program 99.7%
Taylor expanded in y around inf 54.3%
*-commutative54.3%
Simplified54.3%
Taylor expanded in x around inf 46.1%
+-commutative46.1%
fma-define46.1%
*-commutative46.1%
associate-/l*46.2%
Simplified46.2%
Taylor expanded in x around 0 53.1%
associate-*r*53.2%
Simplified53.2%
if -7.1999999999999996e-13 < z < 3.89999999999999977e-16Initial program 99.9%
Taylor expanded in z around 0 74.1%
Final simplification62.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.7e-16) (not (<= z 5.5e-16))) (* 6.0 (* y z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.7e-16) || !(z <= 5.5e-16)) {
tmp = 6.0 * (y * z);
} 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 <= (-2.7d-16)) .or. (.not. (z <= 5.5d-16))) then
tmp = 6.0d0 * (y * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.7e-16) || !(z <= 5.5e-16)) {
tmp = 6.0 * (y * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.7e-16) or not (z <= 5.5e-16): tmp = 6.0 * (y * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.7e-16) || !(z <= 5.5e-16)) tmp = Float64(6.0 * Float64(y * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.7e-16) || ~((z <= 5.5e-16))) tmp = 6.0 * (y * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.7e-16], N[Not[LessEqual[z, 5.5e-16]], $MachinePrecision]], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{-16} \lor \neg \left(z \leq 5.5 \cdot 10^{-16}\right):\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.69999999999999999e-16 or 5.49999999999999964e-16 < z Initial program 99.7%
Taylor expanded in y around inf 54.3%
*-commutative54.3%
Simplified54.3%
Taylor expanded in x around inf 46.1%
+-commutative46.1%
fma-define46.1%
*-commutative46.1%
associate-/l*46.2%
Simplified46.2%
Taylor expanded in x around 0 53.1%
if -2.69999999999999999e-16 < z < 5.49999999999999964e-16Initial program 99.9%
Taylor expanded in z around 0 74.1%
Final simplification62.9%
(FPCore (x y z) :precision binary64 (if (<= z -4e-14) (* 6.0 (* y z)) (if (<= z 5e-16) x (* y (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4e-14) {
tmp = 6.0 * (y * z);
} else if (z <= 5e-16) {
tmp = x;
} else {
tmp = 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 (z <= (-4d-14)) then
tmp = 6.0d0 * (y * z)
else if (z <= 5d-16) then
tmp = x
else
tmp = y * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4e-14) {
tmp = 6.0 * (y * z);
} else if (z <= 5e-16) {
tmp = x;
} else {
tmp = y * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4e-14: tmp = 6.0 * (y * z) elif z <= 5e-16: tmp = x else: tmp = y * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4e-14) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= 5e-16) tmp = x; else tmp = Float64(y * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4e-14) tmp = 6.0 * (y * z); elseif (z <= 5e-16) tmp = x; else tmp = y * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4e-14], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e-16], x, N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{-14}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-16}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -4e-14Initial program 99.8%
Taylor expanded in y around inf 55.9%
*-commutative55.9%
Simplified55.9%
Taylor expanded in x around inf 48.9%
+-commutative48.9%
fma-define48.9%
*-commutative48.9%
associate-/l*48.9%
Simplified48.9%
Taylor expanded in x around 0 55.0%
if -4e-14 < z < 5.0000000000000004e-16Initial program 99.9%
Taylor expanded in z around 0 74.1%
if 5.0000000000000004e-16 < z Initial program 99.7%
Taylor expanded in y around inf 52.9%
*-commutative52.9%
Simplified52.9%
Taylor expanded in x around inf 43.5%
+-commutative43.5%
fma-define43.5%
*-commutative43.5%
associate-/l*43.6%
Simplified43.6%
Taylor expanded in x around 0 51.4%
associate-*r*51.4%
*-commutative51.4%
associate-*r*51.4%
Simplified51.4%
(FPCore (x y z) :precision binary64 (+ x (* 6.0 (* (- y x) z))))
double code(double x, double y, double z) {
return x + (6.0 * ((y - x) * 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 + (6.0d0 * ((y - x) * z))
end function
public static double code(double x, double y, double z) {
return x + (6.0 * ((y - x) * z));
}
def code(x, y, z): return x + (6.0 * ((y - x) * z))
function code(x, y, z) return Float64(x + Float64(6.0 * Float64(Float64(y - x) * z))) end
function tmp = code(x, y, z) tmp = x + (6.0 * ((y - x) * z)); end
code[x_, y_, z_] := N[(x + N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + 6 \cdot \left(\left(y - x\right) \cdot z\right)
\end{array}
Initial program 99.8%
Taylor expanded in z around 0 99.8%
Final simplification99.8%
(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.8%
Taylor expanded in z around 0 36.2%
(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 2024150
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:alt
(! :herbie-platform default (- x (* (* 6 z) (- x y))))
(+ x (* (* (- y x) 6.0) z)))