
(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.4%
+-commutative99.4%
*-commutative99.4%
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 -5.5e+180)
t_0
(if (<= z -3.2e+150)
t_1
(if (<= z -4.8e-28)
t_0
(if (<= z 8.2e-36) x (if (<= z 2.4e+24) t_0 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 <= -5.5e+180) {
tmp = t_0;
} else if (z <= -3.2e+150) {
tmp = t_1;
} else if (z <= -4.8e-28) {
tmp = t_0;
} else if (z <= 8.2e-36) {
tmp = x;
} else if (z <= 2.4e+24) {
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 = 6.0d0 * (y * z)
t_1 = (-6.0d0) * (x * z)
if (z <= (-5.5d+180)) then
tmp = t_0
else if (z <= (-3.2d+150)) then
tmp = t_1
else if (z <= (-4.8d-28)) then
tmp = t_0
else if (z <= 8.2d-36) then
tmp = x
else if (z <= 2.4d+24) 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 = 6.0 * (y * z);
double t_1 = -6.0 * (x * z);
double tmp;
if (z <= -5.5e+180) {
tmp = t_0;
} else if (z <= -3.2e+150) {
tmp = t_1;
} else if (z <= -4.8e-28) {
tmp = t_0;
} else if (z <= 8.2e-36) {
tmp = x;
} else if (z <= 2.4e+24) {
tmp = t_0;
} 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 <= -5.5e+180: tmp = t_0 elif z <= -3.2e+150: tmp = t_1 elif z <= -4.8e-28: tmp = t_0 elif z <= 8.2e-36: tmp = x elif z <= 2.4e+24: tmp = t_0 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 <= -5.5e+180) tmp = t_0; elseif (z <= -3.2e+150) tmp = t_1; elseif (z <= -4.8e-28) tmp = t_0; elseif (z <= 8.2e-36) tmp = x; elseif (z <= 2.4e+24) tmp = t_0; 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 <= -5.5e+180) tmp = t_0; elseif (z <= -3.2e+150) tmp = t_1; elseif (z <= -4.8e-28) tmp = t_0; elseif (z <= 8.2e-36) tmp = x; elseif (z <= 2.4e+24) tmp = t_0; 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, -5.5e+180], t$95$0, If[LessEqual[z, -3.2e+150], t$95$1, If[LessEqual[z, -4.8e-28], t$95$0, If[LessEqual[z, 8.2e-36], x, If[LessEqual[z, 2.4e+24], t$95$0, 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 -5.5 \cdot 10^{+180}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{+150}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -4.8 \cdot 10^{-28}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-36}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+24}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -5.5000000000000003e180 or -3.20000000000000016e150 < z < -4.8000000000000004e-28 or 8.20000000000000025e-36 < z < 2.4000000000000001e24Initial program 99.5%
associate-*r*98.4%
+-commutative98.4%
*-commutative98.4%
associate-*r*99.7%
fma-def99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 66.9%
if -5.5000000000000003e180 < z < -3.20000000000000016e150 or 2.4000000000000001e24 < z Initial program 100.0%
Taylor expanded in y around 0 62.2%
Taylor expanded in z around inf 62.2%
if -4.8000000000000004e-28 < z < 8.20000000000000025e-36Initial program 99.1%
Taylor expanded in z around 0 80.6%
Final simplification72.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* -6.0 (* x z))))
(if (<= z -2.8e+178)
(* z (* y 6.0))
(if (<= z -1.1e+149)
t_1
(if (<= z -1.45e-28)
t_0
(if (<= z 1.1e-35) x (if (<= z 2.3e+28) t_0 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.8e+178) {
tmp = z * (y * 6.0);
} else if (z <= -1.1e+149) {
tmp = t_1;
} else if (z <= -1.45e-28) {
tmp = t_0;
} else if (z <= 1.1e-35) {
tmp = x;
} else if (z <= 2.3e+28) {
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 = 6.0d0 * (y * z)
t_1 = (-6.0d0) * (x * z)
if (z <= (-2.8d+178)) then
tmp = z * (y * 6.0d0)
else if (z <= (-1.1d+149)) then
tmp = t_1
else if (z <= (-1.45d-28)) then
tmp = t_0
else if (z <= 1.1d-35) then
tmp = x
else if (z <= 2.3d+28) 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 = 6.0 * (y * z);
double t_1 = -6.0 * (x * z);
double tmp;
if (z <= -2.8e+178) {
tmp = z * (y * 6.0);
} else if (z <= -1.1e+149) {
tmp = t_1;
} else if (z <= -1.45e-28) {
tmp = t_0;
} else if (z <= 1.1e-35) {
tmp = x;
} else if (z <= 2.3e+28) {
tmp = t_0;
} 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.8e+178: tmp = z * (y * 6.0) elif z <= -1.1e+149: tmp = t_1 elif z <= -1.45e-28: tmp = t_0 elif z <= 1.1e-35: tmp = x elif z <= 2.3e+28: tmp = t_0 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.8e+178) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= -1.1e+149) tmp = t_1; elseif (z <= -1.45e-28) tmp = t_0; elseif (z <= 1.1e-35) tmp = x; elseif (z <= 2.3e+28) tmp = t_0; 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.8e+178) tmp = z * (y * 6.0); elseif (z <= -1.1e+149) tmp = t_1; elseif (z <= -1.45e-28) tmp = t_0; elseif (z <= 1.1e-35) tmp = x; elseif (z <= 2.3e+28) tmp = t_0; 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.8e+178], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.1e+149], t$95$1, If[LessEqual[z, -1.45e-28], t$95$0, If[LessEqual[z, 1.1e-35], x, If[LessEqual[z, 2.3e+28], t$95$0, 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.8 \cdot 10^{+178}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{+149}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.45 \cdot 10^{-28}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-35}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+28}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -2.79999999999999993e178Initial program 99.7%
associate-*r*95.6%
+-commutative95.6%
*-commutative95.6%
associate-*r*99.7%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 66.4%
*-commutative66.4%
*-commutative66.4%
associate-*r*66.4%
*-commutative66.4%
Simplified66.4%
if -2.79999999999999993e178 < z < -1.1e149 or 2.29999999999999984e28 < z Initial program 100.0%
Taylor expanded in y around 0 62.2%
Taylor expanded in z around inf 62.2%
if -1.1e149 < z < -1.45000000000000006e-28 or 1.09999999999999997e-35 < z < 2.29999999999999984e28Initial program 99.4%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.6%
fma-def99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 67.1%
if -1.45000000000000006e-28 < z < 1.09999999999999997e-35Initial program 99.1%
Taylor expanded in z around 0 80.6%
Final simplification72.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* z (* x -6.0))))
(if (<= z -1e+180)
(* z (* y 6.0))
(if (<= z -8.5e+142)
t_1
(if (<= z -4.1e-29)
t_0
(if (<= z 1.2e-34) x (if (<= z 4.7e+23) t_0 t_1)))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double t_1 = z * (x * -6.0);
double tmp;
if (z <= -1e+180) {
tmp = z * (y * 6.0);
} else if (z <= -8.5e+142) {
tmp = t_1;
} else if (z <= -4.1e-29) {
tmp = t_0;
} else if (z <= 1.2e-34) {
tmp = x;
} else if (z <= 4.7e+23) {
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 = 6.0d0 * (y * z)
t_1 = z * (x * (-6.0d0))
if (z <= (-1d+180)) then
tmp = z * (y * 6.0d0)
else if (z <= (-8.5d+142)) then
tmp = t_1
else if (z <= (-4.1d-29)) then
tmp = t_0
else if (z <= 1.2d-34) then
tmp = x
else if (z <= 4.7d+23) 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 = 6.0 * (y * z);
double t_1 = z * (x * -6.0);
double tmp;
if (z <= -1e+180) {
tmp = z * (y * 6.0);
} else if (z <= -8.5e+142) {
tmp = t_1;
} else if (z <= -4.1e-29) {
tmp = t_0;
} else if (z <= 1.2e-34) {
tmp = x;
} else if (z <= 4.7e+23) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) t_1 = z * (x * -6.0) tmp = 0 if z <= -1e+180: tmp = z * (y * 6.0) elif z <= -8.5e+142: tmp = t_1 elif z <= -4.1e-29: tmp = t_0 elif z <= 1.2e-34: tmp = x elif z <= 4.7e+23: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) t_1 = Float64(z * Float64(x * -6.0)) tmp = 0.0 if (z <= -1e+180) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= -8.5e+142) tmp = t_1; elseif (z <= -4.1e-29) tmp = t_0; elseif (z <= 1.2e-34) tmp = x; elseif (z <= 4.7e+23) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); t_1 = z * (x * -6.0); tmp = 0.0; if (z <= -1e+180) tmp = z * (y * 6.0); elseif (z <= -8.5e+142) tmp = t_1; elseif (z <= -4.1e-29) tmp = t_0; elseif (z <= 1.2e-34) tmp = x; elseif (z <= 4.7e+23) tmp = t_0; 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[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1e+180], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -8.5e+142], t$95$1, If[LessEqual[z, -4.1e-29], t$95$0, If[LessEqual[z, 1.2e-34], x, If[LessEqual[z, 4.7e+23], t$95$0, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
t_1 := z \cdot \left(x \cdot -6\right)\\
\mathbf{if}\;z \leq -1 \cdot 10^{+180}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{+142}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -4.1 \cdot 10^{-29}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-34}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{+23}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1e180Initial program 99.7%
associate-*r*95.6%
+-commutative95.6%
*-commutative95.6%
associate-*r*99.7%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 66.4%
*-commutative66.4%
*-commutative66.4%
associate-*r*66.4%
*-commutative66.4%
Simplified66.4%
if -1e180 < z < -8.49999999999999955e142 or 4.6999999999999997e23 < z Initial program 100.0%
Taylor expanded in y around 0 62.2%
Taylor expanded in z around inf 62.2%
associate-*r*62.3%
*-commutative62.3%
Simplified62.3%
if -8.49999999999999955e142 < z < -4.0999999999999998e-29 or 1.19999999999999996e-34 < z < 4.6999999999999997e23Initial program 99.4%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.6%
fma-def99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 67.1%
if -4.0999999999999998e-29 < z < 1.19999999999999996e-34Initial program 99.1%
Taylor expanded in z around 0 80.6%
Final simplification72.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.8e-31) (not (<= z 2.4e-35))) (* z (* (- y x) 6.0)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.8e-31) || !(z <= 2.4e-35)) {
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 <= (-4.8d-31)) .or. (.not. (z <= 2.4d-35))) 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 <= -4.8e-31) || !(z <= 2.4e-35)) {
tmp = z * ((y - x) * 6.0);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.8e-31) or not (z <= 2.4e-35): tmp = z * ((y - x) * 6.0) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.8e-31) || !(z <= 2.4e-35)) 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 <= -4.8e-31) || ~((z <= 2.4e-35))) tmp = z * ((y - x) * 6.0); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.8e-31], N[Not[LessEqual[z, 2.4e-35]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{-31} \lor \neg \left(z \leq 2.4 \cdot 10^{-35}\right):\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.8e-31 or 2.4000000000000001e-35 < z Initial program 99.7%
associate-*r*99.0%
+-commutative99.0%
*-commutative99.0%
associate-*r*99.7%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 95.8%
associate-*r*95.2%
*-commutative95.2%
associate-*l*95.8%
Simplified95.8%
if -4.8e-31 < z < 2.4000000000000001e-35Initial program 99.1%
Taylor expanded in z around 0 80.6%
Final simplification88.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.72) (not (<= z 0.74))) (* z (* (- y x) 6.0)) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.72) || !(z <= 0.74)) {
tmp = z * ((y - x) * 6.0);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-0.72d0)) .or. (.not. (z <= 0.74d0))) then
tmp = z * ((y - x) * 6.0d0)
else
tmp = x + (6.0d0 * (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.72) || !(z <= 0.74)) {
tmp = z * ((y - x) * 6.0);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.72) or not (z <= 0.74): tmp = z * ((y - x) * 6.0) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.72) || !(z <= 0.74)) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); else tmp = Float64(x + Float64(6.0 * Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.72) || ~((z <= 0.74))) tmp = z * ((y - x) * 6.0); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.72], N[Not[LessEqual[z, 0.74]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.72 \lor \neg \left(z \leq 0.74\right):\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -0.71999999999999997 or 0.73999999999999999 < z Initial program 99.8%
associate-*r*98.9%
+-commutative98.9%
*-commutative98.9%
associate-*r*99.7%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 99.5%
associate-*r*98.7%
*-commutative98.7%
associate-*l*99.6%
Simplified99.6%
if -0.71999999999999997 < z < 0.73999999999999999Initial program 99.1%
Taylor expanded in y around inf 99.0%
*-commutative99.0%
Simplified99.0%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (if (<= z -0.72) (* z (- (* y 6.0) (* x 6.0))) (if (<= z 0.74) (+ x (* 6.0 (* y z))) (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.72) {
tmp = z * ((y * 6.0) - (x * 6.0));
} else if (z <= 0.74) {
tmp = x + (6.0 * (y * z));
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-0.72d0)) then
tmp = z * ((y * 6.0d0) - (x * 6.0d0))
else if (z <= 0.74d0) then
tmp = x + (6.0d0 * (y * z))
else
tmp = z * ((y - x) * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.72) {
tmp = z * ((y * 6.0) - (x * 6.0));
} else if (z <= 0.74) {
tmp = x + (6.0 * (y * z));
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.72: tmp = z * ((y * 6.0) - (x * 6.0)) elif z <= 0.74: tmp = x + (6.0 * (y * z)) else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.72) tmp = Float64(z * Float64(Float64(y * 6.0) - Float64(x * 6.0))); elseif (z <= 0.74) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(z * Float64(Float64(y - x) * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.72) tmp = z * ((y * 6.0) - (x * 6.0)); elseif (z <= 0.74) tmp = x + (6.0 * (y * z)); else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.72], N[(z * N[(N[(y * 6.0), $MachinePrecision] - N[(x * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.74], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.72:\\
\;\;\;\;z \cdot \left(y \cdot 6 - x \cdot 6\right)\\
\mathbf{elif}\;z \leq 0.74:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -0.71999999999999997Initial program 99.6%
associate-*r*98.2%
+-commutative98.2%
*-commutative98.2%
associate-*r*99.6%
fma-def99.6%
Applied egg-rr99.6%
Taylor expanded in z around inf 99.6%
associate-*r*98.2%
*-commutative98.2%
associate-*l*99.6%
Simplified99.6%
sub-neg99.6%
distribute-rgt-in99.7%
Applied egg-rr99.7%
distribute-lft-neg-out99.7%
unsub-neg99.7%
*-commutative99.7%
*-commutative99.7%
Applied egg-rr99.7%
if -0.71999999999999997 < z < 0.73999999999999999Initial program 99.1%
Taylor expanded in y around inf 99.0%
*-commutative99.0%
Simplified99.0%
if 0.73999999999999999 < z Initial program 99.9%
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.4%
associate-*r*99.4%
*-commutative99.4%
associate-*l*99.6%
Simplified99.6%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.72) (not (<= z 0.165))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.72) || !(z <= 0.165)) {
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.72d0)) .or. (.not. (z <= 0.165d0))) 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.72) || !(z <= 0.165)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.72) or not (z <= 0.165): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.72) || !(z <= 0.165)) 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.72) || ~((z <= 0.165))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.72], N[Not[LessEqual[z, 0.165]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.72 \lor \neg \left(z \leq 0.165\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.71999999999999997 or 0.165000000000000008 < z Initial program 99.7%
Taylor expanded in y around 0 49.7%
Taylor expanded in z around inf 49.5%
if -0.71999999999999997 < z < 0.165000000000000008Initial program 99.1%
Taylor expanded in z around 0 73.9%
Final simplification62.1%
(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.4%
Simplified99.4%
Final simplification99.4%
(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 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 2023333
(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)))