
(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 12 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.06) (not (<= z 1.55e+17))) (* (+ y -1.0) (* z x)) (* x (+ 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.06) || !(z <= 1.55e+17)) {
tmp = (y + -1.0) * (z * x);
} 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.06d0)) .or. (.not. (z <= 1.55d+17))) then
tmp = (y + (-1.0d0)) * (z * x)
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.06) || !(z <= 1.55e+17)) {
tmp = (y + -1.0) * (z * x);
} else {
tmp = x * (1.0 + (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.06) or not (z <= 1.55e+17): tmp = (y + -1.0) * (z * x) else: tmp = x * (1.0 + (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.06) || !(z <= 1.55e+17)) tmp = Float64(Float64(y + -1.0) * Float64(z * x)); 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.06) || ~((z <= 1.55e+17))) tmp = (y + -1.0) * (z * x); else tmp = x * (1.0 + (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.06], N[Not[LessEqual[z, 1.55e+17]], $MachinePrecision]], N[(N[(y + -1.0), $MachinePrecision] * N[(z * x), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.06 \lor \neg \left(z \leq 1.55 \cdot 10^{+17}\right):\\
\;\;\;\;\left(y + -1\right) \cdot \left(z \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + y \cdot z\right)\\
\end{array}
\end{array}
if z < -1.0600000000000001 or 1.55e17 < z Initial program 89.6%
*-commutative89.6%
sub-neg89.6%
distribute-rgt-in89.6%
*-un-lft-identity89.6%
Applied egg-rr89.6%
Taylor expanded in x around 0 89.6%
mul-1-neg89.6%
*-commutative89.6%
sub-neg89.6%
Simplified89.6%
Taylor expanded in z around inf 89.5%
associate-*r*99.8%
*-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
if -1.0600000000000001 < z < 1.55e17Initial program 99.9%
Taylor expanded in z around 0 99.9%
Taylor expanded in y around inf 98.5%
*-commutative98.5%
Simplified98.5%
*-commutative98.5%
distribute-rgt1-in98.5%
Applied egg-rr98.5%
Final simplification99.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- x))) (t_1 (* x (* y z))))
(if (<= z -3.2e+185)
t_0
(if (<= z -1.1e+153)
t_1
(if (<= z -5.1e+95)
t_0
(if (<= z -6.8e-69)
t_1
(if (<= z 6.8e-13) x (if (<= z 5.5e+88) t_1 t_0))))))))
double code(double x, double y, double z) {
double t_0 = z * -x;
double t_1 = x * (y * z);
double tmp;
if (z <= -3.2e+185) {
tmp = t_0;
} else if (z <= -1.1e+153) {
tmp = t_1;
} else if (z <= -5.1e+95) {
tmp = t_0;
} else if (z <= -6.8e-69) {
tmp = t_1;
} else if (z <= 6.8e-13) {
tmp = x;
} else if (z <= 5.5e+88) {
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 = z * -x
t_1 = x * (y * z)
if (z <= (-3.2d+185)) then
tmp = t_0
else if (z <= (-1.1d+153)) then
tmp = t_1
else if (z <= (-5.1d+95)) then
tmp = t_0
else if (z <= (-6.8d-69)) then
tmp = t_1
else if (z <= 6.8d-13) then
tmp = x
else if (z <= 5.5d+88) 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 = z * -x;
double t_1 = x * (y * z);
double tmp;
if (z <= -3.2e+185) {
tmp = t_0;
} else if (z <= -1.1e+153) {
tmp = t_1;
} else if (z <= -5.1e+95) {
tmp = t_0;
} else if (z <= -6.8e-69) {
tmp = t_1;
} else if (z <= 6.8e-13) {
tmp = x;
} else if (z <= 5.5e+88) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * -x t_1 = x * (y * z) tmp = 0 if z <= -3.2e+185: tmp = t_0 elif z <= -1.1e+153: tmp = t_1 elif z <= -5.1e+95: tmp = t_0 elif z <= -6.8e-69: tmp = t_1 elif z <= 6.8e-13: tmp = x elif z <= 5.5e+88: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-x)) t_1 = Float64(x * Float64(y * z)) tmp = 0.0 if (z <= -3.2e+185) tmp = t_0; elseif (z <= -1.1e+153) tmp = t_1; elseif (z <= -5.1e+95) tmp = t_0; elseif (z <= -6.8e-69) tmp = t_1; elseif (z <= 6.8e-13) tmp = x; elseif (z <= 5.5e+88) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * -x; t_1 = x * (y * z); tmp = 0.0; if (z <= -3.2e+185) tmp = t_0; elseif (z <= -1.1e+153) tmp = t_1; elseif (z <= -5.1e+95) tmp = t_0; elseif (z <= -6.8e-69) tmp = t_1; elseif (z <= 6.8e-13) tmp = x; elseif (z <= 5.5e+88) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * (-x)), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.2e+185], t$95$0, If[LessEqual[z, -1.1e+153], t$95$1, If[LessEqual[z, -5.1e+95], t$95$0, If[LessEqual[z, -6.8e-69], t$95$1, If[LessEqual[z, 6.8e-13], x, If[LessEqual[z, 5.5e+88], t$95$1, t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(-x\right)\\
t_1 := x \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+185}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{+153}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -5.1 \cdot 10^{+95}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -6.8 \cdot 10^{-69}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{+88}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -3.20000000000000006e185 or -1.1e153 < z < -5.10000000000000003e95 or 5.5e88 < z Initial program 88.9%
Taylor expanded in z around inf 88.9%
*-commutative88.9%
associate-*r*99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 69.8%
neg-mul-169.8%
Simplified69.8%
if -3.20000000000000006e185 < z < -1.1e153 or -5.10000000000000003e95 < z < -6.80000000000000016e-69 or 6.80000000000000031e-13 < z < 5.5e88Initial program 94.0%
Taylor expanded in y around inf 67.5%
*-commutative67.5%
Simplified67.5%
if -6.80000000000000016e-69 < z < 6.80000000000000031e-13Initial program 99.9%
Taylor expanded in z around 0 77.5%
Final simplification72.6%
(FPCore (x y z) :precision binary64 (if (<= (* (- 1.0 y) z) -2e+197) (* (+ y -1.0) (* z x)) (* x (+ 1.0 (- (* y z) z)))))
double code(double x, double y, double z) {
double tmp;
if (((1.0 - y) * z) <= -2e+197) {
tmp = (y + -1.0) * (z * x);
} else {
tmp = x * (1.0 + ((y * z) - 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 (((1.0d0 - y) * z) <= (-2d+197)) then
tmp = (y + (-1.0d0)) * (z * x)
else
tmp = x * (1.0d0 + ((y * z) - z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((1.0 - y) * z) <= -2e+197) {
tmp = (y + -1.0) * (z * x);
} else {
tmp = x * (1.0 + ((y * z) - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((1.0 - y) * z) <= -2e+197: tmp = (y + -1.0) * (z * x) else: tmp = x * (1.0 + ((y * z) - z)) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(Float64(1.0 - y) * z) <= -2e+197) tmp = Float64(Float64(y + -1.0) * Float64(z * x)); else tmp = Float64(x * Float64(1.0 + Float64(Float64(y * z) - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((1.0 - y) * z) <= -2e+197) tmp = (y + -1.0) * (z * x); else tmp = x * (1.0 + ((y * z) - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], -2e+197], N[(N[(y + -1.0), $MachinePrecision] * N[(z * x), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(N[(y * z), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - y\right) \cdot z \leq -2 \cdot 10^{+197}:\\
\;\;\;\;\left(y + -1\right) \cdot \left(z \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \left(y \cdot z - z\right)\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 1 y) z) < -1.9999999999999999e197Initial program 79.7%
*-commutative79.7%
sub-neg79.7%
distribute-rgt-in79.8%
*-un-lft-identity79.8%
Applied egg-rr79.8%
Taylor expanded in x around 0 79.8%
mul-1-neg79.8%
*-commutative79.8%
sub-neg79.8%
Simplified79.8%
Taylor expanded in z around inf 79.7%
associate-*r*100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
if -1.9999999999999999e197 < (*.f64 (-.f64 1 y) z) Initial program 98.6%
*-commutative98.6%
sub-neg98.6%
distribute-rgt-in98.6%
*-un-lft-identity98.6%
Applied egg-rr98.6%
Taylor expanded in x around 0 98.6%
mul-1-neg98.6%
*-commutative98.6%
sub-neg98.6%
Simplified98.6%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (<= (* (- 1.0 y) z) -1e+67) (* (+ y -1.0) (* z x)) (* x (+ 1.0 (* z (+ y -1.0))))))
double code(double x, double y, double z) {
double tmp;
if (((1.0 - y) * z) <= -1e+67) {
tmp = (y + -1.0) * (z * x);
} else {
tmp = x * (1.0 + (z * (y + -1.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 (((1.0d0 - y) * z) <= (-1d+67)) then
tmp = (y + (-1.0d0)) * (z * x)
else
tmp = x * (1.0d0 + (z * (y + (-1.0d0))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((1.0 - y) * z) <= -1e+67) {
tmp = (y + -1.0) * (z * x);
} else {
tmp = x * (1.0 + (z * (y + -1.0)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((1.0 - y) * z) <= -1e+67: tmp = (y + -1.0) * (z * x) else: tmp = x * (1.0 + (z * (y + -1.0))) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(Float64(1.0 - y) * z) <= -1e+67) tmp = Float64(Float64(y + -1.0) * Float64(z * x)); else tmp = Float64(x * Float64(1.0 + Float64(z * Float64(y + -1.0)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((1.0 - y) * z) <= -1e+67) tmp = (y + -1.0) * (z * x); else tmp = x * (1.0 + (z * (y + -1.0))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], -1e+67], N[(N[(y + -1.0), $MachinePrecision] * N[(z * x), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(z * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - y\right) \cdot z \leq -1 \cdot 10^{+67}:\\
\;\;\;\;\left(y + -1\right) \cdot \left(z \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + z \cdot \left(y + -1\right)\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 1 y) z) < -9.99999999999999983e66Initial program 85.3%
*-commutative85.3%
sub-neg85.3%
distribute-rgt-in85.3%
*-un-lft-identity85.3%
Applied egg-rr85.3%
Taylor expanded in x around 0 85.3%
mul-1-neg85.3%
*-commutative85.3%
sub-neg85.3%
Simplified85.3%
Taylor expanded in z around inf 85.3%
associate-*r*99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
if -9.99999999999999983e66 < (*.f64 (-.f64 1 y) z) Initial program 98.5%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -7.2e-67) (not (<= z 4.8e-13))) (* z (* (+ y -1.0) x)) (* x (- 1.0 z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7.2e-67) || !(z <= 4.8e-13)) {
tmp = z * ((y + -1.0) * x);
} else {
tmp = x * (1.0 - 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 <= (-7.2d-67)) .or. (.not. (z <= 4.8d-13))) then
tmp = z * ((y + (-1.0d0)) * x)
else
tmp = x * (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -7.2e-67) || !(z <= 4.8e-13)) {
tmp = z * ((y + -1.0) * x);
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -7.2e-67) or not (z <= 4.8e-13): tmp = z * ((y + -1.0) * x) else: tmp = x * (1.0 - z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -7.2e-67) || !(z <= 4.8e-13)) tmp = Float64(z * Float64(Float64(y + -1.0) * x)); else tmp = Float64(x * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -7.2e-67) || ~((z <= 4.8e-13))) tmp = z * ((y + -1.0) * x); else tmp = x * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -7.2e-67], N[Not[LessEqual[z, 4.8e-13]], $MachinePrecision]], N[(z * N[(N[(y + -1.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-67} \lor \neg \left(z \leq 4.8 \cdot 10^{-13}\right):\\
\;\;\;\;z \cdot \left(\left(y + -1\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if z < -7.19999999999999998e-67 or 4.7999999999999997e-13 < z Initial program 91.3%
Taylor expanded in z around inf 86.7%
*-commutative86.7%
associate-*r*94.6%
*-commutative94.6%
sub-neg94.6%
metadata-eval94.6%
Simplified94.6%
if -7.19999999999999998e-67 < z < 4.7999999999999997e-13Initial program 99.9%
Taylor expanded in y around 0 77.6%
Final simplification87.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.9e-65) (not (<= z 2.1e-11))) (* z (- (* y x) x)) (* x (- 1.0 z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.9e-65) || !(z <= 2.1e-11)) {
tmp = z * ((y * x) - x);
} else {
tmp = x * (1.0 - 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 <= (-6.9d-65)) .or. (.not. (z <= 2.1d-11))) then
tmp = z * ((y * x) - x)
else
tmp = x * (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -6.9e-65) || !(z <= 2.1e-11)) {
tmp = z * ((y * x) - x);
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.9e-65) or not (z <= 2.1e-11): tmp = z * ((y * x) - x) else: tmp = x * (1.0 - z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.9e-65) || !(z <= 2.1e-11)) tmp = Float64(z * Float64(Float64(y * x) - x)); else tmp = Float64(x * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6.9e-65) || ~((z <= 2.1e-11))) tmp = z * ((y * x) - x); else tmp = x * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.9e-65], N[Not[LessEqual[z, 2.1e-11]], $MachinePrecision]], N[(z * N[(N[(y * x), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.9 \cdot 10^{-65} \lor \neg \left(z \leq 2.1 \cdot 10^{-11}\right):\\
\;\;\;\;z \cdot \left(y \cdot x - x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if z < -6.89999999999999991e-65 or 2.0999999999999999e-11 < z Initial program 91.3%
Taylor expanded in z around inf 86.7%
*-commutative86.7%
associate-*r*94.6%
*-commutative94.6%
sub-neg94.6%
metadata-eval94.6%
Simplified94.6%
distribute-lft-in94.6%
*-commutative94.6%
mul-1-neg94.6%
Applied egg-rr94.6%
Taylor expanded in z around 0 94.6%
if -6.89999999999999991e-65 < z < 2.0999999999999999e-11Initial program 99.9%
Taylor expanded in y around 0 77.6%
Final simplification87.0%
(FPCore (x y z) :precision binary64 (if (<= z -2.5e-66) (* z (- (* y x) x)) (if (<= z 1.6e-11) (* x (- 1.0 z)) (* (+ y -1.0) (* z x)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.5e-66) {
tmp = z * ((y * x) - x);
} else if (z <= 1.6e-11) {
tmp = x * (1.0 - z);
} else {
tmp = (y + -1.0) * (z * 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 <= (-2.5d-66)) then
tmp = z * ((y * x) - x)
else if (z <= 1.6d-11) then
tmp = x * (1.0d0 - z)
else
tmp = (y + (-1.0d0)) * (z * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.5e-66) {
tmp = z * ((y * x) - x);
} else if (z <= 1.6e-11) {
tmp = x * (1.0 - z);
} else {
tmp = (y + -1.0) * (z * x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.5e-66: tmp = z * ((y * x) - x) elif z <= 1.6e-11: tmp = x * (1.0 - z) else: tmp = (y + -1.0) * (z * x) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.5e-66) tmp = Float64(z * Float64(Float64(y * x) - x)); elseif (z <= 1.6e-11) tmp = Float64(x * Float64(1.0 - z)); else tmp = Float64(Float64(y + -1.0) * Float64(z * x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.5e-66) tmp = z * ((y * x) - x); elseif (z <= 1.6e-11) tmp = x * (1.0 - z); else tmp = (y + -1.0) * (z * x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.5e-66], N[(z * N[(N[(y * x), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6e-11], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(N[(y + -1.0), $MachinePrecision] * N[(z * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{-66}:\\
\;\;\;\;z \cdot \left(y \cdot x - x\right)\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-11}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y + -1\right) \cdot \left(z \cdot x\right)\\
\end{array}
\end{array}
if z < -2.49999999999999981e-66Initial program 89.6%
Taylor expanded in z around inf 82.8%
*-commutative82.8%
associate-*r*91.9%
*-commutative91.9%
sub-neg91.9%
metadata-eval91.9%
Simplified91.9%
distribute-lft-in91.9%
*-commutative91.9%
mul-1-neg91.9%
Applied egg-rr91.9%
Taylor expanded in z around 0 91.9%
if -2.49999999999999981e-66 < z < 1.59999999999999997e-11Initial program 99.9%
Taylor expanded in y around 0 77.6%
if 1.59999999999999997e-11 < z Initial program 93.6%
*-commutative93.6%
sub-neg93.6%
distribute-rgt-in93.6%
*-un-lft-identity93.6%
Applied egg-rr93.6%
Taylor expanded in x around 0 93.6%
mul-1-neg93.6%
*-commutative93.6%
sub-neg93.6%
Simplified93.6%
Taylor expanded in z around inf 91.9%
associate-*r*98.3%
*-commutative98.3%
sub-neg98.3%
metadata-eval98.3%
Simplified98.3%
Final simplification87.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.7e+115) (not (<= y 2.15e+15))) (* x (* y z)) (* x (- 1.0 z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.7e+115) || !(y <= 2.15e+15)) {
tmp = x * (y * z);
} else {
tmp = x * (1.0 - 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 <= (-2.7d+115)) .or. (.not. (y <= 2.15d+15))) then
tmp = x * (y * z)
else
tmp = x * (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.7e+115) || !(y <= 2.15e+15)) {
tmp = x * (y * z);
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.7e+115) or not (y <= 2.15e+15): tmp = x * (y * z) else: tmp = x * (1.0 - z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.7e+115) || !(y <= 2.15e+15)) tmp = Float64(x * Float64(y * z)); else tmp = Float64(x * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.7e+115) || ~((y <= 2.15e+15))) tmp = x * (y * z); else tmp = x * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.7e+115], N[Not[LessEqual[y, 2.15e+15]], $MachinePrecision]], N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+115} \lor \neg \left(y \leq 2.15 \cdot 10^{+15}\right):\\
\;\;\;\;x \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < -2.70000000000000004e115 or 2.15e15 < y Initial program 90.5%
Taylor expanded in y around inf 71.5%
*-commutative71.5%
Simplified71.5%
if -2.70000000000000004e115 < y < 2.15e15Initial program 98.6%
Taylor expanded in y around 0 93.3%
Final simplification83.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -7.8e+116) (not (<= y 1.9e+14))) (* z (* y x)) (* x (- 1.0 z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7.8e+116) || !(y <= 1.9e+14)) {
tmp = z * (y * x);
} else {
tmp = x * (1.0 - 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 <= (-7.8d+116)) .or. (.not. (y <= 1.9d+14))) then
tmp = z * (y * x)
else
tmp = x * (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -7.8e+116) || !(y <= 1.9e+14)) {
tmp = z * (y * x);
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7.8e+116) or not (y <= 1.9e+14): tmp = z * (y * x) else: tmp = x * (1.0 - z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7.8e+116) || !(y <= 1.9e+14)) tmp = Float64(z * Float64(y * x)); else tmp = Float64(x * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -7.8e+116) || ~((y <= 1.9e+14))) tmp = z * (y * x); else tmp = x * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7.8e+116], N[Not[LessEqual[y, 1.9e+14]], $MachinePrecision]], N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{+116} \lor \neg \left(y \leq 1.9 \cdot 10^{+14}\right):\\
\;\;\;\;z \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < -7.80000000000000065e116 or 1.9e14 < y Initial program 90.5%
Taylor expanded in y around inf 71.5%
associate-*r*74.0%
*-commutative74.0%
Simplified74.0%
if -7.80000000000000065e116 < y < 1.9e14Initial program 98.6%
Taylor expanded in y around 0 93.3%
Final simplification84.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.7e+113) (not (<= y 1.8e+15))) (* z (* y x)) (- x (* z x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.7e+113) || !(y <= 1.8e+15)) {
tmp = z * (y * x);
} else {
tmp = x - (z * 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 ((y <= (-2.7d+113)) .or. (.not. (y <= 1.8d+15))) then
tmp = z * (y * x)
else
tmp = x - (z * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.7e+113) || !(y <= 1.8e+15)) {
tmp = z * (y * x);
} else {
tmp = x - (z * x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.7e+113) or not (y <= 1.8e+15): tmp = z * (y * x) else: tmp = x - (z * x) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.7e+113) || !(y <= 1.8e+15)) tmp = Float64(z * Float64(y * x)); else tmp = Float64(x - Float64(z * x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.7e+113) || ~((y <= 1.8e+15))) tmp = z * (y * x); else tmp = x - (z * x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.7e+113], N[Not[LessEqual[y, 1.8e+15]], $MachinePrecision]], N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+113} \lor \neg \left(y \leq 1.8 \cdot 10^{+15}\right):\\
\;\;\;\;z \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot x\\
\end{array}
\end{array}
if y < -2.70000000000000011e113 or 1.8e15 < y Initial program 90.5%
Taylor expanded in y around inf 71.5%
associate-*r*74.0%
*-commutative74.0%
Simplified74.0%
if -2.70000000000000011e113 < y < 1.8e15Initial program 98.6%
Taylor expanded in z around 0 98.7%
+-commutative98.7%
associate-*r*99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Applied egg-rr99.5%
Taylor expanded in y around 0 93.3%
mul-1-neg93.3%
sub-neg93.3%
Simplified93.3%
Final simplification84.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -29.0) (not (<= z 80000000000000.0))) (* z (- x)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -29.0) || !(z <= 80000000000000.0)) {
tmp = z * -x;
} 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 <= (-29.0d0)) .or. (.not. (z <= 80000000000000.0d0))) then
tmp = z * -x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -29.0) || !(z <= 80000000000000.0)) {
tmp = z * -x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -29.0) or not (z <= 80000000000000.0): tmp = z * -x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -29.0) || !(z <= 80000000000000.0)) tmp = Float64(z * Float64(-x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -29.0) || ~((z <= 80000000000000.0))) tmp = z * -x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -29.0], N[Not[LessEqual[z, 80000000000000.0]], $MachinePrecision]], N[(z * (-x)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -29 \lor \neg \left(z \leq 80000000000000\right):\\
\;\;\;\;z \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -29 or 8e13 < z Initial program 89.6%
Taylor expanded in z around inf 89.6%
*-commutative89.6%
associate-*r*99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 55.2%
neg-mul-155.2%
Simplified55.2%
if -29 < z < 8e13Initial program 99.9%
Taylor expanded in z around 0 68.6%
Final simplification62.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 95.1%
Taylor expanded in z around 0 38.0%
Final simplification38.0%
(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 2023310
(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))))