
(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 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (((y - x) * 6.0d0) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
(FPCore (x y z) :precision binary64 (+ x (* (- y x) (* 6.0 z))))
double code(double x, double y, double z) {
return x + ((y - x) * (6.0 * z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + ((y - x) * (6.0d0 * z))
end function
public static double code(double x, double y, double z) {
return x + ((y - x) * (6.0 * z));
}
def code(x, y, z): return x + ((y - x) * (6.0 * z))
function code(x, y, z) return Float64(x + Float64(Float64(y - x) * Float64(6.0 * z))) end
function tmp = code(x, y, z) tmp = x + ((y - x) * (6.0 * z)); end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \left(6 \cdot z\right)
\end{array}
Initial program 99.8%
associate-*l*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))))
(if (<= z -0.17)
t_0
(if (<= z 7.6e-40)
x
(if (or (<= z 4.6e+194) (not (<= z 6e+222))) (* 6.0 (* y z)) t_0)))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double tmp;
if (z <= -0.17) {
tmp = t_0;
} else if (z <= 7.6e-40) {
tmp = x;
} else if ((z <= 4.6e+194) || !(z <= 6e+222)) {
tmp = 6.0 * (y * z);
} else {
tmp = t_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) * (x * z)
if (z <= (-0.17d0)) then
tmp = t_0
else if (z <= 7.6d-40) then
tmp = x
else if ((z <= 4.6d+194) .or. (.not. (z <= 6d+222))) then
tmp = 6.0d0 * (y * z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double tmp;
if (z <= -0.17) {
tmp = t_0;
} else if (z <= 7.6e-40) {
tmp = x;
} else if ((z <= 4.6e+194) || !(z <= 6e+222)) {
tmp = 6.0 * (y * z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (x * z) tmp = 0 if z <= -0.17: tmp = t_0 elif z <= 7.6e-40: tmp = x elif (z <= 4.6e+194) or not (z <= 6e+222): tmp = 6.0 * (y * z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(x * z)) tmp = 0.0 if (z <= -0.17) tmp = t_0; elseif (z <= 7.6e-40) tmp = x; elseif ((z <= 4.6e+194) || !(z <= 6e+222)) tmp = Float64(6.0 * Float64(y * z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (x * z); tmp = 0.0; if (z <= -0.17) tmp = t_0; elseif (z <= 7.6e-40) tmp = x; elseif ((z <= 4.6e+194) || ~((z <= 6e+222))) tmp = 6.0 * (y * z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.17], t$95$0, If[LessEqual[z, 7.6e-40], x, If[Or[LessEqual[z, 4.6e+194], N[Not[LessEqual[z, 6e+222]], $MachinePrecision]], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -0.17:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{-40}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+194} \lor \neg \left(z \leq 6 \cdot 10^{+222}\right):\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.170000000000000012 or 4.6000000000000001e194 < z < 6.00000000000000028e222Initial program 99.7%
Taylor expanded in y around 0 61.0%
Taylor expanded in z around inf 59.4%
if -0.170000000000000012 < z < 7.5999999999999998e-40Initial program 99.9%
Taylor expanded in z around 0 74.2%
if 7.5999999999999998e-40 < z < 4.6000000000000001e194 or 6.00000000000000028e222 < z Initial program 99.8%
Taylor expanded in y around 0 91.5%
+-commutative91.5%
metadata-eval91.5%
cancel-sign-sub-inv91.5%
*-commutative91.5%
associate-*l*91.4%
*-commutative91.4%
associate-*l*91.3%
distribute-lft-out--99.7%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in z around inf 91.5%
Taylor expanded in y around inf 65.9%
*-commutative65.9%
Simplified65.9%
Final simplification68.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* z -6.0))))
(if (<= z -0.17)
t_0
(if (<= z 5.5e-39)
x
(if (or (<= z 1.25e+195) (not (<= z 2.15e+223)))
(* 6.0 (* y z))
t_0)))))
double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double tmp;
if (z <= -0.17) {
tmp = t_0;
} else if (z <= 5.5e-39) {
tmp = x;
} else if ((z <= 1.25e+195) || !(z <= 2.15e+223)) {
tmp = 6.0 * (y * z);
} else {
tmp = t_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 = x * (z * (-6.0d0))
if (z <= (-0.17d0)) then
tmp = t_0
else if (z <= 5.5d-39) then
tmp = x
else if ((z <= 1.25d+195) .or. (.not. (z <= 2.15d+223))) then
tmp = 6.0d0 * (y * z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double tmp;
if (z <= -0.17) {
tmp = t_0;
} else if (z <= 5.5e-39) {
tmp = x;
} else if ((z <= 1.25e+195) || !(z <= 2.15e+223)) {
tmp = 6.0 * (y * z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z * -6.0) tmp = 0 if z <= -0.17: tmp = t_0 elif z <= 5.5e-39: tmp = x elif (z <= 1.25e+195) or not (z <= 2.15e+223): tmp = 6.0 * (y * z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z * -6.0)) tmp = 0.0 if (z <= -0.17) tmp = t_0; elseif (z <= 5.5e-39) tmp = x; elseif ((z <= 1.25e+195) || !(z <= 2.15e+223)) tmp = Float64(6.0 * Float64(y * z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z * -6.0); tmp = 0.0; if (z <= -0.17) tmp = t_0; elseif (z <= 5.5e-39) tmp = x; elseif ((z <= 1.25e+195) || ~((z <= 2.15e+223))) tmp = 6.0 * (y * z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.17], t$95$0, If[LessEqual[z, 5.5e-39], x, If[Or[LessEqual[z, 1.25e+195], N[Not[LessEqual[z, 2.15e+223]], $MachinePrecision]], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot -6\right)\\
\mathbf{if}\;z \leq -0.17:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-39}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+195} \lor \neg \left(z \leq 2.15 \cdot 10^{+223}\right):\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.170000000000000012 or 1.2499999999999999e195 < z < 2.15e223Initial program 99.7%
Taylor expanded in y around 0 94.5%
+-commutative94.5%
metadata-eval94.5%
cancel-sign-sub-inv94.5%
*-commutative94.5%
associate-*l*94.5%
*-commutative94.5%
associate-*l*94.5%
distribute-lft-out--99.8%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 98.1%
Taylor expanded in y around 0 59.4%
associate-*r*59.4%
*-commutative59.4%
associate-*r*59.5%
Simplified59.5%
if -0.170000000000000012 < z < 5.50000000000000018e-39Initial program 99.9%
Taylor expanded in z around 0 74.2%
if 5.50000000000000018e-39 < z < 1.2499999999999999e195 or 2.15e223 < z Initial program 99.8%
Taylor expanded in y around 0 91.5%
+-commutative91.5%
metadata-eval91.5%
cancel-sign-sub-inv91.5%
*-commutative91.5%
associate-*l*91.4%
*-commutative91.4%
associate-*l*91.3%
distribute-lft-out--99.7%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in z around inf 91.5%
Taylor expanded in y around inf 65.9%
*-commutative65.9%
Simplified65.9%
Final simplification68.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.56e-12) (not (<= z 2.1e-39))) (* 6.0 (* (- y x) z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.56e-12) || !(z <= 2.1e-39)) {
tmp = 6.0 * ((y - 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 <= (-1.56d-12)) .or. (.not. (z <= 2.1d-39))) then
tmp = 6.0d0 * ((y - 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 <= -1.56e-12) || !(z <= 2.1e-39)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.56e-12) or not (z <= 2.1e-39): tmp = 6.0 * ((y - x) * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.56e-12) || !(z <= 2.1e-39)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.56e-12) || ~((z <= 2.1e-39))) tmp = 6.0 * ((y - x) * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.56e-12], N[Not[LessEqual[z, 2.1e-39]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.56 \cdot 10^{-12} \lor \neg \left(z \leq 2.1 \cdot 10^{-39}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.56000000000000002e-12 or 2.09999999999999993e-39 < z Initial program 99.8%
Taylor expanded in y around 0 92.8%
+-commutative92.8%
metadata-eval92.8%
cancel-sign-sub-inv92.8%
*-commutative92.8%
associate-*l*92.8%
*-commutative92.8%
associate-*l*92.8%
distribute-lft-out--99.7%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in z around inf 94.4%
if -1.56000000000000002e-12 < z < 2.09999999999999993e-39Initial program 99.9%
Taylor expanded in z around 0 74.2%
Final simplification84.4%
(FPCore (x y z) :precision binary64 (if (<= z -5.5e-10) (* (- y x) (* 6.0 z)) (if (<= z 6.8e-39) x (* 6.0 (* (- y x) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.5e-10) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 6.8e-39) {
tmp = x;
} else {
tmp = 6.0 * ((y - 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 <= (-5.5d-10)) then
tmp = (y - x) * (6.0d0 * z)
else if (z <= 6.8d-39) then
tmp = x
else
tmp = 6.0d0 * ((y - x) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5.5e-10) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 6.8e-39) {
tmp = x;
} else {
tmp = 6.0 * ((y - x) * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.5e-10: tmp = (y - x) * (6.0 * z) elif z <= 6.8e-39: tmp = x else: tmp = 6.0 * ((y - x) * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.5e-10) tmp = Float64(Float64(y - x) * Float64(6.0 * z)); elseif (z <= 6.8e-39) tmp = x; else tmp = Float64(6.0 * Float64(Float64(y - x) * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.5e-10) tmp = (y - x) * (6.0 * z); elseif (z <= 6.8e-39) tmp = x; else tmp = 6.0 * ((y - x) * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.5e-10], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.8e-39], x, N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{-10}:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{-39}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\end{array}
\end{array}
if z < -5.4999999999999996e-10Initial program 99.8%
Taylor expanded in y around 0 93.8%
+-commutative93.8%
metadata-eval93.8%
cancel-sign-sub-inv93.8%
*-commutative93.8%
associate-*l*93.9%
*-commutative93.9%
associate-*l*93.9%
distribute-lft-out--99.8%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 98.0%
Taylor expanded in y around 0 92.1%
metadata-eval92.1%
distribute-lft-neg-in92.1%
*-commutative92.1%
associate-*r*92.1%
distribute-rgt-neg-out92.1%
*-commutative92.1%
associate-*r*92.2%
distribute-lft-out98.0%
+-commutative98.0%
*-commutative98.0%
sub-neg98.0%
Simplified98.0%
if -5.4999999999999996e-10 < z < 6.7999999999999998e-39Initial program 99.9%
Taylor expanded in z around 0 74.2%
if 6.7999999999999998e-39 < z Initial program 99.8%
Taylor expanded in y around 0 92.1%
+-commutative92.1%
metadata-eval92.1%
cancel-sign-sub-inv92.1%
*-commutative92.1%
associate-*l*92.0%
*-commutative92.0%
associate-*l*92.0%
distribute-lft-out--99.7%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in z around inf 92.2%
Final simplification84.4%
(FPCore (x y z) :precision binary64 (if (<= z -0.78) (* (- y x) (* 6.0 z)) (if (<= z 180.0) (+ x (* -6.0 (* x z))) (* 6.0 (* (- y x) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.78) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 180.0) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = 6.0 * ((y - 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 <= (-0.78d0)) then
tmp = (y - x) * (6.0d0 * z)
else if (z <= 180.0d0) then
tmp = x + ((-6.0d0) * (x * z))
else
tmp = 6.0d0 * ((y - x) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.78) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 180.0) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = 6.0 * ((y - x) * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.78: tmp = (y - x) * (6.0 * z) elif z <= 180.0: tmp = x + (-6.0 * (x * z)) else: tmp = 6.0 * ((y - x) * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.78) tmp = Float64(Float64(y - x) * Float64(6.0 * z)); elseif (z <= 180.0) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); else tmp = Float64(6.0 * Float64(Float64(y - x) * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.78) tmp = (y - x) * (6.0 * z); elseif (z <= 180.0) tmp = x + (-6.0 * (x * z)); else tmp = 6.0 * ((y - x) * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.78], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 180.0], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.78:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 180:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\end{array}
\end{array}
if z < -0.78000000000000003Initial program 99.8%
Taylor expanded in y around 0 93.7%
+-commutative93.7%
metadata-eval93.7%
cancel-sign-sub-inv93.7%
*-commutative93.7%
associate-*l*93.8%
*-commutative93.8%
associate-*l*93.8%
distribute-lft-out--99.8%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.5%
Taylor expanded in y around 0 93.5%
metadata-eval93.5%
distribute-lft-neg-in93.5%
*-commutative93.5%
associate-*r*93.5%
distribute-rgt-neg-out93.5%
*-commutative93.5%
associate-*r*93.6%
distribute-lft-out99.6%
+-commutative99.6%
*-commutative99.6%
sub-neg99.6%
Simplified99.6%
if -0.78000000000000003 < z < 180Initial program 99.8%
Taylor expanded in y around 0 73.5%
if 180 < z Initial program 99.8%
Taylor expanded in y around 0 91.0%
+-commutative91.0%
metadata-eval91.0%
cancel-sign-sub-inv91.0%
*-commutative91.0%
associate-*l*90.9%
*-commutative90.9%
associate-*l*90.9%
distribute-lft-out--99.7%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in z around inf 99.0%
Final simplification85.4%
(FPCore (x y z) :precision binary64 (if (<= z -0.2) (* (- y x) (* 6.0 z)) (if (<= z 0.166) (+ x (* 6.0 (* y z))) (* 6.0 (* (- y x) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.2) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 0.166) {
tmp = x + (6.0 * (y * z));
} else {
tmp = 6.0 * ((y - 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 <= (-0.2d0)) then
tmp = (y - x) * (6.0d0 * z)
else if (z <= 0.166d0) then
tmp = x + (6.0d0 * (y * z))
else
tmp = 6.0d0 * ((y - x) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.2) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 0.166) {
tmp = x + (6.0 * (y * z));
} else {
tmp = 6.0 * ((y - x) * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.2: tmp = (y - x) * (6.0 * z) elif z <= 0.166: tmp = x + (6.0 * (y * z)) else: tmp = 6.0 * ((y - x) * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.2) tmp = Float64(Float64(y - x) * Float64(6.0 * z)); elseif (z <= 0.166) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(6.0 * Float64(Float64(y - x) * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.2) tmp = (y - x) * (6.0 * z); elseif (z <= 0.166) tmp = x + (6.0 * (y * z)); else tmp = 6.0 * ((y - x) * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.2], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.166], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.2:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 0.166:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\end{array}
\end{array}
if z < -0.20000000000000001Initial program 99.8%
Taylor expanded in y around 0 93.8%
+-commutative93.8%
metadata-eval93.8%
cancel-sign-sub-inv93.8%
*-commutative93.8%
associate-*l*93.9%
*-commutative93.9%
associate-*l*93.9%
distribute-lft-out--99.8%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 98.0%
Taylor expanded in y around 0 92.1%
metadata-eval92.1%
distribute-lft-neg-in92.1%
*-commutative92.1%
associate-*r*92.1%
distribute-rgt-neg-out92.1%
*-commutative92.1%
associate-*r*92.2%
distribute-lft-out98.0%
+-commutative98.0%
*-commutative98.0%
sub-neg98.0%
Simplified98.0%
if -0.20000000000000001 < z < 0.166000000000000009Initial program 99.8%
Taylor expanded in y around inf 98.7%
if 0.166000000000000009 < z Initial program 99.8%
Taylor expanded in y around 0 91.3%
+-commutative91.3%
metadata-eval91.3%
cancel-sign-sub-inv91.3%
*-commutative91.3%
associate-*l*91.2%
*-commutative91.2%
associate-*l*91.1%
distribute-lft-out--99.7%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in z around inf 97.0%
Final simplification98.1%
(FPCore (x y z) :precision binary64 (if (<= z -0.2) (* (- y x) (* 6.0 z)) (if (<= z 0.166) (+ x (* z (* y 6.0))) (* 6.0 (* (- y x) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.2) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 0.166) {
tmp = x + (z * (y * 6.0));
} else {
tmp = 6.0 * ((y - 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 <= (-0.2d0)) then
tmp = (y - x) * (6.0d0 * z)
else if (z <= 0.166d0) then
tmp = x + (z * (y * 6.0d0))
else
tmp = 6.0d0 * ((y - x) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.2) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 0.166) {
tmp = x + (z * (y * 6.0));
} else {
tmp = 6.0 * ((y - x) * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.2: tmp = (y - x) * (6.0 * z) elif z <= 0.166: tmp = x + (z * (y * 6.0)) else: tmp = 6.0 * ((y - x) * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.2) tmp = Float64(Float64(y - x) * Float64(6.0 * z)); elseif (z <= 0.166) tmp = Float64(x + Float64(z * Float64(y * 6.0))); else tmp = Float64(6.0 * Float64(Float64(y - x) * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.2) tmp = (y - x) * (6.0 * z); elseif (z <= 0.166) tmp = x + (z * (y * 6.0)); else tmp = 6.0 * ((y - x) * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.2], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.166], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.2:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 0.166:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\end{array}
\end{array}
if z < -0.20000000000000001Initial program 99.8%
Taylor expanded in y around 0 93.8%
+-commutative93.8%
metadata-eval93.8%
cancel-sign-sub-inv93.8%
*-commutative93.8%
associate-*l*93.9%
*-commutative93.9%
associate-*l*93.9%
distribute-lft-out--99.8%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 98.0%
Taylor expanded in y around 0 92.1%
metadata-eval92.1%
distribute-lft-neg-in92.1%
*-commutative92.1%
associate-*r*92.1%
distribute-rgt-neg-out92.1%
*-commutative92.1%
associate-*r*92.2%
distribute-lft-out98.0%
+-commutative98.0%
*-commutative98.0%
sub-neg98.0%
Simplified98.0%
if -0.20000000000000001 < z < 0.166000000000000009Initial program 99.8%
Taylor expanded in y around inf 98.7%
if 0.166000000000000009 < z Initial program 99.8%
Taylor expanded in y around 0 91.3%
+-commutative91.3%
metadata-eval91.3%
cancel-sign-sub-inv91.3%
*-commutative91.3%
associate-*l*91.2%
*-commutative91.2%
associate-*l*91.1%
distribute-lft-out--99.7%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in z around inf 97.0%
Final simplification98.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.17) (not (<= z 0.166))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.17) || !(z <= 0.166)) {
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.17d0)) .or. (.not. (z <= 0.166d0))) 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.17) || !(z <= 0.166)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.17) or not (z <= 0.166): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.17) || !(z <= 0.166)) 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.17) || ~((z <= 0.166))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.17], N[Not[LessEqual[z, 0.166]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.17 \lor \neg \left(z \leq 0.166\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.170000000000000012 or 0.166000000000000009 < z Initial program 99.8%
Taylor expanded in y around 0 51.0%
Taylor expanded in z around inf 48.6%
if -0.170000000000000012 < z < 0.166000000000000009Initial program 99.8%
Taylor expanded in z around 0 71.9%
Final simplification60.9%
(FPCore (x y z) :precision binary64 (+ x (* 6.0 (* (- y x) z))))
double code(double x, double y, double z) {
return x + (6.0 * ((y - x) * z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (6.0d0 * ((y - x) * z))
end function
public static double code(double x, double y, double z) {
return x + (6.0 * ((y - x) * z));
}
def code(x, y, z): return x + (6.0 * ((y - x) * z))
function code(x, y, z) return Float64(x + Float64(6.0 * Float64(Float64(y - x) * z))) end
function tmp = code(x, y, z) tmp = x + (6.0 * ((y - x) * z)); end
code[x_, y_, z_] := N[(x + N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + 6 \cdot \left(\left(y - x\right) \cdot z\right)
\end{array}
Initial program 99.8%
Taylor expanded in y around 0 96.3%
+-commutative96.3%
metadata-eval96.3%
cancel-sign-sub-inv96.3%
*-commutative96.3%
associate-*l*96.3%
*-commutative96.3%
associate-*l*96.3%
distribute-lft-out--99.8%
associate-*r*99.8%
Simplified99.8%
Final simplification99.8%
(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.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.8%
Taylor expanded in z around 0 39.4%
Final simplification39.4%
(FPCore (x y z) :precision binary64 (- x (* (* 6.0 z) (- x y))))
double code(double x, double y, double z) {
return x - ((6.0 * z) * (x - y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x - ((6.0d0 * z) * (x - y))
end function
public static double code(double x, double y, double z) {
return x - ((6.0 * z) * (x - y));
}
def code(x, y, z): return x - ((6.0 * z) * (x - y))
function code(x, y, z) return Float64(x - Float64(Float64(6.0 * z) * Float64(x - y))) end
function tmp = code(x, y, z) tmp = x - ((6.0 * z) * (x - y)); end
code[x_, y_, z_] := N[(x - N[(N[(6.0 * z), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(6 \cdot z\right) \cdot \left(x - y\right)
\end{array}
herbie shell --seed 2024039
(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)))