
(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}
\\
\left(x + \sin y\right) + 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}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
(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}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Initial program 99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -1.25e+174)
t_0
(if (<= z -5.4e-23)
(+ x z)
(if (<= z 3e-16) (+ x (sin y)) (if (<= z 6.6e+165) (+ x z) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -1.25e+174) {
tmp = t_0;
} else if (z <= -5.4e-23) {
tmp = x + z;
} else if (z <= 3e-16) {
tmp = x + sin(y);
} else if (z <= 6.6e+165) {
tmp = 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 * cos(y)
if (z <= (-1.25d+174)) then
tmp = t_0
else if (z <= (-5.4d-23)) then
tmp = x + z
else if (z <= 3d-16) then
tmp = x + sin(y)
else if (z <= 6.6d+165) then
tmp = 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 * Math.cos(y);
double tmp;
if (z <= -1.25e+174) {
tmp = t_0;
} else if (z <= -5.4e-23) {
tmp = x + z;
} else if (z <= 3e-16) {
tmp = x + Math.sin(y);
} else if (z <= 6.6e+165) {
tmp = x + z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -1.25e+174: tmp = t_0 elif z <= -5.4e-23: tmp = x + z elif z <= 3e-16: tmp = x + math.sin(y) elif z <= 6.6e+165: tmp = x + z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -1.25e+174) tmp = t_0; elseif (z <= -5.4e-23) tmp = Float64(x + z); elseif (z <= 3e-16) tmp = Float64(x + sin(y)); elseif (z <= 6.6e+165) tmp = Float64(x + z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -1.25e+174) tmp = t_0; elseif (z <= -5.4e-23) tmp = x + z; elseif (z <= 3e-16) tmp = x + sin(y); elseif (z <= 6.6e+165) tmp = x + z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.25e+174], t$95$0, If[LessEqual[z, -5.4e-23], N[(x + z), $MachinePrecision], If[LessEqual[z, 3e-16], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.6e+165], N[(x + z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{+174}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -5.4 \cdot 10^{-23}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-16}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{+165}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.2499999999999999e174 or 6.5999999999999997e165 < z Initial program 99.8%
Taylor expanded in x around inf 99.8%
Taylor expanded in x around inf 61.7%
associate-/l*61.6%
Simplified61.6%
Taylor expanded in x around 0 94.4%
if -1.2499999999999999e174 < z < -5.3999999999999997e-23 or 2.99999999999999994e-16 < z < 6.5999999999999997e165Initial program 99.9%
Taylor expanded in x around inf 98.7%
Taylor expanded in y around 0 84.5%
+-commutative84.5%
Simplified84.5%
if -5.3999999999999997e-23 < z < 2.99999999999999994e-16Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in z around 0 95.7%
Final simplification91.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -1.3e+175)
t_0
(if (<= z 3.6e-94)
(+ x z)
(if (<= z 1.6e-57) (sin y) (if (<= z 6.5e+165) (+ x z) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -1.3e+175) {
tmp = t_0;
} else if (z <= 3.6e-94) {
tmp = x + z;
} else if (z <= 1.6e-57) {
tmp = sin(y);
} else if (z <= 6.5e+165) {
tmp = 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 * cos(y)
if (z <= (-1.3d+175)) then
tmp = t_0
else if (z <= 3.6d-94) then
tmp = x + z
else if (z <= 1.6d-57) then
tmp = sin(y)
else if (z <= 6.5d+165) then
tmp = 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 * Math.cos(y);
double tmp;
if (z <= -1.3e+175) {
tmp = t_0;
} else if (z <= 3.6e-94) {
tmp = x + z;
} else if (z <= 1.6e-57) {
tmp = Math.sin(y);
} else if (z <= 6.5e+165) {
tmp = x + z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -1.3e+175: tmp = t_0 elif z <= 3.6e-94: tmp = x + z elif z <= 1.6e-57: tmp = math.sin(y) elif z <= 6.5e+165: tmp = x + z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -1.3e+175) tmp = t_0; elseif (z <= 3.6e-94) tmp = Float64(x + z); elseif (z <= 1.6e-57) tmp = sin(y); elseif (z <= 6.5e+165) tmp = Float64(x + z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -1.3e+175) tmp = t_0; elseif (z <= 3.6e-94) tmp = x + z; elseif (z <= 1.6e-57) tmp = sin(y); elseif (z <= 6.5e+165) tmp = x + z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e+175], t$95$0, If[LessEqual[z, 3.6e-94], N[(x + z), $MachinePrecision], If[LessEqual[z, 1.6e-57], N[Sin[y], $MachinePrecision], If[LessEqual[z, 6.5e+165], N[(x + z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{+175}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-94}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-57}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+165}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.3e175 or 6.4999999999999999e165 < z Initial program 99.8%
Taylor expanded in x around inf 99.8%
Taylor expanded in x around inf 61.7%
associate-/l*61.6%
Simplified61.6%
Taylor expanded in x around 0 94.4%
if -1.3e175 < z < 3.6e-94 or 1.6e-57 < z < 6.4999999999999999e165Initial program 99.9%
Taylor expanded in x around inf 84.9%
Taylor expanded in y around 0 79.0%
+-commutative79.0%
Simplified79.0%
if 3.6e-94 < z < 1.6e-57Initial program 100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in z around 0 100.0%
Final simplification82.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.7e-12) (not (<= z 4.5e+18))) (+ x (* z (cos y))) (+ (+ x (sin y)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.7e-12) || !(z <= 4.5e+18)) {
tmp = x + (z * cos(y));
} else {
tmp = (x + sin(y)) + z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.7d-12)) .or. (.not. (z <= 4.5d+18))) then
tmp = x + (z * cos(y))
else
tmp = (x + sin(y)) + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.7e-12) || !(z <= 4.5e+18)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = (x + Math.sin(y)) + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.7e-12) or not (z <= 4.5e+18): tmp = x + (z * math.cos(y)) else: tmp = (x + math.sin(y)) + z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.7e-12) || !(z <= 4.5e+18)) tmp = Float64(x + Float64(z * cos(y))); else tmp = Float64(Float64(x + sin(y)) + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.7e-12) || ~((z <= 4.5e+18))) tmp = x + (z * cos(y)); else tmp = (x + sin(y)) + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.7e-12], N[Not[LessEqual[z, 4.5e+18]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-12} \lor \neg \left(z \leq 4.5 \cdot 10^{+18}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;\left(x + \sin y\right) + z\\
\end{array}
\end{array}
if z < -1.7e-12 or 4.5e18 < z Initial program 99.8%
Taylor expanded in x around inf 99.8%
if -1.7e-12 < z < 4.5e18Initial program 100.0%
Taylor expanded in y around 0 99.4%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.3e-18) (not (<= z 6e-16))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.3e-18) || !(z <= 6e-16)) {
tmp = x + (z * cos(y));
} 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) :: tmp
if ((z <= (-4.3d-18)) .or. (.not. (z <= 6d-16))) then
tmp = x + (z * cos(y))
else
tmp = x + sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4.3e-18) || !(z <= 6e-16)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.3e-18) or not (z <= 6e-16): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.3e-18) || !(z <= 6e-16)) tmp = Float64(x + Float64(z * cos(y))); else tmp = Float64(x + sin(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.3e-18) || ~((z <= 6e-16))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.3e-18], N[Not[LessEqual[z, 6e-16]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{-18} \lor \neg \left(z \leq 6 \cdot 10^{-16}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -4.3000000000000002e-18 or 5.99999999999999987e-16 < z Initial program 99.8%
Taylor expanded in x around inf 99.1%
if -4.3000000000000002e-18 < z < 5.99999999999999987e-16Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in z around 0 95.7%
Final simplification97.5%
(FPCore (x y z) :precision binary64 (if (<= y -3.1) (+ x z) (if (<= y 1.45e+20) (+ z (+ x y)) (+ x (* z (* x (/ 1.0 x)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.1) {
tmp = x + z;
} else if (y <= 1.45e+20) {
tmp = z + (x + y);
} else {
tmp = x + (z * (x * (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 (y <= (-3.1d0)) then
tmp = x + z
else if (y <= 1.45d+20) then
tmp = z + (x + y)
else
tmp = x + (z * (x * (1.0d0 / x)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.1) {
tmp = x + z;
} else if (y <= 1.45e+20) {
tmp = z + (x + y);
} else {
tmp = x + (z * (x * (1.0 / x)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.1: tmp = x + z elif y <= 1.45e+20: tmp = z + (x + y) else: tmp = x + (z * (x * (1.0 / x))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.1) tmp = Float64(x + z); elseif (y <= 1.45e+20) tmp = Float64(z + Float64(x + y)); else tmp = Float64(x + Float64(z * Float64(x * Float64(1.0 / x)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.1) tmp = x + z; elseif (y <= 1.45e+20) tmp = z + (x + y); else tmp = x + (z * (x * (1.0 / x))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.1], N[(x + z), $MachinePrecision], If[LessEqual[y, 1.45e+20], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(x * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+20}:\\
\;\;\;\;z + \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x \cdot \frac{1}{x}\right)\\
\end{array}
\end{array}
if y < -3.10000000000000009Initial program 99.8%
Taylor expanded in x around inf 81.0%
Taylor expanded in y around 0 53.8%
+-commutative53.8%
Simplified53.8%
if -3.10000000000000009 < y < 1.45e20Initial program 100.0%
Taylor expanded in y around 0 98.8%
Taylor expanded in y around 0 96.7%
+-commutative96.7%
Simplified96.7%
if 1.45e20 < y Initial program 99.8%
Taylor expanded in x around inf 79.9%
Taylor expanded in x around inf 74.7%
associate-/l*74.7%
Simplified74.7%
+-commutative74.7%
distribute-rgt-in74.7%
associate-*l*79.8%
*-un-lft-identity79.8%
Applied egg-rr79.8%
Taylor expanded in y around 0 50.4%
Final simplification75.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.1) (not (<= y 3.4e+20))) (+ x z) (+ z (+ x y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.1) || !(y <= 3.4e+20)) {
tmp = x + 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 ((y <= (-3.1d0)) .or. (.not. (y <= 3.4d+20))) then
tmp = x + 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 ((y <= -3.1) || !(y <= 3.4e+20)) {
tmp = x + z;
} else {
tmp = z + (x + y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.1) or not (y <= 3.4e+20): tmp = x + z else: tmp = z + (x + y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.1) || !(y <= 3.4e+20)) tmp = Float64(x + z); else tmp = Float64(z + Float64(x + y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.1) || ~((y <= 3.4e+20))) tmp = x + z; else tmp = z + (x + y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.1], N[Not[LessEqual[y, 3.4e+20]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \lor \neg \left(y \leq 3.4 \cdot 10^{+20}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + y\right)\\
\end{array}
\end{array}
if y < -3.10000000000000009 or 3.4e20 < y Initial program 99.8%
Taylor expanded in x around inf 80.5%
Taylor expanded in y around 0 52.3%
+-commutative52.3%
Simplified52.3%
if -3.10000000000000009 < y < 3.4e20Initial program 100.0%
Taylor expanded in y around 0 98.8%
Taylor expanded in y around 0 96.7%
+-commutative96.7%
Simplified96.7%
Final simplification75.1%
(FPCore (x y z) :precision binary64 (if (<= y -9.5) x (if (<= y 2e+52) (+ x y) x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -9.5) {
tmp = x;
} else if (y <= 2e+52) {
tmp = x + y;
} 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 (y <= (-9.5d0)) then
tmp = x
else if (y <= 2d+52) then
tmp = x + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -9.5) {
tmp = x;
} else if (y <= 2e+52) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9.5: tmp = x elif y <= 2e+52: tmp = x + y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9.5) tmp = x; elseif (y <= 2e+52) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9.5) tmp = x; elseif (y <= 2e+52) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9.5], x, If[LessEqual[y, 2e+52], N[(x + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+52}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -9.5 or 2e52 < y Initial program 99.8%
Taylor expanded in x around inf 81.2%
Taylor expanded in x around inf 50.9%
if -9.5 < y < 2e52Initial program 100.0%
Taylor expanded in y around 0 97.0%
Taylor expanded in z around 0 54.4%
Taylor expanded in y around 0 51.0%
+-commutative93.6%
Simplified51.0%
Final simplification51.0%
(FPCore (x y z) :precision binary64 (+ x z))
double code(double x, double y, double z) {
return 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 + z
end function
public static double code(double x, double y, double z) {
return x + z;
}
def code(x, y, z): return x + z
function code(x, y, z) return Float64(x + z) end
function tmp = code(x, y, z) tmp = x + z; end
code[x_, y_, z_] := N[(x + z), $MachinePrecision]
\begin{array}{l}
\\
x + z
\end{array}
Initial program 99.9%
Taylor expanded in x around inf 85.8%
Taylor expanded in y around 0 71.4%
+-commutative71.4%
Simplified71.4%
Final simplification71.4%
(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.9%
Taylor expanded in x around inf 85.8%
Taylor expanded in x around inf 47.4%
herbie shell --seed 2024103
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
:precision binary64
(+ (+ x (sin y)) (* z (cos y))))