
(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
(let* ((t_0 (* (- 1.0 y) z)))
(if (<= t_0 -5e+24)
(* z (* x (+ y -1.0)))
(if (<= t_0 1e+301) (* x (+ 1.0 (* z (+ y -1.0)))) (* z (* y x))))))
double code(double x, double y, double z) {
double t_0 = (1.0 - y) * z;
double tmp;
if (t_0 <= -5e+24) {
tmp = z * (x * (y + -1.0));
} else if (t_0 <= 1e+301) {
tmp = x * (1.0 + (z * (y + -1.0)));
} else {
tmp = z * (y * 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) :: tmp
t_0 = (1.0d0 - y) * z
if (t_0 <= (-5d+24)) then
tmp = z * (x * (y + (-1.0d0)))
else if (t_0 <= 1d+301) then
tmp = x * (1.0d0 + (z * (y + (-1.0d0))))
else
tmp = z * (y * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (1.0 - y) * z;
double tmp;
if (t_0 <= -5e+24) {
tmp = z * (x * (y + -1.0));
} else if (t_0 <= 1e+301) {
tmp = x * (1.0 + (z * (y + -1.0)));
} else {
tmp = z * (y * x);
}
return tmp;
}
def code(x, y, z): t_0 = (1.0 - y) * z tmp = 0 if t_0 <= -5e+24: tmp = z * (x * (y + -1.0)) elif t_0 <= 1e+301: tmp = x * (1.0 + (z * (y + -1.0))) else: tmp = z * (y * x) return tmp
function code(x, y, z) t_0 = Float64(Float64(1.0 - y) * z) tmp = 0.0 if (t_0 <= -5e+24) tmp = Float64(z * Float64(x * Float64(y + -1.0))); elseif (t_0 <= 1e+301) tmp = Float64(x * Float64(1.0 + Float64(z * Float64(y + -1.0)))); else tmp = Float64(z * Float64(y * x)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (1.0 - y) * z; tmp = 0.0; if (t_0 <= -5e+24) tmp = z * (x * (y + -1.0)); elseif (t_0 <= 1e+301) tmp = x * (1.0 + (z * (y + -1.0))); else tmp = z * (y * x); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+24], N[(z * N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+301], N[(x * N[(1.0 + N[(z * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - y\right) \cdot z\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+24}:\\
\;\;\;\;z \cdot \left(x \cdot \left(y + -1\right)\right)\\
\mathbf{elif}\;t\_0 \leq 10^{+301}:\\
\;\;\;\;x \cdot \left(1 + z \cdot \left(y + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 #s(literal 1 binary64) y) z) < -5.00000000000000045e24Initial program 89.0%
Taylor expanded in z around inf 89.0%
associate-*r*98.5%
*-commutative98.5%
sub-neg98.5%
remove-double-neg98.5%
distribute-neg-in98.5%
+-commutative98.5%
sub-neg98.5%
associate-*r*99.9%
*-commutative99.9%
*-commutative99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
Simplified99.9%
if -5.00000000000000045e24 < (*.f64 (-.f64 #s(literal 1 binary64) y) z) < 1.00000000000000005e301Initial program 99.9%
if 1.00000000000000005e301 < (*.f64 (-.f64 #s(literal 1 binary64) y) z) Initial program 70.3%
Taylor expanded in y around inf 70.3%
*-commutative70.3%
*-commutative70.3%
associate-*l*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= y -4.1e+149)
(* z (* y x))
(if (or (<= y -1.0) (not (<= y 1.0)))
(* x (+ 1.0 (* y z)))
(* x (- 1.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.1e+149) {
tmp = z * (y * x);
} else if ((y <= -1.0) || !(y <= 1.0)) {
tmp = x * (1.0 + (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 <= (-4.1d+149)) then
tmp = z * (y * x)
else if ((y <= (-1.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = x * (1.0d0 + (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 <= -4.1e+149) {
tmp = z * (y * x);
} else if ((y <= -1.0) || !(y <= 1.0)) {
tmp = x * (1.0 + (y * z));
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.1e+149: tmp = z * (y * x) elif (y <= -1.0) or not (y <= 1.0): tmp = x * (1.0 + (y * z)) else: tmp = x * (1.0 - z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.1e+149) tmp = Float64(z * Float64(y * x)); elseif ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(x * Float64(1.0 + 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 <= -4.1e+149) tmp = z * (y * x); elseif ((y <= -1.0) || ~((y <= 1.0))) tmp = x * (1.0 + (y * z)); else tmp = x * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.1e+149], N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(x * N[(1.0 + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{+149}:\\
\;\;\;\;z \cdot \left(y \cdot x\right)\\
\mathbf{elif}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;x \cdot \left(1 + y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < -4.0999999999999996e149Initial program 74.6%
Taylor expanded in y around inf 69.0%
*-commutative69.0%
*-commutative69.0%
associate-*l*90.7%
Simplified90.7%
if -4.0999999999999996e149 < y < -1 or 1 < y Initial program 90.8%
Taylor expanded in y around inf 89.0%
neg-mul-189.0%
Simplified89.0%
cancel-sign-sub89.0%
+-commutative89.0%
*-commutative89.0%
Applied egg-rr89.0%
if -1 < y < 1Initial program 100.0%
Taylor expanded in y around 0 99.3%
Final simplification93.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.1e+17) (not (<= z 1.0))) (* z (* x (+ y -1.0))) (* x (+ 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.1e+17) || !(z <= 1.0)) {
tmp = z * (x * (y + -1.0));
} 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.1d+17)) .or. (.not. (z <= 1.0d0))) then
tmp = z * (x * (y + (-1.0d0)))
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.1e+17) || !(z <= 1.0)) {
tmp = z * (x * (y + -1.0));
} else {
tmp = x * (1.0 + (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.1e+17) or not (z <= 1.0): tmp = z * (x * (y + -1.0)) else: tmp = x * (1.0 + (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.1e+17) || !(z <= 1.0)) tmp = Float64(z * Float64(x * Float64(y + -1.0))); 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.1e+17) || ~((z <= 1.0))) tmp = z * (x * (y + -1.0)); else tmp = x * (1.0 + (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.1e+17], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(z * N[(x * N[(y + -1.0), $MachinePrecision]), $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 \cdot 10^{+17} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;z \cdot \left(x \cdot \left(y + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + y \cdot z\right)\\
\end{array}
\end{array}
if z < -1.1e17 or 1 < z Initial program 88.1%
Taylor expanded in z around inf 88.1%
associate-*r*99.8%
*-commutative99.8%
sub-neg99.8%
remove-double-neg99.8%
distribute-neg-in99.8%
+-commutative99.8%
sub-neg99.8%
associate-*r*99.8%
*-commutative99.8%
*-commutative99.8%
neg-sub099.8%
associate--r-99.8%
metadata-eval99.8%
Simplified99.8%
if -1.1e17 < z < 1Initial program 99.9%
Taylor expanded in y around inf 99.6%
neg-mul-199.6%
Simplified99.6%
cancel-sign-sub99.6%
+-commutative99.6%
*-commutative99.6%
Applied egg-rr99.6%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (if (<= z -1.1e+17) (* z (* x (+ y -1.0))) (if (<= z 1.0) (* x (+ 1.0 (* y z))) (* (* z x) (+ y -1.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.1e+17) {
tmp = z * (x * (y + -1.0));
} else if (z <= 1.0) {
tmp = x * (1.0 + (y * z));
} 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 (z <= (-1.1d+17)) then
tmp = z * (x * (y + (-1.0d0)))
else if (z <= 1.0d0) then
tmp = x * (1.0d0 + (y * z))
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 (z <= -1.1e+17) {
tmp = z * (x * (y + -1.0));
} else if (z <= 1.0) {
tmp = x * (1.0 + (y * z));
} else {
tmp = (z * x) * (y + -1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.1e+17: tmp = z * (x * (y + -1.0)) elif z <= 1.0: tmp = x * (1.0 + (y * z)) else: tmp = (z * x) * (y + -1.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.1e+17) tmp = Float64(z * Float64(x * Float64(y + -1.0))); elseif (z <= 1.0) tmp = Float64(x * Float64(1.0 + Float64(y * z))); 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 (z <= -1.1e+17) tmp = z * (x * (y + -1.0)); elseif (z <= 1.0) tmp = x * (1.0 + (y * z)); else tmp = (z * x) * (y + -1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.1e+17], N[(z * N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(x * N[(1.0 + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * x), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+17}:\\
\;\;\;\;z \cdot \left(x \cdot \left(y + -1\right)\right)\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(1 + y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\
\end{array}
\end{array}
if z < -1.1e17Initial program 88.5%
Taylor expanded in z around inf 88.5%
associate-*r*99.8%
*-commutative99.8%
sub-neg99.8%
remove-double-neg99.8%
distribute-neg-in99.8%
+-commutative99.8%
sub-neg99.8%
associate-*r*99.9%
*-commutative99.9%
*-commutative99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
Simplified99.9%
if -1.1e17 < z < 1Initial program 99.9%
Taylor expanded in y around inf 99.6%
neg-mul-199.6%
Simplified99.6%
cancel-sign-sub99.6%
+-commutative99.6%
*-commutative99.6%
Applied egg-rr99.6%
if 1 < z Initial program 87.6%
Taylor expanded in z around inf 87.6%
associate-*r*99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.7e+26) (not (<= y 1.2e+38))) (* z (* y x)) (* x (- 1.0 z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.7e+26) || !(y <= 1.2e+38)) {
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 <= (-4.7d+26)) .or. (.not. (y <= 1.2d+38))) 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 <= -4.7e+26) || !(y <= 1.2e+38)) {
tmp = z * (y * x);
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.7e+26) or not (y <= 1.2e+38): tmp = z * (y * x) else: tmp = x * (1.0 - z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.7e+26) || !(y <= 1.2e+38)) 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 <= -4.7e+26) || ~((y <= 1.2e+38))) tmp = z * (y * x); else tmp = x * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.7e+26], N[Not[LessEqual[y, 1.2e+38]], $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 -4.7 \cdot 10^{+26} \lor \neg \left(y \leq 1.2 \cdot 10^{+38}\right):\\
\;\;\;\;z \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < -4.6999999999999998e26 or 1.20000000000000009e38 < y Initial program 86.9%
Taylor expanded in y around inf 67.5%
*-commutative67.5%
*-commutative67.5%
associate-*l*78.8%
Simplified78.8%
if -4.6999999999999998e26 < y < 1.20000000000000009e38Initial program 99.2%
Taylor expanded in y around 0 94.4%
Final simplification86.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -390000.0) (not (<= z 9e+24))) (* x (- z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -390000.0) || !(z <= 9e+24)) {
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 <= (-390000.0d0)) .or. (.not. (z <= 9d+24))) 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 <= -390000.0) || !(z <= 9e+24)) {
tmp = x * -z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -390000.0) or not (z <= 9e+24): tmp = x * -z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -390000.0) || !(z <= 9e+24)) tmp = Float64(x * Float64(-z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -390000.0) || ~((z <= 9e+24))) tmp = x * -z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -390000.0], N[Not[LessEqual[z, 9e+24]], $MachinePrecision]], N[(x * (-z)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -390000 \lor \neg \left(z \leq 9 \cdot 10^{+24}\right):\\
\;\;\;\;x \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.9e5 or 9.00000000000000039e24 < z Initial program 88.0%
Taylor expanded in z around inf 88.0%
associate-*r*99.9%
*-commutative99.9%
sub-neg99.9%
remove-double-neg99.9%
distribute-neg-in99.9%
+-commutative99.9%
sub-neg99.9%
associate-*r*99.8%
*-commutative99.8%
*-commutative99.8%
neg-sub099.8%
associate--r-99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 48.9%
neg-mul-148.9%
Simplified48.9%
if -3.9e5 < z < 9.00000000000000039e24Initial program 99.9%
Taylor expanded in z around 0 74.0%
Final simplification60.0%
(FPCore (x y z) :precision binary64 (if (<= y 4.2e+104) (* x (- 1.0 z)) (* z x)))
double code(double x, double y, double z) {
double tmp;
if (y <= 4.2e+104) {
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 <= 4.2d+104) 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 <= 4.2e+104) {
tmp = x * (1.0 - z);
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 4.2e+104: tmp = x * (1.0 - z) else: tmp = z * x return tmp
function code(x, y, z) tmp = 0.0 if (y <= 4.2e+104) 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 <= 4.2e+104) tmp = x * (1.0 - z); else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 4.2e+104], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(z * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.2 \cdot 10^{+104}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if y < 4.1999999999999997e104Initial program 94.6%
Taylor expanded in y around 0 69.7%
if 4.1999999999999997e104 < y Initial program 86.8%
Taylor expanded in z around 0 86.8%
Taylor expanded in y around 0 13.7%
mul-1-neg13.7%
unsub-neg13.7%
Simplified13.7%
cancel-sign-sub-inv13.7%
*-commutative13.7%
+-commutative13.7%
*-commutative13.7%
add-sqr-sqrt4.8%
sqrt-unprod30.8%
sqr-neg30.8%
sqrt-unprod23.2%
add-sqr-sqrt36.0%
Applied egg-rr36.0%
Taylor expanded in z around inf 24.2%
Final simplification61.9%
(FPCore (x y z) :precision binary64 (if (<= z -5.4e+62) (* z x) x))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.4e+62) {
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 <= (-5.4d+62)) 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 <= -5.4e+62) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.4e+62: tmp = z * x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.4e+62) tmp = Float64(z * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.4e+62) tmp = z * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.4e+62], N[(z * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{+62}:\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -5.4e62Initial program 85.7%
Taylor expanded in z around 0 85.7%
Taylor expanded in y around 0 39.2%
mul-1-neg39.2%
unsub-neg39.2%
Simplified39.2%
cancel-sign-sub-inv39.2%
*-commutative39.2%
+-commutative39.2%
*-commutative39.2%
add-sqr-sqrt21.9%
sqrt-unprod28.9%
sqr-neg28.9%
sqrt-unprod10.7%
add-sqr-sqrt18.8%
Applied egg-rr18.8%
Taylor expanded in z around inf 18.8%
if -5.4e62 < z Initial program 95.6%
Taylor expanded in z around 0 43.8%
Final simplification38.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 93.3%
Taylor expanded in z around 0 34.3%
(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 2024157
(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))))