
(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 (* 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.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))) (t_1 (* 6.0 (* y z))))
(if (<= z -2e+205)
t_0
(if (<= z -1.22e+148)
t_1
(if (<= z -7.8e+59)
t_0
(if (or (<= z -4.1e-38) (not (<= z 2.05e-59))) t_1 x))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -2e+205) {
tmp = t_0;
} else if (z <= -1.22e+148) {
tmp = t_1;
} else if (z <= -7.8e+59) {
tmp = t_0;
} else if ((z <= -4.1e-38) || !(z <= 2.05e-59)) {
tmp = t_1;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-6.0d0) * (x * z)
t_1 = 6.0d0 * (y * z)
if (z <= (-2d+205)) then
tmp = t_0
else if (z <= (-1.22d+148)) then
tmp = t_1
else if (z <= (-7.8d+59)) then
tmp = t_0
else if ((z <= (-4.1d-38)) .or. (.not. (z <= 2.05d-59))) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -2e+205) {
tmp = t_0;
} else if (z <= -1.22e+148) {
tmp = t_1;
} else if (z <= -7.8e+59) {
tmp = t_0;
} else if ((z <= -4.1e-38) || !(z <= 2.05e-59)) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (x * z) t_1 = 6.0 * (y * z) tmp = 0 if z <= -2e+205: tmp = t_0 elif z <= -1.22e+148: tmp = t_1 elif z <= -7.8e+59: tmp = t_0 elif (z <= -4.1e-38) or not (z <= 2.05e-59): tmp = t_1 else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(x * z)) t_1 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -2e+205) tmp = t_0; elseif (z <= -1.22e+148) tmp = t_1; elseif (z <= -7.8e+59) tmp = t_0; elseif ((z <= -4.1e-38) || !(z <= 2.05e-59)) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (x * z); t_1 = 6.0 * (y * z); tmp = 0.0; if (z <= -2e+205) tmp = t_0; elseif (z <= -1.22e+148) tmp = t_1; elseif (z <= -7.8e+59) tmp = t_0; elseif ((z <= -4.1e-38) || ~((z <= 2.05e-59))) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2e+205], t$95$0, If[LessEqual[z, -1.22e+148], t$95$1, If[LessEqual[z, -7.8e+59], t$95$0, If[Or[LessEqual[z, -4.1e-38], N[Not[LessEqual[z, 2.05e-59]], $MachinePrecision]], t$95$1, x]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(x \cdot z\right)\\
t_1 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -2 \cdot 10^{+205}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.22 \cdot 10^{+148}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -7.8 \cdot 10^{+59}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -4.1 \cdot 10^{-38} \lor \neg \left(z \leq 2.05 \cdot 10^{-59}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.00000000000000003e205 or -1.22000000000000007e148 < z < -7.80000000000000043e59Initial program 100.0%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 99.8%
*-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in y around 0 68.6%
if -2.00000000000000003e205 < z < -1.22000000000000007e148 or -7.80000000000000043e59 < z < -4.0999999999999998e-38 or 2.0499999999999998e-59 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.6%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 66.1%
if -4.0999999999999998e-38 < z < 2.0499999999999998e-59Initial program 99.9%
Taylor expanded in z around 0 85.0%
Final simplification74.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (* x -6.0))) (t_1 (* 6.0 (* y z))))
(if (<= z -1.05e+205)
t_0
(if (<= z -8.5e+146)
t_1
(if (<= z -2.05e+52)
t_0
(if (or (<= z -7.5e-38) (not (<= z 2.4e-60))) t_1 x))))))
double code(double x, double y, double z) {
double t_0 = z * (x * -6.0);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -1.05e+205) {
tmp = t_0;
} else if (z <= -8.5e+146) {
tmp = t_1;
} else if (z <= -2.05e+52) {
tmp = t_0;
} else if ((z <= -7.5e-38) || !(z <= 2.4e-60)) {
tmp = t_1;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z * (x * (-6.0d0))
t_1 = 6.0d0 * (y * z)
if (z <= (-1.05d+205)) then
tmp = t_0
else if (z <= (-8.5d+146)) then
tmp = t_1
else if (z <= (-2.05d+52)) then
tmp = t_0
else if ((z <= (-7.5d-38)) .or. (.not. (z <= 2.4d-60))) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (x * -6.0);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -1.05e+205) {
tmp = t_0;
} else if (z <= -8.5e+146) {
tmp = t_1;
} else if (z <= -2.05e+52) {
tmp = t_0;
} else if ((z <= -7.5e-38) || !(z <= 2.4e-60)) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = z * (x * -6.0) t_1 = 6.0 * (y * z) tmp = 0 if z <= -1.05e+205: tmp = t_0 elif z <= -8.5e+146: tmp = t_1 elif z <= -2.05e+52: tmp = t_0 elif (z <= -7.5e-38) or not (z <= 2.4e-60): tmp = t_1 else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(z * Float64(x * -6.0)) t_1 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -1.05e+205) tmp = t_0; elseif (z <= -8.5e+146) tmp = t_1; elseif (z <= -2.05e+52) tmp = t_0; elseif ((z <= -7.5e-38) || !(z <= 2.4e-60)) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (x * -6.0); t_1 = 6.0 * (y * z); tmp = 0.0; if (z <= -1.05e+205) tmp = t_0; elseif (z <= -8.5e+146) tmp = t_1; elseif (z <= -2.05e+52) tmp = t_0; elseif ((z <= -7.5e-38) || ~((z <= 2.4e-60))) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.05e+205], t$95$0, If[LessEqual[z, -8.5e+146], t$95$1, If[LessEqual[z, -2.05e+52], t$95$0, If[Or[LessEqual[z, -7.5e-38], N[Not[LessEqual[z, 2.4e-60]], $MachinePrecision]], t$95$1, x]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(x \cdot -6\right)\\
t_1 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -1.05 \cdot 10^{+205}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{+146}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -2.05 \cdot 10^{+52}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -7.5 \cdot 10^{-38} \lor \neg \left(z \leq 2.4 \cdot 10^{-60}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.05e205 or -8.5e146 < z < -2.05e52Initial program 100.0%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in y around 0 68.7%
if -1.05e205 < z < -8.5e146 or -2.05e52 < z < -7.5e-38 or 2.40000000000000009e-60 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.6%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 66.1%
if -7.5e-38 < z < 2.40000000000000009e-60Initial program 99.9%
Taylor expanded in z around 0 85.0%
Final simplification74.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (* x -6.0))) (t_1 (* z (* y 6.0))))
(if (<= z -6.6e+204)
t_0
(if (<= z -8.5e+148)
t_1
(if (<= z -4.8e+58)
t_0
(if (<= z -9.2e-38) t_1 (if (<= z 2.7e-59) x (* 6.0 (* y z)))))))))
double code(double x, double y, double z) {
double t_0 = z * (x * -6.0);
double t_1 = z * (y * 6.0);
double tmp;
if (z <= -6.6e+204) {
tmp = t_0;
} else if (z <= -8.5e+148) {
tmp = t_1;
} else if (z <= -4.8e+58) {
tmp = t_0;
} else if (z <= -9.2e-38) {
tmp = t_1;
} else if (z <= 2.7e-59) {
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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z * (x * (-6.0d0))
t_1 = z * (y * 6.0d0)
if (z <= (-6.6d+204)) then
tmp = t_0
else if (z <= (-8.5d+148)) then
tmp = t_1
else if (z <= (-4.8d+58)) then
tmp = t_0
else if (z <= (-9.2d-38)) then
tmp = t_1
else if (z <= 2.7d-59) 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 t_0 = z * (x * -6.0);
double t_1 = z * (y * 6.0);
double tmp;
if (z <= -6.6e+204) {
tmp = t_0;
} else if (z <= -8.5e+148) {
tmp = t_1;
} else if (z <= -4.8e+58) {
tmp = t_0;
} else if (z <= -9.2e-38) {
tmp = t_1;
} else if (z <= 2.7e-59) {
tmp = x;
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
def code(x, y, z): t_0 = z * (x * -6.0) t_1 = z * (y * 6.0) tmp = 0 if z <= -6.6e+204: tmp = t_0 elif z <= -8.5e+148: tmp = t_1 elif z <= -4.8e+58: tmp = t_0 elif z <= -9.2e-38: tmp = t_1 elif z <= 2.7e-59: tmp = x else: tmp = 6.0 * (y * z) return tmp
function code(x, y, z) t_0 = Float64(z * Float64(x * -6.0)) t_1 = Float64(z * Float64(y * 6.0)) tmp = 0.0 if (z <= -6.6e+204) tmp = t_0; elseif (z <= -8.5e+148) tmp = t_1; elseif (z <= -4.8e+58) tmp = t_0; elseif (z <= -9.2e-38) tmp = t_1; elseif (z <= 2.7e-59) tmp = x; else tmp = Float64(6.0 * Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (x * -6.0); t_1 = z * (y * 6.0); tmp = 0.0; if (z <= -6.6e+204) tmp = t_0; elseif (z <= -8.5e+148) tmp = t_1; elseif (z <= -4.8e+58) tmp = t_0; elseif (z <= -9.2e-38) tmp = t_1; elseif (z <= 2.7e-59) tmp = x; else tmp = 6.0 * (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.6e+204], t$95$0, If[LessEqual[z, -8.5e+148], t$95$1, If[LessEqual[z, -4.8e+58], t$95$0, If[LessEqual[z, -9.2e-38], t$95$1, If[LessEqual[z, 2.7e-59], x, N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(x \cdot -6\right)\\
t_1 := z \cdot \left(y \cdot 6\right)\\
\mathbf{if}\;z \leq -6.6 \cdot 10^{+204}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{+148}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -4.8 \cdot 10^{+58}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -9.2 \cdot 10^{-38}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-59}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -6.5999999999999995e204 or -8.4999999999999996e148 < z < -4.8e58Initial program 100.0%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in y around 0 68.7%
if -6.5999999999999995e204 < z < -8.4999999999999996e148 or -4.8e58 < z < -9.20000000000000007e-38Initial program 99.9%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.6%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 72.1%
*-commutative72.1%
*-commutative72.1%
associate-*r*72.4%
*-commutative72.4%
Simplified72.4%
if -9.20000000000000007e-38 < z < 2.6999999999999999e-59Initial program 99.9%
Taylor expanded in z around 0 85.0%
if 2.6999999999999999e-59 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.6%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 64.0%
Final simplification74.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.4e-38) (not (<= z 8.5e-36))) (* z (* (- y x) 6.0)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.4e-38) || !(z <= 8.5e-36)) {
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 <= (-3.4d-38)) .or. (.not. (z <= 8.5d-36))) 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 <= -3.4e-38) || !(z <= 8.5e-36)) {
tmp = z * ((y - x) * 6.0);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.4e-38) or not (z <= 8.5e-36): tmp = z * ((y - x) * 6.0) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.4e-38) || !(z <= 8.5e-36)) 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 <= -3.4e-38) || ~((z <= 8.5e-36))) tmp = z * ((y - x) * 6.0); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.4e-38], N[Not[LessEqual[z, 8.5e-36]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{-38} \lor \neg \left(z \leq 8.5 \cdot 10^{-36}\right):\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.4000000000000002e-38 or 8.5000000000000007e-36 < z Initial program 99.8%
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 95.7%
associate-*r*95.7%
*-commutative95.7%
associate-*l*95.8%
Simplified95.8%
if -3.4000000000000002e-38 < z < 8.5000000000000007e-36Initial program 99.9%
Taylor expanded in z around 0 83.7%
Final simplification90.6%
(FPCore (x y z) :precision binary64 (if (<= z -8.4e-38) (* z (* (- y x) 6.0)) (if (<= z 4.6e-36) x (* (- y x) (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -8.4e-38) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 4.6e-36) {
tmp = x;
} else {
tmp = (y - x) * (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 <= (-8.4d-38)) then
tmp = z * ((y - x) * 6.0d0)
else if (z <= 4.6d-36) then
tmp = x
else
tmp = (y - x) * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -8.4e-38) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 4.6e-36) {
tmp = x;
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -8.4e-38: tmp = z * ((y - x) * 6.0) elif z <= 4.6e-36: tmp = x else: tmp = (y - x) * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -8.4e-38) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); elseif (z <= 4.6e-36) tmp = x; else tmp = Float64(Float64(y - x) * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -8.4e-38) tmp = z * ((y - x) * 6.0); elseif (z <= 4.6e-36) tmp = x; else tmp = (y - x) * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -8.4e-38], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.6e-36], x, N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.4 \cdot 10^{-38}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-36}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -8.40000000000000052e-38Initial program 100.0%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 97.2%
associate-*r*97.2%
*-commutative97.2%
associate-*l*97.4%
Simplified97.4%
if -8.40000000000000052e-38 < z < 4.59999999999999993e-36Initial program 99.9%
Taylor expanded in z around 0 83.7%
if 4.59999999999999993e-36 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.6%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 94.2%
*-commutative94.2%
*-commutative94.2%
associate-*r*94.3%
Simplified94.3%
Final simplification90.6%
(FPCore (x y z) :precision binary64 (if (<= z -9e-5) (* z (* (- y x) 6.0)) (if (<= z 0.17) (+ x (* 6.0 (* y z))) (* (- y x) (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -9e-5) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 0.17) {
tmp = x + (6.0 * (y * z));
} else {
tmp = (y - x) * (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 <= (-9d-5)) then
tmp = z * ((y - x) * 6.0d0)
else if (z <= 0.17d0) then
tmp = x + (6.0d0 * (y * z))
else
tmp = (y - x) * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -9e-5) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 0.17) {
tmp = x + (6.0 * (y * z));
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9e-5: tmp = z * ((y - x) * 6.0) elif z <= 0.17: tmp = x + (6.0 * (y * z)) else: tmp = (y - x) * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9e-5) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); elseif (z <= 0.17) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(Float64(y - x) * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -9e-5) tmp = z * ((y - x) * 6.0); elseif (z <= 0.17) tmp = x + (6.0 * (y * z)); else tmp = (y - x) * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9e-5], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.17], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-5}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -9.00000000000000057e-5Initial program 100.0%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 99.7%
associate-*r*99.8%
*-commutative99.8%
associate-*l*100.0%
Simplified100.0%
if -9.00000000000000057e-5 < z < 0.170000000000000012Initial program 99.9%
Taylor expanded in y around inf 98.7%
if 0.170000000000000012 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.6%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 99.5%
*-commutative99.5%
*-commutative99.5%
associate-*r*99.6%
Simplified99.6%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (<= z -2.65e+20) (* z (* (- y x) 6.0)) (if (<= z 13500.0) (+ x (* z (* y 6.0))) (* (- y x) (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.65e+20) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 13500.0) {
tmp = x + (z * (y * 6.0));
} else {
tmp = (y - x) * (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 <= (-2.65d+20)) then
tmp = z * ((y - x) * 6.0d0)
else if (z <= 13500.0d0) then
tmp = x + (z * (y * 6.0d0))
else
tmp = (y - x) * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.65e+20) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 13500.0) {
tmp = x + (z * (y * 6.0));
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.65e+20: tmp = z * ((y - x) * 6.0) elif z <= 13500.0: tmp = x + (z * (y * 6.0)) else: tmp = (y - x) * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.65e+20) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); elseif (z <= 13500.0) tmp = Float64(x + Float64(z * Float64(y * 6.0))); else tmp = Float64(Float64(y - x) * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.65e+20) tmp = z * ((y - x) * 6.0); elseif (z <= 13500.0) tmp = x + (z * (y * 6.0)); else tmp = (y - x) * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.65e+20], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 13500.0], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{+20}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{elif}\;z \leq 13500:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -2.65e20Initial program 99.9%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 99.7%
associate-*r*99.8%
*-commutative99.8%
associate-*l*99.9%
Simplified99.9%
if -2.65e20 < z < 13500Initial program 99.9%
Taylor expanded in y around inf 98.7%
if 13500 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.6%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 99.5%
*-commutative99.5%
*-commutative99.5%
associate-*r*99.6%
Simplified99.6%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.65e+20) (not (<= z 50000000.0))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.65e+20) || !(z <= 50000000.0)) {
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 <= (-2.65d+20)) .or. (.not. (z <= 50000000.0d0))) 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 <= -2.65e+20) || !(z <= 50000000.0)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.65e+20) or not (z <= 50000000.0): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.65e+20) || !(z <= 50000000.0)) 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 <= -2.65e+20) || ~((z <= 50000000.0))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.65e+20], N[Not[LessEqual[z, 50000000.0]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{+20} \lor \neg \left(z \leq 50000000\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.65e20 or 5e7 < z Initial program 99.8%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 99.7%
*-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in y around 0 49.4%
if -2.65e20 < z < 5e7Initial program 99.9%
Taylor expanded in z around 0 74.1%
Final simplification62.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.9%
Taylor expanded in z around 0 39.6%
Final simplification39.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 2023224
(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)))