
(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 11 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 (<= (* (- 1.0 y) z) -1e+215) (* (* z x) (+ y -1.0)) (+ x (* x (* z (+ y -1.0))))))
double code(double x, double y, double z) {
double tmp;
if (((1.0 - y) * z) <= -1e+215) {
tmp = (z * x) * (y + -1.0);
} else {
tmp = x + (x * (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+215)) then
tmp = (z * x) * (y + (-1.0d0))
else
tmp = x + (x * (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+215) {
tmp = (z * x) * (y + -1.0);
} else {
tmp = x + (x * (z * (y + -1.0)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((1.0 - y) * z) <= -1e+215: tmp = (z * x) * (y + -1.0) else: tmp = x + (x * (z * (y + -1.0))) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(Float64(1.0 - y) * z) <= -1e+215) tmp = Float64(Float64(z * x) * Float64(y + -1.0)); else tmp = Float64(x + Float64(x * 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+215) tmp = (z * x) * (y + -1.0); else tmp = x + (x * (z * (y + -1.0))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], -1e+215], N[(N[(z * x), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * 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^{+215}:\\
\;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(z \cdot \left(y + -1\right)\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 #s(literal 1 binary64) y) z) < -9.99999999999999907e214Initial program 78.3%
Taylor expanded in z around inf 78.3%
associate-*r*99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
if -9.99999999999999907e214 < (*.f64 (-.f64 #s(literal 1 binary64) y) z) Initial program 98.6%
Taylor expanded in z around 0 98.6%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (<= (* (- 1.0 y) z) -1e+215) (* (* z x) (+ y -1.0)) (* x (+ 1.0 (* z (+ y -1.0))))))
double code(double x, double y, double z) {
double tmp;
if (((1.0 - y) * z) <= -1e+215) {
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 (((1.0d0 - y) * z) <= (-1d+215)) 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 (((1.0 - y) * z) <= -1e+215) {
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 ((1.0 - y) * z) <= -1e+215: 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 (Float64(Float64(1.0 - y) * z) <= -1e+215) tmp = Float64(Float64(z * 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 (((1.0 - y) * z) <= -1e+215) 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[N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], -1e+215], N[(N[(z * x), $MachinePrecision] * N[(y + -1.0), $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^{+215}:\\
\;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + z \cdot \left(y + -1\right)\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 #s(literal 1 binary64) y) z) < -9.99999999999999907e214Initial program 78.3%
Taylor expanded in z around inf 78.3%
associate-*r*99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
if -9.99999999999999907e214 < (*.f64 (-.f64 #s(literal 1 binary64) y) z) Initial program 98.6%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -240.0) (not (<= z 1.0))) (* (* z x) (+ y -1.0)) (+ x (* x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -240.0) || !(z <= 1.0)) {
tmp = (z * x) * (y + -1.0);
} else {
tmp = x + (x * (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 <= (-240.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = (z * x) * (y + (-1.0d0))
else
tmp = x + (x * (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -240.0) || !(z <= 1.0)) {
tmp = (z * x) * (y + -1.0);
} else {
tmp = x + (x * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -240.0) or not (z <= 1.0): tmp = (z * x) * (y + -1.0) else: tmp = x + (x * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -240.0) || !(z <= 1.0)) tmp = Float64(Float64(z * x) * Float64(y + -1.0)); else tmp = Float64(x + Float64(x * Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -240.0) || ~((z <= 1.0))) tmp = (z * x) * (y + -1.0); else tmp = x + (x * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -240.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(z * x), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -240 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -240 or 1 < z Initial program 91.3%
Taylor expanded in z around inf 90.2%
associate-*r*98.7%
*-commutative98.7%
sub-neg98.7%
metadata-eval98.7%
Simplified98.7%
if -240 < z < 1Initial program 99.9%
Taylor expanded in z around 0 99.9%
Taylor expanded in y around inf 97.3%
*-commutative97.3%
Simplified97.3%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (if (<= y -6.1e+85) (* z (* y x)) (if (<= y 15600000000000.0) (- x (* z x)) (* (* z x) (+ y -1.0)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -6.1e+85) {
tmp = z * (y * x);
} else if (y <= 15600000000000.0) {
tmp = x - (z * x);
} else {
tmp = (z * x) * (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 (y <= (-6.1d+85)) then
tmp = z * (y * x)
else if (y <= 15600000000000.0d0) then
tmp = x - (z * x)
else
tmp = (z * x) * (y + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -6.1e+85) {
tmp = z * (y * x);
} else if (y <= 15600000000000.0) {
tmp = x - (z * x);
} else {
tmp = (z * x) * (y + -1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6.1e+85: tmp = z * (y * x) elif y <= 15600000000000.0: tmp = x - (z * x) else: tmp = (z * x) * (y + -1.0) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6.1e+85) tmp = Float64(z * Float64(y * x)); elseif (y <= 15600000000000.0) tmp = Float64(x - Float64(z * x)); else tmp = Float64(Float64(z * x) * Float64(y + -1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -6.1e+85) tmp = z * (y * x); elseif (y <= 15600000000000.0) tmp = x - (z * x); else tmp = (z * x) * (y + -1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6.1e+85], N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 15600000000000.0], N[(x - N[(z * x), $MachinePrecision]), $MachinePrecision], N[(N[(z * x), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.1 \cdot 10^{+85}:\\
\;\;\;\;z \cdot \left(y \cdot x\right)\\
\mathbf{elif}\;y \leq 15600000000000:\\
\;\;\;\;x - z \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\
\end{array}
\end{array}
if y < -6.09999999999999981e85Initial program 89.6%
Taylor expanded in y around inf 81.5%
*-commutative81.5%
*-commutative81.5%
associate-*l*87.6%
Simplified87.6%
if -6.09999999999999981e85 < y < 1.56e13Initial program 99.9%
Taylor expanded in z around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-lft-in94.2%
flip-+61.9%
Applied egg-rr63.3%
Taylor expanded in y around 0 94.7%
if 1.56e13 < y Initial program 90.6%
Taylor expanded in z around inf 74.0%
associate-*r*82.2%
*-commutative82.2%
sub-neg82.2%
metadata-eval82.2%
Simplified82.2%
Final simplification90.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -6.1e+85) (not (<= y 3800000000000.0))) (* y (* z x)) (* x (- 1.0 z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.1e+85) || !(y <= 3800000000000.0)) {
tmp = y * (z * 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 <= (-6.1d+85)) .or. (.not. (y <= 3800000000000.0d0))) then
tmp = y * (z * 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 <= -6.1e+85) || !(y <= 3800000000000.0)) {
tmp = y * (z * x);
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6.1e+85) or not (y <= 3800000000000.0): tmp = y * (z * x) else: tmp = x * (1.0 - z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6.1e+85) || !(y <= 3800000000000.0)) tmp = Float64(y * Float64(z * 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 <= -6.1e+85) || ~((y <= 3800000000000.0))) tmp = y * (z * x); else tmp = x * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6.1e+85], N[Not[LessEqual[y, 3800000000000.0]], $MachinePrecision]], N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.1 \cdot 10^{+85} \lor \neg \left(y \leq 3800000000000\right):\\
\;\;\;\;y \cdot \left(z \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < -6.09999999999999981e85 or 3.8e12 < y Initial program 90.2%
Taylor expanded in z around inf 77.0%
associate-*r*80.2%
*-commutative80.2%
sub-neg80.2%
metadata-eval80.2%
Simplified80.2%
add-sqr-sqrt39.0%
pow239.0%
*-commutative39.0%
Applied egg-rr39.0%
unpow239.0%
add-sqr-sqrt80.2%
distribute-rgt-in67.4%
neg-mul-167.4%
unsub-neg67.4%
*-commutative67.4%
associate-*r*64.2%
*-commutative64.2%
*-commutative64.2%
flip--25.8%
unpow225.8%
sqr-neg25.8%
cancel-sign-sub25.8%
distribute-lft-neg-in25.8%
clear-num25.8%
Applied egg-rr77.0%
Taylor expanded in y around inf 77.0%
associate-*r*82.7%
*-commutative82.7%
associate-*r*80.2%
Simplified80.2%
if -6.09999999999999981e85 < y < 3.8e12Initial program 99.9%
Taylor expanded in y around 0 94.7%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (<= y -3.1e+89) (* z (* y x)) (if (<= y 33500000000000.0) (- x (* z x)) (* y (* z x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.1e+89) {
tmp = z * (y * x);
} else if (y <= 33500000000000.0) {
tmp = x - (z * x);
} 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) :: tmp
if (y <= (-3.1d+89)) then
tmp = z * (y * x)
else if (y <= 33500000000000.0d0) then
tmp = x - (z * x)
else
tmp = y * (z * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.1e+89) {
tmp = z * (y * x);
} else if (y <= 33500000000000.0) {
tmp = x - (z * x);
} else {
tmp = y * (z * x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.1e+89: tmp = z * (y * x) elif y <= 33500000000000.0: tmp = x - (z * x) else: tmp = y * (z * x) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.1e+89) tmp = Float64(z * Float64(y * x)); elseif (y <= 33500000000000.0) tmp = Float64(x - Float64(z * x)); else tmp = Float64(y * Float64(z * x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.1e+89) tmp = z * (y * x); elseif (y <= 33500000000000.0) tmp = x - (z * x); else tmp = y * (z * x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.1e+89], N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 33500000000000.0], N[(x - N[(z * x), $MachinePrecision]), $MachinePrecision], N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{+89}:\\
\;\;\;\;z \cdot \left(y \cdot x\right)\\
\mathbf{elif}\;y \leq 33500000000000:\\
\;\;\;\;x - z \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z \cdot x\right)\\
\end{array}
\end{array}
if y < -3.1e89Initial program 89.6%
Taylor expanded in y around inf 81.5%
*-commutative81.5%
*-commutative81.5%
associate-*l*87.6%
Simplified87.6%
if -3.1e89 < y < 3.35e13Initial program 99.9%
Taylor expanded in z around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-lft-in94.2%
flip-+61.9%
Applied egg-rr63.3%
Taylor expanded in y around 0 94.7%
if 3.35e13 < y Initial program 90.6%
Taylor expanded in z around inf 74.0%
associate-*r*82.2%
*-commutative82.2%
sub-neg82.2%
metadata-eval82.2%
Simplified82.2%
add-sqr-sqrt39.1%
pow239.1%
*-commutative39.1%
Applied egg-rr39.1%
unpow239.1%
add-sqr-sqrt82.2%
distribute-rgt-in60.8%
neg-mul-160.8%
unsub-neg60.8%
*-commutative60.8%
associate-*r*52.6%
*-commutative52.6%
*-commutative52.6%
flip--20.8%
unpow220.8%
sqr-neg20.8%
cancel-sign-sub20.8%
distribute-lft-neg-in20.8%
clear-num20.8%
Applied egg-rr73.9%
Taylor expanded in y around inf 74.0%
associate-*r*79.5%
*-commutative79.5%
associate-*r*82.2%
Simplified82.2%
Final simplification90.0%
(FPCore (x y z) :precision binary64 (if (<= y -5e+86) (* z (* y x)) (if (<= y 13200000000000.0) (* x (- 1.0 z)) (* y (* z x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5e+86) {
tmp = z * (y * x);
} else if (y <= 13200000000000.0) {
tmp = x * (1.0 - z);
} 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) :: tmp
if (y <= (-5d+86)) then
tmp = z * (y * x)
else if (y <= 13200000000000.0d0) then
tmp = x * (1.0d0 - z)
else
tmp = y * (z * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5e+86) {
tmp = z * (y * x);
} else if (y <= 13200000000000.0) {
tmp = x * (1.0 - z);
} else {
tmp = y * (z * x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5e+86: tmp = z * (y * x) elif y <= 13200000000000.0: tmp = x * (1.0 - z) else: tmp = y * (z * x) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5e+86) tmp = Float64(z * Float64(y * x)); elseif (y <= 13200000000000.0) tmp = Float64(x * Float64(1.0 - z)); else tmp = Float64(y * Float64(z * x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5e+86) tmp = z * (y * x); elseif (y <= 13200000000000.0) tmp = x * (1.0 - z); else tmp = y * (z * x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5e+86], N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 13200000000000.0], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+86}:\\
\;\;\;\;z \cdot \left(y \cdot x\right)\\
\mathbf{elif}\;y \leq 13200000000000:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z \cdot x\right)\\
\end{array}
\end{array}
if y < -4.9999999999999998e86Initial program 89.6%
Taylor expanded in y around inf 81.5%
*-commutative81.5%
*-commutative81.5%
associate-*l*87.6%
Simplified87.6%
if -4.9999999999999998e86 < y < 1.32e13Initial program 99.9%
Taylor expanded in y around 0 94.7%
if 1.32e13 < y Initial program 90.6%
Taylor expanded in z around inf 74.0%
associate-*r*82.2%
*-commutative82.2%
sub-neg82.2%
metadata-eval82.2%
Simplified82.2%
add-sqr-sqrt39.1%
pow239.1%
*-commutative39.1%
Applied egg-rr39.1%
unpow239.1%
add-sqr-sqrt82.2%
distribute-rgt-in60.8%
neg-mul-160.8%
unsub-neg60.8%
*-commutative60.8%
associate-*r*52.6%
*-commutative52.6%
*-commutative52.6%
flip--20.8%
unpow220.8%
sqr-neg20.8%
cancel-sign-sub20.8%
distribute-lft-neg-in20.8%
clear-num20.8%
Applied egg-rr73.9%
Taylor expanded in y around inf 74.0%
associate-*r*79.5%
*-commutative79.5%
associate-*r*82.2%
Simplified82.2%
Final simplification90.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.00016) (not (<= z 0.98))) (* z (- x)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.00016) || !(z <= 0.98)) {
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 <= (-0.00016d0)) .or. (.not. (z <= 0.98d0))) 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 <= -0.00016) || !(z <= 0.98)) {
tmp = z * -x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.00016) or not (z <= 0.98): tmp = z * -x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.00016) || !(z <= 0.98)) tmp = Float64(z * Float64(-x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.00016) || ~((z <= 0.98))) tmp = z * -x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.00016], N[Not[LessEqual[z, 0.98]], $MachinePrecision]], N[(z * (-x)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00016 \lor \neg \left(z \leq 0.98\right):\\
\;\;\;\;z \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.60000000000000013e-4 or 0.97999999999999998 < z Initial program 91.5%
Taylor expanded in y around 0 54.1%
Taylor expanded in z around inf 52.9%
neg-mul-152.9%
distribute-rgt-neg-in52.9%
Simplified52.9%
if -1.60000000000000013e-4 < z < 0.97999999999999998Initial program 99.9%
Taylor expanded in z around 0 64.5%
Final simplification58.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.3e+71) (not (<= z 8.2e+14))) (* z x) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.3e+71) || !(z <= 8.2e+14)) {
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 <= (-3.3d+71)) .or. (.not. (z <= 8.2d+14))) 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 <= -3.3e+71) || !(z <= 8.2e+14)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.3e+71) or not (z <= 8.2e+14): tmp = z * x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.3e+71) || !(z <= 8.2e+14)) tmp = Float64(z * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.3e+71) || ~((z <= 8.2e+14))) tmp = z * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.3e+71], N[Not[LessEqual[z, 8.2e+14]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+71} \lor \neg \left(z \leq 8.2 \cdot 10^{+14}\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.2999999999999998e71 or 8.2e14 < z Initial program 89.4%
Taylor expanded in y around 0 51.5%
sub-neg51.5%
distribute-rgt-in51.5%
*-un-lft-identity51.5%
distribute-lft-neg-in51.5%
distribute-rgt-neg-out51.5%
+-commutative51.5%
*-commutative51.5%
distribute-lft-neg-in51.5%
pow151.5%
metadata-eval51.5%
sqrt-pow133.8%
pow233.8%
sqr-neg33.8%
sqrt-prod8.3%
add-sqr-sqrt16.5%
Applied egg-rr16.5%
Taylor expanded in z around inf 16.5%
if -3.2999999999999998e71 < z < 8.2e14Initial program 99.9%
Taylor expanded in z around 0 54.0%
Final simplification38.3%
(FPCore (x y z) :precision binary64 (if (<= y 3.3e+102) (* x (- 1.0 z)) (* z x)))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.3e+102) {
tmp = x * (1.0 - z);
} else {
tmp = 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 <= 3.3d+102) then
tmp = x * (1.0d0 - z)
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.3e+102) {
tmp = x * (1.0 - z);
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.3e+102: tmp = x * (1.0 - z) else: tmp = z * x return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.3e+102) tmp = Float64(x * Float64(1.0 - z)); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.3e+102) tmp = x * (1.0 - z); else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.3e+102], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(z * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.3 \cdot 10^{+102}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if y < 3.29999999999999999e102Initial program 97.5%
Taylor expanded in y around 0 73.6%
if 3.29999999999999999e102 < y Initial program 88.5%
Taylor expanded in y around 0 13.3%
sub-neg13.3%
distribute-rgt-in13.3%
*-un-lft-identity13.3%
distribute-lft-neg-in13.3%
distribute-rgt-neg-out13.3%
+-commutative13.3%
*-commutative13.3%
distribute-lft-neg-in13.3%
pow113.3%
metadata-eval13.3%
sqrt-pow133.0%
pow233.0%
sqr-neg33.0%
sqrt-prod24.5%
add-sqr-sqrt39.2%
Applied egg-rr39.2%
Taylor expanded in z around inf 28.0%
Final simplification63.5%
(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.5%
Taylor expanded in z around 0 32.7%
(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 2024146
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, J"
:precision binary64
:alt
(! :herbie-platform default (if (< (* x (- 1 (* (- 1 y) z))) -161819597360704900000000000000000000000000000000000) (+ x (* (- 1 y) (* (- z) x))) (if (< (* x (- 1 (* (- 1 y) z))) 389223764966390300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (* x y) z) (- (* x z) x)) (+ x (* (- 1 y) (* (- z) x))))))
(* x (- 1.0 (* (- 1.0 y) z))))