
(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(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.8%
associate-*l*99.8%
Simplified99.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.6e+78) (not (<= x 1550000.0))) (+ x (* -6.0 (* x z))) (+ x (* y (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.6e+78) || !(x <= 1550000.0)) {
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 <= (-1.6d+78)) .or. (.not. (x <= 1550000.0d0))) 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 <= -1.6e+78) || !(x <= 1550000.0)) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = x + (y * (6.0 * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.6e+78) or not (x <= 1550000.0): 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 <= -1.6e+78) || !(x <= 1550000.0)) 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 <= -1.6e+78) || ~((x <= 1550000.0))) 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, -1.6e+78], N[Not[LessEqual[x, 1550000.0]], $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 -1.6 \cdot 10^{+78} \lor \neg \left(x \leq 1550000\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 < -1.59999999999999997e78 or 1.55e6 < x Initial program 99.9%
Taylor expanded in y around 0 87.4%
if -1.59999999999999997e78 < x < 1.55e6Initial program 99.7%
Taylor expanded in y around inf 88.5%
*-commutative88.5%
associate-*r*88.6%
Simplified88.6%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.55e+78) (not (<= x 2200000.0))) (+ x (* -6.0 (* x z))) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.55e+78) || !(x <= 2200000.0)) {
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 <= (-1.55d+78)) .or. (.not. (x <= 2200000.0d0))) 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 <= -1.55e+78) || !(x <= 2200000.0)) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.55e+78) or not (x <= 2200000.0): 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 <= -1.55e+78) || !(x <= 2200000.0)) 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 <= -1.55e+78) || ~((x <= 2200000.0))) 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, -1.55e+78], N[Not[LessEqual[x, 2200000.0]], $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 -1.55 \cdot 10^{+78} \lor \neg \left(x \leq 2200000\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 < -1.55e78 or 2.2e6 < x Initial program 99.9%
Taylor expanded in y around 0 87.4%
if -1.55e78 < x < 2.2e6Initial program 99.7%
Taylor expanded in y around inf 88.5%
*-commutative88.5%
Simplified88.5%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -25000000000000.0) (not (<= x 320.0))) (+ x (* -6.0 (* x z))) (* 6.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -25000000000000.0) || !(x <= 320.0)) {
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 <= (-25000000000000.0d0)) .or. (.not. (x <= 320.0d0))) 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 <= -25000000000000.0) || !(x <= 320.0)) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -25000000000000.0) or not (x <= 320.0): tmp = x + (-6.0 * (x * z)) else: tmp = 6.0 * (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -25000000000000.0) || !(x <= 320.0)) 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 <= -25000000000000.0) || ~((x <= 320.0))) 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, -25000000000000.0], N[Not[LessEqual[x, 320.0]], $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 -25000000000000 \lor \neg \left(x \leq 320\right):\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if x < -2.5e13 or 320 < x Initial program 99.9%
Taylor expanded in y around 0 84.3%
if -2.5e13 < x < 320Initial program 99.6%
Taylor expanded in y around inf 88.8%
*-commutative88.8%
Simplified88.8%
+-commutative88.8%
*-commutative88.8%
add-cube-cbrt88.0%
associate-*l*88.0%
fma-define88.0%
pow288.0%
Applied egg-rr88.0%
Taylor expanded in z around inf 69.4%
Final simplification76.2%
(FPCore (x y z) :precision binary64 (if (<= x -1.75e+78) (+ x (* -6.0 (* x z))) (if (<= x 4100000.0) (+ x (* y (* 6.0 z))) (+ x (* z (* x -6.0))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.75e+78) {
tmp = x + (-6.0 * (x * z));
} else if (x <= 4100000.0) {
tmp = x + (y * (6.0 * z));
} else {
tmp = x + (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 (x <= (-1.75d+78)) then
tmp = x + ((-6.0d0) * (x * z))
else if (x <= 4100000.0d0) then
tmp = x + (y * (6.0d0 * z))
else
tmp = x + (z * (x * (-6.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.75e+78) {
tmp = x + (-6.0 * (x * z));
} else if (x <= 4100000.0) {
tmp = x + (y * (6.0 * z));
} else {
tmp = x + (z * (x * -6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.75e+78: tmp = x + (-6.0 * (x * z)) elif x <= 4100000.0: tmp = x + (y * (6.0 * z)) else: tmp = x + (z * (x * -6.0)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.75e+78) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); elseif (x <= 4100000.0) tmp = Float64(x + Float64(y * Float64(6.0 * z))); else tmp = Float64(x + Float64(z * Float64(x * -6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.75e+78) tmp = x + (-6.0 * (x * z)); elseif (x <= 4100000.0) tmp = x + (y * (6.0 * z)); else tmp = x + (z * (x * -6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.75e+78], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4100000.0], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+78}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;x \leq 4100000:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x \cdot -6\right)\\
\end{array}
\end{array}
if x < -1.7500000000000001e78Initial program 99.9%
Taylor expanded in y around 0 92.9%
if -1.7500000000000001e78 < x < 4.1e6Initial program 99.7%
Taylor expanded in y around inf 88.5%
*-commutative88.5%
associate-*r*88.6%
Simplified88.6%
if 4.1e6 < x Initial program 100.0%
Taylor expanded in y around 0 82.2%
associate-*r*82.2%
Simplified82.2%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -7.4e-26) (not (<= z 3.9e-107))) (* 6.0 (* y z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7.4e-26) || !(z <= 3.9e-107)) {
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 <= (-7.4d-26)) .or. (.not. (z <= 3.9d-107))) 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 <= -7.4e-26) || !(z <= 3.9e-107)) {
tmp = 6.0 * (y * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -7.4e-26) or not (z <= 3.9e-107): tmp = 6.0 * (y * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -7.4e-26) || !(z <= 3.9e-107)) 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 <= -7.4e-26) || ~((z <= 3.9e-107))) tmp = 6.0 * (y * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -7.4e-26], N[Not[LessEqual[z, 3.9e-107]], $MachinePrecision]], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.4 \cdot 10^{-26} \lor \neg \left(z \leq 3.9 \cdot 10^{-107}\right):\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -7.3999999999999997e-26 or 3.9000000000000001e-107 < z Initial program 99.7%
Taylor expanded in y around inf 64.4%
*-commutative64.4%
Simplified64.4%
+-commutative64.4%
*-commutative64.4%
add-cube-cbrt63.9%
associate-*l*64.0%
fma-define64.0%
pow264.0%
Applied egg-rr64.0%
Taylor expanded in z around inf 59.4%
if -7.3999999999999997e-26 < z < 3.9000000000000001e-107Initial program 99.9%
Taylor expanded in z around 0 78.8%
Final simplification66.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -390000.0) (not (<= z 0.165))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -390000.0) || !(z <= 0.165)) {
tmp = -6.0 * (x * 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 <= (-390000.0d0)) .or. (.not. (z <= 0.165d0))) then
tmp = (-6.0d0) * (x * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -390000.0) || !(z <= 0.165)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -390000.0) or not (z <= 0.165): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -390000.0) || !(z <= 0.165)) tmp = Float64(-6.0 * Float64(x * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -390000.0) || ~((z <= 0.165))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -390000.0], N[Not[LessEqual[z, 0.165]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -390000 \lor \neg \left(z \leq 0.165\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.9e5 or 0.165000000000000008 < z Initial program 99.7%
Taylor expanded in y around 0 43.4%
Taylor expanded in z around inf 43.4%
if -3.9e5 < z < 0.165000000000000008Initial program 99.9%
Taylor expanded in z around 0 70.9%
Final simplification55.3%
(FPCore (x y z) :precision binary64 (if (<= z -5.5e-25) (* z (* y 6.0)) (if (<= z 7e-107) x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.5e-25) {
tmp = z * (y * 6.0);
} else if (z <= 7e-107) {
tmp = x;
} 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 (z <= (-5.5d-25)) then
tmp = z * (y * 6.0d0)
else if (z <= 7d-107) then
tmp = x
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 (z <= -5.5e-25) {
tmp = z * (y * 6.0);
} else if (z <= 7e-107) {
tmp = x;
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.5e-25: tmp = z * (y * 6.0) elif z <= 7e-107: tmp = x else: tmp = 6.0 * (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.5e-25) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= 7e-107) tmp = x; else tmp = Float64(6.0 * Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.5e-25) tmp = z * (y * 6.0); elseif (z <= 7e-107) tmp = x; else tmp = 6.0 * (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.5e-25], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7e-107], x, N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{-25}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-107}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -5.50000000000000004e-25Initial program 99.7%
Taylor expanded in y around inf 62.6%
*-commutative62.6%
Simplified62.6%
+-commutative62.6%
*-commutative62.6%
add-cube-cbrt62.3%
associate-*l*62.3%
fma-define62.3%
pow262.3%
Applied egg-rr62.3%
Taylor expanded in z around inf 60.7%
add-log-exp38.2%
*-un-lft-identity38.2%
log-prod38.2%
metadata-eval38.2%
add-log-exp60.7%
associate-*r*60.7%
*-commutative60.7%
Applied egg-rr60.7%
+-lft-identity60.7%
Simplified60.7%
if -5.50000000000000004e-25 < z < 6.99999999999999971e-107Initial program 99.9%
Taylor expanded in z around 0 78.8%
if 6.99999999999999971e-107 < z Initial program 99.6%
Taylor expanded in y around inf 66.2%
*-commutative66.2%
Simplified66.2%
+-commutative66.2%
*-commutative66.2%
add-cube-cbrt65.5%
associate-*l*65.5%
fma-define65.5%
pow265.5%
Applied egg-rr65.5%
Taylor expanded in z around inf 58.2%
Final simplification66.2%
(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 32.4%
(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 2024157
(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)))