
(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 (fma z (cos y) (+ x (sin y))))
double code(double x, double y, double z) {
return fma(z, cos(y), (x + sin(y)));
}
function code(x, y, z) return fma(z, cos(y), Float64(x + sin(y))) end
code[x_, y_, z_] := N[(z * N[Cos[y], $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \cos y, x + \sin y\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -6e+120)
(+ t_0 (+ y x))
(if (<= z 2.35e+176) (+ z (+ x (sin y))) (+ (sin y) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -6e+120) {
tmp = t_0 + (y + x);
} else if (z <= 2.35e+176) {
tmp = z + (x + sin(y));
} else {
tmp = sin(y) + 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 <= (-6d+120)) then
tmp = t_0 + (y + x)
else if (z <= 2.35d+176) then
tmp = z + (x + sin(y))
else
tmp = sin(y) + 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 <= -6e+120) {
tmp = t_0 + (y + x);
} else if (z <= 2.35e+176) {
tmp = z + (x + Math.sin(y));
} else {
tmp = Math.sin(y) + t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -6e+120: tmp = t_0 + (y + x) elif z <= 2.35e+176: tmp = z + (x + math.sin(y)) else: tmp = math.sin(y) + t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -6e+120) tmp = Float64(t_0 + Float64(y + x)); elseif (z <= 2.35e+176) tmp = Float64(z + Float64(x + sin(y))); else tmp = Float64(sin(y) + t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -6e+120) tmp = t_0 + (y + x); elseif (z <= 2.35e+176) tmp = z + (x + sin(y)); else tmp = sin(y) + 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, -6e+120], N[(t$95$0 + N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.35e+176], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -6 \cdot 10^{+120}:\\
\;\;\;\;t_0 + \left(y + x\right)\\
\mathbf{elif}\;z \leq 2.35 \cdot 10^{+176}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;\sin y + t_0\\
\end{array}
\end{array}
if z < -6e120Initial program 99.9%
Taylor expanded in y around 0 87.7%
if -6e120 < z < 2.34999999999999991e176Initial program 100.0%
Taylor expanded in y around 0 91.3%
if 2.34999999999999991e176 < z Initial program 99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in x around 0 97.0%
Final simplification91.4%
(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 (<= x -0.045)
(+ z x)
(if (<= x -4.4e-308)
t_0
(if (<= x 2.4e-262)
(sin y)
(if (<= x 1.35e-65) t_0 (if (<= x 2.45e-36) (sin y) (+ z x))))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (x <= -0.045) {
tmp = z + x;
} else if (x <= -4.4e-308) {
tmp = t_0;
} else if (x <= 2.4e-262) {
tmp = sin(y);
} else if (x <= 1.35e-65) {
tmp = t_0;
} else if (x <= 2.45e-36) {
tmp = sin(y);
} else {
tmp = z + 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 (x <= (-0.045d0)) then
tmp = z + x
else if (x <= (-4.4d-308)) then
tmp = t_0
else if (x <= 2.4d-262) then
tmp = sin(y)
else if (x <= 1.35d-65) then
tmp = t_0
else if (x <= 2.45d-36) then
tmp = sin(y)
else
tmp = z + 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 (x <= -0.045) {
tmp = z + x;
} else if (x <= -4.4e-308) {
tmp = t_0;
} else if (x <= 2.4e-262) {
tmp = Math.sin(y);
} else if (x <= 1.35e-65) {
tmp = t_0;
} else if (x <= 2.45e-36) {
tmp = Math.sin(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if x <= -0.045: tmp = z + x elif x <= -4.4e-308: tmp = t_0 elif x <= 2.4e-262: tmp = math.sin(y) elif x <= 1.35e-65: tmp = t_0 elif x <= 2.45e-36: tmp = math.sin(y) else: tmp = z + x return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (x <= -0.045) tmp = Float64(z + x); elseif (x <= -4.4e-308) tmp = t_0; elseif (x <= 2.4e-262) tmp = sin(y); elseif (x <= 1.35e-65) tmp = t_0; elseif (x <= 2.45e-36) tmp = sin(y); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (x <= -0.045) tmp = z + x; elseif (x <= -4.4e-308) tmp = t_0; elseif (x <= 2.4e-262) tmp = sin(y); elseif (x <= 1.35e-65) tmp = t_0; elseif (x <= 2.45e-36) tmp = sin(y); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -0.045], N[(z + x), $MachinePrecision], If[LessEqual[x, -4.4e-308], t$95$0, If[LessEqual[x, 2.4e-262], N[Sin[y], $MachinePrecision], If[LessEqual[x, 1.35e-65], t$95$0, If[LessEqual[x, 2.45e-36], N[Sin[y], $MachinePrecision], N[(z + x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;x \leq -0.045:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq -4.4 \cdot 10^{-308}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-262}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-65}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.45 \cdot 10^{-36}:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -0.044999999999999998 or 2.4499999999999998e-36 < x Initial program 99.9%
Taylor expanded in y around 0 87.6%
if -0.044999999999999998 < x < -4.3999999999999999e-308 or 2.4e-262 < x < 1.3499999999999999e-65Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
add-cube-cbrt99.5%
associate-*l*99.5%
fma-def99.5%
pow299.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in z around inf 64.4%
pow-base-164.4%
*-commutative64.4%
*-lft-identity64.4%
Simplified64.4%
if -4.3999999999999999e-308 < x < 2.4e-262 or 1.3499999999999999e-65 < x < 2.4499999999999998e-36Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around 0 96.9%
Taylor expanded in z around 0 80.3%
Final simplification77.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -2.5e+136)
t_0
(if (<= z -2.35e-35) (+ z x) (if (<= z 6.2e+53) (+ x (sin y)) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -2.5e+136) {
tmp = t_0;
} else if (z <= -2.35e-35) {
tmp = z + x;
} else if (z <= 6.2e+53) {
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 <= (-2.5d+136)) then
tmp = t_0
else if (z <= (-2.35d-35)) then
tmp = z + x
else if (z <= 6.2d+53) 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 <= -2.5e+136) {
tmp = t_0;
} else if (z <= -2.35e-35) {
tmp = z + x;
} else if (z <= 6.2e+53) {
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 <= -2.5e+136: tmp = t_0 elif z <= -2.35e-35: tmp = z + x elif z <= 6.2e+53: 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 <= -2.5e+136) tmp = t_0; elseif (z <= -2.35e-35) tmp = Float64(z + x); elseif (z <= 6.2e+53) 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 <= -2.5e+136) tmp = t_0; elseif (z <= -2.35e-35) tmp = z + x; elseif (z <= 6.2e+53) 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, -2.5e+136], t$95$0, If[LessEqual[z, -2.35e-35], N[(z + x), $MachinePrecision], If[LessEqual[z, 6.2e+53], 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 -2.5 \cdot 10^{+136}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -2.35 \cdot 10^{-35}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+53}:\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -2.5000000000000001e136 or 6.20000000000000038e53 < z Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
add-cube-cbrt99.2%
associate-*l*99.2%
fma-def99.2%
pow299.2%
+-commutative99.2%
Applied egg-rr99.2%
Taylor expanded in z around inf 82.7%
pow-base-182.7%
*-commutative82.7%
*-lft-identity82.7%
Simplified82.7%
if -2.5000000000000001e136 < z < -2.35e-35Initial program 99.9%
Taylor expanded in y around 0 76.6%
if -2.35e-35 < z < 6.20000000000000038e53Initial program 100.0%
Taylor expanded in z around 0 93.7%
Final simplification87.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -8.8e+135) (not (<= z 1.5e+182))) (* z (cos y)) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -8.8e+135) || !(z <= 1.5e+182)) {
tmp = 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 <= (-8.8d+135)) .or. (.not. (z <= 1.5d+182))) then
tmp = 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 <= -8.8e+135) || !(z <= 1.5e+182)) {
tmp = z * Math.cos(y);
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -8.8e+135) or not (z <= 1.5e+182): tmp = z * math.cos(y) else: tmp = z + (x + math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -8.8e+135) || !(z <= 1.5e+182)) tmp = 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 <= -8.8e+135) || ~((z <= 1.5e+182))) tmp = z * cos(y); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -8.8e+135], N[Not[LessEqual[z, 1.5e+182]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{+135} \lor \neg \left(z \leq 1.5 \cdot 10^{+182}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -8.7999999999999998e135 or 1.5000000000000001e182 < z Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
add-cube-cbrt99.2%
associate-*l*99.2%
fma-def99.2%
pow299.2%
+-commutative99.2%
Applied egg-rr99.2%
Taylor expanded in z around inf 88.2%
pow-base-188.2%
*-commutative88.2%
*-lft-identity88.2%
Simplified88.2%
if -8.7999999999999998e135 < z < 1.5000000000000001e182Initial program 100.0%
Taylor expanded in y around 0 91.0%
Final simplification90.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -2.2e+121)
(+ t_0 (+ y x))
(if (<= z 3.7e+176) (+ z (+ x (sin y))) t_0))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -2.2e+121) {
tmp = t_0 + (y + x);
} else if (z <= 3.7e+176) {
tmp = z + (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 <= (-2.2d+121)) then
tmp = t_0 + (y + x)
else if (z <= 3.7d+176) then
tmp = z + (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 <= -2.2e+121) {
tmp = t_0 + (y + x);
} else if (z <= 3.7e+176) {
tmp = z + (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 <= -2.2e+121: tmp = t_0 + (y + x) elif z <= 3.7e+176: tmp = z + (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 <= -2.2e+121) tmp = Float64(t_0 + Float64(y + x)); elseif (z <= 3.7e+176) tmp = Float64(z + 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 <= -2.2e+121) tmp = t_0 + (y + x); elseif (z <= 3.7e+176) tmp = z + (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, -2.2e+121], N[(t$95$0 + N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.7e+176], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -2.2 \cdot 10^{+121}:\\
\;\;\;\;t_0 + \left(y + x\right)\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{+176}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -2.20000000000000001e121Initial program 99.9%
Taylor expanded in y around 0 87.7%
if -2.20000000000000001e121 < z < 3.6999999999999998e176Initial program 100.0%
Taylor expanded in y around 0 91.3%
if 3.6999999999999998e176 < z Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
add-cube-cbrt99.1%
associate-*l*99.1%
fma-def99.1%
pow299.1%
+-commutative99.1%
Applied egg-rr99.1%
Taylor expanded in z around inf 97.0%
pow-base-197.0%
*-commutative97.0%
*-lft-identity97.0%
Simplified97.0%
Final simplification91.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.5e-38) (not (<= x 2.9e-35))) (+ z x) (+ z (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.5e-38) || !(x <= 2.9e-35)) {
tmp = z + x;
} else {
tmp = z + 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 ((x <= (-4.5d-38)) .or. (.not. (x <= 2.9d-35))) then
tmp = z + x
else
tmp = z + sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -4.5e-38) || !(x <= 2.9e-35)) {
tmp = z + x;
} else {
tmp = z + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.5e-38) or not (x <= 2.9e-35): tmp = z + x else: tmp = z + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.5e-38) || !(x <= 2.9e-35)) tmp = Float64(z + x); else tmp = Float64(z + sin(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -4.5e-38) || ~((x <= 2.9e-35))) tmp = z + x; else tmp = z + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.5e-38], N[Not[LessEqual[x, 2.9e-35]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{-38} \lor \neg \left(x \leq 2.9 \cdot 10^{-35}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z + \sin y\\
\end{array}
\end{array}
if x < -4.50000000000000009e-38 or 2.9000000000000002e-35 < x Initial program 99.9%
Taylor expanded in y around 0 84.7%
if -4.50000000000000009e-38 < x < 2.9000000000000002e-35Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around 0 95.8%
*-commutative95.8%
add-cube-cbrt94.7%
unpow394.7%
add-sqr-sqrt46.9%
pow246.9%
unpow346.8%
add-cube-cbrt47.1%
*-commutative47.1%
Applied egg-rr47.1%
Taylor expanded in y around 0 73.8%
Final simplification79.8%
(FPCore (x y z) :precision binary64 (if (<= y -8.5e+79) (+ z x) (if (<= y 1.4e+42) (+ x (+ z y)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -8.5e+79) {
tmp = z + x;
} else if (y <= 1.4e+42) {
tmp = x + (z + y);
} else {
tmp = z + 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 <= (-8.5d+79)) then
tmp = z + x
else if (y <= 1.4d+42) then
tmp = x + (z + y)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -8.5e+79) {
tmp = z + x;
} else if (y <= 1.4e+42) {
tmp = x + (z + y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -8.5e+79: tmp = z + x elif y <= 1.4e+42: tmp = x + (z + y) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -8.5e+79) tmp = Float64(z + x); elseif (y <= 1.4e+42) tmp = Float64(x + Float64(z + y)); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -8.5e+79) tmp = z + x; elseif (y <= 1.4e+42) tmp = x + (z + y); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -8.5e+79], N[(z + x), $MachinePrecision], If[LessEqual[y, 1.4e+42], N[(x + N[(z + y), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{+79}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+42}:\\
\;\;\;\;x + \left(z + y\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -8.4999999999999998e79 or 1.4e42 < y Initial program 99.8%
Taylor expanded in y around 0 41.3%
if -8.4999999999999998e79 < y < 1.4e42Initial program 100.0%
Taylor expanded in y around 0 87.0%
associate-+r+87.0%
Simplified87.0%
Final simplification69.7%
(FPCore (x y z) :precision binary64 (if (<= y -9.8e+79) x (if (<= y 1.3e+43) (+ y x) x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -9.8e+79) {
tmp = x;
} else if (y <= 1.3e+43) {
tmp = y + x;
} 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.8d+79)) then
tmp = x
else if (y <= 1.3d+43) then
tmp = y + x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -9.8e+79) {
tmp = x;
} else if (y <= 1.3e+43) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9.8e+79: tmp = x elif y <= 1.3e+43: tmp = y + x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9.8e+79) tmp = x; elseif (y <= 1.3e+43) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9.8e+79) tmp = x; elseif (y <= 1.3e+43) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9.8e+79], x, If[LessEqual[y, 1.3e+43], N[(y + x), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.8 \cdot 10^{+79}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+43}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -9.7999999999999997e79 or 1.3000000000000001e43 < y Initial program 99.8%
Taylor expanded in x around inf 37.9%
if -9.7999999999999997e79 < y < 1.3000000000000001e43Initial program 100.0%
Taylor expanded in z around 0 55.8%
Taylor expanded in y around 0 50.6%
Final simplification45.8%
(FPCore (x y z) :precision binary64 (if (<= x -1.9e-74) x (if (<= x 9.5e-33) (+ z y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.9e-74) {
tmp = x;
} else if (x <= 9.5e-33) {
tmp = z + 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 <= (-1.9d-74)) then
tmp = x
else if (x <= 9.5d-33) then
tmp = z + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.9e-74) {
tmp = x;
} else if (x <= 9.5e-33) {
tmp = z + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.9e-74: tmp = x elif x <= 9.5e-33: tmp = z + y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.9e-74) tmp = x; elseif (x <= 9.5e-33) tmp = Float64(z + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.9e-74) tmp = x; elseif (x <= 9.5e-33) tmp = z + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.9e-74], x, If[LessEqual[x, 9.5e-33], N[(z + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{-74}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-33}:\\
\;\;\;\;z + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.8999999999999998e-74 or 9.50000000000000019e-33 < x Initial program 99.9%
Taylor expanded in x around inf 66.5%
if -1.8999999999999998e-74 < x < 9.50000000000000019e-33Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around 0 96.5%
Taylor expanded in y around 0 47.3%
Final simplification58.3%
(FPCore (x y z) :precision binary64 (if (<= x -6.6e-71) (+ z x) (if (<= x 2.7e-197) (+ z y) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -6.6e-71) {
tmp = z + x;
} else if (x <= 2.7e-197) {
tmp = z + y;
} else {
tmp = z + 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 <= (-6.6d-71)) then
tmp = z + x
else if (x <= 2.7d-197) then
tmp = z + y
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -6.6e-71) {
tmp = z + x;
} else if (x <= 2.7e-197) {
tmp = z + y;
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6.6e-71: tmp = z + x elif x <= 2.7e-197: tmp = z + y else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6.6e-71) tmp = Float64(z + x); elseif (x <= 2.7e-197) tmp = Float64(z + y); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6.6e-71) tmp = z + x; elseif (x <= 2.7e-197) tmp = z + y; else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6.6e-71], N[(z + x), $MachinePrecision], If[LessEqual[x, 2.7e-197], N[(z + y), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.6 \cdot 10^{-71}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{-197}:\\
\;\;\;\;z + y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -6.6000000000000003e-71 or 2.70000000000000017e-197 < x Initial program 99.9%
Taylor expanded in y around 0 76.5%
if -6.6000000000000003e-71 < x < 2.70000000000000017e-197Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around 0 98.6%
Taylor expanded in y around 0 49.2%
Final simplification68.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.6%
Final simplification40.6%
herbie shell --seed 2023199
(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))))