
(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 13 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%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -3e+209)
t_0
(if (<= z 1.06e-211)
(+ x z)
(if (<= z 6.8e-177) (+ (sin y) z) (if (<= z 3.7e+101) (+ x z) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -3e+209) {
tmp = t_0;
} else if (z <= 1.06e-211) {
tmp = x + z;
} else if (z <= 6.8e-177) {
tmp = sin(y) + z;
} else if (z <= 3.7e+101) {
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 <= (-3d+209)) then
tmp = t_0
else if (z <= 1.06d-211) then
tmp = x + z
else if (z <= 6.8d-177) then
tmp = sin(y) + z
else if (z <= 3.7d+101) 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 <= -3e+209) {
tmp = t_0;
} else if (z <= 1.06e-211) {
tmp = x + z;
} else if (z <= 6.8e-177) {
tmp = Math.sin(y) + z;
} else if (z <= 3.7e+101) {
tmp = x + z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -3e+209: tmp = t_0 elif z <= 1.06e-211: tmp = x + z elif z <= 6.8e-177: tmp = math.sin(y) + z elif z <= 3.7e+101: 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 <= -3e+209) tmp = t_0; elseif (z <= 1.06e-211) tmp = Float64(x + z); elseif (z <= 6.8e-177) tmp = Float64(sin(y) + z); elseif (z <= 3.7e+101) 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 <= -3e+209) tmp = t_0; elseif (z <= 1.06e-211) tmp = x + z; elseif (z <= 6.8e-177) tmp = sin(y) + z; elseif (z <= 3.7e+101) 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, -3e+209], t$95$0, If[LessEqual[z, 1.06e-211], N[(x + z), $MachinePrecision], If[LessEqual[z, 6.8e-177], N[(N[Sin[y], $MachinePrecision] + z), $MachinePrecision], If[LessEqual[z, 3.7e+101], N[(x + z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -3 \cdot 10^{+209}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{-211}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{-177}:\\
\;\;\;\;\sin y + z\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{+101}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -2.99999999999999985e209 or 3.6999999999999997e101 < z Initial program 99.9%
Taylor expanded in x around inf 99.9%
Taylor expanded in x around 0 95.2%
if -2.99999999999999985e209 < z < 1.0600000000000001e-211 or 6.8000000000000001e-177 < z < 3.6999999999999997e101Initial program 100.0%
Taylor expanded in y around 0 76.0%
if 1.0600000000000001e-211 < z < 6.8000000000000001e-177Initial program 100.0%
Taylor expanded in x around 0 90.3%
Taylor expanded in y around 0 90.3%
Final simplification80.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -1.22e+209)
t_0
(if (<= z -1.52e-96) (+ x z) (if (<= z 650000.0) (+ x (sin y)) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -1.22e+209) {
tmp = t_0;
} else if (z <= -1.52e-96) {
tmp = x + z;
} else if (z <= 650000.0) {
tmp = x + sin(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 * cos(y)
if (z <= (-1.22d+209)) then
tmp = t_0
else if (z <= (-1.52d-96)) then
tmp = x + z
else if (z <= 650000.0d0) then
tmp = x + sin(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 * Math.cos(y);
double tmp;
if (z <= -1.22e+209) {
tmp = t_0;
} else if (z <= -1.52e-96) {
tmp = x + z;
} else if (z <= 650000.0) {
tmp = x + Math.sin(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -1.22e+209: tmp = t_0 elif z <= -1.52e-96: tmp = x + z elif z <= 650000.0: tmp = x + math.sin(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -1.22e+209) tmp = t_0; elseif (z <= -1.52e-96) tmp = Float64(x + z); elseif (z <= 650000.0) tmp = Float64(x + sin(y)); 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.22e+209) tmp = t_0; elseif (z <= -1.52e-96) tmp = x + z; elseif (z <= 650000.0) tmp = x + sin(y); 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.22e+209], t$95$0, If[LessEqual[z, -1.52e-96], N[(x + z), $MachinePrecision], If[LessEqual[z, 650000.0], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -1.22 \cdot 10^{+209}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.52 \cdot 10^{-96}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq 650000:\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -1.21999999999999995e209 or 6.5e5 < z Initial program 99.9%
Taylor expanded in x around inf 98.4%
Taylor expanded in x around 0 90.1%
if -1.21999999999999995e209 < z < -1.52e-96Initial program 99.9%
Taylor expanded in y around 0 81.5%
if -1.52e-96 < z < 6.5e5Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
add-sqr-sqrt67.1%
associate-*r*67.1%
fma-def67.2%
Applied egg-rr67.2%
Taylor expanded in z around 0 92.3%
Final simplification89.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.4e-96) (not (<= z 5.2e-63))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.4e-96) || !(z <= 5.2e-63)) {
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 <= (-6.4d-96)) .or. (.not. (z <= 5.2d-63))) 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 <= -6.4e-96) || !(z <= 5.2e-63)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.4e-96) or not (z <= 5.2e-63): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.4e-96) || !(z <= 5.2e-63)) 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 <= -6.4e-96) || ~((z <= 5.2e-63))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.4e-96], N[Not[LessEqual[z, 5.2e-63]], $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 -6.4 \cdot 10^{-96} \lor \neg \left(z \leq 5.2 \cdot 10^{-63}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -6.40000000000000023e-96 or 5.2000000000000003e-63 < z Initial program 99.9%
Taylor expanded in x around inf 95.3%
if -6.40000000000000023e-96 < z < 5.2000000000000003e-63Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
add-sqr-sqrt61.7%
associate-*r*61.7%
fma-def61.7%
Applied egg-rr61.7%
Taylor expanded in z around 0 95.4%
Final simplification95.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -80000000.0) (not (<= z 1.6e-5))) (+ x (* z (cos y))) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -80000000.0) || !(z <= 1.6e-5)) {
tmp = x + (z * cos(y));
} else {
tmp = z + (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 <= (-80000000.0d0)) .or. (.not. (z <= 1.6d-5))) then
tmp = x + (z * cos(y))
else
tmp = z + (x + sin(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -80000000.0) || !(z <= 1.6e-5)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -80000000.0) or not (z <= 1.6e-5): tmp = x + (z * math.cos(y)) else: tmp = z + (x + math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -80000000.0) || !(z <= 1.6e-5)) tmp = Float64(x + Float64(z * cos(y))); else tmp = Float64(z + Float64(x + sin(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -80000000.0) || ~((z <= 1.6e-5))) tmp = x + (z * cos(y)); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -80000000.0], N[Not[LessEqual[z, 1.6e-5]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -80000000 \lor \neg \left(z \leq 1.6 \cdot 10^{-5}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -8e7 or 1.59999999999999993e-5 < z Initial program 99.9%
Taylor expanded in x around inf 98.8%
if -8e7 < z < 1.59999999999999993e-5Initial program 100.0%
Taylor expanded in y around 0 99.2%
Final simplification99.0%
(FPCore (x y z) :precision binary64 (if (<= y -7000000000000.0) (+ x z) (if (<= y 27500.0) (+ z (+ x y)) (if (<= y 9e+69) (sin y) (+ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7000000000000.0) {
tmp = x + z;
} else if (y <= 27500.0) {
tmp = z + (x + y);
} else if (y <= 9e+69) {
tmp = sin(y);
} else {
tmp = 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 <= (-7000000000000.0d0)) then
tmp = x + z
else if (y <= 27500.0d0) then
tmp = z + (x + y)
else if (y <= 9d+69) then
tmp = sin(y)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -7000000000000.0) {
tmp = x + z;
} else if (y <= 27500.0) {
tmp = z + (x + y);
} else if (y <= 9e+69) {
tmp = Math.sin(y);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7000000000000.0: tmp = x + z elif y <= 27500.0: tmp = z + (x + y) elif y <= 9e+69: tmp = math.sin(y) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7000000000000.0) tmp = Float64(x + z); elseif (y <= 27500.0) tmp = Float64(z + Float64(x + y)); elseif (y <= 9e+69) tmp = sin(y); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -7000000000000.0) tmp = x + z; elseif (y <= 27500.0) tmp = z + (x + y); elseif (y <= 9e+69) tmp = sin(y); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7000000000000.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 27500.0], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+69], N[Sin[y], $MachinePrecision], N[(x + z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7000000000000:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 27500:\\
\;\;\;\;z + \left(x + y\right)\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+69}:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -7e12 or 8.9999999999999999e69 < y Initial program 99.9%
Taylor expanded in y around 0 43.1%
if -7e12 < y < 27500Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
add-sqr-sqrt52.2%
associate-*r*52.2%
fma-def52.3%
Applied egg-rr52.3%
Taylor expanded in y around 0 98.3%
associate-+r+98.3%
+-commutative98.3%
associate-+l+98.4%
Simplified98.4%
if 27500 < y < 8.9999999999999999e69Initial program 99.8%
Taylor expanded in x around 0 96.7%
Taylor expanded in z around 0 54.9%
Final simplification74.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.5e+209) (not (<= z 3.7e+101))) (* z (cos y)) (+ x z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.5e+209) || !(z <= 3.7e+101)) {
tmp = z * cos(y);
} else {
tmp = 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 <= (-2.5d+209)) .or. (.not. (z <= 3.7d+101))) then
tmp = z * cos(y)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.5e+209) || !(z <= 3.7e+101)) {
tmp = z * Math.cos(y);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.5e+209) or not (z <= 3.7e+101): tmp = z * math.cos(y) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.5e+209) || !(z <= 3.7e+101)) tmp = Float64(z * cos(y)); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.5e+209) || ~((z <= 3.7e+101))) tmp = z * cos(y); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.5e+209], N[Not[LessEqual[z, 3.7e+101]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+209} \lor \neg \left(z \leq 3.7 \cdot 10^{+101}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if z < -2.49999999999999982e209 or 3.6999999999999997e101 < z Initial program 99.9%
Taylor expanded in x around inf 99.9%
Taylor expanded in x around 0 95.2%
if -2.49999999999999982e209 < z < 3.6999999999999997e101Initial program 100.0%
Taylor expanded in y around 0 74.3%
Final simplification79.3%
(FPCore (x y z) :precision binary64 (if (<= y -3.4e+15) (+ x z) (if (<= y 9e+69) (+ y (+ x z)) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.4e+15) {
tmp = x + z;
} else if (y <= 9e+69) {
tmp = y + (x + z);
} else {
tmp = 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 <= (-3.4d+15)) then
tmp = x + z
else if (y <= 9d+69) then
tmp = y + (x + z)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.4e+15) {
tmp = x + z;
} else if (y <= 9e+69) {
tmp = y + (x + z);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.4e+15: tmp = x + z elif y <= 9e+69: tmp = y + (x + z) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.4e+15) tmp = Float64(x + z); elseif (y <= 9e+69) tmp = Float64(y + Float64(x + z)); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.4e+15) tmp = x + z; elseif (y <= 9e+69) tmp = y + (x + z); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.4e+15], N[(x + z), $MachinePrecision], If[LessEqual[y, 9e+69], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+15}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+69}:\\
\;\;\;\;y + \left(x + z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -3.4e15 or 8.9999999999999999e69 < y Initial program 99.9%
Taylor expanded in y around 0 43.1%
if -3.4e15 < y < 8.9999999999999999e69Initial program 100.0%
Taylor expanded in y around 0 92.7%
Final simplification73.1%
(FPCore (x y z) :precision binary64 (if (<= y -7500000000000.0) (+ x z) (if (<= y 9.2e+69) (+ z (+ x y)) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7500000000000.0) {
tmp = x + z;
} else if (y <= 9.2e+69) {
tmp = z + (x + y);
} else {
tmp = 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 <= (-7500000000000.0d0)) then
tmp = x + z
else if (y <= 9.2d+69) then
tmp = z + (x + y)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -7500000000000.0) {
tmp = x + z;
} else if (y <= 9.2e+69) {
tmp = z + (x + y);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7500000000000.0: tmp = x + z elif y <= 9.2e+69: tmp = z + (x + y) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7500000000000.0) tmp = Float64(x + z); elseif (y <= 9.2e+69) tmp = Float64(z + Float64(x + y)); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -7500000000000.0) tmp = x + z; elseif (y <= 9.2e+69) tmp = z + (x + y); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7500000000000.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 9.2e+69], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7500000000000:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 9.2 \cdot 10^{+69}:\\
\;\;\;\;z + \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -7.5e12 or 9.20000000000000067e69 < y Initial program 99.9%
Taylor expanded in y around 0 43.1%
if -7.5e12 < y < 9.20000000000000067e69Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
add-sqr-sqrt53.4%
associate-*r*53.4%
fma-def53.4%
Applied egg-rr53.4%
Taylor expanded in y around 0 92.7%
associate-+r+92.7%
+-commutative92.7%
associate-+l+92.7%
Simplified92.7%
Final simplification73.1%
(FPCore (x y z) :precision binary64 (if (<= x -4.6e-169) (+ x z) (if (<= x 1.55e-216) (+ y z) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.6e-169) {
tmp = x + z;
} else if (x <= 1.55e-216) {
tmp = y + z;
} else {
tmp = 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 (x <= (-4.6d-169)) then
tmp = x + z
else if (x <= 1.55d-216) then
tmp = y + z
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4.6e-169) {
tmp = x + z;
} else if (x <= 1.55e-216) {
tmp = y + z;
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.6e-169: tmp = x + z elif x <= 1.55e-216: tmp = y + z else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.6e-169) tmp = Float64(x + z); elseif (x <= 1.55e-216) tmp = Float64(y + z); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.6e-169) tmp = x + z; elseif (x <= 1.55e-216) tmp = y + z; else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.6e-169], N[(x + z), $MachinePrecision], If[LessEqual[x, 1.55e-216], N[(y + z), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6 \cdot 10^{-169}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-216}:\\
\;\;\;\;y + z\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if x < -4.6000000000000002e-169 or 1.5500000000000001e-216 < x Initial program 100.0%
Taylor expanded in y around 0 73.2%
if -4.6000000000000002e-169 < x < 1.5500000000000001e-216Initial program 99.9%
Taylor expanded in x around 0 99.2%
Taylor expanded in y around 0 64.4%
+-commutative64.4%
Simplified64.4%
Final simplification71.7%
(FPCore (x y z) :precision binary64 (if (<= x -2e-31) x (if (<= x 1.42e-61) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -2e-31) {
tmp = x;
} else if (x <= 1.42e-61) {
tmp = 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 (x <= (-2d-31)) then
tmp = x
else if (x <= 1.42d-61) then
tmp = z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2e-31) {
tmp = x;
} else if (x <= 1.42e-61) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2e-31: tmp = x elif x <= 1.42e-61: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2e-31) tmp = x; elseif (x <= 1.42e-61) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2e-31) tmp = x; elseif (x <= 1.42e-61) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2e-31], x, If[LessEqual[x, 1.42e-61], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-31}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.42 \cdot 10^{-61}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2e-31 or 1.42e-61 < x Initial program 99.9%
Taylor expanded in x around inf 93.9%
Taylor expanded in x around inf 69.5%
if -2e-31 < x < 1.42e-61Initial program 99.9%
Taylor expanded in x around inf 73.0%
Taylor expanded in x around 0 64.4%
Taylor expanded in y around 0 46.9%
Final simplification59.3%
(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 y around 0 68.5%
Final simplification68.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.9%
Taylor expanded in x around inf 84.4%
Taylor expanded in x around inf 42.9%
Final simplification42.9%
herbie shell --seed 2023174
(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))))