
(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 14 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 (if (or (<= x -2.1e-27) (not (<= x 0.036))) (* x (+ 1.0 (* (cos y) (/ z x)))) (+ (sin y) (* z (cos y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.1e-27) || !(x <= 0.036)) {
tmp = x * (1.0 + (cos(y) * (z / x)));
} else {
tmp = sin(y) + (z * cos(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 <= (-2.1d-27)) .or. (.not. (x <= 0.036d0))) then
tmp = x * (1.0d0 + (cos(y) * (z / x)))
else
tmp = sin(y) + (z * cos(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.1e-27) || !(x <= 0.036)) {
tmp = x * (1.0 + (Math.cos(y) * (z / x)));
} else {
tmp = Math.sin(y) + (z * Math.cos(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.1e-27) or not (x <= 0.036): tmp = x * (1.0 + (math.cos(y) * (z / x))) else: tmp = math.sin(y) + (z * math.cos(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.1e-27) || !(x <= 0.036)) tmp = Float64(x * Float64(1.0 + Float64(cos(y) * Float64(z / x)))); else tmp = Float64(sin(y) + Float64(z * cos(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.1e-27) || ~((x <= 0.036))) tmp = x * (1.0 + (cos(y) * (z / x))); else tmp = sin(y) + (z * cos(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.1e-27], N[Not[LessEqual[x, 0.036]], $MachinePrecision]], N[(x * N[(1.0 + N[(N[Cos[y], $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-27} \lor \neg \left(x \leq 0.036\right):\\
\;\;\;\;x \cdot \left(1 + \cos y \cdot \frac{z}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin y + z \cdot \cos y\\
\end{array}
\end{array}
if x < -2.10000000000000015e-27 or 0.0359999999999999973 < x Initial program 100.0%
Taylor expanded in x around inf 99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 77.8%
Taylor expanded in z around inf 97.9%
*-commutative97.9%
associate-/l*97.9%
Simplified97.9%
if -2.10000000000000015e-27 < x < 0.0359999999999999973Initial program 99.8%
Taylor expanded in x around 0 93.5%
Final simplification96.0%
(FPCore (x y z)
:precision binary64
(if (<= z -1.8e+202)
(+ (* z (cos y)) (+ x y))
(if (or (<= z -6e+26) (not (<= z 5.5e-32)))
(* x (+ 1.0 (* (cos y) (/ z x))))
(+ (+ x (sin y)) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.8e+202) {
tmp = (z * cos(y)) + (x + y);
} else if ((z <= -6e+26) || !(z <= 5.5e-32)) {
tmp = x * (1.0 + (cos(y) * (z / x)));
} 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.8d+202)) then
tmp = (z * cos(y)) + (x + y)
else if ((z <= (-6d+26)) .or. (.not. (z <= 5.5d-32))) then
tmp = x * (1.0d0 + (cos(y) * (z / x)))
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.8e+202) {
tmp = (z * Math.cos(y)) + (x + y);
} else if ((z <= -6e+26) || !(z <= 5.5e-32)) {
tmp = x * (1.0 + (Math.cos(y) * (z / x)));
} else {
tmp = (x + Math.sin(y)) + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.8e+202: tmp = (z * math.cos(y)) + (x + y) elif (z <= -6e+26) or not (z <= 5.5e-32): tmp = x * (1.0 + (math.cos(y) * (z / x))) else: tmp = (x + math.sin(y)) + z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.8e+202) tmp = Float64(Float64(z * cos(y)) + Float64(x + y)); elseif ((z <= -6e+26) || !(z <= 5.5e-32)) tmp = Float64(x * Float64(1.0 + Float64(cos(y) * Float64(z / x)))); 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.8e+202) tmp = (z * cos(y)) + (x + y); elseif ((z <= -6e+26) || ~((z <= 5.5e-32))) tmp = x * (1.0 + (cos(y) * (z / x))); else tmp = (x + sin(y)) + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.8e+202], N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -6e+26], N[Not[LessEqual[z, 5.5e-32]], $MachinePrecision]], N[(x * N[(1.0 + N[(N[Cos[y], $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+202}:\\
\;\;\;\;z \cdot \cos y + \left(x + y\right)\\
\mathbf{elif}\;z \leq -6 \cdot 10^{+26} \lor \neg \left(z \leq 5.5 \cdot 10^{-32}\right):\\
\;\;\;\;x \cdot \left(1 + \cos y \cdot \frac{z}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + \sin y\right) + z\\
\end{array}
\end{array}
if z < -1.80000000000000004e202Initial program 99.9%
Taylor expanded in y around 0 96.1%
+-commutative96.1%
Simplified96.1%
if -1.80000000000000004e202 < z < -5.99999999999999994e26 or 5.50000000000000024e-32 < z Initial program 99.8%
Taylor expanded in x around inf 85.5%
associate-/l*85.4%
Simplified85.4%
Taylor expanded in y around 0 58.2%
Taylor expanded in z around inf 85.5%
*-commutative85.5%
associate-/l*85.5%
Simplified85.5%
if -5.99999999999999994e26 < z < 5.50000000000000024e-32Initial program 100.0%
Taylor expanded in y around 0 98.6%
Final simplification92.9%
(FPCore (x y z)
:precision binary64
(if (<= z -5e+205)
(+ (* z (cos y)) (+ x y))
(if (or (<= z -6e+26) (not (<= z 6.6e+18)))
(* x (+ 1.0 (* z (/ (cos y) x))))
(+ (+ x (sin y)) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5e+205) {
tmp = (z * cos(y)) + (x + y);
} else if ((z <= -6e+26) || !(z <= 6.6e+18)) {
tmp = x * (1.0 + (z * (cos(y) / x)));
} 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 <= (-5d+205)) then
tmp = (z * cos(y)) + (x + y)
else if ((z <= (-6d+26)) .or. (.not. (z <= 6.6d+18))) then
tmp = x * (1.0d0 + (z * (cos(y) / x)))
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 <= -5e+205) {
tmp = (z * Math.cos(y)) + (x + y);
} else if ((z <= -6e+26) || !(z <= 6.6e+18)) {
tmp = x * (1.0 + (z * (Math.cos(y) / x)));
} else {
tmp = (x + Math.sin(y)) + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5e+205: tmp = (z * math.cos(y)) + (x + y) elif (z <= -6e+26) or not (z <= 6.6e+18): tmp = x * (1.0 + (z * (math.cos(y) / x))) else: tmp = (x + math.sin(y)) + z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5e+205) tmp = Float64(Float64(z * cos(y)) + Float64(x + y)); elseif ((z <= -6e+26) || !(z <= 6.6e+18)) tmp = Float64(x * Float64(1.0 + Float64(z * Float64(cos(y) / x)))); else tmp = Float64(Float64(x + sin(y)) + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5e+205) tmp = (z * cos(y)) + (x + y); elseif ((z <= -6e+26) || ~((z <= 6.6e+18))) tmp = x * (1.0 + (z * (cos(y) / x))); else tmp = (x + sin(y)) + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5e+205], N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -6e+26], N[Not[LessEqual[z, 6.6e+18]], $MachinePrecision]], N[(x * N[(1.0 + N[(z * N[(N[Cos[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+205}:\\
\;\;\;\;z \cdot \cos y + \left(x + y\right)\\
\mathbf{elif}\;z \leq -6 \cdot 10^{+26} \lor \neg \left(z \leq 6.6 \cdot 10^{+18}\right):\\
\;\;\;\;x \cdot \left(1 + z \cdot \frac{\cos y}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + \sin y\right) + z\\
\end{array}
\end{array}
if z < -5.0000000000000002e205Initial program 99.9%
Taylor expanded in y around 0 95.9%
+-commutative95.9%
Simplified95.9%
if -5.0000000000000002e205 < z < -5.99999999999999994e26 or 6.6e18 < z Initial program 99.8%
Taylor expanded in x around inf 84.4%
associate-/l*84.2%
Simplified84.2%
Taylor expanded in y around 0 57.8%
Taylor expanded in z around inf 84.4%
associate-/l*84.2%
Simplified84.2%
if -5.99999999999999994e26 < z < 6.6e18Initial program 100.0%
Taylor expanded in y around 0 98.7%
Final simplification92.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -1.25e+209)
(+ t_0 (+ x y))
(if (or (<= z -2.8e+27) (not (<= z 2.2e+111))) t_0 (+ (+ x (sin y)) z)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -1.25e+209) {
tmp = t_0 + (x + y);
} else if ((z <= -2.8e+27) || !(z <= 2.2e+111)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = z * cos(y)
if (z <= (-1.25d+209)) then
tmp = t_0 + (x + y)
else if ((z <= (-2.8d+27)) .or. (.not. (z <= 2.2d+111))) then
tmp = t_0
else
tmp = (x + sin(y)) + z
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+209) {
tmp = t_0 + (x + y);
} else if ((z <= -2.8e+27) || !(z <= 2.2e+111)) {
tmp = t_0;
} else {
tmp = (x + Math.sin(y)) + z;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -1.25e+209: tmp = t_0 + (x + y) elif (z <= -2.8e+27) or not (z <= 2.2e+111): tmp = t_0 else: tmp = (x + math.sin(y)) + z return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -1.25e+209) tmp = Float64(t_0 + Float64(x + y)); elseif ((z <= -2.8e+27) || !(z <= 2.2e+111)) tmp = t_0; else tmp = Float64(Float64(x + sin(y)) + z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -1.25e+209) tmp = t_0 + (x + y); elseif ((z <= -2.8e+27) || ~((z <= 2.2e+111))) tmp = t_0; else tmp = (x + sin(y)) + z; 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+209], N[(t$95$0 + N[(x + y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -2.8e+27], N[Not[LessEqual[z, 2.2e+111]], $MachinePrecision]], t$95$0, N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{+209}:\\
\;\;\;\;t\_0 + \left(x + y\right)\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{+27} \lor \neg \left(z \leq 2.2 \cdot 10^{+111}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(x + \sin y\right) + z\\
\end{array}
\end{array}
if z < -1.24999999999999991e209Initial program 99.9%
Taylor expanded in y around 0 95.2%
+-commutative95.2%
Simplified95.2%
if -1.24999999999999991e209 < z < -2.7999999999999999e27 or 2.19999999999999999e111 < z Initial program 99.8%
Taylor expanded in z around inf 79.6%
if -2.7999999999999999e27 < z < 2.19999999999999999e111Initial program 100.0%
Taylor expanded in y around 0 94.7%
Final simplification89.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -1.9e+27)
t_0
(if (<= z 8.6e-204) (+ z (+ x y)) (if (<= z 1.15e+111) (+ x z) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -1.9e+27) {
tmp = t_0;
} else if (z <= 8.6e-204) {
tmp = z + (x + y);
} else if (z <= 1.15e+111) {
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.9d+27)) then
tmp = t_0
else if (z <= 8.6d-204) then
tmp = z + (x + y)
else if (z <= 1.15d+111) 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.9e+27) {
tmp = t_0;
} else if (z <= 8.6e-204) {
tmp = z + (x + y);
} else if (z <= 1.15e+111) {
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.9e+27: tmp = t_0 elif z <= 8.6e-204: tmp = z + (x + y) elif z <= 1.15e+111: 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.9e+27) tmp = t_0; elseif (z <= 8.6e-204) tmp = Float64(z + Float64(x + y)); elseif (z <= 1.15e+111) 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.9e+27) tmp = t_0; elseif (z <= 8.6e-204) tmp = z + (x + y); elseif (z <= 1.15e+111) 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.9e+27], t$95$0, If[LessEqual[z, 8.6e-204], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.15e+111], N[(x + z), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -1.9 \cdot 10^{+27}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{-204}:\\
\;\;\;\;z + \left(x + y\right)\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+111}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.90000000000000011e27 or 1.15000000000000001e111 < z Initial program 99.8%
Taylor expanded in z around inf 78.2%
if -1.90000000000000011e27 < z < 8.6000000000000005e-204Initial program 100.0%
Taylor expanded in y around 0 68.0%
+-commutative68.0%
+-commutative68.0%
associate-+l+68.0%
Simplified68.0%
if 8.6000000000000005e-204 < z < 1.15000000000000001e111Initial program 99.9%
Taylor expanded in y around 0 71.6%
+-commutative71.6%
Simplified71.6%
Final simplification73.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.05e+27) (not (<= z 1.55e+111))) (* z (cos y)) (+ (+ x (sin y)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.05e+27) || !(z <= 1.55e+111)) {
tmp = 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 <= (-3.05d+27)) .or. (.not. (z <= 1.55d+111))) then
tmp = 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 <= -3.05e+27) || !(z <= 1.55e+111)) {
tmp = z * Math.cos(y);
} else {
tmp = (x + Math.sin(y)) + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.05e+27) or not (z <= 1.55e+111): tmp = z * math.cos(y) else: tmp = (x + math.sin(y)) + z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.05e+27) || !(z <= 1.55e+111)) tmp = 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 <= -3.05e+27) || ~((z <= 1.55e+111))) tmp = z * cos(y); else tmp = (x + sin(y)) + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.05e+27], N[Not[LessEqual[z, 1.55e+111]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.05 \cdot 10^{+27} \lor \neg \left(z \leq 1.55 \cdot 10^{+111}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;\left(x + \sin y\right) + z\\
\end{array}
\end{array}
if z < -3.0499999999999999e27 or 1.55e111 < z Initial program 99.8%
Taylor expanded in z around inf 78.2%
if -3.0499999999999999e27 < z < 1.55e111Initial program 100.0%
Taylor expanded in y around 0 94.7%
Final simplification88.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.3e+22) (not (<= z 4.3e+15))) (* z (cos y)) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.3e+22) || !(z <= 4.3e+15)) {
tmp = 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 <= (-1.3d+22)) .or. (.not. (z <= 4.3d+15))) then
tmp = 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 <= -1.3e+22) || !(z <= 4.3e+15)) {
tmp = z * Math.cos(y);
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.3e+22) or not (z <= 4.3e+15): tmp = z * math.cos(y) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.3e+22) || !(z <= 4.3e+15)) tmp = 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 <= -1.3e+22) || ~((z <= 4.3e+15))) tmp = z * cos(y); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.3e+22], N[Not[LessEqual[z, 4.3e+15]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+22} \lor \neg \left(z \leq 4.3 \cdot 10^{+15}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -1.3e22 or 4.3e15 < z Initial program 99.8%
Taylor expanded in z around inf 75.9%
if -1.3e22 < z < 4.3e15Initial program 100.0%
Taylor expanded in z around 0 89.3%
+-commutative89.3%
Simplified89.3%
Final simplification82.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.85e+17) (not (<= y 7600.0))) (+ x z) (+ (+ x z) (* y (+ 1.0 (* -0.5 (* y z)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.85e+17) || !(y <= 7600.0)) {
tmp = x + z;
} else {
tmp = (x + z) + (y * (1.0 + (-0.5 * (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 <= (-2.85d+17)) .or. (.not. (y <= 7600.0d0))) then
tmp = x + z
else
tmp = (x + z) + (y * (1.0d0 + ((-0.5d0) * (y * z))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.85e+17) || !(y <= 7600.0)) {
tmp = x + z;
} else {
tmp = (x + z) + (y * (1.0 + (-0.5 * (y * z))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.85e+17) or not (y <= 7600.0): tmp = x + z else: tmp = (x + z) + (y * (1.0 + (-0.5 * (y * z)))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.85e+17) || !(y <= 7600.0)) tmp = Float64(x + z); else tmp = Float64(Float64(x + z) + Float64(y * Float64(1.0 + Float64(-0.5 * Float64(y * z))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.85e+17) || ~((y <= 7600.0))) tmp = x + z; else tmp = (x + z) + (y * (1.0 + (-0.5 * (y * z)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.85e+17], N[Not[LessEqual[y, 7600.0]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(N[(x + z), $MachinePrecision] + N[(y * N[(1.0 + N[(-0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.85 \cdot 10^{+17} \lor \neg \left(y \leq 7600\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;\left(x + z\right) + y \cdot \left(1 + -0.5 \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if y < -2.85e17 or 7600 < y Initial program 99.8%
Taylor expanded in y around 0 42.8%
+-commutative42.8%
Simplified42.8%
if -2.85e17 < y < 7600Initial program 100.0%
Taylor expanded in y around 0 97.9%
associate-+r+97.9%
+-commutative97.9%
*-commutative97.9%
Simplified97.9%
Final simplification69.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -5.5e+41) (not (<= y 9.5e+25))) (+ x z) (+ z (+ x y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5.5e+41) || !(y <= 9.5e+25)) {
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 <= (-5.5d+41)) .or. (.not. (y <= 9.5d+25))) 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 <= -5.5e+41) || !(y <= 9.5e+25)) {
tmp = x + z;
} else {
tmp = z + (x + y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5.5e+41) or not (y <= 9.5e+25): tmp = x + z else: tmp = z + (x + y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5.5e+41) || !(y <= 9.5e+25)) 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 <= -5.5e+41) || ~((y <= 9.5e+25))) tmp = x + z; else tmp = z + (x + y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5.5e+41], N[Not[LessEqual[y, 9.5e+25]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+41} \lor \neg \left(y \leq 9.5 \cdot 10^{+25}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + y\right)\\
\end{array}
\end{array}
if y < -5.5000000000000003e41 or 9.5000000000000005e25 < y Initial program 99.8%
Taylor expanded in y around 0 42.3%
+-commutative42.3%
Simplified42.3%
if -5.5000000000000003e41 < y < 9.5000000000000005e25Initial program 100.0%
Taylor expanded in y around 0 94.3%
+-commutative94.3%
+-commutative94.3%
associate-+l+94.3%
Simplified94.3%
Final simplification69.5%
(FPCore (x y z) :precision binary64 (if (<= y -9.6e+30) x (if (<= y 1.4e+111) (+ x y) x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -9.6e+30) {
tmp = x;
} else if (y <= 1.4e+111) {
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.6d+30)) then
tmp = x
else if (y <= 1.4d+111) 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.6e+30) {
tmp = x;
} else if (y <= 1.4e+111) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9.6e+30: tmp = x elif y <= 1.4e+111: tmp = x + y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9.6e+30) tmp = x; elseif (y <= 1.4e+111) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9.6e+30) tmp = x; elseif (y <= 1.4e+111) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9.6e+30], x, If[LessEqual[y, 1.4e+111], N[(x + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.6 \cdot 10^{+30}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+111}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -9.5999999999999997e30 or 1.4e111 < y Initial program 99.8%
Taylor expanded in x around inf 38.8%
if -9.5999999999999997e30 < y < 1.4e111Initial program 100.0%
Taylor expanded in z around 0 55.2%
+-commutative55.2%
Simplified55.2%
Taylor expanded in y around 0 50.4%
Final simplification45.7%
(FPCore (x y z) :precision binary64 (if (<= x -2.5e-38) x (if (<= x 1.6e-222) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.5e-38) {
tmp = x;
} else if (x <= 1.6e-222) {
tmp = 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 (x <= (-2.5d-38)) then
tmp = x
else if (x <= 1.6d-222) then
tmp = y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.5e-38) {
tmp = x;
} else if (x <= 1.6e-222) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.5e-38: tmp = x elif x <= 1.6e-222: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.5e-38) tmp = x; elseif (x <= 1.6e-222) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.5e-38) tmp = x; elseif (x <= 1.6e-222) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.5e-38], x, If[LessEqual[x, 1.6e-222], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{-38}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-222}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.50000000000000017e-38 or 1.6e-222 < x Initial program 99.9%
Taylor expanded in x around inf 55.3%
if -2.50000000000000017e-38 < x < 1.6e-222Initial program 99.8%
Taylor expanded in x around inf 73.6%
associate-/l*73.6%
Simplified73.6%
Taylor expanded in y around 0 43.6%
Taylor expanded in y around inf 16.8%
(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 64.3%
+-commutative64.3%
Simplified64.3%
Final simplification64.3%
(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 40.8%
herbie shell --seed 2024111
(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))))