
(FPCore (x y z) :precision binary64 (+ (* x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x * cos(y)) + (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * cos(y)) + (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x * Math.cos(y)) + (z * Math.sin(y));
}
def code(x, y, z): return (x * math.cos(y)) + (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x * cos(y)) + Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x * cos(y)) + (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \cos y + z \cdot \sin y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (* x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x * cos(y)) + (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * cos(y)) + (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x * Math.cos(y)) + (z * Math.sin(y));
}
def code(x, y, z): return (x * math.cos(y)) + (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x * cos(y)) + Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x * cos(y)) + (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \cos y + z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (fma x (cos y) (* z (sin y))))
double code(double x, double y, double z) {
return fma(x, cos(y), (z * sin(y)));
}
function code(x, y, z) return fma(x, cos(y), Float64(z * sin(y))) end
code[x_, y_, z_] := N[(x * N[Cos[y], $MachinePrecision] + N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \cos y, z \cdot \sin y\right)
\end{array}
Initial program 99.8%
fma-define99.8%
Simplified99.8%
(FPCore (x y z) :precision binary64 (+ (* z (sin y)) (* x (cos y))))
double code(double x, double y, double z) {
return (z * sin(y)) + (x * cos(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (z * sin(y)) + (x * cos(y))
end function
public static double code(double x, double y, double z) {
return (z * Math.sin(y)) + (x * Math.cos(y));
}
def code(x, y, z): return (z * math.sin(y)) + (x * math.cos(y))
function code(x, y, z) return Float64(Float64(z * sin(y)) + Float64(x * cos(y))) end
function tmp = code(x, y, z) tmp = (z * sin(y)) + (x * cos(y)); end
code[x_, y_, z_] := N[(N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(x * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \sin y + x \cdot \cos y
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))) (t_1 (* x (cos y))))
(if (<= x -3.4e+106)
t_1
(if (<= x -2.3e-80)
(* x (+ 1.0 (/ 1.0 (/ x t_0))))
(if (<= x 1.95e-175)
t_0
(if (<= x 6.2e+49) (* x (+ 1.0 (* z (/ (sin y) x)))) t_1))))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double t_1 = x * cos(y);
double tmp;
if (x <= -3.4e+106) {
tmp = t_1;
} else if (x <= -2.3e-80) {
tmp = x * (1.0 + (1.0 / (x / t_0)));
} else if (x <= 1.95e-175) {
tmp = t_0;
} else if (x <= 6.2e+49) {
tmp = x * (1.0 + (z * (sin(y) / 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 = z * sin(y)
t_1 = x * cos(y)
if (x <= (-3.4d+106)) then
tmp = t_1
else if (x <= (-2.3d-80)) then
tmp = x * (1.0d0 + (1.0d0 / (x / t_0)))
else if (x <= 1.95d-175) then
tmp = t_0
else if (x <= 6.2d+49) then
tmp = x * (1.0d0 + (z * (sin(y) / x)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(y);
double t_1 = x * Math.cos(y);
double tmp;
if (x <= -3.4e+106) {
tmp = t_1;
} else if (x <= -2.3e-80) {
tmp = x * (1.0 + (1.0 / (x / t_0)));
} else if (x <= 1.95e-175) {
tmp = t_0;
} else if (x <= 6.2e+49) {
tmp = x * (1.0 + (z * (Math.sin(y) / x)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) t_1 = x * math.cos(y) tmp = 0 if x <= -3.4e+106: tmp = t_1 elif x <= -2.3e-80: tmp = x * (1.0 + (1.0 / (x / t_0))) elif x <= 1.95e-175: tmp = t_0 elif x <= 6.2e+49: tmp = x * (1.0 + (z * (math.sin(y) / x))) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) t_1 = Float64(x * cos(y)) tmp = 0.0 if (x <= -3.4e+106) tmp = t_1; elseif (x <= -2.3e-80) tmp = Float64(x * Float64(1.0 + Float64(1.0 / Float64(x / t_0)))); elseif (x <= 1.95e-175) tmp = t_0; elseif (x <= 6.2e+49) tmp = Float64(x * Float64(1.0 + Float64(z * Float64(sin(y) / x)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); t_1 = x * cos(y); tmp = 0.0; if (x <= -3.4e+106) tmp = t_1; elseif (x <= -2.3e-80) tmp = x * (1.0 + (1.0 / (x / t_0))); elseif (x <= 1.95e-175) tmp = t_0; elseif (x <= 6.2e+49) tmp = x * (1.0 + (z * (sin(y) / x))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.4e+106], t$95$1, If[LessEqual[x, -2.3e-80], N[(x * N[(1.0 + N[(1.0 / N[(x / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.95e-175], t$95$0, If[LessEqual[x, 6.2e+49], N[(x * N[(1.0 + N[(z * N[(N[Sin[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
t_1 := x \cdot \cos y\\
\mathbf{if}\;x \leq -3.4 \cdot 10^{+106}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{-80}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{\frac{x}{t\_0}}\right)\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{-175}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{+49}:\\
\;\;\;\;x \cdot \left(1 + z \cdot \frac{\sin y}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.39999999999999994e106 or 6.19999999999999985e49 < x Initial program 99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in x around inf 89.4%
if -3.39999999999999994e106 < x < -2.2999999999999998e-80Initial program 99.7%
fma-define99.7%
Simplified99.7%
Taylor expanded in x around inf 99.6%
associate-/l*99.4%
Simplified99.4%
associate-*r/99.6%
clear-num99.6%
Applied egg-rr99.6%
Taylor expanded in y around 0 82.7%
if -2.2999999999999998e-80 < x < 1.94999999999999999e-175Initial program 99.7%
fma-define99.7%
Simplified99.7%
Taylor expanded in x around 0 76.9%
if 1.94999999999999999e-175 < x < 6.19999999999999985e49Initial program 99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in x around inf 97.9%
associate-/l*97.8%
Simplified97.8%
Taylor expanded in y around 0 85.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (cos y))) (t_1 (* x (+ 1.0 (* z (/ (sin y) x))))))
(if (<= x -7e+92)
t_0
(if (<= x -3.8e-81)
t_1
(if (<= x 1.9e-175) (* z (sin y)) (if (<= x 2.7e+51) t_1 t_0))))))
double code(double x, double y, double z) {
double t_0 = x * cos(y);
double t_1 = x * (1.0 + (z * (sin(y) / x)));
double tmp;
if (x <= -7e+92) {
tmp = t_0;
} else if (x <= -3.8e-81) {
tmp = t_1;
} else if (x <= 1.9e-175) {
tmp = z * sin(y);
} else if (x <= 2.7e+51) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x * cos(y)
t_1 = x * (1.0d0 + (z * (sin(y) / x)))
if (x <= (-7d+92)) then
tmp = t_0
else if (x <= (-3.8d-81)) then
tmp = t_1
else if (x <= 1.9d-175) then
tmp = z * sin(y)
else if (x <= 2.7d+51) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * Math.cos(y);
double t_1 = x * (1.0 + (z * (Math.sin(y) / x)));
double tmp;
if (x <= -7e+92) {
tmp = t_0;
} else if (x <= -3.8e-81) {
tmp = t_1;
} else if (x <= 1.9e-175) {
tmp = z * Math.sin(y);
} else if (x <= 2.7e+51) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * math.cos(y) t_1 = x * (1.0 + (z * (math.sin(y) / x))) tmp = 0 if x <= -7e+92: tmp = t_0 elif x <= -3.8e-81: tmp = t_1 elif x <= 1.9e-175: tmp = z * math.sin(y) elif x <= 2.7e+51: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * cos(y)) t_1 = Float64(x * Float64(1.0 + Float64(z * Float64(sin(y) / x)))) tmp = 0.0 if (x <= -7e+92) tmp = t_0; elseif (x <= -3.8e-81) tmp = t_1; elseif (x <= 1.9e-175) tmp = Float64(z * sin(y)); elseif (x <= 2.7e+51) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * cos(y); t_1 = x * (1.0 + (z * (sin(y) / x))); tmp = 0.0; if (x <= -7e+92) tmp = t_0; elseif (x <= -3.8e-81) tmp = t_1; elseif (x <= 1.9e-175) tmp = z * sin(y); elseif (x <= 2.7e+51) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(1.0 + N[(z * N[(N[Sin[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7e+92], t$95$0, If[LessEqual[x, -3.8e-81], t$95$1, If[LessEqual[x, 1.9e-175], N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.7e+51], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \cos y\\
t_1 := x \cdot \left(1 + z \cdot \frac{\sin y}{x}\right)\\
\mathbf{if}\;x \leq -7 \cdot 10^{+92}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -3.8 \cdot 10^{-81}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-175}:\\
\;\;\;\;z \cdot \sin y\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.99999999999999972e92 or 2.69999999999999992e51 < x Initial program 99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in x around inf 89.4%
if -6.99999999999999972e92 < x < -3.7999999999999999e-81 or 1.9e-175 < x < 2.69999999999999992e51Initial program 99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in x around inf 98.6%
associate-/l*98.5%
Simplified98.5%
Taylor expanded in y around 0 84.3%
if -3.7999999999999999e-81 < x < 1.9e-175Initial program 99.7%
fma-define99.7%
Simplified99.7%
Taylor expanded in x around 0 76.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (cos y))) (t_1 (* z (sin y))))
(if (<= y -1e+195)
t_0
(if (<= y -2.7e+113)
t_1
(if (<= y -1650000000000.0)
t_0
(if (<= y 4.3e-11)
(+
x
(* y (+ z (* y (+ (* x -0.5) (* -0.16666666666666666 (* y z)))))))
(if (<= y 1.2e+156) t_0 t_1)))))))
double code(double x, double y, double z) {
double t_0 = x * cos(y);
double t_1 = z * sin(y);
double tmp;
if (y <= -1e+195) {
tmp = t_0;
} else if (y <= -2.7e+113) {
tmp = t_1;
} else if (y <= -1650000000000.0) {
tmp = t_0;
} else if (y <= 4.3e-11) {
tmp = x + (y * (z + (y * ((x * -0.5) + (-0.16666666666666666 * (y * z))))));
} else if (y <= 1.2e+156) {
tmp = t_0;
} 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 * cos(y)
t_1 = z * sin(y)
if (y <= (-1d+195)) then
tmp = t_0
else if (y <= (-2.7d+113)) then
tmp = t_1
else if (y <= (-1650000000000.0d0)) then
tmp = t_0
else if (y <= 4.3d-11) then
tmp = x + (y * (z + (y * ((x * (-0.5d0)) + ((-0.16666666666666666d0) * (y * z))))))
else if (y <= 1.2d+156) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * Math.cos(y);
double t_1 = z * Math.sin(y);
double tmp;
if (y <= -1e+195) {
tmp = t_0;
} else if (y <= -2.7e+113) {
tmp = t_1;
} else if (y <= -1650000000000.0) {
tmp = t_0;
} else if (y <= 4.3e-11) {
tmp = x + (y * (z + (y * ((x * -0.5) + (-0.16666666666666666 * (y * z))))));
} else if (y <= 1.2e+156) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = x * math.cos(y) t_1 = z * math.sin(y) tmp = 0 if y <= -1e+195: tmp = t_0 elif y <= -2.7e+113: tmp = t_1 elif y <= -1650000000000.0: tmp = t_0 elif y <= 4.3e-11: tmp = x + (y * (z + (y * ((x * -0.5) + (-0.16666666666666666 * (y * z)))))) elif y <= 1.2e+156: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(x * cos(y)) t_1 = Float64(z * sin(y)) tmp = 0.0 if (y <= -1e+195) tmp = t_0; elseif (y <= -2.7e+113) tmp = t_1; elseif (y <= -1650000000000.0) tmp = t_0; elseif (y <= 4.3e-11) tmp = Float64(x + Float64(y * Float64(z + Float64(y * Float64(Float64(x * -0.5) + Float64(-0.16666666666666666 * Float64(y * z))))))); elseif (y <= 1.2e+156) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * cos(y); t_1 = z * sin(y); tmp = 0.0; if (y <= -1e+195) tmp = t_0; elseif (y <= -2.7e+113) tmp = t_1; elseif (y <= -1650000000000.0) tmp = t_0; elseif (y <= 4.3e-11) tmp = x + (y * (z + (y * ((x * -0.5) + (-0.16666666666666666 * (y * z)))))); elseif (y <= 1.2e+156) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1e+195], t$95$0, If[LessEqual[y, -2.7e+113], t$95$1, If[LessEqual[y, -1650000000000.0], t$95$0, If[LessEqual[y, 4.3e-11], N[(x + N[(y * N[(z + N[(y * N[(N[(x * -0.5), $MachinePrecision] + N[(-0.16666666666666666 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e+156], t$95$0, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \cos y\\
t_1 := z \cdot \sin y\\
\mathbf{if}\;y \leq -1 \cdot 10^{+195}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -2.7 \cdot 10^{+113}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1650000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.3 \cdot 10^{-11}:\\
\;\;\;\;x + y \cdot \left(z + y \cdot \left(x \cdot -0.5 + -0.16666666666666666 \cdot \left(y \cdot z\right)\right)\right)\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+156}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.99999999999999977e194 or -2.70000000000000011e113 < y < -1.65e12 or 4.30000000000000001e-11 < y < 1.2000000000000001e156Initial program 99.5%
fma-define99.5%
Simplified99.5%
Taylor expanded in x around inf 63.6%
if -9.99999999999999977e194 < y < -2.70000000000000011e113 or 1.2000000000000001e156 < y Initial program 99.5%
fma-define99.5%
Simplified99.5%
Taylor expanded in x around 0 69.4%
if -1.65e12 < y < 4.30000000000000001e-11Initial program 100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 99.3%
Final simplification83.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -1650000000000.0) (not (<= y 4.3e-11))) (* x (cos y)) (+ x (* y (+ z (* y (+ (* x -0.5) (* -0.16666666666666666 (* y z)))))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1650000000000.0) || !(y <= 4.3e-11)) {
tmp = x * cos(y);
} else {
tmp = x + (y * (z + (y * ((x * -0.5) + (-0.16666666666666666 * (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 ((y <= (-1650000000000.0d0)) .or. (.not. (y <= 4.3d-11))) then
tmp = x * cos(y)
else
tmp = x + (y * (z + (y * ((x * (-0.5d0)) + ((-0.16666666666666666d0) * (y * z))))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1650000000000.0) || !(y <= 4.3e-11)) {
tmp = x * Math.cos(y);
} else {
tmp = x + (y * (z + (y * ((x * -0.5) + (-0.16666666666666666 * (y * z))))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1650000000000.0) or not (y <= 4.3e-11): tmp = x * math.cos(y) else: tmp = x + (y * (z + (y * ((x * -0.5) + (-0.16666666666666666 * (y * z)))))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1650000000000.0) || !(y <= 4.3e-11)) tmp = Float64(x * cos(y)); else tmp = Float64(x + Float64(y * Float64(z + Float64(y * Float64(Float64(x * -0.5) + Float64(-0.16666666666666666 * Float64(y * z))))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1650000000000.0) || ~((y <= 4.3e-11))) tmp = x * cos(y); else tmp = x + (y * (z + (y * ((x * -0.5) + (-0.16666666666666666 * (y * z)))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1650000000000.0], N[Not[LessEqual[y, 4.3e-11]], $MachinePrecision]], N[(x * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z + N[(y * N[(N[(x * -0.5), $MachinePrecision] + N[(-0.16666666666666666 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1650000000000 \lor \neg \left(y \leq 4.3 \cdot 10^{-11}\right):\\
\;\;\;\;x \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(z + y \cdot \left(x \cdot -0.5 + -0.16666666666666666 \cdot \left(y \cdot z\right)\right)\right)\\
\end{array}
\end{array}
if y < -1.65e12 or 4.30000000000000001e-11 < y Initial program 99.5%
fma-define99.5%
Simplified99.5%
Taylor expanded in x around inf 50.0%
if -1.65e12 < y < 4.30000000000000001e-11Initial program 100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 99.3%
Final simplification76.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -7.2e+119) (not (<= z 1.32e+112))) (* y z) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7.2e+119) || !(z <= 1.32e+112)) {
tmp = y * 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 <= (-7.2d+119)) .or. (.not. (z <= 1.32d+112))) then
tmp = y * z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -7.2e+119) || !(z <= 1.32e+112)) {
tmp = y * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -7.2e+119) or not (z <= 1.32e+112): tmp = y * z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -7.2e+119) || !(z <= 1.32e+112)) tmp = Float64(y * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -7.2e+119) || ~((z <= 1.32e+112))) tmp = y * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -7.2e+119], N[Not[LessEqual[z, 1.32e+112]], $MachinePrecision]], N[(y * z), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+119} \lor \neg \left(z \leq 1.32 \cdot 10^{+112}\right):\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -7.20000000000000003e119 or 1.32e112 < z Initial program 99.7%
fma-define99.7%
Simplified99.7%
Taylor expanded in y around 0 50.6%
Taylor expanded in x around 0 37.1%
if -7.20000000000000003e119 < z < 1.32e112Initial program 99.8%
log1p-expm1-u99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 52.9%
Final simplification47.4%
(FPCore (x y z) :precision binary64 (+ x (* y z)))
double code(double x, double y, double z) {
return 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 = x + (y * z)
end function
public static double code(double x, double y, double z) {
return x + (y * z);
}
def code(x, y, z): return x + (y * z)
function code(x, y, z) return Float64(x + Float64(y * z)) end
function tmp = code(x, y, z) tmp = x + (y * z); end
code[x_, y_, z_] := N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot z
\end{array}
Initial program 99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in y around 0 56.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 99.8%
log1p-expm1-u99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 40.4%
herbie shell --seed 2024182
(FPCore (x y z)
:name "Diagrams.ThreeD.Transform:aboutY from diagrams-lib-1.3.0.3"
:precision binary64
(+ (* x (cos y)) (* z (sin y))))