
(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 z (sin (- y)) (+ x (cos y))))
double code(double x, double y, double z) {
return fma(z, sin(-y), (x + cos(y)));
}
function code(x, y, z) return fma(z, sin(Float64(-y)), Float64(x + cos(y))) end
code[x_, y_, z_] := N[(z * N[Sin[(-y)], $MachinePrecision] + N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \sin \left(-y\right), x + \cos y\right)
\end{array}
Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
Simplified99.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -1e-12) (not (<= x 7e-17))) (+ x (* z (- (/ 1.0 z) (sin y)))) (- (cos y) (* z (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1e-12) || !(x <= 7e-17)) {
tmp = x + (z * ((1.0 / z) - sin(y)));
} else {
tmp = cos(y) - (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 <= (-1d-12)) .or. (.not. (x <= 7d-17))) then
tmp = x + (z * ((1.0d0 / z) - sin(y)))
else
tmp = cos(y) - (z * sin(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1e-12) || !(x <= 7e-17)) {
tmp = x + (z * ((1.0 / z) - Math.sin(y)));
} else {
tmp = Math.cos(y) - (z * Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1e-12) or not (x <= 7e-17): tmp = x + (z * ((1.0 / z) - math.sin(y))) else: tmp = math.cos(y) - (z * math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1e-12) || !(x <= 7e-17)) tmp = Float64(x + Float64(z * Float64(Float64(1.0 / z) - sin(y)))); else tmp = Float64(cos(y) - Float64(z * sin(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1e-12) || ~((x <= 7e-17))) tmp = x + (z * ((1.0 / z) - sin(y))); else tmp = cos(y) - (z * sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1e-12], N[Not[LessEqual[x, 7e-17]], $MachinePrecision]], N[(x + N[(z * N[(N[(1.0 / z), $MachinePrecision] - N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-12} \lor \neg \left(x \leq 7 \cdot 10^{-17}\right):\\
\;\;\;\;x + z \cdot \left(\frac{1}{z} - \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;\cos y - z \cdot \sin y\\
\end{array}
\end{array}
if x < -9.9999999999999998e-13 or 7.0000000000000003e-17 < x Initial program 99.9%
Taylor expanded in z around -inf 78.2%
associate-*r*78.2%
*-commutative78.2%
sub-neg78.2%
distribute-rgt-neg-in78.2%
sin-neg78.2%
+-commutative78.2%
associate-*l*78.2%
neg-mul-178.2%
distribute-lft-out78.2%
mul-1-neg78.2%
remove-double-neg78.2%
+-commutative78.2%
sin-neg78.2%
Simplified78.2%
Taylor expanded in y around 0 77.1%
Taylor expanded in x around 0 98.7%
if -9.9999999999999998e-13 < x < 7.0000000000000003e-17Initial program 99.9%
Taylor expanded in x around 0 99.9%
Final simplification99.3%
(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}
Initial program 99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (* z (sin y)))))
(if (<= z -1.8e+225)
t_0
(if (<= z -7e+179)
(- (+ x 1.0) (* z y))
(if (or (<= z -1.15e+142) (not (<= z 1.42e+88))) t_0 (+ x (cos y)))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (z * sin(y));
double tmp;
if (z <= -1.8e+225) {
tmp = t_0;
} else if (z <= -7e+179) {
tmp = (x + 1.0) - (z * y);
} else if ((z <= -1.15e+142) || !(z <= 1.42e+88)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (z * sin(y))
if (z <= (-1.8d+225)) then
tmp = t_0
else if (z <= (-7d+179)) then
tmp = (x + 1.0d0) - (z * y)
else if ((z <= (-1.15d+142)) .or. (.not. (z <= 1.42d+88))) then
tmp = t_0
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 - (z * Math.sin(y));
double tmp;
if (z <= -1.8e+225) {
tmp = t_0;
} else if (z <= -7e+179) {
tmp = (x + 1.0) - (z * y);
} else if ((z <= -1.15e+142) || !(z <= 1.42e+88)) {
tmp = t_0;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (z * math.sin(y)) tmp = 0 if z <= -1.8e+225: tmp = t_0 elif z <= -7e+179: tmp = (x + 1.0) - (z * y) elif (z <= -1.15e+142) or not (z <= 1.42e+88): tmp = t_0 else: tmp = x + math.cos(y) return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(z * sin(y))) tmp = 0.0 if (z <= -1.8e+225) tmp = t_0; elseif (z <= -7e+179) tmp = Float64(Float64(x + 1.0) - Float64(z * y)); elseif ((z <= -1.15e+142) || !(z <= 1.42e+88)) tmp = t_0; else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (z * sin(y)); tmp = 0.0; if (z <= -1.8e+225) tmp = t_0; elseif (z <= -7e+179) tmp = (x + 1.0) - (z * y); elseif ((z <= -1.15e+142) || ~((z <= 1.42e+88))) tmp = t_0; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.8e+225], t$95$0, If[LessEqual[z, -7e+179], N[(N[(x + 1.0), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.15e+142], N[Not[LessEqual[z, 1.42e+88]], $MachinePrecision]], t$95$0, N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - z \cdot \sin y\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{+225}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -7 \cdot 10^{+179}:\\
\;\;\;\;\left(x + 1\right) - z \cdot y\\
\mathbf{elif}\;z \leq -1.15 \cdot 10^{+142} \lor \neg \left(z \leq 1.42 \cdot 10^{+88}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.7999999999999999e225 or -7.0000000000000003e179 < z < -1.15000000000000001e142 or 1.41999999999999996e88 < z Initial program 99.8%
Taylor expanded in z around -inf 99.6%
associate-*r*99.6%
*-commutative99.6%
sub-neg99.6%
distribute-rgt-neg-in99.6%
sin-neg99.6%
+-commutative99.6%
associate-*l*99.6%
neg-mul-199.6%
distribute-lft-out99.6%
mul-1-neg99.6%
remove-double-neg99.6%
+-commutative99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in y around 0 99.6%
Taylor expanded in x around 0 82.3%
sub-neg82.3%
distribute-lft-in82.4%
rgt-mult-inverse82.4%
Simplified82.4%
if -1.7999999999999999e225 < z < -7.0000000000000003e179Initial program 100.0%
Taylor expanded in y around 0 89.5%
associate-+r+89.5%
mul-1-neg89.5%
unsub-neg89.5%
+-commutative89.5%
Simplified89.5%
if -1.15000000000000001e142 < z < 1.41999999999999996e88Initial program 100.0%
Taylor expanded in z around 0 92.6%
+-commutative92.6%
Simplified92.6%
Final simplification89.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin (- y)))))
(if (<= z -1.8e+225)
t_0
(if (<= z -4.05e+183)
(- (+ x 1.0) (* z y))
(if (or (<= z -4.8e+142) (not (<= z 1.2e+88))) t_0 (+ x (cos y)))))))
double code(double x, double y, double z) {
double t_0 = z * sin(-y);
double tmp;
if (z <= -1.8e+225) {
tmp = t_0;
} else if (z <= -4.05e+183) {
tmp = (x + 1.0) - (z * y);
} else if ((z <= -4.8e+142) || !(z <= 1.2e+88)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = z * sin(-y)
if (z <= (-1.8d+225)) then
tmp = t_0
else if (z <= (-4.05d+183)) then
tmp = (x + 1.0d0) - (z * y)
else if ((z <= (-4.8d+142)) .or. (.not. (z <= 1.2d+88))) then
tmp = t_0
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(-y);
double tmp;
if (z <= -1.8e+225) {
tmp = t_0;
} else if (z <= -4.05e+183) {
tmp = (x + 1.0) - (z * y);
} else if ((z <= -4.8e+142) || !(z <= 1.2e+88)) {
tmp = t_0;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(-y) tmp = 0 if z <= -1.8e+225: tmp = t_0 elif z <= -4.05e+183: tmp = (x + 1.0) - (z * y) elif (z <= -4.8e+142) or not (z <= 1.2e+88): tmp = t_0 else: tmp = x + math.cos(y) return tmp
function code(x, y, z) t_0 = Float64(z * sin(Float64(-y))) tmp = 0.0 if (z <= -1.8e+225) tmp = t_0; elseif (z <= -4.05e+183) tmp = Float64(Float64(x + 1.0) - Float64(z * y)); elseif ((z <= -4.8e+142) || !(z <= 1.2e+88)) tmp = t_0; else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(-y); tmp = 0.0; if (z <= -1.8e+225) tmp = t_0; elseif (z <= -4.05e+183) tmp = (x + 1.0) - (z * y); elseif ((z <= -4.8e+142) || ~((z <= 1.2e+88))) tmp = t_0; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[(-y)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.8e+225], t$95$0, If[LessEqual[z, -4.05e+183], N[(N[(x + 1.0), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -4.8e+142], N[Not[LessEqual[z, 1.2e+88]], $MachinePrecision]], t$95$0, N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin \left(-y\right)\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{+225}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -4.05 \cdot 10^{+183}:\\
\;\;\;\;\left(x + 1\right) - z \cdot y\\
\mathbf{elif}\;z \leq -4.8 \cdot 10^{+142} \lor \neg \left(z \leq 1.2 \cdot 10^{+88}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.7999999999999999e225 or -4.04999999999999997e183 < z < -4.7999999999999998e142 or 1.2e88 < z Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
sin-neg99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in z around inf 68.8%
if -1.7999999999999999e225 < z < -4.04999999999999997e183Initial program 100.0%
Taylor expanded in y around 0 89.5%
associate-+r+89.5%
mul-1-neg89.5%
unsub-neg89.5%
+-commutative89.5%
Simplified89.5%
if -4.7999999999999998e142 < z < 1.2e88Initial program 100.0%
Taylor expanded in z around 0 92.6%
+-commutative92.6%
Simplified92.6%
Final simplification85.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.65) (not (<= z 3.5e-16))) (+ x (* z (- (/ 1.0 z) (sin y)))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.65) || !(z <= 3.5e-16)) {
tmp = x + (z * ((1.0 / z) - sin(y)));
} 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 <= (-1.65d0)) .or. (.not. (z <= 3.5d-16))) then
tmp = x + (z * ((1.0d0 / z) - sin(y)))
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 <= -1.65) || !(z <= 3.5e-16)) {
tmp = x + (z * ((1.0 / z) - Math.sin(y)));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.65) or not (z <= 3.5e-16): tmp = x + (z * ((1.0 / z) - math.sin(y))) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.65) || !(z <= 3.5e-16)) tmp = Float64(x + Float64(z * Float64(Float64(1.0 / z) - sin(y)))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.65) || ~((z <= 3.5e-16))) tmp = x + (z * ((1.0 / z) - sin(y))); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.65], N[Not[LessEqual[z, 3.5e-16]], $MachinePrecision]], N[(x + N[(z * N[(N[(1.0 / z), $MachinePrecision] - N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \lor \neg \left(z \leq 3.5 \cdot 10^{-16}\right):\\
\;\;\;\;x + z \cdot \left(\frac{1}{z} - \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.6499999999999999 or 3.50000000000000017e-16 < z Initial program 99.8%
Taylor expanded in z around -inf 99.7%
associate-*r*99.7%
*-commutative99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
sin-neg99.7%
+-commutative99.7%
associate-*l*99.7%
neg-mul-199.7%
distribute-lft-out99.7%
mul-1-neg99.7%
remove-double-neg99.7%
+-commutative99.7%
sin-neg99.7%
Simplified99.7%
Taylor expanded in y around 0 99.2%
Taylor expanded in x around 0 99.3%
if -1.6499999999999999 < z < 3.50000000000000017e-16Initial program 100.0%
Taylor expanded in z around 0 99.2%
+-commutative99.2%
Simplified99.2%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.82) (not (<= z 3.5e-16))) (* z (- (/ (+ x 1.0) z) (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.82) || !(z <= 3.5e-16)) {
tmp = z * (((x + 1.0) / z) - sin(y));
} 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 <= (-0.82d0)) .or. (.not. (z <= 3.5d-16))) then
tmp = z * (((x + 1.0d0) / z) - sin(y))
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 <= -0.82) || !(z <= 3.5e-16)) {
tmp = z * (((x + 1.0) / z) - Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.82) or not (z <= 3.5e-16): tmp = z * (((x + 1.0) / z) - math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.82) || !(z <= 3.5e-16)) tmp = Float64(z * Float64(Float64(Float64(x + 1.0) / z) - sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.82) || ~((z <= 3.5e-16))) tmp = z * (((x + 1.0) / z) - sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.82], N[Not[LessEqual[z, 3.5e-16]], $MachinePrecision]], N[(z * N[(N[(N[(x + 1.0), $MachinePrecision] / z), $MachinePrecision] - N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.82 \lor \neg \left(z \leq 3.5 \cdot 10^{-16}\right):\\
\;\;\;\;z \cdot \left(\frac{x + 1}{z} - \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -0.819999999999999951 or 3.50000000000000017e-16 < z Initial program 99.8%
Taylor expanded in z around -inf 99.7%
associate-*r*99.7%
*-commutative99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
sin-neg99.7%
+-commutative99.7%
associate-*l*99.7%
neg-mul-199.7%
distribute-lft-out99.7%
mul-1-neg99.7%
remove-double-neg99.7%
+-commutative99.7%
sin-neg99.7%
Simplified99.7%
Taylor expanded in y around 0 99.2%
if -0.819999999999999951 < z < 3.50000000000000017e-16Initial program 100.0%
Taylor expanded in z around 0 99.2%
+-commutative99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.5e+77) (not (<= z 2.85e+69))) (* z (- (/ x z) (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.5e+77) || !(z <= 2.85e+69)) {
tmp = z * ((x / z) - sin(y));
} 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 <= (-2.5d+77)) .or. (.not. (z <= 2.85d+69))) then
tmp = z * ((x / z) - sin(y))
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 <= -2.5e+77) || !(z <= 2.85e+69)) {
tmp = z * ((x / z) - Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.5e+77) or not (z <= 2.85e+69): tmp = z * ((x / z) - math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.5e+77) || !(z <= 2.85e+69)) tmp = Float64(z * Float64(Float64(x / z) - sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.5e+77) || ~((z <= 2.85e+69))) tmp = z * ((x / z) - sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.5e+77], N[Not[LessEqual[z, 2.85e+69]], $MachinePrecision]], N[(z * N[(N[(x / z), $MachinePrecision] - N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+77} \lor \neg \left(z \leq 2.85 \cdot 10^{+69}\right):\\
\;\;\;\;z \cdot \left(\frac{x}{z} - \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -2.50000000000000002e77 or 2.85e69 < z Initial program 99.8%
Taylor expanded in z around -inf 99.6%
associate-*r*99.6%
*-commutative99.6%
sub-neg99.6%
distribute-rgt-neg-in99.6%
sin-neg99.6%
+-commutative99.6%
associate-*l*99.6%
neg-mul-199.6%
distribute-lft-out99.6%
mul-1-neg99.6%
remove-double-neg99.6%
+-commutative99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in x around inf 86.4%
if -2.50000000000000002e77 < z < 2.85e69Initial program 100.0%
Taylor expanded in z around 0 95.4%
+-commutative95.4%
Simplified95.4%
Final simplification91.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.62) (not (<= y 0.0072))) (+ x (cos y)) (+ 1.0 (+ x (* y (- (* y (- (* (* z y) 0.16666666666666666) 0.5)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.62) || !(y <= 0.0072)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * (((z * y) * 0.16666666666666666) - 0.5)) - 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.62d0)) .or. (.not. (y <= 0.0072d0))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x + (y * ((y * (((z * y) * 0.16666666666666666d0) - 0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -0.62) || !(y <= 0.0072)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * (((z * y) * 0.16666666666666666) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.62) or not (y <= 0.0072): tmp = x + math.cos(y) else: tmp = 1.0 + (x + (y * ((y * (((z * y) * 0.16666666666666666) - 0.5)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.62) || !(y <= 0.0072)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(Float64(z * y) * 0.16666666666666666) - 0.5)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.62) || ~((y <= 0.0072))) tmp = x + cos(y); else tmp = 1.0 + (x + (y * ((y * (((z * y) * 0.16666666666666666) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.62], N[Not[LessEqual[y, 0.0072]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(N[(z * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.62 \lor \neg \left(y \leq 0.0072\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(\left(z \cdot y\right) \cdot 0.16666666666666666 - 0.5\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -0.619999999999999996 or 0.0071999999999999998 < y Initial program 99.8%
Taylor expanded in z around 0 58.2%
+-commutative58.2%
Simplified58.2%
if -0.619999999999999996 < y < 0.0071999999999999998Initial program 100.0%
Taylor expanded in y around 0 99.9%
Final simplification78.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.8e-12) (not (<= x 1.6e-42))) (+ x 1.0) (cos y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.8e-12) || !(x <= 1.6e-42)) {
tmp = x + 1.0;
} else {
tmp = 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 <= (-3.8d-12)) .or. (.not. (x <= 1.6d-42))) then
tmp = x + 1.0d0
else
tmp = cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -3.8e-12) || !(x <= 1.6e-42)) {
tmp = x + 1.0;
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.8e-12) or not (x <= 1.6e-42): tmp = x + 1.0 else: tmp = math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.8e-12) || !(x <= 1.6e-42)) tmp = Float64(x + 1.0); else tmp = cos(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.8e-12) || ~((x <= 1.6e-42))) tmp = x + 1.0; else tmp = cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.8e-12], N[Not[LessEqual[x, 1.6e-42]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[Cos[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-12} \lor \neg \left(x \leq 1.6 \cdot 10^{-42}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if x < -3.79999999999999996e-12 or 1.60000000000000012e-42 < x Initial program 99.9%
Taylor expanded in y around 0 75.8%
+-commutative75.8%
Simplified75.8%
if -3.79999999999999996e-12 < x < 1.60000000000000012e-42Initial program 99.9%
Taylor expanded in z around 0 62.1%
+-commutative62.1%
Simplified62.1%
Taylor expanded in x around 0 62.1%
Final simplification69.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.7e+22) (not (<= y 1.3e+68))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y (- (* (* z y) 0.16666666666666666) 0.5)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.7e+22) || !(y <= 1.3e+68)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * (((z * y) * 0.16666666666666666) - 0.5)) - 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.7d+22)) .or. (.not. (y <= 1.3d+68))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (y * ((y * (((z * y) * 0.16666666666666666d0) - 0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.7e+22) || !(y <= 1.3e+68)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * (((z * y) * 0.16666666666666666) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.7e+22) or not (y <= 1.3e+68): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * (((z * y) * 0.16666666666666666) - 0.5)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.7e+22) || !(y <= 1.3e+68)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(Float64(z * y) * 0.16666666666666666) - 0.5)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.7e+22) || ~((y <= 1.3e+68))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * (((z * y) * 0.16666666666666666) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.7e+22], N[Not[LessEqual[y, 1.3e+68]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(N[(z * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+22} \lor \neg \left(y \leq 1.3 \cdot 10^{+68}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(\left(z \cdot y\right) \cdot 0.16666666666666666 - 0.5\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -2.7000000000000002e22 or 1.2999999999999999e68 < y Initial program 99.8%
Taylor expanded in y around 0 39.3%
+-commutative39.3%
Simplified39.3%
if -2.7000000000000002e22 < y < 1.2999999999999999e68Initial program 100.0%
Taylor expanded in y around 0 92.3%
Final simplification67.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.1e+24) (not (<= y 1.8e+68))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y -0.5) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.1e+24) || !(y <= 1.8e+68)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * -0.5) - 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 <= (-4.1d+24)) .or. (.not. (y <= 1.8d+68))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (y * ((y * (-0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -4.1e+24) || !(y <= 1.8e+68)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.1e+24) or not (y <= 1.8e+68): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * -0.5) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.1e+24) || !(y <= 1.8e+68)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * -0.5) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -4.1e+24) || ~((y <= 1.8e+68))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * -0.5) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.1e+24], N[Not[LessEqual[y, 1.8e+68]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{+24} \lor \neg \left(y \leq 1.8 \cdot 10^{+68}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\end{array}
\end{array}
if y < -4.1000000000000001e24 or 1.7999999999999999e68 < y Initial program 99.8%
Taylor expanded in y around 0 39.0%
+-commutative39.0%
Simplified39.0%
if -4.1000000000000001e24 < y < 1.7999999999999999e68Initial program 100.0%
Taylor expanded in y around 0 91.2%
Final simplification67.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -6.5e+25) (not (<= y 0.0072))) (+ x 1.0) (- (+ x 1.0) (* z y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.5e+25) || !(y <= 0.0072)) {
tmp = x + 1.0;
} else {
tmp = (x + 1.0) - (z * 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 <= (-6.5d+25)) .or. (.not. (y <= 0.0072d0))) then
tmp = x + 1.0d0
else
tmp = (x + 1.0d0) - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6.5e+25) || !(y <= 0.0072)) {
tmp = x + 1.0;
} else {
tmp = (x + 1.0) - (z * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6.5e+25) or not (y <= 0.0072): tmp = x + 1.0 else: tmp = (x + 1.0) - (z * y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6.5e+25) || !(y <= 0.0072)) tmp = Float64(x + 1.0); else tmp = Float64(Float64(x + 1.0) - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6.5e+25) || ~((y <= 0.0072))) tmp = x + 1.0; else tmp = (x + 1.0) - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6.5e+25], N[Not[LessEqual[y, 0.0072]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{+25} \lor \neg \left(y \leq 0.0072\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - z \cdot y\\
\end{array}
\end{array}
if y < -6.50000000000000005e25 or 0.0071999999999999998 < y Initial program 99.8%
Taylor expanded in y around 0 37.9%
+-commutative37.9%
Simplified37.9%
if -6.50000000000000005e25 < y < 0.0071999999999999998Initial program 100.0%
Taylor expanded in y around 0 97.3%
associate-+r+97.3%
mul-1-neg97.3%
unsub-neg97.3%
+-commutative97.3%
Simplified97.3%
Final simplification67.3%
(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 59.5%
+-commutative59.5%
Simplified59.5%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.9%
Taylor expanded in x around inf 40.5%
herbie shell --seed 2024096
(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))))