
(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 (<= y -2.3e+239)
t_0
(if (<= y -1.72e+170)
(sin y)
(if (<= y -6.2e-6)
t_0
(if (<= y 1.8e+91)
(+ y (+ x z))
(if (<= y 4.2e+176) t_0 (if (<= y 9.4e+247) (sin y) x))))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (y <= -2.3e+239) {
tmp = t_0;
} else if (y <= -1.72e+170) {
tmp = sin(y);
} else if (y <= -6.2e-6) {
tmp = t_0;
} else if (y <= 1.8e+91) {
tmp = y + (x + z);
} else if (y <= 4.2e+176) {
tmp = t_0;
} else if (y <= 9.4e+247) {
tmp = sin(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) :: t_0
real(8) :: tmp
t_0 = z * cos(y)
if (y <= (-2.3d+239)) then
tmp = t_0
else if (y <= (-1.72d+170)) then
tmp = sin(y)
else if (y <= (-6.2d-6)) then
tmp = t_0
else if (y <= 1.8d+91) then
tmp = y + (x + z)
else if (y <= 4.2d+176) then
tmp = t_0
else if (y <= 9.4d+247) then
tmp = sin(y)
else
tmp = x
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 (y <= -2.3e+239) {
tmp = t_0;
} else if (y <= -1.72e+170) {
tmp = Math.sin(y);
} else if (y <= -6.2e-6) {
tmp = t_0;
} else if (y <= 1.8e+91) {
tmp = y + (x + z);
} else if (y <= 4.2e+176) {
tmp = t_0;
} else if (y <= 9.4e+247) {
tmp = Math.sin(y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if y <= -2.3e+239: tmp = t_0 elif y <= -1.72e+170: tmp = math.sin(y) elif y <= -6.2e-6: tmp = t_0 elif y <= 1.8e+91: tmp = y + (x + z) elif y <= 4.2e+176: tmp = t_0 elif y <= 9.4e+247: tmp = math.sin(y) else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (y <= -2.3e+239) tmp = t_0; elseif (y <= -1.72e+170) tmp = sin(y); elseif (y <= -6.2e-6) tmp = t_0; elseif (y <= 1.8e+91) tmp = Float64(y + Float64(x + z)); elseif (y <= 4.2e+176) tmp = t_0; elseif (y <= 9.4e+247) tmp = sin(y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (y <= -2.3e+239) tmp = t_0; elseif (y <= -1.72e+170) tmp = sin(y); elseif (y <= -6.2e-6) tmp = t_0; elseif (y <= 1.8e+91) tmp = y + (x + z); elseif (y <= 4.2e+176) tmp = t_0; elseif (y <= 9.4e+247) tmp = sin(y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.3e+239], t$95$0, If[LessEqual[y, -1.72e+170], N[Sin[y], $MachinePrecision], If[LessEqual[y, -6.2e-6], t$95$0, If[LessEqual[y, 1.8e+91], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.2e+176], t$95$0, If[LessEqual[y, 9.4e+247], N[Sin[y], $MachinePrecision], x]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;y \leq -2.3 \cdot 10^{+239}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -1.72 \cdot 10^{+170}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-6}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+91}:\\
\;\;\;\;y + \left(x + z\right)\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+176}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 9.4 \cdot 10^{+247}:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.3000000000000002e239 or -1.7200000000000001e170 < y < -6.1999999999999999e-6 or 1.8e91 < y < 4.1999999999999998e176Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
add-cube-cbrt98.7%
associate-*l*98.7%
fma-def98.7%
pow298.7%
Applied egg-rr98.7%
Taylor expanded in z around inf 59.0%
*-commutative59.0%
pow-base-159.0%
*-lft-identity59.0%
Simplified59.0%
if -2.3000000000000002e239 < y < -1.7200000000000001e170 or 4.1999999999999998e176 < y < 9.4000000000000005e247Initial program 99.8%
Taylor expanded in x around 0 86.3%
Taylor expanded in z around 0 63.4%
if -6.1999999999999999e-6 < y < 1.8e91Initial program 100.0%
Taylor expanded in y around 0 90.2%
if 9.4000000000000005e247 < y Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
add-cube-cbrt99.5%
associate-*l*99.5%
fma-def99.5%
pow299.5%
Applied egg-rr99.5%
Taylor expanded in x around inf 86.3%
Final simplification79.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (sin y) z)))
(if (<= x -5.5e-60)
(+ x z)
(if (<= x 1.95e-185)
t_0
(if (<= x 2.9e-144) (* z (cos y)) (if (<= x 9.5e-84) t_0 (+ x z)))))))
double code(double x, double y, double z) {
double t_0 = sin(y) + z;
double tmp;
if (x <= -5.5e-60) {
tmp = x + z;
} else if (x <= 1.95e-185) {
tmp = t_0;
} else if (x <= 2.9e-144) {
tmp = z * cos(y);
} else if (x <= 9.5e-84) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = sin(y) + z
if (x <= (-5.5d-60)) then
tmp = x + z
else if (x <= 1.95d-185) then
tmp = t_0
else if (x <= 2.9d-144) then
tmp = z * cos(y)
else if (x <= 9.5d-84) then
tmp = t_0
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.sin(y) + z;
double tmp;
if (x <= -5.5e-60) {
tmp = x + z;
} else if (x <= 1.95e-185) {
tmp = t_0;
} else if (x <= 2.9e-144) {
tmp = z * Math.cos(y);
} else if (x <= 9.5e-84) {
tmp = t_0;
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) + z tmp = 0 if x <= -5.5e-60: tmp = x + z elif x <= 1.95e-185: tmp = t_0 elif x <= 2.9e-144: tmp = z * math.cos(y) elif x <= 9.5e-84: tmp = t_0 else: tmp = x + z return tmp
function code(x, y, z) t_0 = Float64(sin(y) + z) tmp = 0.0 if (x <= -5.5e-60) tmp = Float64(x + z); elseif (x <= 1.95e-185) tmp = t_0; elseif (x <= 2.9e-144) tmp = Float64(z * cos(y)); elseif (x <= 9.5e-84) tmp = t_0; else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) + z; tmp = 0.0; if (x <= -5.5e-60) tmp = x + z; elseif (x <= 1.95e-185) tmp = t_0; elseif (x <= 2.9e-144) tmp = z * cos(y); elseif (x <= 9.5e-84) tmp = t_0; else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] + z), $MachinePrecision]}, If[LessEqual[x, -5.5e-60], N[(x + z), $MachinePrecision], If[LessEqual[x, 1.95e-185], t$95$0, If[LessEqual[x, 2.9e-144], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9.5e-84], t$95$0, N[(x + z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y + z\\
\mathbf{if}\;x \leq -5.5 \cdot 10^{-60}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{-185}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-144}:\\
\;\;\;\;z \cdot \cos y\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-84}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if x < -5.4999999999999997e-60 or 9.49999999999999941e-84 < x Initial program 99.9%
Taylor expanded in y around 0 80.4%
if -5.4999999999999997e-60 < x < 1.95e-185 or 2.9000000000000002e-144 < x < 9.49999999999999941e-84Initial program 99.9%
Taylor expanded in x around 0 94.4%
Taylor expanded in y around 0 80.8%
if 1.95e-185 < x < 2.9000000000000002e-144Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
add-cube-cbrt98.4%
associate-*l*98.2%
fma-def98.2%
pow298.2%
Applied egg-rr98.2%
Taylor expanded in z around inf 89.5%
*-commutative89.5%
pow-base-189.5%
*-lft-identity89.5%
Simplified89.5%
Final simplification80.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -1.1e+47)
t_0
(if (<= z -2.8e-64)
(+ x z)
(if (<= z 1.95e-63) (+ x (sin y)) (if (<= z 3.1e+125) (+ x z) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -1.1e+47) {
tmp = t_0;
} else if (z <= -2.8e-64) {
tmp = x + z;
} else if (z <= 1.95e-63) {
tmp = x + sin(y);
} else if (z <= 3.1e+125) {
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.1d+47)) then
tmp = t_0
else if (z <= (-2.8d-64)) then
tmp = x + z
else if (z <= 1.95d-63) then
tmp = x + sin(y)
else if (z <= 3.1d+125) 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.1e+47) {
tmp = t_0;
} else if (z <= -2.8e-64) {
tmp = x + z;
} else if (z <= 1.95e-63) {
tmp = x + Math.sin(y);
} else if (z <= 3.1e+125) {
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.1e+47: tmp = t_0 elif z <= -2.8e-64: tmp = x + z elif z <= 1.95e-63: tmp = x + math.sin(y) elif z <= 3.1e+125: 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.1e+47) tmp = t_0; elseif (z <= -2.8e-64) tmp = Float64(x + z); elseif (z <= 1.95e-63) tmp = Float64(x + sin(y)); elseif (z <= 3.1e+125) 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.1e+47) tmp = t_0; elseif (z <= -2.8e-64) tmp = x + z; elseif (z <= 1.95e-63) tmp = x + sin(y); elseif (z <= 3.1e+125) 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.1e+47], t$95$0, If[LessEqual[z, -2.8e-64], N[(x + z), $MachinePrecision], If[LessEqual[z, 1.95e-63], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.1e+125], N[(x + z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -1.1 \cdot 10^{+47}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-64}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{-63}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{+125}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -1.1e47 or 3.1e125 < z Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
add-cube-cbrt98.9%
associate-*l*98.9%
fma-def98.9%
pow298.9%
Applied egg-rr98.9%
Taylor expanded in z around inf 84.5%
*-commutative84.5%
pow-base-184.5%
*-lft-identity84.5%
Simplified84.5%
if -1.1e47 < z < -2.80000000000000004e-64 or 1.95000000000000011e-63 < z < 3.1e125Initial program 99.9%
Taylor expanded in y around 0 84.0%
if -2.80000000000000004e-64 < z < 1.95000000000000011e-63Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
add-cube-cbrt100.0%
associate-*l*100.0%
fma-def100.0%
pow2100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 95.0%
Final simplification89.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.3e-65) (not (<= z 3.15e-58))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.3e-65) || !(z <= 3.15e-58)) {
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 <= (-3.3d-65)) .or. (.not. (z <= 3.15d-58))) 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 <= -3.3e-65) || !(z <= 3.15e-58)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.3e-65) or not (z <= 3.15e-58): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.3e-65) || !(z <= 3.15e-58)) 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 <= -3.3e-65) || ~((z <= 3.15e-58))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.3e-65], N[Not[LessEqual[z, 3.15e-58]], $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 -3.3 \cdot 10^{-65} \lor \neg \left(z \leq 3.15 \cdot 10^{-58}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -3.3000000000000001e-65 or 3.14999999999999999e-58 < z Initial program 99.9%
Taylor expanded in x around inf 97.1%
if -3.3000000000000001e-65 < z < 3.14999999999999999e-58Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
add-cube-cbrt100.0%
associate-*l*100.0%
fma-def100.0%
pow2100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 95.0%
Final simplification96.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -150000000000.0) (not (<= z 7.2e-58))) (+ x (* z (cos y))) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -150000000000.0) || !(z <= 7.2e-58)) {
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 <= (-150000000000.0d0)) .or. (.not. (z <= 7.2d-58))) 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 <= -150000000000.0) || !(z <= 7.2e-58)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -150000000000.0) or not (z <= 7.2e-58): 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 <= -150000000000.0) || !(z <= 7.2e-58)) 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 <= -150000000000.0) || ~((z <= 7.2e-58))) tmp = x + (z * cos(y)); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -150000000000.0], N[Not[LessEqual[z, 7.2e-58]], $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 -150000000000 \lor \neg \left(z \leq 7.2 \cdot 10^{-58}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -1.5e11 or 7.20000000000000019e-58 < z Initial program 99.8%
Taylor expanded in x around inf 99.8%
if -1.5e11 < z < 7.20000000000000019e-58Initial program 100.0%
Taylor expanded in y around 0 98.8%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (<= y -2500000.0) (sin y) (if (<= y 8.2e+64) (+ y (+ x z)) (if (<= y 3.3e+247) (sin y) x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2500000.0) {
tmp = sin(y);
} else if (y <= 8.2e+64) {
tmp = y + (x + z);
} else if (y <= 3.3e+247) {
tmp = sin(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 <= (-2500000.0d0)) then
tmp = sin(y)
else if (y <= 8.2d+64) then
tmp = y + (x + z)
else if (y <= 3.3d+247) then
tmp = sin(y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2500000.0) {
tmp = Math.sin(y);
} else if (y <= 8.2e+64) {
tmp = y + (x + z);
} else if (y <= 3.3e+247) {
tmp = Math.sin(y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2500000.0: tmp = math.sin(y) elif y <= 8.2e+64: tmp = y + (x + z) elif y <= 3.3e+247: tmp = math.sin(y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2500000.0) tmp = sin(y); elseif (y <= 8.2e+64) tmp = Float64(y + Float64(x + z)); elseif (y <= 3.3e+247) tmp = sin(y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2500000.0) tmp = sin(y); elseif (y <= 8.2e+64) tmp = y + (x + z); elseif (y <= 3.3e+247) tmp = sin(y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2500000.0], N[Sin[y], $MachinePrecision], If[LessEqual[y, 8.2e+64], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.3e+247], N[Sin[y], $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2500000:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+64}:\\
\;\;\;\;y + \left(x + z\right)\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+247}:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.5e6 or 8.19999999999999956e64 < y < 3.30000000000000001e247Initial program 99.8%
Taylor expanded in x around 0 77.7%
Taylor expanded in z around 0 36.2%
if -2.5e6 < y < 8.19999999999999956e64Initial program 100.0%
Taylor expanded in y around 0 94.1%
if 3.30000000000000001e247 < y Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
add-cube-cbrt99.5%
associate-*l*99.5%
fma-def99.5%
pow299.5%
Applied egg-rr99.5%
Taylor expanded in x around inf 86.3%
Final simplification71.5%
(FPCore (x y z) :precision binary64 (if (<= x -2.3e+24) x (if (<= x -1e-281) z (if (<= x 2e-305) y (if (<= x 3.1e-56) z x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.3e+24) {
tmp = x;
} else if (x <= -1e-281) {
tmp = z;
} else if (x <= 2e-305) {
tmp = y;
} else if (x <= 3.1e-56) {
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 <= (-2.3d+24)) then
tmp = x
else if (x <= (-1d-281)) then
tmp = z
else if (x <= 2d-305) then
tmp = y
else if (x <= 3.1d-56) 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 <= -2.3e+24) {
tmp = x;
} else if (x <= -1e-281) {
tmp = z;
} else if (x <= 2e-305) {
tmp = y;
} else if (x <= 3.1e-56) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.3e+24: tmp = x elif x <= -1e-281: tmp = z elif x <= 2e-305: tmp = y elif x <= 3.1e-56: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.3e+24) tmp = x; elseif (x <= -1e-281) tmp = z; elseif (x <= 2e-305) tmp = y; elseif (x <= 3.1e-56) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.3e+24) tmp = x; elseif (x <= -1e-281) tmp = z; elseif (x <= 2e-305) tmp = y; elseif (x <= 3.1e-56) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.3e+24], x, If[LessEqual[x, -1e-281], z, If[LessEqual[x, 2e-305], y, If[LessEqual[x, 3.1e-56], z, x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+24}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-281}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-305}:\\
\;\;\;\;y\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{-56}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.2999999999999999e24 or 3.09999999999999987e-56 < x Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
add-cube-cbrt99.5%
associate-*l*99.6%
fma-def99.6%
pow299.6%
Applied egg-rr99.6%
Taylor expanded in x around inf 71.8%
if -2.2999999999999999e24 < x < -1e-281 or 1.99999999999999999e-305 < x < 3.09999999999999987e-56Initial program 99.9%
Taylor expanded in y around 0 52.4%
Taylor expanded in z around inf 38.7%
if -1e-281 < x < 1.99999999999999999e-305Initial program 100.0%
Taylor expanded in y around 0 83.3%
Taylor expanded in y around inf 71.6%
Final simplification55.4%
(FPCore (x y z) :precision binary64 (if (<= y -3100000000.0) (+ x z) (if (<= y 0.000225) (+ y (+ x z)) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3100000000.0) {
tmp = x + z;
} else if (y <= 0.000225) {
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 <= (-3100000000.0d0)) then
tmp = x + z
else if (y <= 0.000225d0) 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 <= -3100000000.0) {
tmp = x + z;
} else if (y <= 0.000225) {
tmp = y + (x + z);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3100000000.0: tmp = x + z elif y <= 0.000225: tmp = y + (x + z) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3100000000.0) tmp = Float64(x + z); elseif (y <= 0.000225) 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 <= -3100000000.0) tmp = x + z; elseif (y <= 0.000225) tmp = y + (x + z); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3100000000.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 0.000225], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3100000000:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 0.000225:\\
\;\;\;\;y + \left(x + z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -3.1e9 or 2.2499999999999999e-4 < y Initial program 99.8%
Taylor expanded in y around 0 34.0%
if -3.1e9 < y < 2.2499999999999999e-4Initial program 100.0%
Taylor expanded in y around 0 98.6%
Final simplification68.1%
(FPCore (x y z) :precision binary64 (if (<= x -2.3e+24) x (if (<= x 4e-70) (+ y z) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.3e+24) {
tmp = x;
} else if (x <= 4e-70) {
tmp = y + z;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-2.3d+24)) then
tmp = x
else if (x <= 4d-70) then
tmp = y + z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.3e+24) {
tmp = x;
} else if (x <= 4e-70) {
tmp = y + z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.3e+24: tmp = x elif x <= 4e-70: tmp = y + z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.3e+24) tmp = x; elseif (x <= 4e-70) tmp = Float64(y + z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.3e+24) tmp = x; elseif (x <= 4e-70) tmp = y + z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.3e+24], x, If[LessEqual[x, 4e-70], N[(y + z), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+24}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-70}:\\
\;\;\;\;y + z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.2999999999999999e24 or 3.99999999999999998e-70 < x Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
add-cube-cbrt99.5%
associate-*l*99.6%
fma-def99.6%
pow299.6%
Applied egg-rr99.6%
Taylor expanded in x around inf 71.2%
if -2.2999999999999999e24 < x < 3.99999999999999998e-70Initial program 99.9%
Taylor expanded in x around 0 90.3%
Taylor expanded in y around 0 46.2%
Final simplification58.1%
(FPCore (x y z) :precision binary64 (if (<= x -8.8e-222) (+ x z) (if (<= x 1.25e-133) (+ y z) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -8.8e-222) {
tmp = x + z;
} else if (x <= 1.25e-133) {
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 <= (-8.8d-222)) then
tmp = x + z
else if (x <= 1.25d-133) 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 <= -8.8e-222) {
tmp = x + z;
} else if (x <= 1.25e-133) {
tmp = y + z;
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -8.8e-222: tmp = x + z elif x <= 1.25e-133: tmp = y + z else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -8.8e-222) tmp = Float64(x + z); elseif (x <= 1.25e-133) 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 <= -8.8e-222) tmp = x + z; elseif (x <= 1.25e-133) tmp = y + z; else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -8.8e-222], N[(x + z), $MachinePrecision], If[LessEqual[x, 1.25e-133], N[(y + z), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.8 \cdot 10^{-222}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-133}:\\
\;\;\;\;y + z\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if x < -8.8000000000000001e-222 or 1.25e-133 < x Initial program 99.9%
Taylor expanded in y around 0 71.5%
if -8.8000000000000001e-222 < x < 1.25e-133Initial program 100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in y around 0 55.5%
Final simplification67.3%
(FPCore (x y z) :precision binary64 (if (<= x -8.8e-222) x (if (<= x 4.2e-124) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -8.8e-222) {
tmp = x;
} else if (x <= 4.2e-124) {
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 <= (-8.8d-222)) then
tmp = x
else if (x <= 4.2d-124) 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 <= -8.8e-222) {
tmp = x;
} else if (x <= 4.2e-124) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -8.8e-222: tmp = x elif x <= 4.2e-124: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -8.8e-222) tmp = x; elseif (x <= 4.2e-124) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -8.8e-222) tmp = x; elseif (x <= 4.2e-124) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -8.8e-222], x, If[LessEqual[x, 4.2e-124], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.8 \cdot 10^{-222}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-124}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -8.8000000000000001e-222 or 4.2000000000000002e-124 < x Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
add-cube-cbrt99.6%
associate-*l*99.6%
fma-def99.6%
pow299.6%
Applied egg-rr99.6%
Taylor expanded in x around inf 53.2%
if -8.8000000000000001e-222 < x < 4.2000000000000002e-124Initial program 100.0%
Taylor expanded in y around 0 53.9%
Taylor expanded in y around inf 21.6%
Final simplification44.7%
(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%
+-commutative99.9%
*-commutative99.9%
add-cube-cbrt99.6%
associate-*l*99.6%
fma-def99.6%
pow299.6%
Applied egg-rr99.6%
Taylor expanded in x around inf 39.7%
Final simplification39.7%
herbie shell --seed 2023185
(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))))