
(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 11 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 (fma (* (- y x) z) 6.0 x))
double code(double x, double y, double z) {
return fma(((y - x) * z), 6.0, x);
}
function code(x, y, z) return fma(Float64(Float64(y - x) * z), 6.0, x) end
code[x_, y_, z_] := N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * 6.0 + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(y - x\right) \cdot z, 6, x\right)
\end{array}
Initial program 99.4%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* -6.0 (* x z))))
(if (<= z -2.7e+186)
t_0
(if (<= z -1.66e+81)
t_1
(if (<= z -2.8e-88) t_0 (if (<= z 0.17) x t_1))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double t_1 = -6.0 * (x * z);
double tmp;
if (z <= -2.7e+186) {
tmp = t_0;
} else if (z <= -1.66e+81) {
tmp = t_1;
} else if (z <= -2.8e-88) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = t_1;
}
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 * (y * z)
t_1 = (-6.0d0) * (x * z)
if (z <= (-2.7d+186)) then
tmp = t_0
else if (z <= (-1.66d+81)) then
tmp = t_1
else if (z <= (-2.8d-88)) then
tmp = t_0
else if (z <= 0.17d0) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double t_1 = -6.0 * (x * z);
double tmp;
if (z <= -2.7e+186) {
tmp = t_0;
} else if (z <= -1.66e+81) {
tmp = t_1;
} else if (z <= -2.8e-88) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) t_1 = -6.0 * (x * z) tmp = 0 if z <= -2.7e+186: tmp = t_0 elif z <= -1.66e+81: tmp = t_1 elif z <= -2.8e-88: tmp = t_0 elif z <= 0.17: tmp = x else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) t_1 = Float64(-6.0 * Float64(x * z)) tmp = 0.0 if (z <= -2.7e+186) tmp = t_0; elseif (z <= -1.66e+81) tmp = t_1; elseif (z <= -2.8e-88) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); t_1 = -6.0 * (x * z); tmp = 0.0; if (z <= -2.7e+186) tmp = t_0; elseif (z <= -1.66e+81) tmp = t_1; elseif (z <= -2.8e-88) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.7e+186], t$95$0, If[LessEqual[z, -1.66e+81], t$95$1, If[LessEqual[z, -2.8e-88], t$95$0, If[LessEqual[z, 0.17], x, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
t_1 := -6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -2.7 \cdot 10^{+186}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.66 \cdot 10^{+81}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-88}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -2.6999999999999999e186 or -1.66000000000000001e81 < z < -2.79999999999999976e-88Initial program 99.7%
associate-*r*99.9%
+-commutative99.9%
*-commutative99.9%
associate-*r*99.8%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 59.8%
if -2.6999999999999999e186 < z < -1.66000000000000001e81 or 0.170000000000000012 < z Initial program 99.7%
Taylor expanded in x around inf 60.7%
Taylor expanded in z around inf 59.1%
if -2.79999999999999976e-88 < z < 0.170000000000000012Initial program 99.0%
Taylor expanded in z around 0 76.3%
Final simplification66.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))))
(if (<= z -3.2e+186)
t_0
(if (<= z -4.2e+80)
(* -6.0 (* x z))
(if (<= z -2.9e-89) t_0 (if (<= z 0.17) x (* x (* z -6.0))))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -3.2e+186) {
tmp = t_0;
} else if (z <= -4.2e+80) {
tmp = -6.0 * (x * z);
} else if (z <= -2.9e-89) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = x * (z * -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) :: t_0
real(8) :: tmp
t_0 = 6.0d0 * (y * z)
if (z <= (-3.2d+186)) then
tmp = t_0
else if (z <= (-4.2d+80)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-2.9d-89)) then
tmp = t_0
else if (z <= 0.17d0) then
tmp = x
else
tmp = x * (z * (-6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -3.2e+186) {
tmp = t_0;
} else if (z <= -4.2e+80) {
tmp = -6.0 * (x * z);
} else if (z <= -2.9e-89) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = x * (z * -6.0);
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if z <= -3.2e+186: tmp = t_0 elif z <= -4.2e+80: tmp = -6.0 * (x * z) elif z <= -2.9e-89: tmp = t_0 elif z <= 0.17: tmp = x else: tmp = x * (z * -6.0) return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -3.2e+186) tmp = t_0; elseif (z <= -4.2e+80) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -2.9e-89) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = Float64(x * Float64(z * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); tmp = 0.0; if (z <= -3.2e+186) tmp = t_0; elseif (z <= -4.2e+80) tmp = -6.0 * (x * z); elseif (z <= -2.9e-89) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = x * (z * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.2e+186], t$95$0, If[LessEqual[z, -4.2e+80], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.9e-89], t$95$0, If[LessEqual[z, 0.17], x, N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+186}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -4.2 \cdot 10^{+80}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -2.9 \cdot 10^{-89}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\end{array}
\end{array}
if z < -3.1999999999999999e186 or -4.20000000000000003e80 < z < -2.89999999999999992e-89Initial program 99.7%
associate-*r*99.9%
+-commutative99.9%
*-commutative99.9%
associate-*r*99.8%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 59.8%
if -3.1999999999999999e186 < z < -4.20000000000000003e80Initial program 99.7%
Taylor expanded in x around inf 80.3%
Taylor expanded in z around inf 80.4%
if -2.89999999999999992e-89 < z < 0.170000000000000012Initial program 99.0%
Taylor expanded in z around 0 76.3%
if 0.170000000000000012 < z Initial program 99.7%
Taylor expanded in x around inf 56.3%
Taylor expanded in z around inf 54.3%
associate-*r*54.3%
*-commutative54.3%
associate-*r*54.3%
Simplified54.3%
Final simplification66.8%
(FPCore (x y z)
:precision binary64
(if (<= z -2.85e+186)
(* y (* z 6.0))
(if (<= z -4.6e+80)
(* -6.0 (* x z))
(if (<= z -2.9e-89)
(* 6.0 (* y z))
(if (<= z 0.17) x (* x (* z -6.0)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.85e+186) {
tmp = y * (z * 6.0);
} else if (z <= -4.6e+80) {
tmp = -6.0 * (x * z);
} else if (z <= -2.9e-89) {
tmp = 6.0 * (y * z);
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = x * (z * -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 <= (-2.85d+186)) then
tmp = y * (z * 6.0d0)
else if (z <= (-4.6d+80)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-2.9d-89)) then
tmp = 6.0d0 * (y * z)
else if (z <= 0.17d0) then
tmp = x
else
tmp = x * (z * (-6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.85e+186) {
tmp = y * (z * 6.0);
} else if (z <= -4.6e+80) {
tmp = -6.0 * (x * z);
} else if (z <= -2.9e-89) {
tmp = 6.0 * (y * z);
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = x * (z * -6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.85e+186: tmp = y * (z * 6.0) elif z <= -4.6e+80: tmp = -6.0 * (x * z) elif z <= -2.9e-89: tmp = 6.0 * (y * z) elif z <= 0.17: tmp = x else: tmp = x * (z * -6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.85e+186) tmp = Float64(y * Float64(z * 6.0)); elseif (z <= -4.6e+80) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -2.9e-89) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= 0.17) tmp = x; else tmp = Float64(x * Float64(z * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.85e+186) tmp = y * (z * 6.0); elseif (z <= -4.6e+80) tmp = -6.0 * (x * z); elseif (z <= -2.9e-89) tmp = 6.0 * (y * z); elseif (z <= 0.17) tmp = x; else tmp = x * (z * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.85e+186], N[(y * N[(z * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -4.6e+80], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.9e-89], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.17], x, N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.85 \cdot 10^{+186}:\\
\;\;\;\;y \cdot \left(z \cdot 6\right)\\
\mathbf{elif}\;z \leq -4.6 \cdot 10^{+80}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -2.9 \cdot 10^{-89}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\end{array}
\end{array}
if z < -2.85000000000000009e186Initial program 99.6%
associate-*r*99.9%
+-commutative99.9%
*-commutative99.9%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 62.0%
*-commutative62.0%
associate-*r*62.1%
Simplified62.1%
if -2.85000000000000009e186 < z < -4.60000000000000008e80Initial program 99.7%
Taylor expanded in x around inf 80.3%
Taylor expanded in z around inf 80.4%
if -4.60000000000000008e80 < z < -2.89999999999999992e-89Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-def99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 57.7%
if -2.89999999999999992e-89 < z < 0.170000000000000012Initial program 99.0%
Taylor expanded in z around 0 76.3%
if 0.170000000000000012 < z Initial program 99.7%
Taylor expanded in x around inf 56.3%
Taylor expanded in z around inf 54.3%
associate-*r*54.3%
*-commutative54.3%
associate-*r*54.3%
Simplified54.3%
Final simplification66.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.4e-136) (not (<= x 4.3e-132))) (* x (+ 1.0 (* z -6.0))) (* y (* z 6.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.4e-136) || !(x <= 4.3e-132)) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = y * (z * 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 <= (-4.4d-136)) .or. (.not. (x <= 4.3d-132))) then
tmp = x * (1.0d0 + (z * (-6.0d0)))
else
tmp = y * (z * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -4.4e-136) || !(x <= 4.3e-132)) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = y * (z * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.4e-136) or not (x <= 4.3e-132): tmp = x * (1.0 + (z * -6.0)) else: tmp = y * (z * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.4e-136) || !(x <= 4.3e-132)) tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); else tmp = Float64(y * Float64(z * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -4.4e-136) || ~((x <= 4.3e-132))) tmp = x * (1.0 + (z * -6.0)); else tmp = y * (z * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.4e-136], N[Not[LessEqual[x, 4.3e-132]], $MachinePrecision]], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{-136} \lor \neg \left(x \leq 4.3 \cdot 10^{-132}\right):\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z \cdot 6\right)\\
\end{array}
\end{array}
if x < -4.4000000000000002e-136 or 4.2999999999999997e-132 < x Initial program 99.3%
Taylor expanded in x around inf 81.0%
if -4.4000000000000002e-136 < x < 4.2999999999999997e-132Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 77.6%
*-commutative77.6%
associate-*r*77.7%
Simplified77.7%
Final simplification80.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.4e-88) (not (<= z 11000000000.0))) (* (- y x) (* z 6.0)) (* x (+ 1.0 (* z -6.0)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.4e-88) || !(z <= 11000000000.0)) {
tmp = (y - x) * (z * 6.0);
} else {
tmp = x * (1.0 + (z * -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 <= (-2.4d-88)) .or. (.not. (z <= 11000000000.0d0))) then
tmp = (y - x) * (z * 6.0d0)
else
tmp = x * (1.0d0 + (z * (-6.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.4e-88) || !(z <= 11000000000.0)) {
tmp = (y - x) * (z * 6.0);
} else {
tmp = x * (1.0 + (z * -6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.4e-88) or not (z <= 11000000000.0): tmp = (y - x) * (z * 6.0) else: tmp = x * (1.0 + (z * -6.0)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.4e-88) || !(z <= 11000000000.0)) tmp = Float64(Float64(y - x) * Float64(z * 6.0)); else tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.4e-88) || ~((z <= 11000000000.0))) tmp = (y - x) * (z * 6.0); else tmp = x * (1.0 + (z * -6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.4e-88], N[Not[LessEqual[z, 11000000000.0]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z * 6.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{-88} \lor \neg \left(z \leq 11000000000\right):\\
\;\;\;\;\left(y - x\right) \cdot \left(z \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\end{array}
\end{array}
if z < -2.4e-88 or 1.1e10 < z Initial program 99.7%
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 95.0%
*-commutative95.0%
*-commutative95.0%
associate-*r*95.1%
Simplified95.1%
if -2.4e-88 < z < 1.1e10Initial program 99.0%
Taylor expanded in x around inf 78.3%
Final simplification87.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.15) (not (<= z 0.019))) (* (- y x) (* z 6.0)) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.15) || !(z <= 0.019)) {
tmp = (y - x) * (z * 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.15d0)) .or. (.not. (z <= 0.019d0))) then
tmp = (y - x) * (z * 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.15) || !(z <= 0.019)) {
tmp = (y - x) * (z * 6.0);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.15) or not (z <= 0.019): tmp = (y - x) * (z * 6.0) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.15) || !(z <= 0.019)) tmp = Float64(Float64(y - x) * Float64(z * 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.15) || ~((z <= 0.019))) tmp = (y - x) * (z * 6.0); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.15], N[Not[LessEqual[z, 0.019]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z * 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.15 \lor \neg \left(z \leq 0.019\right):\\
\;\;\;\;\left(y - x\right) \cdot \left(z \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -0.149999999999999994 or 0.0189999999999999995 < 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 98.7%
*-commutative98.7%
*-commutative98.7%
associate-*r*98.8%
Simplified98.8%
if -0.149999999999999994 < z < 0.0189999999999999995Initial program 99.1%
Taylor expanded in y around inf 97.6%
*-commutative97.6%
Simplified97.6%
Final simplification98.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.165) (not (<= z 0.17))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 0.17)) {
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.17d0))) 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.17)) {
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.17): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.165) || !(z <= 0.17)) 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.17))) 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.17]], $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.17\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 0.170000000000000012 < z Initial program 99.7%
Taylor expanded in x around inf 54.3%
Taylor expanded in z around inf 53.3%
if -0.165000000000000008 < z < 0.170000000000000012Initial program 99.1%
Taylor expanded in z around 0 70.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.4%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (+ x (* (- y x) (* z 6.0))))
double code(double x, double y, double z) {
return x + ((y - x) * (z * 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 + ((y - x) * (z * 6.0d0))
end function
public static double code(double x, double y, double z) {
return x + ((y - x) * (z * 6.0));
}
def code(x, y, z): return x + ((y - x) * (z * 6.0))
function code(x, y, z) return Float64(x + Float64(Float64(y - x) * Float64(z * 6.0))) end
function tmp = code(x, y, z) tmp = x + ((y - x) * (z * 6.0)); end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \left(z \cdot 6\right)
\end{array}
Initial program 99.4%
associate-*l*99.8%
Simplified99.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.4%
Taylor expanded in z around 0 37.1%
Final simplification37.1%
(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 2023336
(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)))