
(FPCore (x y z) :precision binary64 (+ (* x y) (* (- 1.0 x) z)))
double code(double x, double y, double z) {
return (x * y) + ((1.0 - x) * 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 * y) + ((1.0d0 - x) * z)
end function
public static double code(double x, double y, double z) {
return (x * y) + ((1.0 - x) * z);
}
def code(x, y, z): return (x * y) + ((1.0 - x) * z)
function code(x, y, z) return Float64(Float64(x * y) + Float64(Float64(1.0 - x) * z)) end
function tmp = code(x, y, z) tmp = (x * y) + ((1.0 - x) * z); end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot y + \left(1 - x\right) \cdot z
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (* x y) (* (- 1.0 x) z)))
double code(double x, double y, double z) {
return (x * y) + ((1.0 - x) * 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 * y) + ((1.0d0 - x) * z)
end function
public static double code(double x, double y, double z) {
return (x * y) + ((1.0 - x) * z);
}
def code(x, y, z): return (x * y) + ((1.0 - x) * z)
function code(x, y, z) return Float64(Float64(x * y) + Float64(Float64(1.0 - x) * z)) end
function tmp = code(x, y, z) tmp = (x * y) + ((1.0 - x) * z); end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot y + \left(1 - x\right) \cdot z
\end{array}
(FPCore (x y z) :precision binary64 (+ z (* x (- y z))))
double code(double x, double y, double z) {
return z + (x * (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 = z + (x * (y - z))
end function
public static double code(double x, double y, double z) {
return z + (x * (y - z));
}
def code(x, y, z): return z + (x * (y - z))
function code(x, y, z) return Float64(z + Float64(x * Float64(y - z))) end
function tmp = code(x, y, z) tmp = z + (x * (y - z)); end
code[x_, y_, z_] := N[(z + N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z + x \cdot \left(y - z\right)
\end{array}
Initial program 99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-out--99.2%
*-lft-identity99.2%
associate-+l-99.2%
distribute-lft-out--100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- x))))
(if (<= x -5.8e+232)
(* x y)
(if (<= x -1.0)
t_0
(if (<= x 5.08e-85)
z
(if (or (<= x 1.95e+110) (not (<= x 1e+189))) (* x y) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * -x;
double tmp;
if (x <= -5.8e+232) {
tmp = x * y;
} else if (x <= -1.0) {
tmp = t_0;
} else if (x <= 5.08e-85) {
tmp = z;
} else if ((x <= 1.95e+110) || !(x <= 1e+189)) {
tmp = x * y;
} 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
if (x <= (-5.8d+232)) then
tmp = x * y
else if (x <= (-1.0d0)) then
tmp = t_0
else if (x <= 5.08d-85) then
tmp = z
else if ((x <= 1.95d+110) .or. (.not. (x <= 1d+189))) then
tmp = x * y
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 tmp;
if (x <= -5.8e+232) {
tmp = x * y;
} else if (x <= -1.0) {
tmp = t_0;
} else if (x <= 5.08e-85) {
tmp = z;
} else if ((x <= 1.95e+110) || !(x <= 1e+189)) {
tmp = x * y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * -x tmp = 0 if x <= -5.8e+232: tmp = x * y elif x <= -1.0: tmp = t_0 elif x <= 5.08e-85: tmp = z elif (x <= 1.95e+110) or not (x <= 1e+189): tmp = x * y else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-x)) tmp = 0.0 if (x <= -5.8e+232) tmp = Float64(x * y); elseif (x <= -1.0) tmp = t_0; elseif (x <= 5.08e-85) tmp = z; elseif ((x <= 1.95e+110) || !(x <= 1e+189)) tmp = Float64(x * y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * -x; tmp = 0.0; if (x <= -5.8e+232) tmp = x * y; elseif (x <= -1.0) tmp = t_0; elseif (x <= 5.08e-85) tmp = z; elseif ((x <= 1.95e+110) || ~((x <= 1e+189))) tmp = x * y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * (-x)), $MachinePrecision]}, If[LessEqual[x, -5.8e+232], N[(x * y), $MachinePrecision], If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, 5.08e-85], z, If[Or[LessEqual[x, 1.95e+110], N[Not[LessEqual[x, 1e+189]], $MachinePrecision]], N[(x * y), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(-x\right)\\
\mathbf{if}\;x \leq -5.8 \cdot 10^{+232}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.08 \cdot 10^{-85}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{+110} \lor \neg \left(x \leq 10^{+189}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -5.80000000000000047e232 or 5.0799999999999997e-85 < x < 1.9500000000000002e110 or 1e189 < x Initial program 100.0%
Taylor expanded in y around inf 68.3%
if -5.80000000000000047e232 < x < -1 or 1.9500000000000002e110 < x < 1e189Initial program 97.0%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 68.1%
mul-1-neg68.1%
distribute-rgt-neg-out68.1%
Simplified68.1%
if -1 < x < 5.0799999999999997e-85Initial program 100.0%
Taylor expanded in x around 0 77.0%
Final simplification71.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- x))))
(if (<= x -5.6e+232)
(* x y)
(if (<= x -1.0)
t_0
(if (<= x 5.08e-85)
z
(if (<= x 1.35e+108)
(* x (+ z y))
(if (<= x 1.35e+191) t_0 (* x y))))))))
double code(double x, double y, double z) {
double t_0 = z * -x;
double tmp;
if (x <= -5.6e+232) {
tmp = x * y;
} else if (x <= -1.0) {
tmp = t_0;
} else if (x <= 5.08e-85) {
tmp = z;
} else if (x <= 1.35e+108) {
tmp = x * (z + y);
} else if (x <= 1.35e+191) {
tmp = t_0;
} else {
tmp = 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) :: tmp
t_0 = z * -x
if (x <= (-5.6d+232)) then
tmp = x * y
else if (x <= (-1.0d0)) then
tmp = t_0
else if (x <= 5.08d-85) then
tmp = z
else if (x <= 1.35d+108) then
tmp = x * (z + y)
else if (x <= 1.35d+191) then
tmp = t_0
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * -x;
double tmp;
if (x <= -5.6e+232) {
tmp = x * y;
} else if (x <= -1.0) {
tmp = t_0;
} else if (x <= 5.08e-85) {
tmp = z;
} else if (x <= 1.35e+108) {
tmp = x * (z + y);
} else if (x <= 1.35e+191) {
tmp = t_0;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z): t_0 = z * -x tmp = 0 if x <= -5.6e+232: tmp = x * y elif x <= -1.0: tmp = t_0 elif x <= 5.08e-85: tmp = z elif x <= 1.35e+108: tmp = x * (z + y) elif x <= 1.35e+191: tmp = t_0 else: tmp = x * y return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-x)) tmp = 0.0 if (x <= -5.6e+232) tmp = Float64(x * y); elseif (x <= -1.0) tmp = t_0; elseif (x <= 5.08e-85) tmp = z; elseif (x <= 1.35e+108) tmp = Float64(x * Float64(z + y)); elseif (x <= 1.35e+191) tmp = t_0; else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * -x; tmp = 0.0; if (x <= -5.6e+232) tmp = x * y; elseif (x <= -1.0) tmp = t_0; elseif (x <= 5.08e-85) tmp = z; elseif (x <= 1.35e+108) tmp = x * (z + y); elseif (x <= 1.35e+191) tmp = t_0; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * (-x)), $MachinePrecision]}, If[LessEqual[x, -5.6e+232], N[(x * y), $MachinePrecision], If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, 5.08e-85], z, If[LessEqual[x, 1.35e+108], N[(x * N[(z + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.35e+191], t$95$0, N[(x * y), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(-x\right)\\
\mathbf{if}\;x \leq -5.6 \cdot 10^{+232}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.08 \cdot 10^{-85}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+108}:\\
\;\;\;\;x \cdot \left(z + y\right)\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+191}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if x < -5.5999999999999998e232 or 1.34999999999999998e191 < x Initial program 100.0%
Taylor expanded in y around inf 72.8%
if -5.5999999999999998e232 < x < -1 or 1.35e108 < x < 1.34999999999999998e191Initial program 97.0%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 68.1%
mul-1-neg68.1%
distribute-rgt-neg-out68.1%
Simplified68.1%
if -1 < x < 5.0799999999999997e-85Initial program 100.0%
Taylor expanded in x around 0 77.0%
if 5.0799999999999997e-85 < x < 1.35e108Initial program 99.9%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around inf 76.6%
mul-1-neg76.6%
distribute-lft-neg-out76.6%
*-commutative76.6%
Simplified76.6%
fma-undefine76.6%
+-commutative76.6%
add-sqr-sqrt0.0%
sqrt-unprod64.8%
sqr-neg64.8%
sqrt-unprod64.8%
add-sqr-sqrt64.8%
Applied egg-rr64.8%
+-commutative64.8%
*-commutative64.8%
distribute-rgt-out64.8%
Simplified64.8%
Final simplification71.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -3e-5) (not (<= x 5.08e-85))) (* x (- y z)) z))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3e-5) || !(x <= 5.08e-85)) {
tmp = x * (y - z);
} else {
tmp = 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 ((x <= (-3d-5)) .or. (.not. (x <= 5.08d-85))) then
tmp = x * (y - z)
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -3e-5) || !(x <= 5.08e-85)) {
tmp = x * (y - z);
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3e-5) or not (x <= 5.08e-85): tmp = x * (y - z) else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3e-5) || !(x <= 5.08e-85)) tmp = Float64(x * Float64(y - z)); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3e-5) || ~((x <= 5.08e-85))) tmp = x * (y - z); else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3e-5], N[Not[LessEqual[x, 5.08e-85]], $MachinePrecision]], N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision], z]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{-5} \lor \neg \left(x \leq 5.08 \cdot 10^{-85}\right):\\
\;\;\;\;x \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -3.00000000000000008e-5 or 5.0799999999999997e-85 < x Initial program 98.7%
Taylor expanded in x around inf 92.7%
mul-1-neg92.7%
sub-neg92.7%
Simplified92.7%
if -3.00000000000000008e-5 < x < 5.0799999999999997e-85Initial program 100.0%
Taylor expanded in x around 0 77.0%
Final simplification86.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -8e-5) (not (<= x 5.08e-85))) (* x (- y z)) (* z (- 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -8e-5) || !(x <= 5.08e-85)) {
tmp = x * (y - z);
} else {
tmp = z * (1.0 - 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 ((x <= (-8d-5)) .or. (.not. (x <= 5.08d-85))) then
tmp = x * (y - z)
else
tmp = z * (1.0d0 - x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -8e-5) || !(x <= 5.08e-85)) {
tmp = x * (y - z);
} else {
tmp = z * (1.0 - x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -8e-5) or not (x <= 5.08e-85): tmp = x * (y - z) else: tmp = z * (1.0 - x) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -8e-5) || !(x <= 5.08e-85)) tmp = Float64(x * Float64(y - z)); else tmp = Float64(z * Float64(1.0 - x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -8e-5) || ~((x <= 5.08e-85))) tmp = x * (y - z); else tmp = z * (1.0 - x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -8e-5], N[Not[LessEqual[x, 5.08e-85]], $MachinePrecision]], N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(z * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{-5} \lor \neg \left(x \leq 5.08 \cdot 10^{-85}\right):\\
\;\;\;\;x \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(1 - x\right)\\
\end{array}
\end{array}
if x < -8.00000000000000065e-5 or 5.0799999999999997e-85 < x Initial program 98.7%
Taylor expanded in x around inf 92.7%
mul-1-neg92.7%
sub-neg92.7%
Simplified92.7%
if -8.00000000000000065e-5 < x < 5.0799999999999997e-85Initial program 100.0%
Taylor expanded in y around 0 77.5%
Final simplification86.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -0.45) (not (<= x 5.08e-85))) (* x (- y z)) (- z (* z x))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -0.45) || !(x <= 5.08e-85)) {
tmp = x * (y - z);
} else {
tmp = z - (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 ((x <= (-0.45d0)) .or. (.not. (x <= 5.08d-85))) then
tmp = x * (y - z)
else
tmp = z - (z * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -0.45) || !(x <= 5.08e-85)) {
tmp = x * (y - z);
} else {
tmp = z - (z * x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -0.45) or not (x <= 5.08e-85): tmp = x * (y - z) else: tmp = z - (z * x) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -0.45) || !(x <= 5.08e-85)) tmp = Float64(x * Float64(y - z)); else tmp = Float64(z - Float64(z * x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -0.45) || ~((x <= 5.08e-85))) tmp = x * (y - z); else tmp = z - (z * x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -0.45], N[Not[LessEqual[x, 5.08e-85]], $MachinePrecision]], N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(z - N[(z * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.45 \lor \neg \left(x \leq 5.08 \cdot 10^{-85}\right):\\
\;\;\;\;x \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;z - z \cdot x\\
\end{array}
\end{array}
if x < -0.450000000000000011 or 5.0799999999999997e-85 < x Initial program 98.7%
Taylor expanded in x around inf 92.7%
mul-1-neg92.7%
sub-neg92.7%
Simplified92.7%
if -0.450000000000000011 < x < 5.0799999999999997e-85Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
distribute-rgt-out--100.0%
*-lft-identity100.0%
associate-+l-100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in z around inf 77.6%
*-commutative77.6%
Simplified77.6%
Final simplification86.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -15500000000000.0) (not (<= x 0.000118))) (* x (- y z)) (+ z (* x y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -15500000000000.0) || !(x <= 0.000118)) {
tmp = x * (y - z);
} 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) :: tmp
if ((x <= (-15500000000000.0d0)) .or. (.not. (x <= 0.000118d0))) then
tmp = x * (y - z)
else
tmp = z + (x * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -15500000000000.0) || !(x <= 0.000118)) {
tmp = x * (y - z);
} else {
tmp = z + (x * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -15500000000000.0) or not (x <= 0.000118): tmp = x * (y - z) else: tmp = z + (x * y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -15500000000000.0) || !(x <= 0.000118)) tmp = Float64(x * Float64(y - z)); else tmp = Float64(z + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -15500000000000.0) || ~((x <= 0.000118))) tmp = x * (y - z); else tmp = z + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -15500000000000.0], N[Not[LessEqual[x, 0.000118]], $MachinePrecision]], N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(z + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -15500000000000 \lor \neg \left(x \leq 0.000118\right):\\
\;\;\;\;x \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;z + x \cdot y\\
\end{array}
\end{array}
if x < -1.55e13 or 1.18e-4 < x Initial program 98.4%
Taylor expanded in x around inf 99.4%
mul-1-neg99.4%
sub-neg99.4%
Simplified99.4%
if -1.55e13 < x < 1.18e-4Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
distribute-rgt-out--100.0%
*-lft-identity100.0%
associate-+l-100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in z around 0 98.8%
associate-*r*98.8%
neg-mul-198.8%
Simplified98.8%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -3e-5) (not (<= x 5.08e-85))) (* x y) z))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3e-5) || !(x <= 5.08e-85)) {
tmp = x * y;
} else {
tmp = 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 ((x <= (-3d-5)) .or. (.not. (x <= 5.08d-85))) then
tmp = x * y
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -3e-5) || !(x <= 5.08e-85)) {
tmp = x * y;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3e-5) or not (x <= 5.08e-85): tmp = x * y else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3e-5) || !(x <= 5.08e-85)) tmp = Float64(x * y); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3e-5) || ~((x <= 5.08e-85))) tmp = x * y; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3e-5], N[Not[LessEqual[x, 5.08e-85]], $MachinePrecision]], N[(x * y), $MachinePrecision], z]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{-5} \lor \neg \left(x \leq 5.08 \cdot 10^{-85}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -3.00000000000000008e-5 or 5.0799999999999997e-85 < x Initial program 98.7%
Taylor expanded in y around inf 53.3%
if -3.00000000000000008e-5 < x < 5.0799999999999997e-85Initial program 100.0%
Taylor expanded in x around 0 77.0%
Final simplification62.8%
(FPCore (x y z) :precision binary64 z)
double code(double x, double y, double z) {
return z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z
end function
public static double code(double x, double y, double z) {
return z;
}
def code(x, y, z): return z
function code(x, y, z) return z end
function tmp = code(x, y, z) tmp = z; end
code[x_, y_, z_] := z
\begin{array}{l}
\\
z
\end{array}
Initial program 99.2%
Taylor expanded in x around 0 36.0%
Final simplification36.0%
herbie shell --seed 2024034
(FPCore (x y z)
:name "Diagrams.Backend.Rasterific:$crender from diagrams-rasterific-1.3.1.3"
:precision binary64
(+ (* x y) (* (- 1.0 x) z)))