
(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 14 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 (- (+ 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%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- (/ 1.0 z) (sin y)))))
(if (<= z -2.9e+225)
t_0
(if (<= z -2.4e+185)
(+ x (- 1.0 (* y z)))
(if (or (<= z -3.6e+140) (not (<= z 6.8e+87))) t_0 (+ x (cos y)))))))
double code(double x, double y, double z) {
double t_0 = z * ((1.0 / z) - sin(y));
double tmp;
if (z <= -2.9e+225) {
tmp = t_0;
} else if (z <= -2.4e+185) {
tmp = x + (1.0 - (y * z));
} else if ((z <= -3.6e+140) || !(z <= 6.8e+87)) {
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 * ((1.0d0 / z) - sin(y))
if (z <= (-2.9d+225)) then
tmp = t_0
else if (z <= (-2.4d+185)) then
tmp = x + (1.0d0 - (y * z))
else if ((z <= (-3.6d+140)) .or. (.not. (z <= 6.8d+87))) 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 * ((1.0 / z) - Math.sin(y));
double tmp;
if (z <= -2.9e+225) {
tmp = t_0;
} else if (z <= -2.4e+185) {
tmp = x + (1.0 - (y * z));
} else if ((z <= -3.6e+140) || !(z <= 6.8e+87)) {
tmp = t_0;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): t_0 = z * ((1.0 / z) - math.sin(y)) tmp = 0 if z <= -2.9e+225: tmp = t_0 elif z <= -2.4e+185: tmp = x + (1.0 - (y * z)) elif (z <= -3.6e+140) or not (z <= 6.8e+87): tmp = t_0 else: tmp = x + math.cos(y) return tmp
function code(x, y, z) t_0 = Float64(z * Float64(Float64(1.0 / z) - sin(y))) tmp = 0.0 if (z <= -2.9e+225) tmp = t_0; elseif (z <= -2.4e+185) tmp = Float64(x + Float64(1.0 - Float64(y * z))); elseif ((z <= -3.6e+140) || !(z <= 6.8e+87)) tmp = t_0; else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * ((1.0 / z) - sin(y)); tmp = 0.0; if (z <= -2.9e+225) tmp = t_0; elseif (z <= -2.4e+185) tmp = x + (1.0 - (y * z)); elseif ((z <= -3.6e+140) || ~((z <= 6.8e+87))) tmp = t_0; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(N[(1.0 / z), $MachinePrecision] - N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.9e+225], t$95$0, If[LessEqual[z, -2.4e+185], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -3.6e+140], N[Not[LessEqual[z, 6.8e+87]], $MachinePrecision]], t$95$0, N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(\frac{1}{z} - \sin y\right)\\
\mathbf{if}\;z \leq -2.9 \cdot 10^{+225}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2.4 \cdot 10^{+185}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{+140} \lor \neg \left(z \leq 6.8 \cdot 10^{+87}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -2.9000000000000001e225 or -2.39999999999999989e185 < z < -3.6e140 or 6.8000000000000004e87 < z Initial program 99.8%
Taylor expanded in z around -inf 99.6%
mul-1-neg99.6%
distribute-rgt-neg-in99.6%
distribute-lft-out--99.6%
mul-1-neg99.6%
remove-double-neg99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in x around 0 82.3%
Taylor expanded in y around 0 82.3%
if -2.9000000000000001e225 < z < -2.39999999999999989e185Initial program 100.0%
Taylor expanded in y around 0 89.5%
associate-+r+89.5%
+-commutative89.5%
associate-+l+89.5%
mul-1-neg89.5%
unsub-neg89.5%
Simplified89.5%
if -3.6e140 < z < 6.8000000000000004e87Initial 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 -7e+226)
t_0
(if (<= z -3.5e+186)
(+ x (- 1.0 (* y z)))
(if (or (<= z -2e+143) (not (<= z 1.42e+88))) t_0 (+ x (cos y)))))))
double code(double x, double y, double z) {
double t_0 = z * -sin(y);
double tmp;
if (z <= -7e+226) {
tmp = t_0;
} else if (z <= -3.5e+186) {
tmp = x + (1.0 - (y * z));
} else if ((z <= -2e+143) || !(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 = z * -sin(y)
if (z <= (-7d+226)) then
tmp = t_0
else if (z <= (-3.5d+186)) then
tmp = x + (1.0d0 - (y * z))
else if ((z <= (-2d+143)) .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 = z * -Math.sin(y);
double tmp;
if (z <= -7e+226) {
tmp = t_0;
} else if (z <= -3.5e+186) {
tmp = x + (1.0 - (y * z));
} else if ((z <= -2e+143) || !(z <= 1.42e+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 <= -7e+226: tmp = t_0 elif z <= -3.5e+186: tmp = x + (1.0 - (y * z)) elif (z <= -2e+143) 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(z * Float64(-sin(y))) tmp = 0.0 if (z <= -7e+226) tmp = t_0; elseif (z <= -3.5e+186) tmp = Float64(x + Float64(1.0 - Float64(y * z))); elseif ((z <= -2e+143) || !(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 = z * -sin(y); tmp = 0.0; if (z <= -7e+226) tmp = t_0; elseif (z <= -3.5e+186) tmp = x + (1.0 - (y * z)); elseif ((z <= -2e+143) || ~((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[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[z, -7e+226], t$95$0, If[LessEqual[z, -3.5e+186], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -2e+143], 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 := z \cdot \left(-\sin y\right)\\
\mathbf{if}\;z \leq -7 \cdot 10^{+226}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.5 \cdot 10^{+186}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{elif}\;z \leq -2 \cdot 10^{+143} \lor \neg \left(z \leq 1.42 \cdot 10^{+88}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -6.9999999999999996e226 or -3.49999999999999987e186 < z < -2e143 or 1.41999999999999996e88 < z Initial program 99.8%
Taylor expanded in z around inf 68.8%
associate-*r*68.8%
neg-mul-168.8%
*-commutative68.8%
Simplified68.8%
if -6.9999999999999996e226 < z < -3.49999999999999987e186Initial program 100.0%
Taylor expanded in y around 0 89.5%
associate-+r+89.5%
+-commutative89.5%
associate-+l+89.5%
mul-1-neg89.5%
unsub-neg89.5%
Simplified89.5%
if -2e143 < z < 1.41999999999999996e88Initial 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 -3.1) (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 <= -3.1) || !(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 <= (-3.1d0)) .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 <= -3.1) || !(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 <= -3.1) 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 <= -3.1) || !(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 <= -3.1) || ~((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, -3.1], 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 -3.1 \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 < -3.10000000000000009 or 3.50000000000000017e-16 < z Initial program 99.8%
Taylor expanded in z around -inf 99.7%
mul-1-neg99.7%
distribute-rgt-neg-in99.7%
distribute-lft-out--99.7%
mul-1-neg99.7%
remove-double-neg99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 99.2%
if -3.10000000000000009 < 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 1.75e+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 <= 1.75e+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 <= 1.75d+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 <= 1.75e+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 <= 1.75e+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 <= 1.75e+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 <= 1.75e+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, 1.75e+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 1.75 \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 1.74999999999999994e69 < z Initial program 99.8%
Taylor expanded in z around -inf 99.6%
mul-1-neg99.6%
distribute-rgt-neg-in99.6%
distribute-lft-out--99.6%
mul-1-neg99.6%
remove-double-neg99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in x around inf 86.4%
if -2.50000000000000002e77 < z < 1.74999999999999994e69Initial 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.32) (not (<= y 0.0072))) (+ x (cos y)) (+ 1.0 (+ x (* y (- (* y (- (* (* y z) 0.16666666666666666) 0.5)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.32) || !(y <= 0.0072)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * (((y * z) * 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.32d0)) .or. (.not. (y <= 0.0072d0))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x + (y * ((y * (((y * z) * 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.32) || !(y <= 0.0072)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.32) or not (y <= 0.0072): tmp = x + math.cos(y) else: tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.32) || !(y <= 0.0072)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(Float64(y * z) * 0.16666666666666666) - 0.5)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.32) || ~((y <= 0.0072))) tmp = x + cos(y); else tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.32], 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[(y * z), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.32 \lor \neg \left(y \leq 0.0072\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(\left(y \cdot z\right) \cdot 0.16666666666666666 - 0.5\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -0.320000000000000007 or 0.0071999999999999998 < y Initial program 99.8%
Taylor expanded in z around 0 58.2%
+-commutative58.2%
Simplified58.2%
if -0.320000000000000007 < 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 -5.2e-13) (not (<= x 1.6e-42))) (+ x 1.0) (cos y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5.2e-13) || !(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 <= (-5.2d-13)) .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 <= -5.2e-13) || !(x <= 1.6e-42)) {
tmp = x + 1.0;
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5.2e-13) 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 <= -5.2e-13) || !(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 <= -5.2e-13) || ~((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, -5.2e-13], 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 -5.2 \cdot 10^{-13} \lor \neg \left(x \leq 1.6 \cdot 10^{-42}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if x < -5.2000000000000001e-13 or 1.60000000000000012e-42 < x Initial program 99.9%
Taylor expanded in y around 0 75.8%
+-commutative75.8%
Simplified75.8%
if -5.2000000000000001e-13 < x < 1.60000000000000012e-42Initial program 99.9%
Taylor expanded in z around -inf 99.7%
mul-1-neg99.7%
distribute-rgt-neg-in99.7%
distribute-lft-out--99.7%
mul-1-neg99.7%
remove-double-neg99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around 0 99.7%
Taylor expanded in z around 0 62.1%
Final simplification69.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.8e+22) (not (<= y 1.3e+68))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y (- (* (* y z) 0.16666666666666666) 0.5)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.8e+22) || !(y <= 1.3e+68)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * (((y * z) * 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 <= (-1.8d+22)) .or. (.not. (y <= 1.3d+68))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (y * ((y * (((y * z) * 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 <= -1.8e+22) || !(y <= 1.3e+68)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.8e+22) or not (y <= 1.3e+68): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.8e+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(y * z) * 0.16666666666666666) - 0.5)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.8e+22) || ~((y <= 1.3e+68))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.8e+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[(y * z), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \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(y \cdot z\right) \cdot 0.16666666666666666 - 0.5\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -1.8e22 or 1.2999999999999999e68 < y Initial program 99.8%
Taylor expanded in y around 0 39.3%
+-commutative39.3%
Simplified39.3%
if -1.8e22 < 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 -4e+24) (not (<= y 1.3e+68))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y -0.5) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4e+24) || !(y <= 1.3e+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 <= (-4d+24)) .or. (.not. (y <= 1.3d+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 <= -4e+24) || !(y <= 1.3e+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 <= -4e+24) or not (y <= 1.3e+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 <= -4e+24) || !(y <= 1.3e+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 <= -4e+24) || ~((y <= 1.3e+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, -4e+24], N[Not[LessEqual[y, 1.3e+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 \cdot 10^{+24} \lor \neg \left(y \leq 1.3 \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 < -3.9999999999999999e24 or 1.2999999999999999e68 < y Initial program 99.8%
Taylor expanded in y around 0 39.0%
+-commutative39.0%
Simplified39.0%
if -3.9999999999999999e24 < y < 1.2999999999999999e68Initial program 100.0%
Taylor expanded in y around 0 91.2%
Final simplification67.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.2e+26) (not (<= y 0.0072))) (+ x 1.0) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.2e+26) || !(y <= 0.0072)) {
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 <= (-2.2d+26)) .or. (.not. (y <= 0.0072d0))) 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 <= -2.2e+26) || !(y <= 0.0072)) {
tmp = x + 1.0;
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.2e+26) or not (y <= 0.0072): tmp = x + 1.0 else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.2e+26) || !(y <= 0.0072)) tmp = Float64(x + 1.0); else tmp = Float64(x + Float64(1.0 - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.2e+26) || ~((y <= 0.0072))) tmp = x + 1.0; else tmp = x + (1.0 - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.2e+26], N[Not[LessEqual[y, 0.0072]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{+26} \lor \neg \left(y \leq 0.0072\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -2.20000000000000007e26 or 0.0071999999999999998 < y Initial program 99.8%
Taylor expanded in y around 0 37.9%
+-commutative37.9%
Simplified37.9%
if -2.20000000000000007e26 < y < 0.0071999999999999998Initial program 100.0%
Taylor expanded in y around 0 97.3%
associate-+r+97.3%
+-commutative97.3%
associate-+l+97.3%
mul-1-neg97.3%
unsub-neg97.3%
Simplified97.3%
Final simplification67.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -8.5e-20) (not (<= x 7e-17))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -8.5e-20) || !(x <= 7e-17)) {
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 <= (-8.5d-20)) .or. (.not. (x <= 7d-17))) 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 <= -8.5e-20) || !(x <= 7e-17)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -8.5e-20) or not (x <= 7e-17): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -8.5e-20) || !(x <= 7e-17)) 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 <= -8.5e-20) || ~((x <= 7e-17))) tmp = x + 1.0; else tmp = 1.0 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -8.5e-20], N[Not[LessEqual[x, 7e-17]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{-20} \lor \neg \left(x \leq 7 \cdot 10^{-17}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -8.5000000000000005e-20 or 7.0000000000000003e-17 < x Initial program 99.9%
Taylor expanded in y around 0 75.7%
+-commutative75.7%
Simplified75.7%
if -8.5000000000000005e-20 < x < 7.0000000000000003e-17Initial program 99.9%
Taylor expanded in z around -inf 99.7%
mul-1-neg99.7%
distribute-rgt-neg-in99.7%
distribute-lft-out--99.7%
mul-1-neg99.7%
remove-double-neg99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around 0 99.7%
Taylor expanded in y around 0 54.3%
mul-1-neg54.3%
unsub-neg54.3%
*-commutative54.3%
Simplified54.3%
Final simplification65.9%
(FPCore (x y z) :precision binary64 (if (<= x -17200000000000.0) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -17200000000000.0) {
tmp = x;
} else if (x <= 1.0) {
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 <= (-17200000000000.0d0)) then
tmp = x
else if (x <= 1.0d0) 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 <= -17200000000000.0) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -17200000000000.0: tmp = x elif x <= 1.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -17200000000000.0) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -17200000000000.0) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -17200000000000.0], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -17200000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.72e13 or 1 < x Initial program 99.9%
Taylor expanded in x around inf 78.2%
if -1.72e13 < x < 1Initial program 99.9%
Taylor expanded in z around -inf 99.6%
mul-1-neg99.6%
distribute-rgt-neg-in99.6%
distribute-lft-out--99.6%
mul-1-neg99.6%
remove-double-neg99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in x around 0 98.2%
Taylor expanded in y around 0 39.6%
Final simplification58.8%
(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%
Final simplification59.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%
Taylor expanded in z around -inf 88.3%
mul-1-neg88.3%
distribute-rgt-neg-in88.3%
distribute-lft-out--88.3%
mul-1-neg88.3%
remove-double-neg88.3%
+-commutative88.3%
Simplified88.3%
Taylor expanded in x around 0 60.0%
Taylor expanded in y around 0 21.5%
Final simplification21.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))))