
(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 (let* ((t_0 (* z (+ y -1.0)))) (if (<= (+ 1.0 t_0) -5e+277) (* z (* x (+ y -1.0))) (+ x (* x t_0)))))
double code(double x, double y, double z) {
double t_0 = z * (y + -1.0);
double tmp;
if ((1.0 + t_0) <= -5e+277) {
tmp = z * (x * (y + -1.0));
} else {
tmp = x + (x * t_0);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * (y + (-1.0d0))
if ((1.0d0 + t_0) <= (-5d+277)) then
tmp = z * (x * (y + (-1.0d0)))
else
tmp = x + (x * t_0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (y + -1.0);
double tmp;
if ((1.0 + t_0) <= -5e+277) {
tmp = z * (x * (y + -1.0));
} else {
tmp = x + (x * t_0);
}
return tmp;
}
def code(x, y, z): t_0 = z * (y + -1.0) tmp = 0 if (1.0 + t_0) <= -5e+277: tmp = z * (x * (y + -1.0)) else: tmp = x + (x * t_0) return tmp
function code(x, y, z) t_0 = Float64(z * Float64(y + -1.0)) tmp = 0.0 if (Float64(1.0 + t_0) <= -5e+277) tmp = Float64(z * Float64(x * Float64(y + -1.0))); else tmp = Float64(x + Float64(x * t_0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (y + -1.0); tmp = 0.0; if ((1.0 + t_0) <= -5e+277) tmp = z * (x * (y + -1.0)); else tmp = x + (x * t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 + t$95$0), $MachinePrecision], -5e+277], N[(z * N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(y + -1\right)\\
\mathbf{if}\;1 + t\_0 \leq -5 \cdot 10^{+277}:\\
\;\;\;\;z \cdot \left(x \cdot \left(y + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot t\_0\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 (-.f64 #s(literal 1 binary64) y) z)) < -4.99999999999999982e277Initial program 74.0%
sub-negN/A
distribute-rgt-inN/A
fma-defineN/A
distribute-lft-neg-outN/A
fmm-undefN/A
*-lft-identityN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6474.0%
Applied egg-rr74.0%
Taylor expanded in z around inf
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
associate--r-N/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
if -4.99999999999999982e277 < (-.f64 #s(literal 1 binary64) (*.f64 (-.f64 #s(literal 1 binary64) y) z)) Initial program 98.7%
sub-negN/A
distribute-rgt-inN/A
fma-defineN/A
distribute-lft-neg-outN/A
fmm-undefN/A
*-lft-identityN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.7%
Applied egg-rr98.7%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ 1.0 (* z (+ y -1.0))))) (if (<= t_0 -5e+277) (* z (* x (+ y -1.0))) (* x t_0))))
double code(double x, double y, double z) {
double t_0 = 1.0 + (z * (y + -1.0));
double tmp;
if (t_0 <= -5e+277) {
tmp = z * (x * (y + -1.0));
} else {
tmp = x * t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (z * (y + (-1.0d0)))
if (t_0 <= (-5d+277)) then
tmp = z * (x * (y + (-1.0d0)))
else
tmp = x * t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 + (z * (y + -1.0));
double tmp;
if (t_0 <= -5e+277) {
tmp = z * (x * (y + -1.0));
} else {
tmp = x * t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + (z * (y + -1.0)) tmp = 0 if t_0 <= -5e+277: tmp = z * (x * (y + -1.0)) else: tmp = x * t_0 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(z * Float64(y + -1.0))) tmp = 0.0 if (t_0 <= -5e+277) tmp = Float64(z * Float64(x * Float64(y + -1.0))); else tmp = Float64(x * t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + (z * (y + -1.0)); tmp = 0.0; if (t_0 <= -5e+277) tmp = z * (x * (y + -1.0)); else tmp = x * t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(z * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+277], N[(z * N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + z \cdot \left(y + -1\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+277}:\\
\;\;\;\;z \cdot \left(x \cdot \left(y + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\_0\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 (-.f64 #s(literal 1 binary64) y) z)) < -4.99999999999999982e277Initial program 74.0%
sub-negN/A
distribute-rgt-inN/A
fma-defineN/A
distribute-lft-neg-outN/A
fmm-undefN/A
*-lft-identityN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6474.0%
Applied egg-rr74.0%
Taylor expanded in z around inf
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
associate--r-N/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
if -4.99999999999999982e277 < (-.f64 #s(literal 1 binary64) (*.f64 (-.f64 #s(literal 1 binary64) y) z)) Initial program 98.7%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (* x (+ y -1.0))))) (if (<= z -0.96) t_0 (if (<= z 6.8e-6) (* x (+ 1.0 (* y z))) t_0))))
double code(double x, double y, double z) {
double t_0 = z * (x * (y + -1.0));
double tmp;
if (z <= -0.96) {
tmp = t_0;
} else if (z <= 6.8e-6) {
tmp = x * (1.0 + (y * z));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * (x * (y + (-1.0d0)))
if (z <= (-0.96d0)) then
tmp = t_0
else if (z <= 6.8d-6) then
tmp = x * (1.0d0 + (y * z))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (x * (y + -1.0));
double tmp;
if (z <= -0.96) {
tmp = t_0;
} else if (z <= 6.8e-6) {
tmp = x * (1.0 + (y * z));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (x * (y + -1.0)) tmp = 0 if z <= -0.96: tmp = t_0 elif z <= 6.8e-6: tmp = x * (1.0 + (y * z)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(x * Float64(y + -1.0))) tmp = 0.0 if (z <= -0.96) tmp = t_0; elseif (z <= 6.8e-6) tmp = Float64(x * Float64(1.0 + Float64(y * z))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (x * (y + -1.0)); tmp = 0.0; if (z <= -0.96) tmp = t_0; elseif (z <= 6.8e-6) tmp = x * (1.0 + (y * z)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.96], t$95$0, If[LessEqual[z, 6.8e-6], N[(x * N[(1.0 + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(x \cdot \left(y + -1\right)\right)\\
\mathbf{if}\;z \leq -0.96:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{-6}:\\
\;\;\;\;x \cdot \left(1 + y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.95999999999999996 or 6.80000000000000012e-6 < z Initial program 92.2%
sub-negN/A
distribute-rgt-inN/A
fma-defineN/A
distribute-lft-neg-outN/A
fmm-undefN/A
*-lft-identityN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6492.1%
Applied egg-rr92.1%
Taylor expanded in z around inf
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
associate--r-N/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f6498.0%
Simplified98.0%
if -0.95999999999999996 < z < 6.80000000000000012e-6Initial program 99.9%
*-commutativeN/A
flip3--N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
clear-numN/A
flip3--N/A
/-lowering-/.f64N/A
--lowering--.f6499.8%
Applied egg-rr99.8%
Taylor expanded in y around inf
/-lowering-/.f6498.8%
Simplified98.8%
*-commutativeN/A
*-lowering-*.f64N/A
associate-/r/N/A
div-invN/A
metadata-evalN/A
*-commutativeN/A
neg-mul-1N/A
cancel-sign-subN/A
+-lowering-+.f64N/A
*-lowering-*.f6498.9%
Applied egg-rr98.9%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (* x (+ y -1.0))))) (if (<= z -135000.0) t_0 (if (<= z 1.18e-9) (- x (* x z)) t_0))))
double code(double x, double y, double z) {
double t_0 = z * (x * (y + -1.0));
double tmp;
if (z <= -135000.0) {
tmp = t_0;
} else if (z <= 1.18e-9) {
tmp = x - (x * z);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * (x * (y + (-1.0d0)))
if (z <= (-135000.0d0)) then
tmp = t_0
else if (z <= 1.18d-9) then
tmp = x - (x * z)
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 * (y + -1.0));
double tmp;
if (z <= -135000.0) {
tmp = t_0;
} else if (z <= 1.18e-9) {
tmp = x - (x * z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (x * (y + -1.0)) tmp = 0 if z <= -135000.0: tmp = t_0 elif z <= 1.18e-9: tmp = x - (x * z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(x * Float64(y + -1.0))) tmp = 0.0 if (z <= -135000.0) tmp = t_0; elseif (z <= 1.18e-9) tmp = Float64(x - Float64(x * z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (x * (y + -1.0)); tmp = 0.0; if (z <= -135000.0) tmp = t_0; elseif (z <= 1.18e-9) tmp = x - (x * z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -135000.0], t$95$0, If[LessEqual[z, 1.18e-9], N[(x - N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(x \cdot \left(y + -1\right)\right)\\
\mathbf{if}\;z \leq -135000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.18 \cdot 10^{-9}:\\
\;\;\;\;x - x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -135000 or 1.1800000000000001e-9 < z Initial program 92.1%
sub-negN/A
distribute-rgt-inN/A
fma-defineN/A
distribute-lft-neg-outN/A
fmm-undefN/A
*-lft-identityN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6492.0%
Applied egg-rr92.0%
Taylor expanded in z around inf
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
associate--r-N/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f6498.8%
Simplified98.8%
if -135000 < z < 1.1800000000000001e-9Initial program 99.9%
sub-negN/A
distribute-rgt-inN/A
fma-defineN/A
distribute-lft-neg-outN/A
fmm-undefN/A
*-lft-identityN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6499.9%
Applied egg-rr99.9%
Taylor expanded in y around 0
Simplified77.7%
Final simplification88.5%
(FPCore (x y z) :precision binary64 (if (<= y -9.8e+78) (* z (* x y)) (if (<= y 1.75e+28) (- x (* x z)) (* y (* x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -9.8e+78) {
tmp = z * (x * y);
} else if (y <= 1.75e+28) {
tmp = x - (x * z);
} else {
tmp = y * (x * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-9.8d+78)) then
tmp = z * (x * y)
else if (y <= 1.75d+28) then
tmp = x - (x * z)
else
tmp = y * (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -9.8e+78) {
tmp = z * (x * y);
} else if (y <= 1.75e+28) {
tmp = x - (x * z);
} else {
tmp = y * (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9.8e+78: tmp = z * (x * y) elif y <= 1.75e+28: tmp = x - (x * z) else: tmp = y * (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9.8e+78) tmp = Float64(z * Float64(x * y)); elseif (y <= 1.75e+28) tmp = Float64(x - Float64(x * z)); else tmp = Float64(y * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9.8e+78) tmp = z * (x * y); elseif (y <= 1.75e+28) tmp = x - (x * z); else tmp = y * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9.8e+78], N[(z * N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.75e+28], N[(x - N[(x * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.8 \cdot 10^{+78}:\\
\;\;\;\;z \cdot \left(x \cdot y\right)\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{+28}:\\
\;\;\;\;x - x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if y < -9.8000000000000004e78Initial program 88.7%
Taylor expanded in y around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6472.8%
Simplified72.8%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6479.7%
Applied egg-rr79.7%
if -9.8000000000000004e78 < y < 1.75e28Initial program 99.9%
sub-negN/A
distribute-rgt-inN/A
fma-defineN/A
distribute-lft-neg-outN/A
fmm-undefN/A
*-lft-identityN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0
Simplified96.0%
if 1.75e28 < y Initial program 91.7%
Taylor expanded in y around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6461.7%
Simplified61.7%
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6467.0%
Applied egg-rr67.0%
Final simplification85.5%
(FPCore (x y z) :precision binary64 (if (<= y -2.15e+82) (* z (* x y)) (if (<= y 1.26e+29) (* x (- 1.0 z)) (* y (* x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.15e+82) {
tmp = z * (x * y);
} else if (y <= 1.26e+29) {
tmp = x * (1.0 - z);
} else {
tmp = y * (x * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-2.15d+82)) then
tmp = z * (x * y)
else if (y <= 1.26d+29) then
tmp = x * (1.0d0 - z)
else
tmp = y * (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.15e+82) {
tmp = z * (x * y);
} else if (y <= 1.26e+29) {
tmp = x * (1.0 - z);
} else {
tmp = y * (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.15e+82: tmp = z * (x * y) elif y <= 1.26e+29: tmp = x * (1.0 - z) else: tmp = y * (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.15e+82) tmp = Float64(z * Float64(x * y)); elseif (y <= 1.26e+29) tmp = Float64(x * Float64(1.0 - z)); else tmp = Float64(y * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.15e+82) tmp = z * (x * y); elseif (y <= 1.26e+29) tmp = x * (1.0 - z); else tmp = y * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.15e+82], N[(z * N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.26e+29], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.15 \cdot 10^{+82}:\\
\;\;\;\;z \cdot \left(x \cdot y\right)\\
\mathbf{elif}\;y \leq 1.26 \cdot 10^{+29}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if y < -2.15000000000000007e82Initial program 88.7%
Taylor expanded in y around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6472.8%
Simplified72.8%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6479.7%
Applied egg-rr79.7%
if -2.15000000000000007e82 < y < 1.26e29Initial program 99.9%
Taylor expanded in y around 0
*-lowering-*.f64N/A
--lowering--.f6495.9%
Simplified95.9%
if 1.26e29 < y Initial program 91.7%
Taylor expanded in y around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6461.7%
Simplified61.7%
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6467.0%
Applied egg-rr67.0%
Final simplification85.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (* x y)))) (if (<= y -6e+82) t_0 (if (<= y 1.85e+28) (* x (- 1.0 z)) t_0))))
double code(double x, double y, double z) {
double t_0 = z * (x * y);
double tmp;
if (y <= -6e+82) {
tmp = t_0;
} else if (y <= 1.85e+28) {
tmp = x * (1.0 - z);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * (x * y)
if (y <= (-6d+82)) then
tmp = t_0
else if (y <= 1.85d+28) then
tmp = x * (1.0d0 - z)
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 * y);
double tmp;
if (y <= -6e+82) {
tmp = t_0;
} else if (y <= 1.85e+28) {
tmp = x * (1.0 - z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (x * y) tmp = 0 if y <= -6e+82: tmp = t_0 elif y <= 1.85e+28: tmp = x * (1.0 - z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(x * y)) tmp = 0.0 if (y <= -6e+82) tmp = t_0; elseif (y <= 1.85e+28) tmp = Float64(x * Float64(1.0 - z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (x * y); tmp = 0.0; if (y <= -6e+82) tmp = t_0; elseif (y <= 1.85e+28) tmp = x * (1.0 - z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6e+82], t$95$0, If[LessEqual[y, 1.85e+28], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(x \cdot y\right)\\
\mathbf{if}\;y \leq -6 \cdot 10^{+82}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+28}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -5.99999999999999978e82 or 1.85e28 < y Initial program 90.6%
Taylor expanded in y around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6465.9%
Simplified65.9%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6471.1%
Applied egg-rr71.1%
if -5.99999999999999978e82 < y < 1.85e28Initial program 99.9%
Taylor expanded in y around 0
*-lowering-*.f64N/A
--lowering--.f6495.9%
Simplified95.9%
Final simplification85.2%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (* y z)))) (if (<= y -2.45e+115) t_0 (if (<= y 1.25e+28) (* x (- 1.0 z)) t_0))))
double code(double x, double y, double z) {
double t_0 = x * (y * z);
double tmp;
if (y <= -2.45e+115) {
tmp = t_0;
} else if (y <= 1.25e+28) {
tmp = x * (1.0 - z);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = x * (y * z)
if (y <= (-2.45d+115)) then
tmp = t_0
else if (y <= 1.25d+28) then
tmp = x * (1.0d0 - z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (y * z);
double tmp;
if (y <= -2.45e+115) {
tmp = t_0;
} else if (y <= 1.25e+28) {
tmp = x * (1.0 - z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (y * z) tmp = 0 if y <= -2.45e+115: tmp = t_0 elif y <= 1.25e+28: tmp = x * (1.0 - z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(y * z)) tmp = 0.0 if (y <= -2.45e+115) tmp = t_0; elseif (y <= 1.25e+28) tmp = Float64(x * Float64(1.0 - z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (y * z); tmp = 0.0; if (y <= -2.45e+115) tmp = t_0; elseif (y <= 1.25e+28) tmp = x * (1.0 - z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.45e+115], t$95$0, If[LessEqual[y, 1.25e+28], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(y \cdot z\right)\\
\mathbf{if}\;y \leq -2.45 \cdot 10^{+115}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+28}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.44999999999999982e115 or 1.24999999999999989e28 < y Initial program 92.4%
Taylor expanded in y around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6468.5%
Simplified68.5%
if -2.44999999999999982e115 < y < 1.24999999999999989e28Initial program 98.1%
Taylor expanded in y around 0
*-lowering-*.f64N/A
--lowering--.f6493.2%
Simplified93.2%
Final simplification83.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (* y z)))) (if (<= z -102000.0) t_0 (if (<= z 3.2e-10) x t_0))))
double code(double x, double y, double z) {
double t_0 = x * (y * z);
double tmp;
if (z <= -102000.0) {
tmp = t_0;
} else if (z <= 3.2e-10) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = x * (y * z)
if (z <= (-102000.0d0)) then
tmp = t_0
else if (z <= 3.2d-10) then
tmp = x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (y * z);
double tmp;
if (z <= -102000.0) {
tmp = t_0;
} else if (z <= 3.2e-10) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (y * z) tmp = 0 if z <= -102000.0: tmp = t_0 elif z <= 3.2e-10: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(y * z)) tmp = 0.0 if (z <= -102000.0) tmp = t_0; elseif (z <= 3.2e-10) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (y * z); tmp = 0.0; if (z <= -102000.0) tmp = t_0; elseif (z <= 3.2e-10) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -102000.0], t$95$0, If[LessEqual[z, 3.2e-10], x, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -102000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-10}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -102000 or 3.19999999999999981e-10 < z Initial program 92.1%
Taylor expanded in y around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6442.0%
Simplified42.0%
if -102000 < z < 3.19999999999999981e-10Initial program 99.9%
Taylor expanded in z around 0
Simplified75.6%
Final simplification58.4%
(FPCore (x y z) :precision binary64 (+ x (* (* x z) (+ y -1.0))))
double code(double x, double y, double z) {
return x + ((x * z) * (y + -1.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + ((x * z) * (y + (-1.0d0)))
end function
public static double code(double x, double y, double z) {
return x + ((x * z) * (y + -1.0));
}
def code(x, y, z): return x + ((x * z) * (y + -1.0))
function code(x, y, z) return Float64(x + Float64(Float64(x * z) * Float64(y + -1.0))) end
function tmp = code(x, y, z) tmp = x + ((x * z) * (y + -1.0)); end
code[x_, y_, z_] := N[(x + N[(N[(x * z), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(x \cdot z\right) \cdot \left(y + -1\right)
\end{array}
Initial program 95.9%
sub-negN/A
distribute-rgt-inN/A
fma-defineN/A
distribute-lft-neg-outN/A
fmm-undefN/A
*-lft-identityN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6495.9%
Applied egg-rr95.9%
--lowering--.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6497.8%
Applied egg-rr97.8%
Final simplification97.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 95.9%
Taylor expanded in z around 0
Simplified38.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (- 1.0 (* (- 1.0 y) z))))
(t_1 (+ x (* (- 1.0 y) (* (- z) x)))))
(if (< t_0 -1.618195973607049e+50)
t_1
(if (< t_0 3.892237649663903e+134) (- (* (* x y) z) (- (* x z) x)) t_1))))
double code(double x, double y, double z) {
double t_0 = x * (1.0 - ((1.0 - y) * z));
double t_1 = x + ((1.0 - y) * (-z * x));
double tmp;
if (t_0 < -1.618195973607049e+50) {
tmp = t_1;
} else if (t_0 < 3.892237649663903e+134) {
tmp = ((x * y) * z) - ((x * z) - x);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x * (1.0d0 - ((1.0d0 - y) * z))
t_1 = x + ((1.0d0 - y) * (-z * x))
if (t_0 < (-1.618195973607049d+50)) then
tmp = t_1
else if (t_0 < 3.892237649663903d+134) then
tmp = ((x * y) * z) - ((x * z) - x)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (1.0 - ((1.0 - y) * z));
double t_1 = x + ((1.0 - y) * (-z * x));
double tmp;
if (t_0 < -1.618195973607049e+50) {
tmp = t_1;
} else if (t_0 < 3.892237649663903e+134) {
tmp = ((x * y) * z) - ((x * z) - x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = x * (1.0 - ((1.0 - y) * z)) t_1 = x + ((1.0 - y) * (-z * x)) tmp = 0 if t_0 < -1.618195973607049e+50: tmp = t_1 elif t_0 < 3.892237649663903e+134: tmp = ((x * y) * z) - ((x * z) - x) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(1.0 - Float64(Float64(1.0 - y) * z))) t_1 = Float64(x + Float64(Float64(1.0 - y) * Float64(Float64(-z) * x))) tmp = 0.0 if (t_0 < -1.618195973607049e+50) tmp = t_1; elseif (t_0 < 3.892237649663903e+134) tmp = Float64(Float64(Float64(x * y) * z) - Float64(Float64(x * z) - x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (1.0 - ((1.0 - y) * z)); t_1 = x + ((1.0 - y) * (-z * x)); tmp = 0.0; if (t_0 < -1.618195973607049e+50) tmp = t_1; elseif (t_0 < 3.892237649663903e+134) tmp = ((x * y) * z) - ((x * z) - x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(1.0 - N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(N[(1.0 - y), $MachinePrecision] * N[((-z) * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$0, -1.618195973607049e+50], t$95$1, If[Less[t$95$0, 3.892237649663903e+134], N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] - N[(N[(x * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\\
t_1 := x + \left(1 - y\right) \cdot \left(\left(-z\right) \cdot x\right)\\
\mathbf{if}\;t\_0 < -1.618195973607049 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 < 3.892237649663903 \cdot 10^{+134}:\\
\;\;\;\;\left(x \cdot y\right) \cdot z - \left(x \cdot z - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024145
(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))))