
(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 10 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 -23.0) (not (<= z 0.084))) (* z (* x (+ y -1.0))) (+ x (* x (* z y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -23.0) || !(z <= 0.084)) {
tmp = z * (x * (y + -1.0));
} else {
tmp = x + (x * (z * y));
}
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 <= (-23.0d0)) .or. (.not. (z <= 0.084d0))) then
tmp = z * (x * (y + (-1.0d0)))
else
tmp = x + (x * (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -23.0) || !(z <= 0.084)) {
tmp = z * (x * (y + -1.0));
} else {
tmp = x + (x * (z * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -23.0) or not (z <= 0.084): tmp = z * (x * (y + -1.0)) else: tmp = x + (x * (z * y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -23.0) || !(z <= 0.084)) tmp = Float64(z * Float64(x * Float64(y + -1.0))); else tmp = Float64(x + Float64(x * Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -23.0) || ~((z <= 0.084))) tmp = z * (x * (y + -1.0)); else tmp = x + (x * (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -23.0], N[Not[LessEqual[z, 0.084]], $MachinePrecision]], N[(z * N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -23 \lor \neg \left(z \leq 0.084\right):\\
\;\;\;\;z \cdot \left(x \cdot \left(y + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(z \cdot y\right)\\
\end{array}
\end{array}
if z < -23 or 0.0840000000000000052 < z Initial program 94.0%
Taylor expanded in z around inf 93.5%
*-commutative93.5%
associate-*r*99.3%
*-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
if -23 < z < 0.0840000000000000052Initial program 99.9%
Taylor expanded in z around 0 99.9%
Taylor expanded in y around inf 98.7%
*-commutative98.7%
Simplified98.7%
Final simplification99.0%
(FPCore (x y z)
:precision binary64
(if (or (<= y -1.5e+194)
(and (not (<= y -1.15e+137)) (or (<= y -1.9e+90) (not (<= y 8e+39)))))
(* x (* z y))
(* x (- 1.0 z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.5e+194) || (!(y <= -1.15e+137) && ((y <= -1.9e+90) || !(y <= 8e+39)))) {
tmp = x * (z * y);
} 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 <= (-1.5d+194)) .or. (.not. (y <= (-1.15d+137))) .and. (y <= (-1.9d+90)) .or. (.not. (y <= 8d+39))) then
tmp = x * (z * y)
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 <= -1.5e+194) || (!(y <= -1.15e+137) && ((y <= -1.9e+90) || !(y <= 8e+39)))) {
tmp = x * (z * y);
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.5e+194) or (not (y <= -1.15e+137) and ((y <= -1.9e+90) or not (y <= 8e+39))): tmp = x * (z * y) else: tmp = x * (1.0 - z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.5e+194) || (!(y <= -1.15e+137) && ((y <= -1.9e+90) || !(y <= 8e+39)))) tmp = Float64(x * Float64(z * y)); else tmp = Float64(x * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.5e+194) || (~((y <= -1.15e+137)) && ((y <= -1.9e+90) || ~((y <= 8e+39))))) tmp = x * (z * y); else tmp = x * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.5e+194], And[N[Not[LessEqual[y, -1.15e+137]], $MachinePrecision], Or[LessEqual[y, -1.9e+90], N[Not[LessEqual[y, 8e+39]], $MachinePrecision]]]], N[(x * N[(z * y), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+194} \lor \neg \left(y \leq -1.15 \cdot 10^{+137}\right) \land \left(y \leq -1.9 \cdot 10^{+90} \lor \neg \left(y \leq 8 \cdot 10^{+39}\right)\right):\\
\;\;\;\;x \cdot \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < -1.5000000000000002e194 or -1.15e137 < y < -1.9000000000000001e90 or 7.99999999999999952e39 < y Initial program 91.9%
Taylor expanded in y around inf 78.8%
*-commutative78.8%
Simplified78.8%
if -1.5000000000000002e194 < y < -1.15e137 or -1.9000000000000001e90 < y < 7.99999999999999952e39Initial program 99.4%
Taylor expanded in y around 0 92.3%
Final simplification87.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- x))) (t_1 (* x (* z y))))
(if (<= z -8e+33)
t_0
(if (<= z -1e-49)
t_1
(if (<= z 5.8e-46) x (if (<= z 4.8e+61) t_1 t_0))))))
double code(double x, double y, double z) {
double t_0 = z * -x;
double t_1 = x * (z * y);
double tmp;
if (z <= -8e+33) {
tmp = t_0;
} else if (z <= -1e-49) {
tmp = t_1;
} else if (z <= 5.8e-46) {
tmp = x;
} else if (z <= 4.8e+61) {
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 * (z * y)
if (z <= (-8d+33)) then
tmp = t_0
else if (z <= (-1d-49)) then
tmp = t_1
else if (z <= 5.8d-46) then
tmp = x
else if (z <= 4.8d+61) 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 * (z * y);
double tmp;
if (z <= -8e+33) {
tmp = t_0;
} else if (z <= -1e-49) {
tmp = t_1;
} else if (z <= 5.8e-46) {
tmp = x;
} else if (z <= 4.8e+61) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * -x t_1 = x * (z * y) tmp = 0 if z <= -8e+33: tmp = t_0 elif z <= -1e-49: tmp = t_1 elif z <= 5.8e-46: tmp = x elif z <= 4.8e+61: 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(z * y)) tmp = 0.0 if (z <= -8e+33) tmp = t_0; elseif (z <= -1e-49) tmp = t_1; elseif (z <= 5.8e-46) tmp = x; elseif (z <= 4.8e+61) 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 * (z * y); tmp = 0.0; if (z <= -8e+33) tmp = t_0; elseif (z <= -1e-49) tmp = t_1; elseif (z <= 5.8e-46) tmp = x; elseif (z <= 4.8e+61) 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[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8e+33], t$95$0, If[LessEqual[z, -1e-49], t$95$1, If[LessEqual[z, 5.8e-46], x, If[LessEqual[z, 4.8e+61], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(-x\right)\\
t_1 := x \cdot \left(z \cdot y\right)\\
\mathbf{if}\;z \leq -8 \cdot 10^{+33}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-46}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -7.9999999999999996e33 or 4.7999999999999998e61 < z Initial program 92.6%
Taylor expanded in z around inf 92.6%
*-commutative92.6%
associate-*r*99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 63.1%
neg-mul-163.1%
Simplified63.1%
if -7.9999999999999996e33 < z < -9.99999999999999936e-50 or 5.80000000000000009e-46 < z < 4.7999999999999998e61Initial program 99.7%
Taylor expanded in y around inf 65.8%
*-commutative65.8%
Simplified65.8%
if -9.99999999999999936e-50 < z < 5.80000000000000009e-46Initial program 99.9%
Taylor expanded in z around 0 86.4%
Final simplification73.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* z y))) (t_1 (* x (- 1.0 z))))
(if (<= y -1.45e+194)
t_0
(if (<= y -1.1e+137)
t_1
(if (<= y -2e+91) t_0 (if (<= y 8.2e+40) t_1 (* y (* z x))))))))
double code(double x, double y, double z) {
double t_0 = x * (z * y);
double t_1 = x * (1.0 - z);
double tmp;
if (y <= -1.45e+194) {
tmp = t_0;
} else if (y <= -1.1e+137) {
tmp = t_1;
} else if (y <= -2e+91) {
tmp = t_0;
} else if (y <= 8.2e+40) {
tmp = t_1;
} else {
tmp = y * (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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x * (z * y)
t_1 = x * (1.0d0 - z)
if (y <= (-1.45d+194)) then
tmp = t_0
else if (y <= (-1.1d+137)) then
tmp = t_1
else if (y <= (-2d+91)) then
tmp = t_0
else if (y <= 8.2d+40) then
tmp = t_1
else
tmp = y * (z * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (z * y);
double t_1 = x * (1.0 - z);
double tmp;
if (y <= -1.45e+194) {
tmp = t_0;
} else if (y <= -1.1e+137) {
tmp = t_1;
} else if (y <= -2e+91) {
tmp = t_0;
} else if (y <= 8.2e+40) {
tmp = t_1;
} else {
tmp = y * (z * x);
}
return tmp;
}
def code(x, y, z): t_0 = x * (z * y) t_1 = x * (1.0 - z) tmp = 0 if y <= -1.45e+194: tmp = t_0 elif y <= -1.1e+137: tmp = t_1 elif y <= -2e+91: tmp = t_0 elif y <= 8.2e+40: tmp = t_1 else: tmp = y * (z * x) return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z * y)) t_1 = Float64(x * Float64(1.0 - z)) tmp = 0.0 if (y <= -1.45e+194) tmp = t_0; elseif (y <= -1.1e+137) tmp = t_1; elseif (y <= -2e+91) tmp = t_0; elseif (y <= 8.2e+40) tmp = t_1; else tmp = Float64(y * Float64(z * x)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z * y); t_1 = x * (1.0 - z); tmp = 0.0; if (y <= -1.45e+194) tmp = t_0; elseif (y <= -1.1e+137) tmp = t_1; elseif (y <= -2e+91) tmp = t_0; elseif (y <= 8.2e+40) tmp = t_1; else tmp = y * (z * x); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.45e+194], t$95$0, If[LessEqual[y, -1.1e+137], t$95$1, If[LessEqual[y, -2e+91], t$95$0, If[LessEqual[y, 8.2e+40], t$95$1, N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot y\right)\\
t_1 := x \cdot \left(1 - z\right)\\
\mathbf{if}\;y \leq -1.45 \cdot 10^{+194}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1.1 \cdot 10^{+137}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2 \cdot 10^{+91}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z \cdot x\right)\\
\end{array}
\end{array}
if y < -1.45e194 or -1.10000000000000008e137 < y < -2.00000000000000016e91Initial program 96.2%
Taylor expanded in y around inf 88.4%
*-commutative88.4%
Simplified88.4%
if -1.45e194 < y < -1.10000000000000008e137 or -2.00000000000000016e91 < y < 8.2000000000000003e40Initial program 99.4%
Taylor expanded in y around 0 92.3%
if 8.2000000000000003e40 < y Initial program 89.8%
Taylor expanded in y around inf 80.4%
Taylor expanded in y around inf 79.0%
Final simplification89.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* z y))) (t_1 (* x (- 1.0 z))))
(if (<= y -1.45e+194)
t_0
(if (<= y -1.02e+137)
t_1
(if (<= y -8.5e+90) t_0 (if (<= y 1.05e+40) t_1 (* z (* x y))))))))
double code(double x, double y, double z) {
double t_0 = x * (z * y);
double t_1 = x * (1.0 - z);
double tmp;
if (y <= -1.45e+194) {
tmp = t_0;
} else if (y <= -1.02e+137) {
tmp = t_1;
} else if (y <= -8.5e+90) {
tmp = t_0;
} else if (y <= 1.05e+40) {
tmp = t_1;
} else {
tmp = z * (x * y);
}
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 * y)
t_1 = x * (1.0d0 - z)
if (y <= (-1.45d+194)) then
tmp = t_0
else if (y <= (-1.02d+137)) then
tmp = t_1
else if (y <= (-8.5d+90)) then
tmp = t_0
else if (y <= 1.05d+40) then
tmp = t_1
else
tmp = z * (x * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (z * y);
double t_1 = x * (1.0 - z);
double tmp;
if (y <= -1.45e+194) {
tmp = t_0;
} else if (y <= -1.02e+137) {
tmp = t_1;
} else if (y <= -8.5e+90) {
tmp = t_0;
} else if (y <= 1.05e+40) {
tmp = t_1;
} else {
tmp = z * (x * y);
}
return tmp;
}
def code(x, y, z): t_0 = x * (z * y) t_1 = x * (1.0 - z) tmp = 0 if y <= -1.45e+194: tmp = t_0 elif y <= -1.02e+137: tmp = t_1 elif y <= -8.5e+90: tmp = t_0 elif y <= 1.05e+40: tmp = t_1 else: tmp = z * (x * y) return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z * y)) t_1 = Float64(x * Float64(1.0 - z)) tmp = 0.0 if (y <= -1.45e+194) tmp = t_0; elseif (y <= -1.02e+137) tmp = t_1; elseif (y <= -8.5e+90) tmp = t_0; elseif (y <= 1.05e+40) tmp = t_1; else tmp = Float64(z * Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z * y); t_1 = x * (1.0 - z); tmp = 0.0; if (y <= -1.45e+194) tmp = t_0; elseif (y <= -1.02e+137) tmp = t_1; elseif (y <= -8.5e+90) tmp = t_0; elseif (y <= 1.05e+40) tmp = t_1; else tmp = z * (x * y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.45e+194], t$95$0, If[LessEqual[y, -1.02e+137], t$95$1, If[LessEqual[y, -8.5e+90], t$95$0, If[LessEqual[y, 1.05e+40], t$95$1, N[(z * N[(x * y), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot y\right)\\
t_1 := x \cdot \left(1 - z\right)\\
\mathbf{if}\;y \leq -1.45 \cdot 10^{+194}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1.02 \cdot 10^{+137}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -8.5 \cdot 10^{+90}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot y\right)\\
\end{array}
\end{array}
if y < -1.45e194 or -1.02000000000000004e137 < y < -8.5000000000000002e90Initial program 96.2%
Taylor expanded in y around inf 88.4%
*-commutative88.4%
Simplified88.4%
if -1.45e194 < y < -1.02000000000000004e137 or -8.5000000000000002e90 < y < 1.05000000000000005e40Initial program 99.4%
Taylor expanded in y around 0 92.3%
if 1.05000000000000005e40 < y Initial program 89.8%
Taylor expanded in z around inf 74.2%
*-commutative74.2%
associate-*r*80.7%
*-commutative80.7%
sub-neg80.7%
metadata-eval80.7%
Simplified80.7%
Taylor expanded in y around inf 80.7%
Final simplification89.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -9e-50) (not (<= z 2.7e-47))) (* x (* z (+ y -1.0))) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -9e-50) || !(z <= 2.7e-47)) {
tmp = x * (z * (y + -1.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 <= (-9d-50)) .or. (.not. (z <= 2.7d-47))) then
tmp = x * (z * (y + (-1.0d0)))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -9e-50) || !(z <= 2.7e-47)) {
tmp = x * (z * (y + -1.0));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -9e-50) or not (z <= 2.7e-47): tmp = x * (z * (y + -1.0)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -9e-50) || !(z <= 2.7e-47)) tmp = Float64(x * Float64(z * Float64(y + -1.0))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -9e-50) || ~((z <= 2.7e-47))) tmp = x * (z * (y + -1.0)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -9e-50], N[Not[LessEqual[z, 2.7e-47]], $MachinePrecision]], N[(x * N[(z * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-50} \lor \neg \left(z \leq 2.7 \cdot 10^{-47}\right):\\
\;\;\;\;x \cdot \left(z \cdot \left(y + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -8.99999999999999924e-50 or 2.6999999999999998e-47 < z Initial program 94.8%
Taylor expanded in z around inf 89.2%
if -8.99999999999999924e-50 < z < 2.6999999999999998e-47Initial program 99.9%
Taylor expanded in z around 0 86.4%
Final simplification88.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.9e-50) (not (<= z 2.2e-45))) (* z (* x (+ y -1.0))) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.9e-50) || !(z <= 2.2e-45)) {
tmp = z * (x * (y + -1.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 <= (-2.9d-50)) .or. (.not. (z <= 2.2d-45))) then
tmp = z * (x * (y + (-1.0d0)))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.9e-50) || !(z <= 2.2e-45)) {
tmp = z * (x * (y + -1.0));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.9e-50) or not (z <= 2.2e-45): tmp = z * (x * (y + -1.0)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.9e-50) || !(z <= 2.2e-45)) tmp = Float64(z * Float64(x * Float64(y + -1.0))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.9e-50) || ~((z <= 2.2e-45))) tmp = z * (x * (y + -1.0)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.9e-50], N[Not[LessEqual[z, 2.2e-45]], $MachinePrecision]], N[(z * N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{-50} \lor \neg \left(z \leq 2.2 \cdot 10^{-45}\right):\\
\;\;\;\;z \cdot \left(x \cdot \left(y + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.90000000000000008e-50 or 2.19999999999999993e-45 < z Initial program 94.8%
Taylor expanded in z around inf 89.2%
*-commutative89.2%
associate-*r*94.3%
*-commutative94.3%
sub-neg94.3%
metadata-eval94.3%
Simplified94.3%
if -2.90000000000000008e-50 < z < 2.19999999999999993e-45Initial program 99.9%
Taylor expanded in z around 0 86.4%
Final simplification90.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -23.0) (not (<= z 0.084))) (* z (- x)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -23.0) || !(z <= 0.084)) {
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 <= (-23.0d0)) .or. (.not. (z <= 0.084d0))) 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 <= -23.0) || !(z <= 0.084)) {
tmp = z * -x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -23.0) or not (z <= 0.084): tmp = z * -x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -23.0) || !(z <= 0.084)) tmp = Float64(z * Float64(-x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -23.0) || ~((z <= 0.084))) tmp = z * -x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -23.0], N[Not[LessEqual[z, 0.084]], $MachinePrecision]], N[(z * (-x)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -23 \lor \neg \left(z \leq 0.084\right):\\
\;\;\;\;z \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -23 or 0.0840000000000000052 < z Initial program 94.0%
Taylor expanded in z around inf 93.5%
*-commutative93.5%
associate-*r*99.3%
*-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in y around 0 57.1%
neg-mul-157.1%
Simplified57.1%
if -23 < z < 0.0840000000000000052Initial program 99.9%
Taylor expanded in z around 0 78.3%
Final simplification67.7%
(FPCore (x y z) :precision binary64 (if (<= z -5.8e+130) (* z (* x (+ y -1.0))) (* x (+ 1.0 (* z (+ y -1.0))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.8e+130) {
tmp = z * (x * (y + -1.0));
} 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 (z <= (-5.8d+130)) then
tmp = z * (x * (y + (-1.0d0)))
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 (z <= -5.8e+130) {
tmp = z * (x * (y + -1.0));
} else {
tmp = x * (1.0 + (z * (y + -1.0)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.8e+130: tmp = z * (x * (y + -1.0)) else: tmp = x * (1.0 + (z * (y + -1.0))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.8e+130) tmp = Float64(z * Float64(x * Float64(y + -1.0))); 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 (z <= -5.8e+130) tmp = z * (x * (y + -1.0)); else tmp = x * (1.0 + (z * (y + -1.0))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.8e+130], N[(z * N[(x * N[(y + -1.0), $MachinePrecision]), $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}\;z \leq -5.8 \cdot 10^{+130}:\\
\;\;\;\;z \cdot \left(x \cdot \left(y + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + z \cdot \left(y + -1\right)\right)\\
\end{array}
\end{array}
if z < -5.7999999999999998e130Initial program 88.0%
Taylor expanded in z around inf 88.0%
*-commutative88.0%
associate-*r*99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
if -5.7999999999999998e130 < z Initial program 98.6%
Final simplification98.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 97.0%
Taylor expanded in z around 0 41.0%
Final simplification41.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 2024055
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, J"
:precision binary64
:alt
(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))))