
(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 9 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 (* 6.0 (* z (- y x)))))
double code(double x, double y, double z) {
return x + (6.0 * (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 = x + (6.0d0 * (z * (y - x)))
end function
public static double code(double x, double y, double z) {
return x + (6.0 * (z * (y - x)));
}
def code(x, y, z): return x + (6.0 * (z * (y - x)))
function code(x, y, z) return Float64(x + Float64(6.0 * Float64(z * Float64(y - x)))) end
function tmp = code(x, y, z) tmp = x + (6.0 * (z * (y - x))); end
code[x_, y_, z_] := N[(x + N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + 6 \cdot \left(z \cdot \left(y - x\right)\right)
\end{array}
Initial program 99.7%
Taylor expanded in z around 0 99.8%
(FPCore (x y z) :precision binary64 (if (<= z -9.2e+136) (* (* 6.0 z) (- x)) (if (or (<= z -3.8e-42) (not (<= z 3.7e-11))) (* 6.0 (* z y)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -9.2e+136) {
tmp = (6.0 * z) * -x;
} else if ((z <= -3.8e-42) || !(z <= 3.7e-11)) {
tmp = 6.0 * (z * y);
} 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 <= (-9.2d+136)) then
tmp = (6.0d0 * z) * -x
else if ((z <= (-3.8d-42)) .or. (.not. (z <= 3.7d-11))) then
tmp = 6.0d0 * (z * y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -9.2e+136) {
tmp = (6.0 * z) * -x;
} else if ((z <= -3.8e-42) || !(z <= 3.7e-11)) {
tmp = 6.0 * (z * y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9.2e+136: tmp = (6.0 * z) * -x elif (z <= -3.8e-42) or not (z <= 3.7e-11): tmp = 6.0 * (z * y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9.2e+136) tmp = Float64(Float64(6.0 * z) * Float64(-x)); elseif ((z <= -3.8e-42) || !(z <= 3.7e-11)) tmp = Float64(6.0 * Float64(z * y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -9.2e+136) tmp = (6.0 * z) * -x; elseif ((z <= -3.8e-42) || ~((z <= 3.7e-11))) tmp = 6.0 * (z * y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9.2e+136], N[(N[(6.0 * z), $MachinePrecision] * (-x)), $MachinePrecision], If[Or[LessEqual[z, -3.8e-42], N[Not[LessEqual[z, 3.7e-11]], $MachinePrecision]], N[(6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{+136}:\\
\;\;\;\;\left(6 \cdot z\right) \cdot \left(-x\right)\\
\mathbf{elif}\;z \leq -3.8 \cdot 10^{-42} \lor \neg \left(z \leq 3.7 \cdot 10^{-11}\right):\\
\;\;\;\;6 \cdot \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.2e136Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in y around 0 97.2%
associate-*r*97.2%
associate-*r*97.1%
distribute-rgt-in99.7%
+-commutative99.7%
metadata-eval99.7%
cancel-sign-sub-inv99.7%
distribute-lft-out--99.7%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in y around 0 58.8%
neg-mul-158.8%
Simplified58.8%
if -9.2e136 < z < -3.80000000000000017e-42 or 3.7000000000000001e-11 < z Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 95.9%
Taylor expanded in y around inf 59.8%
*-commutative59.8%
Simplified59.8%
if -3.80000000000000017e-42 < z < 3.7000000000000001e-11Initial program 99.9%
Taylor expanded in z around 0 72.2%
Final simplification64.6%
(FPCore (x y z) :precision binary64 (if (<= z -6e+136) (* -6.0 (* x z)) (if (or (<= z -3.8e-42) (not (<= z 3.2e-11))) (* 6.0 (* z y)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -6e+136) {
tmp = -6.0 * (x * z);
} else if ((z <= -3.8e-42) || !(z <= 3.2e-11)) {
tmp = 6.0 * (z * y);
} 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 <= (-6d+136)) then
tmp = (-6.0d0) * (x * z)
else if ((z <= (-3.8d-42)) .or. (.not. (z <= 3.2d-11))) then
tmp = 6.0d0 * (z * y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -6e+136) {
tmp = -6.0 * (x * z);
} else if ((z <= -3.8e-42) || !(z <= 3.2e-11)) {
tmp = 6.0 * (z * y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6e+136: tmp = -6.0 * (x * z) elif (z <= -3.8e-42) or not (z <= 3.2e-11): tmp = 6.0 * (z * y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6e+136) tmp = Float64(-6.0 * Float64(x * z)); elseif ((z <= -3.8e-42) || !(z <= 3.2e-11)) tmp = Float64(6.0 * Float64(z * y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -6e+136) tmp = -6.0 * (x * z); elseif ((z <= -3.8e-42) || ~((z <= 3.2e-11))) tmp = 6.0 * (z * y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6e+136], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -3.8e-42], N[Not[LessEqual[z, 3.2e-11]], $MachinePrecision]], N[(6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+136}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -3.8 \cdot 10^{-42} \lor \neg \left(z \leq 3.2 \cdot 10^{-11}\right):\\
\;\;\;\;6 \cdot \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -5.99999999999999958e136Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in y around 0 58.8%
if -5.99999999999999958e136 < z < -3.80000000000000017e-42 or 3.19999999999999994e-11 < z Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 95.9%
Taylor expanded in y around inf 59.8%
*-commutative59.8%
Simplified59.8%
if -3.80000000000000017e-42 < z < 3.19999999999999994e-11Initial program 99.9%
Taylor expanded in z around 0 72.2%
Final simplification64.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -195000000.0) (not (<= z 2.7e-5))) (* 6.0 (* z (- y x))) (+ x (* 6.0 (* z y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -195000000.0) || !(z <= 2.7e-5)) {
tmp = 6.0 * (z * (y - x));
} else {
tmp = x + (6.0 * (z * y));
}
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 <= (-195000000.0d0)) .or. (.not. (z <= 2.7d-5))) then
tmp = 6.0d0 * (z * (y - x))
else
tmp = x + (6.0d0 * (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -195000000.0) || !(z <= 2.7e-5)) {
tmp = 6.0 * (z * (y - x));
} else {
tmp = x + (6.0 * (z * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -195000000.0) or not (z <= 2.7e-5): tmp = 6.0 * (z * (y - x)) else: tmp = x + (6.0 * (z * y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -195000000.0) || !(z <= 2.7e-5)) tmp = Float64(6.0 * Float64(z * Float64(y - x))); else tmp = Float64(x + Float64(6.0 * Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -195000000.0) || ~((z <= 2.7e-5))) tmp = 6.0 * (z * (y - x)); else tmp = x + (6.0 * (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -195000000.0], N[Not[LessEqual[z, 2.7e-5]], $MachinePrecision]], N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -195000000 \lor \neg \left(z \leq 2.7 \cdot 10^{-5}\right):\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(z \cdot y\right)\\
\end{array}
\end{array}
if z < -1.95e8 or 2.6999999999999999e-5 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 98.6%
if -1.95e8 < z < 2.6999999999999999e-5Initial program 99.8%
Taylor expanded in y around inf 99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.8e-42) (not (<= z 4.1e-7))) (* 6.0 (* z (- y x))) (+ x (* -6.0 (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.8e-42) || !(z <= 4.1e-7)) {
tmp = 6.0 * (z * (y - x));
} 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 ((z <= (-3.8d-42)) .or. (.not. (z <= 4.1d-7))) then
tmp = 6.0d0 * (z * (y - x))
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 ((z <= -3.8e-42) || !(z <= 4.1e-7)) {
tmp = 6.0 * (z * (y - x));
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.8e-42) or not (z <= 4.1e-7): tmp = 6.0 * (z * (y - x)) else: tmp = x + (-6.0 * (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.8e-42) || !(z <= 4.1e-7)) tmp = Float64(6.0 * Float64(z * Float64(y - x))); 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 ((z <= -3.8e-42) || ~((z <= 4.1e-7))) tmp = 6.0 * (z * (y - x)); else tmp = x + (-6.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.8e-42], N[Not[LessEqual[z, 4.1e-7]], $MachinePrecision]], N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-42} \lor \neg \left(z \leq 4.1 \cdot 10^{-7}\right):\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if z < -3.80000000000000017e-42 or 4.0999999999999999e-7 < z Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 96.9%
if -3.80000000000000017e-42 < z < 4.0999999999999999e-7Initial program 99.9%
Taylor expanded in y around 0 72.4%
Final simplification87.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.8e-42) (not (<= z 6e-12))) (* 6.0 (* z (- y x))) (* x (+ (* z -6.0) 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.8e-42) || !(z <= 6e-12)) {
tmp = 6.0 * (z * (y - x));
} else {
tmp = x * ((z * -6.0) + 1.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 <= (-3.8d-42)) .or. (.not. (z <= 6d-12))) then
tmp = 6.0d0 * (z * (y - x))
else
tmp = x * ((z * (-6.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -3.8e-42) || !(z <= 6e-12)) {
tmp = 6.0 * (z * (y - x));
} else {
tmp = x * ((z * -6.0) + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.8e-42) or not (z <= 6e-12): tmp = 6.0 * (z * (y - x)) else: tmp = x * ((z * -6.0) + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.8e-42) || !(z <= 6e-12)) tmp = Float64(6.0 * Float64(z * Float64(y - x))); else tmp = Float64(x * Float64(Float64(z * -6.0) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.8e-42) || ~((z <= 6e-12))) tmp = 6.0 * (z * (y - x)); else tmp = x * ((z * -6.0) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.8e-42], N[Not[LessEqual[z, 6e-12]], $MachinePrecision]], N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-42} \lor \neg \left(z \leq 6 \cdot 10^{-12}\right):\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\end{array}
\end{array}
if z < -3.80000000000000017e-42 or 6.0000000000000003e-12 < z Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 96.9%
if -3.80000000000000017e-42 < z < 6.0000000000000003e-12Initial program 99.9%
Taylor expanded in x around inf 72.4%
+-commutative72.4%
Simplified72.4%
Final simplification87.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.8e-42) (not (<= z 7.8e-13))) (* 6.0 (* z (- y x))) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.8e-42) || !(z <= 7.8e-13)) {
tmp = 6.0 * (z * (y - x));
} 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 <= (-3.8d-42)) .or. (.not. (z <= 7.8d-13))) then
tmp = 6.0d0 * (z * (y - x))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -3.8e-42) || !(z <= 7.8e-13)) {
tmp = 6.0 * (z * (y - x));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.8e-42) or not (z <= 7.8e-13): tmp = 6.0 * (z * (y - x)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.8e-42) || !(z <= 7.8e-13)) tmp = Float64(6.0 * Float64(z * Float64(y - x))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.8e-42) || ~((z <= 7.8e-13))) tmp = 6.0 * (z * (y - x)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.8e-42], N[Not[LessEqual[z, 7.8e-13]], $MachinePrecision]], N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-42} \lor \neg \left(z \leq 7.8 \cdot 10^{-13}\right):\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.80000000000000017e-42 or 7.80000000000000009e-13 < z Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 96.9%
if -3.80000000000000017e-42 < z < 7.80000000000000009e-13Initial program 99.9%
Taylor expanded in z around 0 72.2%
Final simplification87.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.165) (not (<= z 0.165))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(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 <= (-0.165d0)) .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 <= -0.165) || !(z <= 0.165)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.165) 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 <= -0.165) || !(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 <= -0.165) || ~((z <= 0.165))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.165], 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 -0.165 \lor \neg \left(z \leq 0.165\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 0.165000000000000008 < z Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 98.6%
Taylor expanded in y around 0 50.6%
if -0.165000000000000008 < z < 0.165000000000000008Initial program 99.8%
Taylor expanded in z around 0 67.9%
Final simplification58.2%
(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.7%
Taylor expanded in z around 0 31.5%
(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 2024132
(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)))