
(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 (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.8%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* z -6.0))) (t_1 (* 6.0 (* y z))))
(if (<= z -3e+181)
t_0
(if (<= z -3.1e+148)
t_1
(if (<= z -3.2e+98)
(* -6.0 (* x z))
(if (<= z -1.8e-64)
t_1
(if (<= z 4.5e-51)
x
(if (or (<= z 6.8e+40) (not (<= z 1e+203))) t_1 t_0))))))))
double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -3e+181) {
tmp = t_0;
} else if (z <= -3.1e+148) {
tmp = t_1;
} else if (z <= -3.2e+98) {
tmp = -6.0 * (x * z);
} else if (z <= -1.8e-64) {
tmp = t_1;
} else if (z <= 4.5e-51) {
tmp = x;
} else if ((z <= 6.8e+40) || !(z <= 1e+203)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = x * (z * (-6.0d0))
t_1 = 6.0d0 * (y * z)
if (z <= (-3d+181)) then
tmp = t_0
else if (z <= (-3.1d+148)) then
tmp = t_1
else if (z <= (-3.2d+98)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-1.8d-64)) then
tmp = t_1
else if (z <= 4.5d-51) then
tmp = x
else if ((z <= 6.8d+40) .or. (.not. (z <= 1d+203))) then
tmp = t_1
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 t_1 = 6.0 * (y * z);
double tmp;
if (z <= -3e+181) {
tmp = t_0;
} else if (z <= -3.1e+148) {
tmp = t_1;
} else if (z <= -3.2e+98) {
tmp = -6.0 * (x * z);
} else if (z <= -1.8e-64) {
tmp = t_1;
} else if (z <= 4.5e-51) {
tmp = x;
} else if ((z <= 6.8e+40) || !(z <= 1e+203)) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z * -6.0) t_1 = 6.0 * (y * z) tmp = 0 if z <= -3e+181: tmp = t_0 elif z <= -3.1e+148: tmp = t_1 elif z <= -3.2e+98: tmp = -6.0 * (x * z) elif z <= -1.8e-64: tmp = t_1 elif z <= 4.5e-51: tmp = x elif (z <= 6.8e+40) or not (z <= 1e+203): tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z * -6.0)) t_1 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -3e+181) tmp = t_0; elseif (z <= -3.1e+148) tmp = t_1; elseif (z <= -3.2e+98) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -1.8e-64) tmp = t_1; elseif (z <= 4.5e-51) tmp = x; elseif ((z <= 6.8e+40) || !(z <= 1e+203)) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z * -6.0); t_1 = 6.0 * (y * z); tmp = 0.0; if (z <= -3e+181) tmp = t_0; elseif (z <= -3.1e+148) tmp = t_1; elseif (z <= -3.2e+98) tmp = -6.0 * (x * z); elseif (z <= -1.8e-64) tmp = t_1; elseif (z <= 4.5e-51) tmp = x; elseif ((z <= 6.8e+40) || ~((z <= 1e+203))) tmp = t_1; 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]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3e+181], t$95$0, If[LessEqual[z, -3.1e+148], t$95$1, If[LessEqual[z, -3.2e+98], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.8e-64], t$95$1, If[LessEqual[z, 4.5e-51], x, If[Or[LessEqual[z, 6.8e+40], N[Not[LessEqual[z, 1e+203]], $MachinePrecision]], t$95$1, t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot -6\right)\\
t_1 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -3 \cdot 10^{+181}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.1 \cdot 10^{+148}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{+98}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -1.8 \cdot 10^{-64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-51}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+40} \lor \neg \left(z \leq 10^{+203}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.00000000000000012e181 or 6.79999999999999977e40 < z < 9.9999999999999999e202Initial program 99.8%
Taylor expanded in y around 0 58.9%
Taylor expanded in z around inf 58.9%
*-commutative58.9%
associate-*r*58.9%
*-commutative58.9%
Simplified58.9%
if -3.00000000000000012e181 < z < -3.09999999999999975e148 or -3.2000000000000002e98 < z < -1.7999999999999999e-64 or 4.49999999999999974e-51 < z < 6.79999999999999977e40 or 9.9999999999999999e202 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 64.2%
*-commutative64.2%
Simplified64.2%
if -3.09999999999999975e148 < z < -3.2000000000000002e98Initial program 99.9%
Taylor expanded in y around 0 82.3%
Taylor expanded in z around inf 82.3%
if -1.7999999999999999e-64 < z < 4.49999999999999974e-51Initial program 99.9%
Taylor expanded in z around 0 79.1%
Final simplification70.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))) (t_1 (* 6.0 (* y z))))
(if (<= z -2.45e+182)
t_0
(if (<= z -1.05e+150)
t_1
(if (<= z -3e+98)
t_0
(if (<= z -1e-64)
t_1
(if (<= z 1.25e-48)
x
(if (or (<= z 7.2e+44) (not (<= z 4e+202))) t_1 t_0))))))))
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 <= -2.45e+182) {
tmp = t_0;
} else if (z <= -1.05e+150) {
tmp = t_1;
} else if (z <= -3e+98) {
tmp = t_0;
} else if (z <= -1e-64) {
tmp = t_1;
} else if (z <= 1.25e-48) {
tmp = x;
} else if ((z <= 7.2e+44) || !(z <= 4e+202)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = (-6.0d0) * (x * z)
t_1 = 6.0d0 * (y * z)
if (z <= (-2.45d+182)) then
tmp = t_0
else if (z <= (-1.05d+150)) then
tmp = t_1
else if (z <= (-3d+98)) then
tmp = t_0
else if (z <= (-1d-64)) then
tmp = t_1
else if (z <= 1.25d-48) then
tmp = x
else if ((z <= 7.2d+44) .or. (.not. (z <= 4d+202))) then
tmp = t_1
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 t_1 = 6.0 * (y * z);
double tmp;
if (z <= -2.45e+182) {
tmp = t_0;
} else if (z <= -1.05e+150) {
tmp = t_1;
} else if (z <= -3e+98) {
tmp = t_0;
} else if (z <= -1e-64) {
tmp = t_1;
} else if (z <= 1.25e-48) {
tmp = x;
} else if ((z <= 7.2e+44) || !(z <= 4e+202)) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (x * z) t_1 = 6.0 * (y * z) tmp = 0 if z <= -2.45e+182: tmp = t_0 elif z <= -1.05e+150: tmp = t_1 elif z <= -3e+98: tmp = t_0 elif z <= -1e-64: tmp = t_1 elif z <= 1.25e-48: tmp = x elif (z <= 7.2e+44) or not (z <= 4e+202): tmp = t_1 else: tmp = t_0 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 <= -2.45e+182) tmp = t_0; elseif (z <= -1.05e+150) tmp = t_1; elseif (z <= -3e+98) tmp = t_0; elseif (z <= -1e-64) tmp = t_1; elseif (z <= 1.25e-48) tmp = x; elseif ((z <= 7.2e+44) || !(z <= 4e+202)) tmp = t_1; else tmp = t_0; 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 <= -2.45e+182) tmp = t_0; elseif (z <= -1.05e+150) tmp = t_1; elseif (z <= -3e+98) tmp = t_0; elseif (z <= -1e-64) tmp = t_1; elseif (z <= 1.25e-48) tmp = x; elseif ((z <= 7.2e+44) || ~((z <= 4e+202))) tmp = t_1; 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]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.45e+182], t$95$0, If[LessEqual[z, -1.05e+150], t$95$1, If[LessEqual[z, -3e+98], t$95$0, If[LessEqual[z, -1e-64], t$95$1, If[LessEqual[z, 1.25e-48], x, If[Or[LessEqual[z, 7.2e+44], N[Not[LessEqual[z, 4e+202]], $MachinePrecision]], t$95$1, t$95$0]]]]]]]]
\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.45 \cdot 10^{+182}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{+150}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3 \cdot 10^{+98}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1 \cdot 10^{-64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{-48}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+44} \lor \neg \left(z \leq 4 \cdot 10^{+202}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.45e182 or -1.04999999999999999e150 < z < -3.0000000000000001e98 or 7.2e44 < z < 3.9999999999999996e202Initial program 99.8%
Taylor expanded in y around 0 63.2%
Taylor expanded in z around inf 63.2%
if -2.45e182 < z < -1.04999999999999999e150 or -3.0000000000000001e98 < z < -9.99999999999999965e-65 or 1.25e-48 < z < 7.2e44 or 3.9999999999999996e202 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 63.9%
*-commutative63.9%
Simplified63.9%
if -9.99999999999999965e-65 < z < 1.25e-48Initial program 99.9%
Taylor expanded in z around 0 79.1%
Final simplification70.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* z -6.0))) (t_1 (* 6.0 (* y z))))
(if (<= z -2e+182)
t_0
(if (<= z -1.35e+153)
t_1
(if (<= z -3.7e+98)
(* (* x 6.0) (- z))
(if (<= z -1.55e-65)
t_1
(if (<= z 1.08e-48)
x
(if (<= z 5.2e+40)
(* z (* y 6.0))
(if (<= z 9.2e+201) t_0 t_1)))))))))
double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -2e+182) {
tmp = t_0;
} else if (z <= -1.35e+153) {
tmp = t_1;
} else if (z <= -3.7e+98) {
tmp = (x * 6.0) * -z;
} else if (z <= -1.55e-65) {
tmp = t_1;
} else if (z <= 1.08e-48) {
tmp = x;
} else if (z <= 5.2e+40) {
tmp = z * (y * 6.0);
} else if (z <= 9.2e+201) {
tmp = t_0;
} 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 = x * (z * (-6.0d0))
t_1 = 6.0d0 * (y * z)
if (z <= (-2d+182)) then
tmp = t_0
else if (z <= (-1.35d+153)) then
tmp = t_1
else if (z <= (-3.7d+98)) then
tmp = (x * 6.0d0) * -z
else if (z <= (-1.55d-65)) then
tmp = t_1
else if (z <= 1.08d-48) then
tmp = x
else if (z <= 5.2d+40) then
tmp = z * (y * 6.0d0)
else if (z <= 9.2d+201) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -2e+182) {
tmp = t_0;
} else if (z <= -1.35e+153) {
tmp = t_1;
} else if (z <= -3.7e+98) {
tmp = (x * 6.0) * -z;
} else if (z <= -1.55e-65) {
tmp = t_1;
} else if (z <= 1.08e-48) {
tmp = x;
} else if (z <= 5.2e+40) {
tmp = z * (y * 6.0);
} else if (z <= 9.2e+201) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z * -6.0) t_1 = 6.0 * (y * z) tmp = 0 if z <= -2e+182: tmp = t_0 elif z <= -1.35e+153: tmp = t_1 elif z <= -3.7e+98: tmp = (x * 6.0) * -z elif z <= -1.55e-65: tmp = t_1 elif z <= 1.08e-48: tmp = x elif z <= 5.2e+40: tmp = z * (y * 6.0) elif z <= 9.2e+201: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z * -6.0)) t_1 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -2e+182) tmp = t_0; elseif (z <= -1.35e+153) tmp = t_1; elseif (z <= -3.7e+98) tmp = Float64(Float64(x * 6.0) * Float64(-z)); elseif (z <= -1.55e-65) tmp = t_1; elseif (z <= 1.08e-48) tmp = x; elseif (z <= 5.2e+40) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= 9.2e+201) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z * -6.0); t_1 = 6.0 * (y * z); tmp = 0.0; if (z <= -2e+182) tmp = t_0; elseif (z <= -1.35e+153) tmp = t_1; elseif (z <= -3.7e+98) tmp = (x * 6.0) * -z; elseif (z <= -1.55e-65) tmp = t_1; elseif (z <= 1.08e-48) tmp = x; elseif (z <= 5.2e+40) tmp = z * (y * 6.0); elseif (z <= 9.2e+201) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2e+182], t$95$0, If[LessEqual[z, -1.35e+153], t$95$1, If[LessEqual[z, -3.7e+98], N[(N[(x * 6.0), $MachinePrecision] * (-z)), $MachinePrecision], If[LessEqual[z, -1.55e-65], t$95$1, If[LessEqual[z, 1.08e-48], x, If[LessEqual[z, 5.2e+40], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.2e+201], t$95$0, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot -6\right)\\
t_1 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -2 \cdot 10^{+182}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.35 \cdot 10^{+153}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{+98}:\\
\;\;\;\;\left(x \cdot 6\right) \cdot \left(-z\right)\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{-65}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.08 \cdot 10^{-48}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+40}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+201}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.0000000000000001e182 or 5.2000000000000001e40 < z < 9.2000000000000004e201Initial program 99.8%
Taylor expanded in y around 0 58.9%
Taylor expanded in z around inf 58.9%
*-commutative58.9%
associate-*r*58.9%
*-commutative58.9%
Simplified58.9%
if -2.0000000000000001e182 < z < -1.35e153 or -3.6999999999999999e98 < z < -1.55000000000000008e-65 or 9.2000000000000004e201 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 64.5%
*-commutative64.5%
Simplified64.5%
if -1.35e153 < z < -3.6999999999999999e98Initial program 99.9%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.7%
fma-define99.6%
Applied egg-rr99.6%
Taylor expanded in z around inf 99.7%
associate-*r*99.6%
*-commutative99.6%
associate-*r*99.9%
Simplified99.9%
Taylor expanded in y around 0 82.4%
neg-mul-182.4%
Simplified82.4%
if -1.55000000000000008e-65 < z < 1.08e-48Initial program 99.9%
Taylor expanded in z around 0 79.1%
if 1.08e-48 < z < 5.2000000000000001e40Initial program 99.7%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.6%
fma-define99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 63.3%
*-commutative63.3%
associate-*r*63.2%
*-commutative63.2%
associate-*r*63.4%
Simplified63.4%
Final simplification70.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* z -6.0))) (t_1 (* 6.0 (* y z))))
(if (<= z -6.8e+183)
t_0
(if (<= z -1.16e+153)
t_1
(if (<= z -3.4e+98)
(* -6.0 (* x z))
(if (<= z -8.2e-65)
t_1
(if (<= z 2.3e-49)
x
(if (<= z 3.8e+40)
(* z (* y 6.0))
(if (<= z 6e+202) t_0 t_1)))))))))
double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -6.8e+183) {
tmp = t_0;
} else if (z <= -1.16e+153) {
tmp = t_1;
} else if (z <= -3.4e+98) {
tmp = -6.0 * (x * z);
} else if (z <= -8.2e-65) {
tmp = t_1;
} else if (z <= 2.3e-49) {
tmp = x;
} else if (z <= 3.8e+40) {
tmp = z * (y * 6.0);
} else if (z <= 6e+202) {
tmp = t_0;
} 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 = x * (z * (-6.0d0))
t_1 = 6.0d0 * (y * z)
if (z <= (-6.8d+183)) then
tmp = t_0
else if (z <= (-1.16d+153)) then
tmp = t_1
else if (z <= (-3.4d+98)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-8.2d-65)) then
tmp = t_1
else if (z <= 2.3d-49) then
tmp = x
else if (z <= 3.8d+40) then
tmp = z * (y * 6.0d0)
else if (z <= 6d+202) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -6.8e+183) {
tmp = t_0;
} else if (z <= -1.16e+153) {
tmp = t_1;
} else if (z <= -3.4e+98) {
tmp = -6.0 * (x * z);
} else if (z <= -8.2e-65) {
tmp = t_1;
} else if (z <= 2.3e-49) {
tmp = x;
} else if (z <= 3.8e+40) {
tmp = z * (y * 6.0);
} else if (z <= 6e+202) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z * -6.0) t_1 = 6.0 * (y * z) tmp = 0 if z <= -6.8e+183: tmp = t_0 elif z <= -1.16e+153: tmp = t_1 elif z <= -3.4e+98: tmp = -6.0 * (x * z) elif z <= -8.2e-65: tmp = t_1 elif z <= 2.3e-49: tmp = x elif z <= 3.8e+40: tmp = z * (y * 6.0) elif z <= 6e+202: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z * -6.0)) t_1 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -6.8e+183) tmp = t_0; elseif (z <= -1.16e+153) tmp = t_1; elseif (z <= -3.4e+98) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -8.2e-65) tmp = t_1; elseif (z <= 2.3e-49) tmp = x; elseif (z <= 3.8e+40) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= 6e+202) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z * -6.0); t_1 = 6.0 * (y * z); tmp = 0.0; if (z <= -6.8e+183) tmp = t_0; elseif (z <= -1.16e+153) tmp = t_1; elseif (z <= -3.4e+98) tmp = -6.0 * (x * z); elseif (z <= -8.2e-65) tmp = t_1; elseif (z <= 2.3e-49) tmp = x; elseif (z <= 3.8e+40) tmp = z * (y * 6.0); elseif (z <= 6e+202) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.8e+183], t$95$0, If[LessEqual[z, -1.16e+153], t$95$1, If[LessEqual[z, -3.4e+98], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -8.2e-65], t$95$1, If[LessEqual[z, 2.3e-49], x, If[LessEqual[z, 3.8e+40], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6e+202], t$95$0, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot -6\right)\\
t_1 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -6.8 \cdot 10^{+183}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.16 \cdot 10^{+153}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.4 \cdot 10^{+98}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -8.2 \cdot 10^{-65}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-49}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+40}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+202}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.8e183 or 3.80000000000000004e40 < z < 6.0000000000000003e202Initial program 99.8%
Taylor expanded in y around 0 58.9%
Taylor expanded in z around inf 58.9%
*-commutative58.9%
associate-*r*58.9%
*-commutative58.9%
Simplified58.9%
if -6.8e183 < z < -1.1599999999999999e153 or -3.39999999999999972e98 < z < -8.19999999999999975e-65 or 6.0000000000000003e202 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 64.5%
*-commutative64.5%
Simplified64.5%
if -1.1599999999999999e153 < z < -3.39999999999999972e98Initial program 99.9%
Taylor expanded in y around 0 82.3%
Taylor expanded in z around inf 82.3%
if -8.19999999999999975e-65 < z < 2.2999999999999999e-49Initial program 99.9%
Taylor expanded in z around 0 79.1%
if 2.2999999999999999e-49 < z < 3.80000000000000004e40Initial program 99.7%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.6%
fma-define99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 63.3%
*-commutative63.3%
associate-*r*63.2%
*-commutative63.2%
associate-*r*63.4%
Simplified63.4%
Final simplification70.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.25e-66) (not (<= z 1.02e-48))) (* (* (- y x) z) 6.0) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.25e-66) || !(z <= 1.02e-48)) {
tmp = ((y - x) * z) * 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 <= (-1.25d-66)) .or. (.not. (z <= 1.02d-48))) then
tmp = ((y - x) * z) * 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 <= -1.25e-66) || !(z <= 1.02e-48)) {
tmp = ((y - x) * z) * 6.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.25e-66) or not (z <= 1.02e-48): tmp = ((y - x) * z) * 6.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.25e-66) || !(z <= 1.02e-48)) tmp = Float64(Float64(Float64(y - x) * z) * 6.0); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.25e-66) || ~((z <= 1.02e-48))) tmp = ((y - x) * z) * 6.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.25e-66], N[Not[LessEqual[z, 1.02e-48]], $MachinePrecision]], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * 6.0), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{-66} \lor \neg \left(z \leq 1.02 \cdot 10^{-48}\right):\\
\;\;\;\;\left(\left(y - x\right) \cdot z\right) \cdot 6\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.2499999999999999e-66 or 1.02000000000000005e-48 < z Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 94.1%
if -1.2499999999999999e-66 < z < 1.02000000000000005e-48Initial program 99.9%
Taylor expanded in z around 0 79.1%
Final simplification87.7%
(FPCore (x y z) :precision binary64 (if (<= z -5800.0) (* z (* (- y x) 6.0)) (if (<= z 0.0165) (+ x (* 6.0 (* y z))) (* (* (- y x) z) 6.0))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5800.0) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 0.0165) {
tmp = x + (6.0 * (y * z));
} else {
tmp = ((y - 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 <= (-5800.0d0)) then
tmp = z * ((y - x) * 6.0d0)
else if (z <= 0.0165d0) then
tmp = x + (6.0d0 * (y * z))
else
tmp = ((y - x) * z) * 6.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5800.0) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 0.0165) {
tmp = x + (6.0 * (y * z));
} else {
tmp = ((y - x) * z) * 6.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5800.0: tmp = z * ((y - x) * 6.0) elif z <= 0.0165: tmp = x + (6.0 * (y * z)) else: tmp = ((y - x) * z) * 6.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5800.0) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); elseif (z <= 0.0165) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(Float64(Float64(y - x) * z) * 6.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5800.0) tmp = z * ((y - x) * 6.0); elseif (z <= 0.0165) tmp = x + (6.0 * (y * z)); else tmp = ((y - x) * z) * 6.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5800.0], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0165], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * 6.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5800:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{elif}\;z \leq 0.0165:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y - x\right) \cdot z\right) \cdot 6\\
\end{array}
\end{array}
if z < -5800Initial program 99.8%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 99.5%
associate-*r*99.6%
*-commutative99.6%
associate-*r*99.6%
Simplified99.6%
if -5800 < z < 0.016500000000000001Initial program 99.9%
Taylor expanded in y around inf 99.3%
*-commutative99.3%
Simplified99.3%
if 0.016500000000000001 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 98.7%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (<= z -1.55e-65) (* (* (- y x) z) 6.0) (if (<= z 4e-50) x (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.55e-65) {
tmp = ((y - x) * z) * 6.0;
} else if (z <= 4e-50) {
tmp = x;
} 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 <= (-1.55d-65)) then
tmp = ((y - x) * z) * 6.0d0
else if (z <= 4d-50) then
tmp = x
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 <= -1.55e-65) {
tmp = ((y - x) * z) * 6.0;
} else if (z <= 4e-50) {
tmp = x;
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.55e-65: tmp = ((y - x) * z) * 6.0 elif z <= 4e-50: tmp = x else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.55e-65) tmp = Float64(Float64(Float64(y - x) * z) * 6.0); elseif (z <= 4e-50) tmp = x; 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 <= -1.55e-65) tmp = ((y - x) * z) * 6.0; elseif (z <= 4e-50) tmp = x; else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.55e-65], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * 6.0), $MachinePrecision], If[LessEqual[z, 4e-50], x, N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{-65}:\\
\;\;\;\;\left(\left(y - x\right) \cdot z\right) \cdot 6\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-50}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -1.55000000000000008e-65Initial program 99.8%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 93.0%
if -1.55000000000000008e-65 < z < 4.00000000000000003e-50Initial program 99.9%
Taylor expanded in z around 0 79.1%
if 4.00000000000000003e-50 < z Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 95.1%
associate-*r*95.1%
*-commutative95.1%
associate-*r*95.2%
Simplified95.2%
Final simplification87.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.17) (not (<= z 0.0165))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.17) || !(z <= 0.0165)) {
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.0165d0))) 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.0165)) {
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.0165): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.17) || !(z <= 0.0165)) 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.0165))) 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.0165]], $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.0165\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.170000000000000012 or 0.016500000000000001 < z Initial program 99.7%
Taylor expanded in y around 0 53.0%
Taylor expanded in z around inf 52.4%
if -0.170000000000000012 < z < 0.016500000000000001Initial program 99.9%
Taylor expanded in z around 0 72.8%
Final simplification62.6%
(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.8%
associate-*l*99.8%
Simplified99.8%
Final simplification99.8%
(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(Float64(y - x) * 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[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot z\right) \cdot 6
\end{array}
Initial program 99.8%
Taylor expanded in y around 0 97.5%
+-commutative97.5%
metadata-eval97.5%
cancel-sign-sub-inv97.5%
*-commutative97.5%
associate-*r*97.5%
*-commutative97.5%
associate-*l*97.5%
distribute-lft-out--99.8%
associate-*r*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.8%
Taylor expanded in z around 0 37.8%
(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 2024110
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:alt
(- x (* (* 6.0 z) (- x y)))
(+ x (* (* (- y x) 6.0) z)))