
(FPCore (x y z) :precision binary64 (+ (* x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x * sin(y)) + (z * 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 = (x * sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x * Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x * math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x * sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x * sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x * N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \sin y + z \cdot \cos y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (* x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x * sin(y)) + (z * 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 = (x * sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x * Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x * math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x * sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x * sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x * N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \sin y + z \cdot \cos y
\end{array}
(FPCore (x y z) :precision binary64 (fma x (sin y) (* z (cos y))))
double code(double x, double y, double z) {
return fma(x, sin(y), (z * cos(y)));
}
function code(x, y, z) return fma(x, sin(y), Float64(z * cos(y))) end
code[x_, y_, z_] := N[(x * N[Sin[y], $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \sin y, z \cdot \cos y\right)
\end{array}
Initial program 99.8%
fma-define99.8%
Simplified99.8%
(FPCore (x y z) :precision binary64 (+ (* z (cos y)) (* x (sin y))))
double code(double x, double y, double z) {
return (z * cos(y)) + (x * 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 = (z * cos(y)) + (x * sin(y))
end function
public static double code(double x, double y, double z) {
return (z * Math.cos(y)) + (x * Math.sin(y));
}
def code(x, y, z): return (z * math.cos(y)) + (x * math.sin(y))
function code(x, y, z) return Float64(Float64(z * cos(y)) + Float64(x * sin(y))) end
function tmp = code(x, y, z) tmp = (z * cos(y)) + (x * sin(y)); end
code[x_, y_, z_] := N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(x * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \cos y + x \cdot \sin y
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (sin y))))
(if (<= x -1.65e+189)
t_0
(if (<= x -9.5e-53)
(* x (+ y (* z (/ (cos y) x))))
(if (or (<= x 1.8e-10) (and (not (<= x 3.8e+46)) (<= x 1.05e+115)))
(* z (cos y))
t_0)))))
double code(double x, double y, double z) {
double t_0 = x * sin(y);
double tmp;
if (x <= -1.65e+189) {
tmp = t_0;
} else if (x <= -9.5e-53) {
tmp = x * (y + (z * (cos(y) / x)));
} else if ((x <= 1.8e-10) || (!(x <= 3.8e+46) && (x <= 1.05e+115))) {
tmp = z * cos(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 = x * sin(y)
if (x <= (-1.65d+189)) then
tmp = t_0
else if (x <= (-9.5d-53)) then
tmp = x * (y + (z * (cos(y) / x)))
else if ((x <= 1.8d-10) .or. (.not. (x <= 3.8d+46)) .and. (x <= 1.05d+115)) then
tmp = z * cos(y)
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.sin(y);
double tmp;
if (x <= -1.65e+189) {
tmp = t_0;
} else if (x <= -9.5e-53) {
tmp = x * (y + (z * (Math.cos(y) / x)));
} else if ((x <= 1.8e-10) || (!(x <= 3.8e+46) && (x <= 1.05e+115))) {
tmp = z * Math.cos(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * math.sin(y) tmp = 0 if x <= -1.65e+189: tmp = t_0 elif x <= -9.5e-53: tmp = x * (y + (z * (math.cos(y) / x))) elif (x <= 1.8e-10) or (not (x <= 3.8e+46) and (x <= 1.05e+115)): tmp = z * math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * sin(y)) tmp = 0.0 if (x <= -1.65e+189) tmp = t_0; elseif (x <= -9.5e-53) tmp = Float64(x * Float64(y + Float64(z * Float64(cos(y) / x)))); elseif ((x <= 1.8e-10) || (!(x <= 3.8e+46) && (x <= 1.05e+115))) tmp = Float64(z * cos(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * sin(y); tmp = 0.0; if (x <= -1.65e+189) tmp = t_0; elseif (x <= -9.5e-53) tmp = x * (y + (z * (cos(y) / x))); elseif ((x <= 1.8e-10) || (~((x <= 3.8e+46)) && (x <= 1.05e+115))) tmp = z * cos(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.65e+189], t$95$0, If[LessEqual[x, -9.5e-53], N[(x * N[(y + N[(z * N[(N[Cos[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 1.8e-10], And[N[Not[LessEqual[x, 3.8e+46]], $MachinePrecision], LessEqual[x, 1.05e+115]]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \sin y\\
\mathbf{if}\;x \leq -1.65 \cdot 10^{+189}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -9.5 \cdot 10^{-53}:\\
\;\;\;\;x \cdot \left(y + z \cdot \frac{\cos y}{x}\right)\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-10} \lor \neg \left(x \leq 3.8 \cdot 10^{+46}\right) \land x \leq 1.05 \cdot 10^{+115}:\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.6500000000000001e189 or 1.8e-10 < x < 3.7999999999999999e46 or 1.05000000000000002e115 < x Initial program 99.7%
Taylor expanded in x around inf 79.5%
if -1.6500000000000001e189 < x < -9.5000000000000008e-53Initial program 99.7%
+-commutative99.7%
*-commutative99.7%
add-cube-cbrt98.6%
associate-*r*98.6%
fma-define98.6%
pow298.6%
Applied egg-rr98.6%
Taylor expanded in y around 0 68.5%
Taylor expanded in x around inf 69.2%
associate-/l*69.1%
Simplified69.1%
if -9.5000000000000008e-53 < x < 1.8e-10 or 3.7999999999999999e46 < x < 1.05000000000000002e115Initial program 99.8%
Taylor expanded in x around 0 90.6%
Final simplification83.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))) (t_1 (* z (+ 1.0 (* x (/ (sin y) z))))))
(if (<= x -5e-52)
t_1
(if (<= x 8.8e-13)
t_0
(if (<= x 2.1e+42) t_1 (if (<= x 6.6e+113) t_0 (* x (sin y))))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double t_1 = z * (1.0 + (x * (sin(y) / z)));
double tmp;
if (x <= -5e-52) {
tmp = t_1;
} else if (x <= 8.8e-13) {
tmp = t_0;
} else if (x <= 2.1e+42) {
tmp = t_1;
} else if (x <= 6.6e+113) {
tmp = t_0;
} else {
tmp = x * sin(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) :: t_1
real(8) :: tmp
t_0 = z * cos(y)
t_1 = z * (1.0d0 + (x * (sin(y) / z)))
if (x <= (-5d-52)) then
tmp = t_1
else if (x <= 8.8d-13) then
tmp = t_0
else if (x <= 2.1d+42) then
tmp = t_1
else if (x <= 6.6d+113) then
tmp = t_0
else
tmp = x * sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double t_1 = z * (1.0 + (x * (Math.sin(y) / z)));
double tmp;
if (x <= -5e-52) {
tmp = t_1;
} else if (x <= 8.8e-13) {
tmp = t_0;
} else if (x <= 2.1e+42) {
tmp = t_1;
} else if (x <= 6.6e+113) {
tmp = t_0;
} else {
tmp = x * Math.sin(y);
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) t_1 = z * (1.0 + (x * (math.sin(y) / z))) tmp = 0 if x <= -5e-52: tmp = t_1 elif x <= 8.8e-13: tmp = t_0 elif x <= 2.1e+42: tmp = t_1 elif x <= 6.6e+113: tmp = t_0 else: tmp = x * math.sin(y) return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) t_1 = Float64(z * Float64(1.0 + Float64(x * Float64(sin(y) / z)))) tmp = 0.0 if (x <= -5e-52) tmp = t_1; elseif (x <= 8.8e-13) tmp = t_0; elseif (x <= 2.1e+42) tmp = t_1; elseif (x <= 6.6e+113) tmp = t_0; else tmp = Float64(x * sin(y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); t_1 = z * (1.0 + (x * (sin(y) / z))); tmp = 0.0; if (x <= -5e-52) tmp = t_1; elseif (x <= 8.8e-13) tmp = t_0; elseif (x <= 2.1e+42) tmp = t_1; elseif (x <= 6.6e+113) tmp = t_0; else tmp = x * sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(1.0 + N[(x * N[(N[Sin[y], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5e-52], t$95$1, If[LessEqual[x, 8.8e-13], t$95$0, If[LessEqual[x, 2.1e+42], t$95$1, If[LessEqual[x, 6.6e+113], t$95$0, N[(x * N[Sin[y], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
t_1 := z \cdot \left(1 + x \cdot \frac{\sin y}{z}\right)\\
\mathbf{if}\;x \leq -5 \cdot 10^{-52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{-13}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{+42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{+113}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \sin y\\
\end{array}
\end{array}
if x < -5e-52 or 8.79999999999999986e-13 < x < 2.09999999999999995e42Initial program 99.7%
Taylor expanded in z around inf 94.3%
associate-/l*94.3%
Simplified94.3%
distribute-rgt-in94.3%
+-commutative94.3%
*-commutative94.3%
associate-*l*84.3%
fma-define84.3%
*-commutative84.3%
Applied egg-rr84.3%
Taylor expanded in y around 0 73.2%
Taylor expanded in z around inf 77.8%
associate-*r/77.8%
Simplified77.8%
if -5e-52 < x < 8.79999999999999986e-13 or 2.09999999999999995e42 < x < 6.6000000000000006e113Initial program 99.8%
Taylor expanded in x around 0 90.6%
if 6.6000000000000006e113 < x Initial program 99.8%
Taylor expanded in x around inf 79.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.5e+26) (not (<= z 62000000.0))) (* z (cos y)) (+ z (* (/ (sin y) z) (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.5e+26) || !(z <= 62000000.0)) {
tmp = z * cos(y);
} else {
tmp = z + ((sin(y) / z) * (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 ((z <= (-1.5d+26)) .or. (.not. (z <= 62000000.0d0))) then
tmp = z * cos(y)
else
tmp = z + ((sin(y) / z) * (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.5e+26) || !(z <= 62000000.0)) {
tmp = z * Math.cos(y);
} else {
tmp = z + ((Math.sin(y) / z) * (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.5e+26) or not (z <= 62000000.0): tmp = z * math.cos(y) else: tmp = z + ((math.sin(y) / z) * (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.5e+26) || !(z <= 62000000.0)) tmp = Float64(z * cos(y)); else tmp = Float64(z + Float64(Float64(sin(y) / z) * Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.5e+26) || ~((z <= 62000000.0))) tmp = z * cos(y); else tmp = z + ((sin(y) / z) * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.5e+26], N[Not[LessEqual[z, 62000000.0]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(z + N[(N[(N[Sin[y], $MachinePrecision] / z), $MachinePrecision] * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+26} \lor \neg \left(z \leq 62000000\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \frac{\sin y}{z} \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if z < -1.49999999999999999e26 or 6.2e7 < z Initial program 99.7%
Taylor expanded in x around 0 86.5%
if -1.49999999999999999e26 < z < 6.2e7Initial program 99.8%
Taylor expanded in z around inf 91.3%
associate-/l*91.3%
Simplified91.3%
distribute-rgt-in91.3%
+-commutative91.3%
*-commutative91.3%
associate-*l*95.8%
fma-define95.8%
*-commutative95.8%
Applied egg-rr95.8%
Taylor expanded in y around 0 81.4%
fma-undefine81.4%
*-commutative81.4%
Applied egg-rr81.4%
Final simplification83.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.000425) (not (<= y 68000000000.0))) (* z (cos y)) (+ z (* y (+ x (* y (+ (* z -0.5) (* -0.16666666666666666 (* x y)))))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.000425) || !(y <= 68000000000.0)) {
tmp = z * cos(y);
} else {
tmp = z + (y * (x + (y * ((z * -0.5) + (-0.16666666666666666 * (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 ((y <= (-0.000425d0)) .or. (.not. (y <= 68000000000.0d0))) then
tmp = z * cos(y)
else
tmp = z + (y * (x + (y * ((z * (-0.5d0)) + ((-0.16666666666666666d0) * (x * y))))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -0.000425) || !(y <= 68000000000.0)) {
tmp = z * Math.cos(y);
} else {
tmp = z + (y * (x + (y * ((z * -0.5) + (-0.16666666666666666 * (x * y))))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.000425) or not (y <= 68000000000.0): tmp = z * math.cos(y) else: tmp = z + (y * (x + (y * ((z * -0.5) + (-0.16666666666666666 * (x * y)))))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.000425) || !(y <= 68000000000.0)) tmp = Float64(z * cos(y)); else tmp = Float64(z + Float64(y * Float64(x + Float64(y * Float64(Float64(z * -0.5) + Float64(-0.16666666666666666 * Float64(x * y))))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.000425) || ~((y <= 68000000000.0))) tmp = z * cos(y); else tmp = z + (y * (x + (y * ((z * -0.5) + (-0.16666666666666666 * (x * y)))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.000425], N[Not[LessEqual[y, 68000000000.0]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(z + N[(y * N[(x + N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(-0.16666666666666666 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.000425 \lor \neg \left(y \leq 68000000000\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + y \cdot \left(x + y \cdot \left(z \cdot -0.5 + -0.16666666666666666 \cdot \left(x \cdot y\right)\right)\right)\\
\end{array}
\end{array}
if y < -4.24999999999999976e-4 or 6.8e10 < y Initial program 99.6%
Taylor expanded in x around 0 61.9%
if -4.24999999999999976e-4 < y < 6.8e10Initial program 100.0%
Taylor expanded in y around 0 99.2%
Final simplification78.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.32) (not (<= y 0.1))) (* x (sin y)) (+ z (* y (+ x (* y (+ (* z -0.5) (* -0.16666666666666666 (* x y)))))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.32) || !(y <= 0.1)) {
tmp = x * sin(y);
} else {
tmp = z + (y * (x + (y * ((z * -0.5) + (-0.16666666666666666 * (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 ((y <= (-0.32d0)) .or. (.not. (y <= 0.1d0))) then
tmp = x * sin(y)
else
tmp = z + (y * (x + (y * ((z * (-0.5d0)) + ((-0.16666666666666666d0) * (x * y))))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -0.32) || !(y <= 0.1)) {
tmp = x * Math.sin(y);
} else {
tmp = z + (y * (x + (y * ((z * -0.5) + (-0.16666666666666666 * (x * y))))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.32) or not (y <= 0.1): tmp = x * math.sin(y) else: tmp = z + (y * (x + (y * ((z * -0.5) + (-0.16666666666666666 * (x * y)))))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.32) || !(y <= 0.1)) tmp = Float64(x * sin(y)); else tmp = Float64(z + Float64(y * Float64(x + Float64(y * Float64(Float64(z * -0.5) + Float64(-0.16666666666666666 * Float64(x * y))))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.32) || ~((y <= 0.1))) tmp = x * sin(y); else tmp = z + (y * (x + (y * ((z * -0.5) + (-0.16666666666666666 * (x * y)))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.32], N[Not[LessEqual[y, 0.1]], $MachinePrecision]], N[(x * N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(z + N[(y * N[(x + N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(-0.16666666666666666 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.32 \lor \neg \left(y \leq 0.1\right):\\
\;\;\;\;x \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;z + y \cdot \left(x + y \cdot \left(z \cdot -0.5 + -0.16666666666666666 \cdot \left(x \cdot y\right)\right)\right)\\
\end{array}
\end{array}
if y < -0.320000000000000007 or 0.10000000000000001 < y Initial program 99.6%
Taylor expanded in x around inf 41.0%
if -0.320000000000000007 < y < 0.10000000000000001Initial program 100.0%
Taylor expanded in y around 0 99.4%
Final simplification67.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -8.8e+220) (not (<= x 5.2e+135))) (* x y) z))
double code(double x, double y, double z) {
double tmp;
if ((x <= -8.8e+220) || !(x <= 5.2e+135)) {
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 <= (-8.8d+220)) .or. (.not. (x <= 5.2d+135))) 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 <= -8.8e+220) || !(x <= 5.2e+135)) {
tmp = x * y;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -8.8e+220) or not (x <= 5.2e+135): tmp = x * y else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -8.8e+220) || !(x <= 5.2e+135)) tmp = Float64(x * y); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -8.8e+220) || ~((x <= 5.2e+135))) tmp = x * y; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -8.8e+220], N[Not[LessEqual[x, 5.2e+135]], $MachinePrecision]], N[(x * y), $MachinePrecision], z]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.8 \cdot 10^{+220} \lor \neg \left(x \leq 5.2 \cdot 10^{+135}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -8.79999999999999957e220 or 5.2e135 < x Initial program 99.7%
Taylor expanded in x around inf 83.6%
Taylor expanded in y around 0 41.1%
if -8.79999999999999957e220 < x < 5.2e135Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
add-cube-cbrt98.2%
associate-*r*98.2%
fma-define98.2%
pow298.2%
Applied egg-rr98.2%
Taylor expanded in y around 0 40.6%
Final simplification40.7%
(FPCore (x y z) :precision binary64 (+ z (* x y)))
double code(double x, double y, double z) {
return z + (x * 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 + (x * y)
end function
public static double code(double x, double y, double z) {
return z + (x * y);
}
def code(x, y, z): return z + (x * y)
function code(x, y, z) return Float64(z + Float64(x * y)) end
function tmp = code(x, y, z) tmp = z + (x * y); end
code[x_, y_, z_] := N[(z + N[(x * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z + x \cdot y
\end{array}
Initial program 99.8%
Taylor expanded in y around 0 47.3%
+-commutative47.3%
Simplified47.3%
Final simplification47.3%
(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.8%
+-commutative99.8%
*-commutative99.8%
add-cube-cbrt98.4%
associate-*r*98.4%
fma-define98.4%
pow298.4%
Applied egg-rr98.4%
Taylor expanded in y around 0 34.8%
herbie shell --seed 2024091
(FPCore (x y z)
:name "Diagrams.ThreeD.Transform:aboutX from diagrams-lib-1.3.0.3, B"
:precision binary64
(+ (* x (sin y)) (* z (cos y))))