
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* (- 1.0 y) z))))
double code(double x, double y, double z) {
return x * (1.0 - ((1.0 - y) * 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 * (1.0d0 - ((1.0d0 - y) * z))
end function
public static double code(double x, double y, double z) {
return x * (1.0 - ((1.0 - y) * z));
}
def code(x, y, z): return x * (1.0 - ((1.0 - y) * z))
function code(x, y, z) return Float64(x * Float64(1.0 - Float64(Float64(1.0 - y) * z))) end
function tmp = code(x, y, z) tmp = x * (1.0 - ((1.0 - y) * z)); end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* (- 1.0 y) z))))
double code(double x, double y, double z) {
return x * (1.0 - ((1.0 - y) * 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 * (1.0d0 - ((1.0d0 - y) * z))
end function
public static double code(double x, double y, double z) {
return x * (1.0 - ((1.0 - y) * z));
}
def code(x, y, z): return x * (1.0 - ((1.0 - y) * z))
function code(x, y, z) return Float64(x * Float64(1.0 - Float64(Float64(1.0 - y) * z))) end
function tmp = code(x, y, z) tmp = x * (1.0 - ((1.0 - y) * z)); end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= z -1.1) (not (<= z 9.4e+54))) (* (+ y -1.0) (* x z)) (* x (+ 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.1) || !(z <= 9.4e+54)) {
tmp = (y + -1.0) * (x * z);
} else {
tmp = x * (1.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 <= (-1.1d0)) .or. (.not. (z <= 9.4d+54))) then
tmp = (y + (-1.0d0)) * (x * z)
else
tmp = x * (1.0d0 + (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.1) || !(z <= 9.4e+54)) {
tmp = (y + -1.0) * (x * z);
} else {
tmp = x * (1.0 + (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.1) or not (z <= 9.4e+54): tmp = (y + -1.0) * (x * z) else: tmp = x * (1.0 + (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.1) || !(z <= 9.4e+54)) tmp = Float64(Float64(y + -1.0) * Float64(x * z)); else tmp = Float64(x * Float64(1.0 + Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.1) || ~((z <= 9.4e+54))) tmp = (y + -1.0) * (x * z); else tmp = x * (1.0 + (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.1], N[Not[LessEqual[z, 9.4e+54]], $MachinePrecision]], N[(N[(y + -1.0), $MachinePrecision] * N[(x * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \lor \neg \left(z \leq 9.4 \cdot 10^{+54}\right):\\
\;\;\;\;\left(y + -1\right) \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + y \cdot z\right)\\
\end{array}
\end{array}
if z < -1.1000000000000001 or 9.39999999999999985e54 < z Initial program 93.5%
Taylor expanded in z around inf 93.1%
associate-*r*99.6%
*-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
if -1.1000000000000001 < z < 9.39999999999999985e54Initial program 99.9%
Taylor expanded in y around inf 99.1%
mul-1-neg99.1%
distribute-lft-neg-out99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in z around 0 99.1%
*-commutative99.1%
distribute-rgt1-in99.1%
Applied egg-rr99.1%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (- 1.0 (* (- 1.0 y) z))))) (if (<= t_0 (- INFINITY)) (* (+ y -1.0) (* x z)) t_0)))
double code(double x, double y, double z) {
double t_0 = x * (1.0 - ((1.0 - y) * z));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (y + -1.0) * (x * z);
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = x * (1.0 - ((1.0 - y) * z));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = (y + -1.0) * (x * z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (1.0 - ((1.0 - y) * z)) tmp = 0 if t_0 <= -math.inf: tmp = (y + -1.0) * (x * z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(1.0 - Float64(Float64(1.0 - y) * z))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(y + -1.0) * Float64(x * z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (1.0 - ((1.0 - y) * z)); tmp = 0.0; if (t_0 <= -Inf) tmp = (y + -1.0) * (x * z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(1.0 - N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(y + -1.0), $MachinePrecision] * N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;\left(y + -1\right) \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (*.f64 x (-.f64 1 (*.f64 (-.f64 1 y) z))) < -inf.0Initial program 81.8%
Taylor expanded in z around inf 81.8%
associate-*r*99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
if -inf.0 < (*.f64 x (-.f64 1 (*.f64 (-.f64 1 y) z))) Initial program 99.1%
Final simplification99.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (- z))))
(if (<= z -9.5e+181)
(* y (* x z))
(if (<= z -27.5)
t_0
(if (<= z 1.25e-48) x (if (<= z 7.2e+84) (* x (* y z)) t_0))))))
double code(double x, double y, double z) {
double t_0 = x * -z;
double tmp;
if (z <= -9.5e+181) {
tmp = y * (x * z);
} else if (z <= -27.5) {
tmp = t_0;
} else if (z <= 1.25e-48) {
tmp = x;
} else if (z <= 7.2e+84) {
tmp = x * (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
if (z <= (-9.5d+181)) then
tmp = y * (x * z)
else if (z <= (-27.5d0)) then
tmp = t_0
else if (z <= 1.25d-48) then
tmp = x
else if (z <= 7.2d+84) then
tmp = x * (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;
double tmp;
if (z <= -9.5e+181) {
tmp = y * (x * z);
} else if (z <= -27.5) {
tmp = t_0;
} else if (z <= 1.25e-48) {
tmp = x;
} else if (z <= 7.2e+84) {
tmp = x * (y * z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * -z tmp = 0 if z <= -9.5e+181: tmp = y * (x * z) elif z <= -27.5: tmp = t_0 elif z <= 1.25e-48: tmp = x elif z <= 7.2e+84: tmp = x * (y * z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(-z)) tmp = 0.0 if (z <= -9.5e+181) tmp = Float64(y * Float64(x * z)); elseif (z <= -27.5) tmp = t_0; elseif (z <= 1.25e-48) tmp = x; elseif (z <= 7.2e+84) tmp = Float64(x * Float64(y * z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * -z; tmp = 0.0; if (z <= -9.5e+181) tmp = y * (x * z); elseif (z <= -27.5) tmp = t_0; elseif (z <= 1.25e-48) tmp = x; elseif (z <= 7.2e+84) tmp = x * (y * z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * (-z)), $MachinePrecision]}, If[LessEqual[z, -9.5e+181], N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -27.5], t$95$0, If[LessEqual[z, 1.25e-48], x, If[LessEqual[z, 7.2e+84], N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{+181}:\\
\;\;\;\;y \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -27.5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{-48}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+84}:\\
\;\;\;\;x \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -9.50000000000000032e181Initial program 88.9%
flip--88.9%
associate-*l/84.9%
metadata-eval84.9%
Applied egg-rr84.9%
Taylor expanded in y around inf 56.0%
*-commutative56.0%
associate-*r*74.9%
Simplified74.9%
if -9.50000000000000032e181 < z < -27.5 or 7.1999999999999999e84 < z Initial program 95.3%
Taylor expanded in z around inf 94.8%
*-commutative94.8%
associate-*l*99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in y around 0 70.4%
mul-1-neg70.4%
distribute-rgt-neg-in70.4%
Simplified70.4%
if -27.5 < z < 1.25e-48Initial program 99.9%
Taylor expanded in z around 0 79.3%
if 1.25e-48 < z < 7.1999999999999999e84Initial program 95.6%
Taylor expanded in y around inf 70.4%
*-commutative70.4%
Simplified70.4%
Final simplification75.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (- z))))
(if (<= z -2.6e+182)
(* y (* x z))
(if (<= z -27.5)
t_0
(if (<= z 1.04e-48) x (if (<= z 3.8e+87) (* z (* x y)) t_0))))))
double code(double x, double y, double z) {
double t_0 = x * -z;
double tmp;
if (z <= -2.6e+182) {
tmp = y * (x * z);
} else if (z <= -27.5) {
tmp = t_0;
} else if (z <= 1.04e-48) {
tmp = x;
} else if (z <= 3.8e+87) {
tmp = z * (x * y);
} 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
if (z <= (-2.6d+182)) then
tmp = y * (x * z)
else if (z <= (-27.5d0)) then
tmp = t_0
else if (z <= 1.04d-48) then
tmp = x
else if (z <= 3.8d+87) then
tmp = z * (x * y)
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;
double tmp;
if (z <= -2.6e+182) {
tmp = y * (x * z);
} else if (z <= -27.5) {
tmp = t_0;
} else if (z <= 1.04e-48) {
tmp = x;
} else if (z <= 3.8e+87) {
tmp = z * (x * y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * -z tmp = 0 if z <= -2.6e+182: tmp = y * (x * z) elif z <= -27.5: tmp = t_0 elif z <= 1.04e-48: tmp = x elif z <= 3.8e+87: tmp = z * (x * y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(-z)) tmp = 0.0 if (z <= -2.6e+182) tmp = Float64(y * Float64(x * z)); elseif (z <= -27.5) tmp = t_0; elseif (z <= 1.04e-48) tmp = x; elseif (z <= 3.8e+87) tmp = Float64(z * Float64(x * y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * -z; tmp = 0.0; if (z <= -2.6e+182) tmp = y * (x * z); elseif (z <= -27.5) tmp = t_0; elseif (z <= 1.04e-48) tmp = x; elseif (z <= 3.8e+87) tmp = z * (x * y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * (-z)), $MachinePrecision]}, If[LessEqual[z, -2.6e+182], N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -27.5], t$95$0, If[LessEqual[z, 1.04e-48], x, If[LessEqual[z, 3.8e+87], N[(z * N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -2.6 \cdot 10^{+182}:\\
\;\;\;\;y \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -27.5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.04 \cdot 10^{-48}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+87}:\\
\;\;\;\;z \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -2.6e182Initial program 88.9%
flip--88.9%
associate-*l/84.9%
metadata-eval84.9%
Applied egg-rr84.9%
Taylor expanded in y around inf 56.0%
*-commutative56.0%
associate-*r*74.9%
Simplified74.9%
if -2.6e182 < z < -27.5 or 3.80000000000000011e87 < z Initial program 95.3%
Taylor expanded in z around inf 94.8%
*-commutative94.8%
associate-*l*99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in y around 0 70.4%
mul-1-neg70.4%
distribute-rgt-neg-in70.4%
Simplified70.4%
if -27.5 < z < 1.03999999999999998e-48Initial program 99.9%
Taylor expanded in z around 0 79.3%
if 1.03999999999999998e-48 < z < 3.80000000000000011e87Initial program 95.6%
flip--82.4%
associate-*l/78.0%
metadata-eval78.0%
Applied egg-rr78.0%
Taylor expanded in y around inf 70.4%
*-commutative70.4%
*-commutative70.4%
associate-*l*74.8%
Simplified74.8%
Final simplification75.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (- z))))
(if (<= z -27.5)
t_0
(if (<= z 9.2e-49) x (if (<= z 7e+84) (* x (* y z)) t_0)))))
double code(double x, double y, double z) {
double t_0 = x * -z;
double tmp;
if (z <= -27.5) {
tmp = t_0;
} else if (z <= 9.2e-49) {
tmp = x;
} else if (z <= 7e+84) {
tmp = x * (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
if (z <= (-27.5d0)) then
tmp = t_0
else if (z <= 9.2d-49) then
tmp = x
else if (z <= 7d+84) then
tmp = x * (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;
double tmp;
if (z <= -27.5) {
tmp = t_0;
} else if (z <= 9.2e-49) {
tmp = x;
} else if (z <= 7e+84) {
tmp = x * (y * z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * -z tmp = 0 if z <= -27.5: tmp = t_0 elif z <= 9.2e-49: tmp = x elif z <= 7e+84: tmp = x * (y * z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(-z)) tmp = 0.0 if (z <= -27.5) tmp = t_0; elseif (z <= 9.2e-49) tmp = x; elseif (z <= 7e+84) tmp = Float64(x * Float64(y * z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * -z; tmp = 0.0; if (z <= -27.5) tmp = t_0; elseif (z <= 9.2e-49) tmp = x; elseif (z <= 7e+84) tmp = x * (y * z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * (-z)), $MachinePrecision]}, If[LessEqual[z, -27.5], t$95$0, If[LessEqual[z, 9.2e-49], x, If[LessEqual[z, 7e+84], N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -27.5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-49}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+84}:\\
\;\;\;\;x \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -27.5 or 6.9999999999999998e84 < z Initial program 93.8%
Taylor expanded in z around inf 93.5%
*-commutative93.5%
associate-*l*99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in y around 0 65.2%
mul-1-neg65.2%
distribute-rgt-neg-in65.2%
Simplified65.2%
if -27.5 < z < 9.1999999999999996e-49Initial program 99.9%
Taylor expanded in z around 0 79.3%
if 9.1999999999999996e-49 < z < 6.9999999999999998e84Initial program 95.6%
Taylor expanded in y around inf 70.4%
*-commutative70.4%
Simplified70.4%
Final simplification72.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.3e-25) (not (<= z 1.25e-48))) (* z (* x (+ y -1.0))) (- x (* x z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.3e-25) || !(z <= 1.25e-48)) {
tmp = z * (x * (y + -1.0));
} else {
tmp = x - (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 <= (-1.3d-25)) .or. (.not. (z <= 1.25d-48))) then
tmp = z * (x * (y + (-1.0d0)))
else
tmp = x - (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.3e-25) || !(z <= 1.25e-48)) {
tmp = z * (x * (y + -1.0));
} else {
tmp = x - (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.3e-25) or not (z <= 1.25e-48): tmp = z * (x * (y + -1.0)) else: tmp = x - (x * z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.3e-25) || !(z <= 1.25e-48)) tmp = Float64(z * Float64(x * Float64(y + -1.0))); else tmp = Float64(x - Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.3e-25) || ~((z <= 1.25e-48))) tmp = z * (x * (y + -1.0)); else tmp = x - (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.3e-25], N[Not[LessEqual[z, 1.25e-48]], $MachinePrecision]], N[(z * N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{-25} \lor \neg \left(z \leq 1.25 \cdot 10^{-48}\right):\\
\;\;\;\;z \cdot \left(x \cdot \left(y + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot z\\
\end{array}
\end{array}
if z < -1.3e-25 or 1.25e-48 < z Initial program 94.4%
Taylor expanded in z around inf 90.4%
*-commutative90.4%
associate-*l*96.0%
sub-neg96.0%
metadata-eval96.0%
Simplified96.0%
if -1.3e-25 < z < 1.25e-48Initial program 99.9%
Taylor expanded in y around 0 81.5%
sub-neg81.5%
distribute-rgt-in81.5%
*-lft-identity81.5%
distribute-lft-neg-out81.5%
*-commutative81.5%
unsub-neg81.5%
Simplified81.5%
Final simplification89.0%
(FPCore (x y z) :precision binary64 (if (<= y -1.9e+124) (* z (* x y)) (if (<= y 7.6e+143) (- x (* x z)) (* y (* x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.9e+124) {
tmp = z * (x * y);
} else if (y <= 7.6e+143) {
tmp = x - (x * z);
} else {
tmp = 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 (y <= (-1.9d+124)) then
tmp = z * (x * y)
else if (y <= 7.6d+143) then
tmp = x - (x * z)
else
tmp = y * (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.9e+124) {
tmp = z * (x * y);
} else if (y <= 7.6e+143) {
tmp = x - (x * z);
} else {
tmp = y * (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.9e+124: tmp = z * (x * y) elif y <= 7.6e+143: tmp = x - (x * z) else: tmp = y * (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.9e+124) tmp = Float64(z * Float64(x * y)); elseif (y <= 7.6e+143) tmp = Float64(x - Float64(x * z)); else tmp = Float64(y * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.9e+124) tmp = z * (x * y); elseif (y <= 7.6e+143) tmp = x - (x * z); else tmp = y * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.9e+124], N[(z * N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.6e+143], N[(x - N[(x * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{+124}:\\
\;\;\;\;z \cdot \left(x \cdot y\right)\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{+143}:\\
\;\;\;\;x - x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if y < -1.8999999999999999e124Initial program 92.7%
flip--58.9%
associate-*l/53.7%
metadata-eval53.7%
Applied egg-rr53.7%
Taylor expanded in y around inf 82.2%
*-commutative82.2%
*-commutative82.2%
associate-*l*87.0%
Simplified87.0%
if -1.8999999999999999e124 < y < 7.60000000000000001e143Initial program 100.0%
Taylor expanded in y around 0 87.8%
sub-neg87.8%
distribute-rgt-in87.8%
*-lft-identity87.8%
distribute-lft-neg-out87.8%
*-commutative87.8%
unsub-neg87.8%
Simplified87.8%
if 7.60000000000000001e143 < y Initial program 84.0%
flip--49.3%
associate-*l/46.1%
metadata-eval46.1%
Applied egg-rr46.1%
Taylor expanded in y around inf 78.8%
*-commutative78.8%
associate-*r*93.6%
Simplified93.6%
Final simplification88.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -27.5) (not (<= z 29000000000.0))) (* x (- z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -27.5) || !(z <= 29000000000.0)) {
tmp = 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 <= (-27.5d0)) .or. (.not. (z <= 29000000000.0d0))) then
tmp = 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 <= -27.5) || !(z <= 29000000000.0)) {
tmp = x * -z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -27.5) or not (z <= 29000000000.0): tmp = x * -z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -27.5) || !(z <= 29000000000.0)) tmp = Float64(x * Float64(-z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -27.5) || ~((z <= 29000000000.0))) tmp = x * -z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -27.5], N[Not[LessEqual[z, 29000000000.0]], $MachinePrecision]], N[(x * (-z)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -27.5 \lor \neg \left(z \leq 29000000000\right):\\
\;\;\;\;x \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -27.5 or 2.9e10 < z Initial program 93.7%
Taylor expanded in z around inf 93.3%
*-commutative93.3%
associate-*l*99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around 0 63.0%
mul-1-neg63.0%
distribute-rgt-neg-in63.0%
Simplified63.0%
if -27.5 < z < 2.9e10Initial program 99.9%
Taylor expanded in z around 0 75.8%
Final simplification70.0%
(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 97.0%
Taylor expanded in z around 0 42.5%
Final simplification42.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (- 1.0 (* (- 1.0 y) z))))
(t_1 (+ x (* (- 1.0 y) (* (- z) x)))))
(if (< t_0 -1.618195973607049e+50)
t_1
(if (< t_0 3.892237649663903e+134) (- (* (* x y) z) (- (* x z) x)) t_1))))
double code(double x, double y, double z) {
double t_0 = x * (1.0 - ((1.0 - y) * z));
double t_1 = x + ((1.0 - y) * (-z * x));
double tmp;
if (t_0 < -1.618195973607049e+50) {
tmp = t_1;
} else if (t_0 < 3.892237649663903e+134) {
tmp = ((x * y) * z) - ((x * z) - 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 = x * (1.0d0 - ((1.0d0 - y) * z))
t_1 = x + ((1.0d0 - y) * (-z * x))
if (t_0 < (-1.618195973607049d+50)) then
tmp = t_1
else if (t_0 < 3.892237649663903d+134) then
tmp = ((x * y) * z) - ((x * z) - x)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (1.0 - ((1.0 - y) * z));
double t_1 = x + ((1.0 - y) * (-z * x));
double tmp;
if (t_0 < -1.618195973607049e+50) {
tmp = t_1;
} else if (t_0 < 3.892237649663903e+134) {
tmp = ((x * y) * z) - ((x * z) - x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = x * (1.0 - ((1.0 - y) * z)) t_1 = x + ((1.0 - y) * (-z * x)) tmp = 0 if t_0 < -1.618195973607049e+50: tmp = t_1 elif t_0 < 3.892237649663903e+134: tmp = ((x * y) * z) - ((x * z) - x) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(1.0 - Float64(Float64(1.0 - y) * z))) t_1 = Float64(x + Float64(Float64(1.0 - y) * Float64(Float64(-z) * x))) tmp = 0.0 if (t_0 < -1.618195973607049e+50) tmp = t_1; elseif (t_0 < 3.892237649663903e+134) tmp = Float64(Float64(Float64(x * y) * z) - Float64(Float64(x * z) - x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (1.0 - ((1.0 - y) * z)); t_1 = x + ((1.0 - y) * (-z * x)); tmp = 0.0; if (t_0 < -1.618195973607049e+50) tmp = t_1; elseif (t_0 < 3.892237649663903e+134) tmp = ((x * y) * z) - ((x * z) - x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(1.0 - N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(N[(1.0 - y), $MachinePrecision] * N[((-z) * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$0, -1.618195973607049e+50], t$95$1, If[Less[t$95$0, 3.892237649663903e+134], N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] - N[(N[(x * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\\
t_1 := x + \left(1 - y\right) \cdot \left(\left(-z\right) \cdot x\right)\\
\mathbf{if}\;t_0 < -1.618195973607049 \cdot 10^{+50}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 < 3.892237649663903 \cdot 10^{+134}:\\
\;\;\;\;\left(x \cdot y\right) \cdot z - \left(x \cdot z - x\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023279
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, J"
:precision binary64
:herbie-target
(if (< (* x (- 1.0 (* (- 1.0 y) z))) -1.618195973607049e+50) (+ x (* (- 1.0 y) (* (- z) x))) (if (< (* x (- 1.0 (* (- 1.0 y) z))) 3.892237649663903e+134) (- (* (* x y) z) (- (* x z) x)) (+ x (* (- 1.0 y) (* (- z) x)))))
(* x (- 1.0 (* (- 1.0 y) z))))