
(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(x + Float64(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[(x + N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\cos y - z \cdot \sin y\right)
\end{array}
Initial program 99.9%
associate--l+100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (sin y)))) (if (or (<= x -1.0) (not (<= x 0.62))) (- x t_0) (- (cos y) t_0))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if ((x <= -1.0) || !(x <= 0.62)) {
tmp = x - t_0;
} else {
tmp = cos(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 * sin(y)
if ((x <= (-1.0d0)) .or. (.not. (x <= 0.62d0))) then
tmp = x - t_0
else
tmp = cos(y) - t_0
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 ((x <= -1.0) || !(x <= 0.62)) {
tmp = x - t_0;
} else {
tmp = Math.cos(y) - t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) tmp = 0 if (x <= -1.0) or not (x <= 0.62): tmp = x - t_0 else: tmp = math.cos(y) - t_0 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) tmp = 0.0 if ((x <= -1.0) || !(x <= 0.62)) tmp = Float64(x - t_0); else tmp = Float64(cos(y) - t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); tmp = 0.0; if ((x <= -1.0) || ~((x <= 0.62))) tmp = x - t_0; else tmp = cos(y) - t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 0.62]], $MachinePrecision]], N[(x - t$95$0), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 0.62\right):\\
\;\;\;\;x - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -1 or 0.619999999999999996 < x Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around -inf 68.2%
mul-1-neg68.2%
distribute-rgt-neg-in68.2%
distribute-lft-out--68.2%
mul-1-neg68.2%
remove-double-neg68.2%
+-commutative68.2%
Simplified68.2%
Taylor expanded in x around inf 65.7%
Taylor expanded in z around 0 97.5%
mul-1-neg97.5%
unsub-neg97.5%
Simplified97.5%
if -1 < x < 0.619999999999999996Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 96.7%
Final simplification97.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.2e+23) (not (<= z 2.8e+135))) (- x (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.2e+23) || !(z <= 2.8e+135)) {
tmp = 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 <= (-6.2d+23)) .or. (.not. (z <= 2.8d+135))) then
tmp = 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 <= -6.2e+23) || !(z <= 2.8e+135)) {
tmp = x - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.2e+23) or not (z <= 2.8e+135): tmp = x - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.2e+23) || !(z <= 2.8e+135)) tmp = Float64(x - Float64(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 <= -6.2e+23) || ~((z <= 2.8e+135))) tmp = x - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.2e+23], N[Not[LessEqual[z, 2.8e+135]], $MachinePrecision]], N[(x - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+23} \lor \neg \left(z \leq 2.8 \cdot 10^{+135}\right):\\
\;\;\;\;x - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -6.19999999999999941e23 or 2.80000000000000002e135 < z Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in z around -inf 99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
distribute-lft-out--99.8%
mul-1-neg99.8%
remove-double-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 92.0%
Taylor expanded in z around 0 92.0%
mul-1-neg92.0%
unsub-neg92.0%
Simplified92.0%
if -6.19999999999999941e23 < z < 2.80000000000000002e135Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around 0 97.8%
+-commutative97.8%
Simplified97.8%
Final simplification95.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -7.5e+146) (not (<= z 5.2e+136))) (* z (- (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7.5e+146) || !(z <= 5.2e+136)) {
tmp = 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 <= (-7.5d+146)) .or. (.not. (z <= 5.2d+136))) then
tmp = 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 <= -7.5e+146) || !(z <= 5.2e+136)) {
tmp = z * -Math.sin(y);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -7.5e+146) or not (z <= 5.2e+136): tmp = z * -math.sin(y) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -7.5e+146) || !(z <= 5.2e+136)) tmp = Float64(z * Float64(-sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -7.5e+146) || ~((z <= 5.2e+136))) tmp = z * -sin(y); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -7.5e+146], N[Not[LessEqual[z, 5.2e+136]], $MachinePrecision]], N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+146} \lor \neg \left(z \leq 5.2 \cdot 10^{+136}\right):\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -7.49999999999999983e146 or 5.2000000000000003e136 < z Initial program 99.8%
associate--l+99.9%
Simplified99.9%
Taylor expanded in z around inf 82.4%
associate-*r*82.4%
neg-mul-182.4%
*-commutative82.4%
Simplified82.4%
if -7.49999999999999983e146 < z < 5.2000000000000003e136Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around 0 91.8%
+-commutative91.8%
Simplified91.8%
Final simplification89.5%
(FPCore (x y z)
:precision binary64
(if (or (<= y -135.0) (not (<= y 0.55)))
(+ x (cos y))
(+
1.0
(+
x
(*
y
(-
(*
y
(-
(*
y
(-
(* y (+ 0.041666666666666664 (* -0.008333333333333333 (* y z))))
(* z -0.16666666666666666)))
0.5))
z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -135.0) || !(y <= 0.55)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * ((y * ((y * (0.041666666666666664 + (-0.008333333333333333 * (y * z)))) - (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 <= (-135.0d0)) .or. (.not. (y <= 0.55d0))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x + (y * ((y * ((y * ((y * (0.041666666666666664d0 + ((-0.008333333333333333d0) * (y * z)))) - (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 <= -135.0) || !(y <= 0.55)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * ((y * ((y * (0.041666666666666664 + (-0.008333333333333333 * (y * z)))) - (z * -0.16666666666666666))) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -135.0) or not (y <= 0.55): tmp = x + math.cos(y) else: tmp = 1.0 + (x + (y * ((y * ((y * ((y * (0.041666666666666664 + (-0.008333333333333333 * (y * z)))) - (z * -0.16666666666666666))) - 0.5)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -135.0) || !(y <= 0.55)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(y * Float64(Float64(y * Float64(0.041666666666666664 + Float64(-0.008333333333333333 * Float64(y * z)))) - Float64(z * -0.16666666666666666))) - 0.5)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -135.0) || ~((y <= 0.55))) tmp = x + cos(y); else tmp = 1.0 + (x + (y * ((y * ((y * ((y * (0.041666666666666664 + (-0.008333333333333333 * (y * z)))) - (z * -0.16666666666666666))) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -135.0], N[Not[LessEqual[y, 0.55]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(y * N[(N[(y * N[(0.041666666666666664 + N[(-0.008333333333333333 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -135 \lor \neg \left(y \leq 0.55\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(y \cdot \left(y \cdot \left(0.041666666666666664 + -0.008333333333333333 \cdot \left(y \cdot z\right)\right) - z \cdot -0.16666666666666666\right) - 0.5\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -135 or 0.55000000000000004 < y Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in z around 0 68.3%
+-commutative68.3%
Simplified68.3%
if -135 < y < 0.55000000000000004Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 99.3%
Final simplification83.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -9.2e+40) (not (<= y 6.5e+18))) (+ 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 <= -9.2e+40) || !(y <= 6.5e+18)) {
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 <= (-9.2d+40)) .or. (.not. (y <= 6.5d+18))) 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 <= -9.2e+40) || !(y <= 6.5e+18)) {
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 <= -9.2e+40) or not (y <= 6.5e+18): 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 <= -9.2e+40) || !(y <= 6.5e+18)) 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 <= -9.2e+40) || ~((y <= 6.5e+18))) 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, -9.2e+40], N[Not[LessEqual[y, 6.5e+18]], $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 -9.2 \cdot 10^{+40} \lor \neg \left(y \leq 6.5 \cdot 10^{+18}\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 < -9.19999999999999975e40 or 6.5e18 < y Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around 0 48.3%
+-commutative48.3%
Simplified48.3%
if -9.19999999999999975e40 < y < 6.5e18Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 95.1%
Final simplification73.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -620000000000.0) (not (<= y 6.6e+18))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y (* (* y z) 0.16666666666666666)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -620000000000.0) || !(y <= 6.6e+18)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * ((y * z) * 0.16666666666666666)) - 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 <= (-620000000000.0d0)) .or. (.not. (y <= 6.6d+18))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (y * ((y * ((y * z) * 0.16666666666666666d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -620000000000.0) || !(y <= 6.6e+18)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * ((y * z) * 0.16666666666666666)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -620000000000.0) or not (y <= 6.6e+18): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * ((y * z) * 0.16666666666666666)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -620000000000.0) || !(y <= 6.6e+18)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(y * z) * 0.16666666666666666)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -620000000000.0) || ~((y <= 6.6e+18))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * ((y * z) * 0.16666666666666666)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -620000000000.0], N[Not[LessEqual[y, 6.6e+18]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(y * z), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -620000000000 \lor \neg \left(y \leq 6.6 \cdot 10^{+18}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(\left(y \cdot z\right) \cdot 0.16666666666666666\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -6.2e11 or 6.6e18 < y Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around 0 47.2%
+-commutative47.2%
Simplified47.2%
if -6.2e11 < y < 6.6e18Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 97.1%
Taylor expanded in y around inf 97.1%
Final simplification73.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -4e+41) (not (<= y 4000000.0))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y -0.5) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4e+41) || !(y <= 4000000.0)) {
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+41)) .or. (.not. (y <= 4000000.0d0))) 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+41) || !(y <= 4000000.0)) {
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+41) or not (y <= 4000000.0): 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+41) || !(y <= 4000000.0)) 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+41) || ~((y <= 4000000.0))) 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+41], N[Not[LessEqual[y, 4000000.0]], $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^{+41} \lor \neg \left(y \leq 4000000\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.00000000000000002e41 or 4e6 < y Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around 0 47.9%
+-commutative47.9%
Simplified47.9%
if -4.00000000000000002e41 < y < 4e6Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 95.5%
Final simplification73.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -3900.0) (not (<= y 1200000.0))) (+ x 1.0) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3900.0) || !(y <= 1200000.0)) {
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 <= (-3900.0d0)) .or. (.not. (y <= 1200000.0d0))) 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 <= -3900.0) || !(y <= 1200000.0)) {
tmp = x + 1.0;
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3900.0) or not (y <= 1200000.0): tmp = x + 1.0 else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3900.0) || !(y <= 1200000.0)) 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 <= -3900.0) || ~((y <= 1200000.0))) tmp = x + 1.0; else tmp = x + (1.0 - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3900.0], N[Not[LessEqual[y, 1200000.0]], $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 -3900 \lor \neg \left(y \leq 1200000\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -3900 or 1.2e6 < y Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around 0 46.9%
+-commutative46.9%
Simplified46.9%
if -3900 < y < 1.2e6Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 98.3%
associate-+r+98.3%
+-commutative98.3%
associate-+l+98.3%
mul-1-neg98.3%
unsub-neg98.3%
Simplified98.3%
Final simplification73.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.7e+128) (not (<= z 1.8e+164))) (- x (* y z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.7e+128) || !(z <= 1.8e+164)) {
tmp = x - (y * z);
} 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 ((z <= (-2.7d+128)) .or. (.not. (z <= 1.8d+164))) then
tmp = x - (y * z)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.7e+128) || !(z <= 1.8e+164)) {
tmp = x - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.7e+128) or not (z <= 1.8e+164): tmp = x - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.7e+128) || !(z <= 1.8e+164)) tmp = Float64(x - Float64(y * z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.7e+128) || ~((z <= 1.8e+164))) tmp = x - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.7e+128], N[Not[LessEqual[z, 1.8e+164]], $MachinePrecision]], N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+128} \lor \neg \left(z \leq 1.8 \cdot 10^{+164}\right):\\
\;\;\;\;x - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -2.70000000000000001e128 or 1.79999999999999995e164 < z Initial program 99.8%
associate--l+99.9%
Simplified99.9%
Taylor expanded in z around -inf 99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
distribute-lft-out--99.8%
mul-1-neg99.8%
remove-double-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 94.9%
Taylor expanded in y around 0 47.7%
mul-1-neg47.7%
unsub-neg47.7%
Simplified47.7%
if -2.70000000000000001e128 < z < 1.79999999999999995e164Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 77.0%
+-commutative77.0%
Simplified77.0%
Final simplification69.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -9.5e+202) (not (<= z 1e+165))) (- 1.0 (* y z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -9.5e+202) || !(z <= 1e+165)) {
tmp = 1.0 - (y * z);
} 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 ((z <= (-9.5d+202)) .or. (.not. (z <= 1d+165))) then
tmp = 1.0d0 - (y * z)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -9.5e+202) || !(z <= 1e+165)) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -9.5e+202) or not (z <= 1e+165): tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -9.5e+202) || !(z <= 1e+165)) tmp = Float64(1.0 - Float64(y * z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -9.5e+202) || ~((z <= 1e+165))) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -9.5e+202], N[Not[LessEqual[z, 1e+165]], $MachinePrecision]], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+202} \lor \neg \left(z \leq 10^{+165}\right):\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -9.50000000000000059e202 or 9.99999999999999899e164 < z Initial program 99.8%
associate--l+99.9%
Simplified99.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 93.4%
Taylor expanded in y around 0 49.4%
mul-1-neg49.4%
distribute-rgt-neg-out49.4%
Simplified49.4%
if -9.50000000000000059e202 < z < 9.99999999999999899e164Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 75.0%
+-commutative75.0%
Simplified75.0%
Final simplification70.2%
(FPCore (x y z) :precision binary64 (if (<= x -0.9) x (if (<= x 1.06) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.9) {
tmp = x;
} else if (x <= 1.06) {
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 <= (-0.9d0)) then
tmp = x
else if (x <= 1.06d0) 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 <= -0.9) {
tmp = x;
} else if (x <= 1.06) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.9: tmp = x elif x <= 1.06: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.9) tmp = x; elseif (x <= 1.06) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.9) tmp = x; elseif (x <= 1.06) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.9], x, If[LessEqual[x, 1.06], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.9:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.06:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -0.900000000000000022 or 1.0600000000000001 < x Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around inf 80.3%
if -0.900000000000000022 < x < 1.0600000000000001Initial program 99.9%
associate--l+99.9%
Simplified99.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 96.4%
Taylor expanded in y around 0 43.3%
Final simplification61.2%
(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%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 62.8%
+-commutative62.8%
Simplified62.8%
Final simplification62.8%
(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%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around -inf 84.4%
mul-1-neg84.4%
distribute-rgt-neg-in84.4%
distribute-lft-out--84.4%
mul-1-neg84.4%
remove-double-neg84.4%
+-commutative84.4%
Simplified84.4%
Taylor expanded in x around 0 59.1%
Taylor expanded in y around 0 23.8%
Final simplification23.8%
herbie shell --seed 2024053
(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))))