
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(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 + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(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 + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (fma (sin y) (- z) (+ x (cos y))))
double code(double x, double y, double z) {
return fma(sin(y), -z, (x + cos(y)));
}
function code(x, y, z) return fma(sin(y), Float64(-z), Float64(x + cos(y))) end
code[x_, y_, z_] := N[(N[Sin[y], $MachinePrecision] * (-z) + N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\sin y, -z, x + \cos y\right)
\end{array}
Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin y) z)))
(if (<= x -3.4e-5)
(- (+ x 1.0) t_0)
(if (<= x 9e-72) (- (cos y) t_0) (- x (fma (sin y) z -1.0))))))
double code(double x, double y, double z) {
double t_0 = sin(y) * z;
double tmp;
if (x <= -3.4e-5) {
tmp = (x + 1.0) - t_0;
} else if (x <= 9e-72) {
tmp = cos(y) - t_0;
} else {
tmp = x - fma(sin(y), z, -1.0);
}
return tmp;
}
function code(x, y, z) t_0 = Float64(sin(y) * z) tmp = 0.0 if (x <= -3.4e-5) tmp = Float64(Float64(x + 1.0) - t_0); elseif (x <= 9e-72) tmp = Float64(cos(y) - t_0); else tmp = Float64(x - fma(sin(y), z, -1.0)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[x, -3.4e-5], N[(N[(x + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 9e-72], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision], N[(x - N[(N[Sin[y], $MachinePrecision] * z + -1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot z\\
\mathbf{if}\;x \leq -3.4 \cdot 10^{-5}:\\
\;\;\;\;\left(x + 1\right) - t_0\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-72}:\\
\;\;\;\;\cos y - t_0\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(\sin y, z, -1\right)\\
\end{array}
\end{array}
if x < -3.4e-5Initial program 100.0%
Taylor expanded in y around 0 100.0%
if -3.4e-5 < x < 9e-72Initial program 99.9%
Taylor expanded in x around 0 99.9%
if 9e-72 < x Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 99.3%
Taylor expanded in y around inf 99.3%
mul-1-neg99.3%
*-commutative99.3%
sub-neg99.3%
+-commutative99.3%
associate-+l-99.3%
fma-neg99.3%
metadata-eval99.3%
Simplified99.3%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= x -3.4e-5) (fma (sin y) (- z) (+ x 1.0)) (if (<= x 9e-72) (- (cos y) (* (sin y) z)) (- x (fma (sin y) z -1.0)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.4e-5) {
tmp = fma(sin(y), -z, (x + 1.0));
} else if (x <= 9e-72) {
tmp = cos(y) - (sin(y) * z);
} else {
tmp = x - fma(sin(y), z, -1.0);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -3.4e-5) tmp = fma(sin(y), Float64(-z), Float64(x + 1.0)); elseif (x <= 9e-72) tmp = Float64(cos(y) - Float64(sin(y) * z)); else tmp = Float64(x - fma(sin(y), z, -1.0)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -3.4e-5], N[(N[Sin[y], $MachinePrecision] * (-z) + N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9e-72], N[(N[Cos[y], $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[Sin[y], $MachinePrecision] * z + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(\sin y, -z, x + 1\right)\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-72}:\\
\;\;\;\;\cos y - \sin y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(\sin y, z, -1\right)\\
\end{array}
\end{array}
if x < -3.4e-5Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 100.0%
if -3.4e-5 < x < 9e-72Initial program 99.9%
Taylor expanded in x around 0 99.9%
if 9e-72 < x Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 99.3%
Taylor expanded in y around inf 99.3%
mul-1-neg99.3%
*-commutative99.3%
sub-neg99.3%
+-commutative99.3%
associate-+l-99.3%
fma-neg99.3%
metadata-eval99.3%
Simplified99.3%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= z -47000.0) (- x (fma (sin y) z -1.0)) (if (<= z 1.0) (+ x (cos y)) (- (+ x 1.0) (* (sin y) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -47000.0) {
tmp = x - fma(sin(y), z, -1.0);
} else if (z <= 1.0) {
tmp = x + cos(y);
} else {
tmp = (x + 1.0) - (sin(y) * z);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -47000.0) tmp = Float64(x - fma(sin(y), z, -1.0)); elseif (z <= 1.0) tmp = Float64(x + cos(y)); else tmp = Float64(Float64(x + 1.0) - Float64(sin(y) * z)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -47000.0], N[(x - N[(N[Sin[y], $MachinePrecision] * z + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -47000:\\
\;\;\;\;x - \mathsf{fma}\left(\sin y, z, -1\right)\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - \sin y \cdot z\\
\end{array}
\end{array}
if z < -47000Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 98.8%
Taylor expanded in y around inf 98.8%
mul-1-neg98.8%
*-commutative98.8%
sub-neg98.8%
+-commutative98.8%
associate-+l-98.8%
fma-neg98.8%
metadata-eval98.8%
Simplified98.8%
if -47000 < z < 1Initial program 100.0%
Taylor expanded in z around 0 99.3%
+-commutative99.3%
Simplified99.3%
if 1 < z Initial program 99.9%
Taylor expanded in y around 0 99.9%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* (sin y) z)))
double code(double x, double y, double z) {
return (x + cos(y)) - (sin(y) * 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 + cos(y)) - (sin(y) * z)
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (Math.sin(y) * z);
}
def code(x, y, z): return (x + math.cos(y)) - (math.sin(y) * z)
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(sin(y) * z)) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (sin(y) * z); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - \sin y \cdot z
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (cos y))))
(if (<= y -0.000165)
t_0
(if (<= y 7.5e-7)
(- (+ x 1.0) (* y z))
(if (or (<= y 3.1e+197) (not (<= y 1.22e+280)))
t_0
(* (sin y) (- z)))))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double tmp;
if (y <= -0.000165) {
tmp = t_0;
} else if (y <= 7.5e-7) {
tmp = (x + 1.0) - (y * z);
} else if ((y <= 3.1e+197) || !(y <= 1.22e+280)) {
tmp = t_0;
} else {
tmp = 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 = x + cos(y)
if (y <= (-0.000165d0)) then
tmp = t_0
else if (y <= 7.5d-7) then
tmp = (x + 1.0d0) - (y * z)
else if ((y <= 3.1d+197) .or. (.not. (y <= 1.22d+280))) then
tmp = t_0
else
tmp = sin(y) * -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + Math.cos(y);
double tmp;
if (y <= -0.000165) {
tmp = t_0;
} else if (y <= 7.5e-7) {
tmp = (x + 1.0) - (y * z);
} else if ((y <= 3.1e+197) || !(y <= 1.22e+280)) {
tmp = t_0;
} else {
tmp = Math.sin(y) * -z;
}
return tmp;
}
def code(x, y, z): t_0 = x + math.cos(y) tmp = 0 if y <= -0.000165: tmp = t_0 elif y <= 7.5e-7: tmp = (x + 1.0) - (y * z) elif (y <= 3.1e+197) or not (y <= 1.22e+280): tmp = t_0 else: tmp = math.sin(y) * -z return tmp
function code(x, y, z) t_0 = Float64(x + cos(y)) tmp = 0.0 if (y <= -0.000165) tmp = t_0; elseif (y <= 7.5e-7) tmp = Float64(Float64(x + 1.0) - Float64(y * z)); elseif ((y <= 3.1e+197) || !(y <= 1.22e+280)) tmp = t_0; else tmp = Float64(sin(y) * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + cos(y); tmp = 0.0; if (y <= -0.000165) tmp = t_0; elseif (y <= 7.5e-7) tmp = (x + 1.0) - (y * z); elseif ((y <= 3.1e+197) || ~((y <= 1.22e+280))) tmp = t_0; else tmp = sin(y) * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.000165], t$95$0, If[LessEqual[y, 7.5e-7], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 3.1e+197], N[Not[LessEqual[y, 1.22e+280]], $MachinePrecision]], t$95$0, N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
\mathbf{if}\;y \leq -0.000165:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{-7}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+197} \lor \neg \left(y \leq 1.22 \cdot 10^{+280}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\end{array}
\end{array}
if y < -1.65e-4 or 7.5000000000000002e-7 < y < 3.1e197 or 1.2199999999999999e280 < y Initial program 99.9%
Taylor expanded in z around 0 72.9%
+-commutative72.9%
Simplified72.9%
if -1.65e-4 < y < 7.5000000000000002e-7Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around 0 100.0%
if 3.1e197 < y < 1.2199999999999999e280Initial program 99.7%
Taylor expanded in z around inf 74.6%
associate-*r*74.6%
neg-mul-174.6%
*-commutative74.6%
Simplified74.6%
Final simplification86.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -47000.0) (not (<= z 2.0))) (- (+ x 1.0) (* (sin y) z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -47000.0) || !(z <= 2.0)) {
tmp = (x + 1.0) - (sin(y) * z);
} else {
tmp = x + 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 ((z <= (-47000.0d0)) .or. (.not. (z <= 2.0d0))) then
tmp = (x + 1.0d0) - (sin(y) * z)
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -47000.0) || !(z <= 2.0)) {
tmp = (x + 1.0) - (Math.sin(y) * z);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -47000.0) or not (z <= 2.0): tmp = (x + 1.0) - (math.sin(y) * z) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -47000.0) || !(z <= 2.0)) tmp = Float64(Float64(x + 1.0) - Float64(sin(y) * z)); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -47000.0) || ~((z <= 2.0))) tmp = (x + 1.0) - (sin(y) * z); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -47000.0], N[Not[LessEqual[z, 2.0]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -47000 \lor \neg \left(z \leq 2\right):\\
\;\;\;\;\left(x + 1\right) - \sin y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -47000 or 2 < z Initial program 99.9%
Taylor expanded in y around 0 99.3%
if -47000 < z < 2Initial program 100.0%
Taylor expanded in z around 0 99.3%
+-commutative99.3%
Simplified99.3%
Final simplification99.3%
(FPCore (x y z)
:precision binary64
(if (<= x -3e+24)
x
(if (<= x -5.2e-93)
(- (+ x 1.0) (* y z))
(if (<= x 9e-72) (cos y) (+ x 1.0)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3e+24) {
tmp = x;
} else if (x <= -5.2e-93) {
tmp = (x + 1.0) - (y * z);
} else if (x <= 9e-72) {
tmp = cos(y);
} else {
tmp = x + 1.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) :: tmp
if (x <= (-3d+24)) then
tmp = x
else if (x <= (-5.2d-93)) then
tmp = (x + 1.0d0) - (y * z)
else if (x <= 9d-72) then
tmp = cos(y)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3e+24) {
tmp = x;
} else if (x <= -5.2e-93) {
tmp = (x + 1.0) - (y * z);
} else if (x <= 9e-72) {
tmp = Math.cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3e+24: tmp = x elif x <= -5.2e-93: tmp = (x + 1.0) - (y * z) elif x <= 9e-72: tmp = math.cos(y) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3e+24) tmp = x; elseif (x <= -5.2e-93) tmp = Float64(Float64(x + 1.0) - Float64(y * z)); elseif (x <= 9e-72) tmp = cos(y); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3e+24) tmp = x; elseif (x <= -5.2e-93) tmp = (x + 1.0) - (y * z); elseif (x <= 9e-72) tmp = cos(y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3e+24], x, If[LessEqual[x, -5.2e-93], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9e-72], N[Cos[y], $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{+24}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-93}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-72}:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -2.99999999999999995e24Initial program 100.0%
Taylor expanded in x around inf 90.5%
if -2.99999999999999995e24 < x < -5.1999999999999997e-93Initial program 100.0%
Taylor expanded in y around 0 92.1%
Taylor expanded in y around 0 78.5%
if -5.1999999999999997e-93 < x < 9e-72Initial program 99.9%
Taylor expanded in z around 0 69.5%
+-commutative69.5%
Simplified69.5%
Taylor expanded in x around 0 69.5%
if 9e-72 < x Initial program 99.9%
Taylor expanded in y around 0 79.1%
+-commutative79.1%
Simplified79.1%
Final simplification79.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -72000.0) (not (<= z 9e+32))) (- x (* (sin y) z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -72000.0) || !(z <= 9e+32)) {
tmp = x - (sin(y) * z);
} else {
tmp = x + 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 ((z <= (-72000.0d0)) .or. (.not. (z <= 9d+32))) then
tmp = x - (sin(y) * z)
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -72000.0) || !(z <= 9e+32)) {
tmp = x - (Math.sin(y) * z);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -72000.0) or not (z <= 9e+32): tmp = x - (math.sin(y) * z) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -72000.0) || !(z <= 9e+32)) tmp = Float64(x - Float64(sin(y) * z)); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -72000.0) || ~((z <= 9e+32))) tmp = x - (sin(y) * z); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -72000.0], N[Not[LessEqual[z, 9e+32]], $MachinePrecision]], N[(x - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -72000 \lor \neg \left(z \leq 9 \cdot 10^{+32}\right):\\
\;\;\;\;x - \sin y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -72000 or 9.0000000000000007e32 < z Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 99.3%
Taylor expanded in y around inf 99.2%
mul-1-neg99.2%
*-commutative99.2%
sub-neg99.2%
+-commutative99.2%
associate-+l-99.2%
fma-neg99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in z around inf 90.3%
if -72000 < z < 9.0000000000000007e32Initial program 100.0%
Taylor expanded in z around 0 99.3%
+-commutative99.3%
Simplified99.3%
Final simplification95.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.000165) (not (<= y 7.5e-7))) (+ x (cos y)) (- (+ x 1.0) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.000165) || !(y <= 7.5e-7)) {
tmp = x + cos(y);
} else {
tmp = (x + 1.0) - (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 <= (-0.000165d0)) .or. (.not. (y <= 7.5d-7))) then
tmp = x + cos(y)
else
tmp = (x + 1.0d0) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -0.000165) || !(y <= 7.5e-7)) {
tmp = x + Math.cos(y);
} else {
tmp = (x + 1.0) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.000165) or not (y <= 7.5e-7): tmp = x + math.cos(y) else: tmp = (x + 1.0) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.000165) || !(y <= 7.5e-7)) tmp = Float64(x + cos(y)); else tmp = Float64(Float64(x + 1.0) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.000165) || ~((y <= 7.5e-7))) tmp = x + cos(y); else tmp = (x + 1.0) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.000165], N[Not[LessEqual[y, 7.5e-7]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.000165 \lor \neg \left(y \leq 7.5 \cdot 10^{-7}\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\end{array}
\end{array}
if y < -1.65e-4 or 7.5000000000000002e-7 < y Initial program 99.9%
Taylor expanded in z around 0 67.5%
+-commutative67.5%
Simplified67.5%
if -1.65e-4 < y < 7.5000000000000002e-7Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around 0 100.0%
Final simplification83.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.2e+79) (not (<= y 7.5e-7))) (+ x 1.0) (- (+ x 1.0) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.2e+79) || !(y <= 7.5e-7)) {
tmp = x + 1.0;
} else {
tmp = (x + 1.0) - (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 <= (-3.2d+79)) .or. (.not. (y <= 7.5d-7))) then
tmp = x + 1.0d0
else
tmp = (x + 1.0d0) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3.2e+79) || !(y <= 7.5e-7)) {
tmp = x + 1.0;
} else {
tmp = (x + 1.0) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.2e+79) or not (y <= 7.5e-7): tmp = x + 1.0 else: tmp = (x + 1.0) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.2e+79) || !(y <= 7.5e-7)) tmp = Float64(x + 1.0); else tmp = Float64(Float64(x + 1.0) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.2e+79) || ~((y <= 7.5e-7))) tmp = x + 1.0; else tmp = (x + 1.0) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.2e+79], N[Not[LessEqual[y, 7.5e-7]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+79} \lor \neg \left(y \leq 7.5 \cdot 10^{-7}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\end{array}
\end{array}
if y < -3.20000000000000003e79 or 7.5000000000000002e-7 < y Initial program 99.8%
Taylor expanded in y around 0 45.3%
+-commutative45.3%
Simplified45.3%
if -3.20000000000000003e79 < y < 7.5000000000000002e-7Initial program 100.0%
Taylor expanded in y around 0 97.3%
Taylor expanded in y around 0 95.9%
Final simplification73.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -5.2e-5) (not (<= x 7.5e-12))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5.2e-5) || !(x <= 7.5e-12)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (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 ((x <= (-5.2d-5)) .or. (.not. (x <= 7.5d-12))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -5.2e-5) || !(x <= 7.5e-12)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5.2e-5) or not (x <= 7.5e-12): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -5.2e-5) || !(x <= 7.5e-12)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -5.2e-5) || ~((x <= 7.5e-12))) tmp = x + 1.0; else tmp = 1.0 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -5.2e-5], N[Not[LessEqual[x, 7.5e-12]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{-5} \lor \neg \left(x \leq 7.5 \cdot 10^{-12}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -5.19999999999999968e-5 or 7.5e-12 < x Initial program 99.9%
Taylor expanded in y around 0 86.5%
+-commutative86.5%
Simplified86.5%
if -5.19999999999999968e-5 < x < 7.5e-12Initial program 99.9%
Taylor expanded in y around 0 75.9%
Taylor expanded in y around 0 52.8%
Taylor expanded in x around 0 52.8%
Final simplification71.2%
(FPCore (x y z) :precision binary64 (if (<= x -2.25e-23) x (if (<= x 3.5) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.25e-23) {
tmp = x;
} else if (x <= 3.5) {
tmp = 1.0;
} 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.25d-23)) then
tmp = x
else if (x <= 3.5d0) then
tmp = 1.0d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.25e-23) {
tmp = x;
} else if (x <= 3.5) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.25e-23: tmp = x elif x <= 3.5: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.25e-23) tmp = x; elseif (x <= 3.5) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.25e-23) tmp = x; elseif (x <= 3.5) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.25e-23], x, If[LessEqual[x, 3.5], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.25 \cdot 10^{-23}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.5:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.24999999999999987e-23 or 3.5 < x Initial program 99.9%
Taylor expanded in x around inf 85.4%
if -2.24999999999999987e-23 < x < 3.5Initial program 99.9%
add-cube-cbrt98.5%
pow398.6%
associate--l+98.6%
Applied egg-rr98.6%
Taylor expanded in y around 0 75.4%
Taylor expanded in x around 0 58.8%
unpow1/374.6%
*-commutative74.6%
Simplified74.6%
Taylor expanded in y around 0 40.5%
Final simplification64.9%
(FPCore (x y z) :precision binary64 (+ x 1.0))
double code(double x, double y, double z) {
return x + 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + 1.0d0
end function
public static double code(double x, double y, double z) {
return x + 1.0;
}
def code(x, y, z): return x + 1.0
function code(x, y, z) return Float64(x + 1.0) end
function tmp = code(x, y, z) tmp = x + 1.0; end
code[x_, y_, z_] := N[(x + 1.0), $MachinePrecision]
\begin{array}{l}
\\
x + 1
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 65.5%
+-commutative65.5%
Simplified65.5%
Final simplification65.5%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.9%
add-cube-cbrt98.1%
pow398.2%
associate--l+98.2%
Applied egg-rr98.2%
Taylor expanded in y around 0 87.5%
Taylor expanded in x around 0 31.0%
unpow1/342.5%
*-commutative42.5%
Simplified42.5%
Taylor expanded in y around 0 20.0%
Final simplification20.0%
herbie shell --seed 2024021
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, B"
:precision binary64
(- (+ x (cos y)) (* z (sin y))))