
(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.5%
associate-*l*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= z -2.35e+89) (* 6.0 (* y z)) (if (or (<= z -0.0027) (not (<= z 15000.0))) (* z (* x -6.0)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.35e+89) {
tmp = 6.0 * (y * z);
} else if ((z <= -0.0027) || !(z <= 15000.0)) {
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 <= (-2.35d+89)) then
tmp = 6.0d0 * (y * z)
else if ((z <= (-0.0027d0)) .or. (.not. (z <= 15000.0d0))) 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 <= -2.35e+89) {
tmp = 6.0 * (y * z);
} else if ((z <= -0.0027) || !(z <= 15000.0)) {
tmp = z * (x * -6.0);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.35e+89: tmp = 6.0 * (y * z) elif (z <= -0.0027) or not (z <= 15000.0): tmp = z * (x * -6.0) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.35e+89) tmp = Float64(6.0 * Float64(y * z)); elseif ((z <= -0.0027) || !(z <= 15000.0)) 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 <= -2.35e+89) tmp = 6.0 * (y * z); elseif ((z <= -0.0027) || ~((z <= 15000.0))) tmp = z * (x * -6.0); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.35e+89], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -0.0027], N[Not[LessEqual[z, 15000.0]], $MachinePrecision]], N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{+89}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq -0.0027 \lor \neg \left(z \leq 15000\right):\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.35000000000000011e89Initial program 99.8%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 67.5%
*-commutative67.5%
Simplified67.5%
if -2.35000000000000011e89 < z < -0.0027000000000000001 or 15000 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-def99.6%
Applied egg-rr99.6%
Taylor expanded in z around inf 98.1%
associate-*r*98.1%
*-commutative98.1%
associate-*l*98.0%
Simplified98.0%
sub-neg98.0%
distribute-rgt-in98.0%
Applied egg-rr98.0%
Taylor expanded in y around 0 62.4%
*-commutative62.4%
Simplified62.4%
if -0.0027000000000000001 < z < 15000Initial program 99.2%
Taylor expanded in z around 0 70.4%
Final simplification67.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.5e-33) (not (<= z 5.8e-61))) (* z (* (- y x) 6.0)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.5e-33) || !(z <= 5.8e-61)) {
tmp = z * ((y - 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 <= (-2.5d-33)) .or. (.not. (z <= 5.8d-61))) then
tmp = z * ((y - 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 <= -2.5e-33) || !(z <= 5.8e-61)) {
tmp = z * ((y - x) * 6.0);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.5e-33) or not (z <= 5.8e-61): tmp = z * ((y - x) * 6.0) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.5e-33) || !(z <= 5.8e-61)) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.5e-33) || ~((z <= 5.8e-61))) tmp = z * ((y - x) * 6.0); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.5e-33], N[Not[LessEqual[z, 5.8e-61]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{-33} \lor \neg \left(z \leq 5.8 \cdot 10^{-61}\right):\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.50000000000000014e-33 or 5.7999999999999999e-61 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 94.0%
associate-*r*94.0%
*-commutative94.0%
associate-*l*94.0%
Simplified94.0%
if -2.50000000000000014e-33 < z < 5.7999999999999999e-61Initial program 99.1%
Taylor expanded in z around 0 75.4%
Final simplification86.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -1e-33) (not (<= z 0.00043))) (* z (* (- y x) 6.0)) (+ x (* -6.0 (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1e-33) || !(z <= 0.00043)) {
tmp = z * ((y - x) * 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 ((z <= (-1d-33)) .or. (.not. (z <= 0.00043d0))) then
tmp = z * ((y - x) * 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 ((z <= -1e-33) || !(z <= 0.00043)) {
tmp = z * ((y - x) * 6.0);
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1e-33) or not (z <= 0.00043): tmp = z * ((y - x) * 6.0) else: tmp = x + (-6.0 * (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1e-33) || !(z <= 0.00043)) tmp = Float64(z * Float64(Float64(y - x) * 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 ((z <= -1e-33) || ~((z <= 0.00043))) tmp = z * ((y - x) * 6.0); else tmp = x + (-6.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1e-33], N[Not[LessEqual[z, 0.00043]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-33} \lor \neg \left(z \leq 0.00043\right):\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if z < -1.0000000000000001e-33 or 4.29999999999999989e-4 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 96.5%
associate-*r*96.5%
*-commutative96.5%
associate-*l*96.5%
Simplified96.5%
if -1.0000000000000001e-33 < z < 4.29999999999999989e-4Initial program 99.1%
Taylor expanded in y around 0 73.8%
Final simplification86.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.18) (not (<= z 0.0025))) (* z (* (- y x) 6.0)) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.18) || !(z <= 0.0025)) {
tmp = z * ((y - x) * 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 ((z <= (-0.18d0)) .or. (.not. (z <= 0.0025d0))) then
tmp = z * ((y - x) * 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 ((z <= -0.18) || !(z <= 0.0025)) {
tmp = z * ((y - x) * 6.0);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.18) or not (z <= 0.0025): tmp = z * ((y - x) * 6.0) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.18) || !(z <= 0.0025)) tmp = Float64(z * Float64(Float64(y - x) * 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 ((z <= -0.18) || ~((z <= 0.0025))) tmp = z * ((y - x) * 6.0); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.18], N[Not[LessEqual[z, 0.0025]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.18 \lor \neg \left(z \leq 0.0025\right):\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -0.17999999999999999 or 0.00250000000000000005 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 98.3%
associate-*r*98.3%
*-commutative98.3%
associate-*l*98.3%
Simplified98.3%
if -0.17999999999999999 < z < 0.00250000000000000005Initial program 99.2%
Taylor expanded in y around inf 98.5%
*-commutative98.5%
Simplified98.5%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (if (<= z -0.175) (* z (- (* y 6.0) (* x 6.0))) (if (<= z 0.0025) (+ x (* 6.0 (* y z))) (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.175) {
tmp = z * ((y * 6.0) - (x * 6.0));
} else if (z <= 0.0025) {
tmp = x + (6.0 * (y * z));
} else {
tmp = z * ((y - 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.175d0)) then
tmp = z * ((y * 6.0d0) - (x * 6.0d0))
else if (z <= 0.0025d0) then
tmp = x + (6.0d0 * (y * z))
else
tmp = z * ((y - x) * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.175) {
tmp = z * ((y * 6.0) - (x * 6.0));
} else if (z <= 0.0025) {
tmp = x + (6.0 * (y * z));
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.175: tmp = z * ((y * 6.0) - (x * 6.0)) elif z <= 0.0025: tmp = x + (6.0 * (y * z)) else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.175) tmp = Float64(z * Float64(Float64(y * 6.0) - Float64(x * 6.0))); elseif (z <= 0.0025) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(z * Float64(Float64(y - x) * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.175) tmp = z * ((y * 6.0) - (x * 6.0)); elseif (z <= 0.0025) tmp = x + (6.0 * (y * z)); else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.175], N[(z * N[(N[(y * 6.0), $MachinePrecision] - N[(x * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0025], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.175:\\
\;\;\;\;z \cdot \left(y \cdot 6 - x \cdot 6\right)\\
\mathbf{elif}\;z \leq 0.0025:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -0.17499999999999999Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 98.0%
associate-*r*98.0%
*-commutative98.0%
associate-*l*98.0%
Simplified98.0%
sub-neg98.0%
distribute-rgt-in98.0%
Applied egg-rr98.0%
distribute-lft-neg-out98.0%
unsub-neg98.0%
Applied egg-rr98.0%
if -0.17499999999999999 < z < 0.00250000000000000005Initial program 99.2%
Taylor expanded in y around inf 98.5%
*-commutative98.5%
Simplified98.5%
if 0.00250000000000000005 < z Initial program 99.8%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-def99.6%
Applied egg-rr99.6%
Taylor expanded in z around inf 98.7%
associate-*r*98.7%
*-commutative98.7%
associate-*l*98.7%
Simplified98.7%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.45e-30) (not (<= z 5.8e-61))) (* 6.0 (* y z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.45e-30) || !(z <= 5.8e-61)) {
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.45d-30)) .or. (.not. (z <= 5.8d-61))) 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.45e-30) || !(z <= 5.8e-61)) {
tmp = 6.0 * (y * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.45e-30) or not (z <= 5.8e-61): tmp = 6.0 * (y * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.45e-30) || !(z <= 5.8e-61)) 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.45e-30) || ~((z <= 5.8e-61))) tmp = 6.0 * (y * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.45e-30], N[Not[LessEqual[z, 5.8e-61]], $MachinePrecision]], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.45 \cdot 10^{-30} \lor \neg \left(z \leq 5.8 \cdot 10^{-61}\right):\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.44999999999999985e-30 or 5.7999999999999999e-61 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 52.4%
*-commutative52.4%
Simplified52.4%
if -2.44999999999999985e-30 < z < 5.7999999999999999e-61Initial program 99.1%
Taylor expanded in z around 0 75.0%
Final simplification62.0%
(FPCore (x y z) :precision binary64 (if (<= z -2.05e-31) (* z (* y 6.0)) (if (<= z 5.4e-61) x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.05e-31) {
tmp = z * (y * 6.0);
} else if (z <= 5.4e-61) {
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 <= (-2.05d-31)) then
tmp = z * (y * 6.0d0)
else if (z <= 5.4d-61) 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 <= -2.05e-31) {
tmp = z * (y * 6.0);
} else if (z <= 5.4e-61) {
tmp = x;
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.05e-31: tmp = z * (y * 6.0) elif z <= 5.4e-61: tmp = x else: tmp = 6.0 * (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.05e-31) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= 5.4e-61) 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 <= -2.05e-31) tmp = z * (y * 6.0); elseif (z <= 5.4e-61) tmp = x; else tmp = 6.0 * (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.05e-31], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.4e-61], x, N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{-31}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{-61}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -2.0499999999999998e-31Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 55.3%
*-commutative55.3%
*-commutative55.3%
associate-*r*55.3%
*-commutative55.3%
Simplified55.3%
if -2.0499999999999998e-31 < z < 5.39999999999999987e-61Initial program 99.1%
Taylor expanded in z around 0 75.0%
if 5.39999999999999987e-61 < z Initial program 99.8%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 48.4%
*-commutative48.4%
Simplified48.4%
Final simplification62.0%
(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.5%
Final simplification99.5%
(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.5%
Taylor expanded in z around 0 35.2%
Final simplification35.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 2023308
(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)))