
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
(FPCore (x y z) :precision binary64 (+ (* z (cos y)) (+ x (sin y))))
double code(double x, double y, double z) {
return (z * cos(y)) + (x + 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 = (z * cos(y)) + (x + sin(y))
end function
public static double code(double x, double y, double z) {
return (z * Math.cos(y)) + (x + Math.sin(y));
}
def code(x, y, z): return (z * math.cos(y)) + (x + math.sin(y))
function code(x, y, z) return Float64(Float64(z * cos(y)) + Float64(x + sin(y))) end
function tmp = code(x, y, z) tmp = (z * cos(y)) + (x + sin(y)); end
code[x_, y_, z_] := N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \cos y + \left(x + \sin y\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -60000000.0) (not (<= x 40000000.0))) (+ x z) (+ (sin y) (* z (cos y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -60000000.0) || !(x <= 40000000.0)) {
tmp = x + z;
} else {
tmp = sin(y) + (z * 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 <= (-60000000.0d0)) .or. (.not. (x <= 40000000.0d0))) then
tmp = x + z
else
tmp = sin(y) + (z * cos(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -60000000.0) || !(x <= 40000000.0)) {
tmp = x + z;
} else {
tmp = Math.sin(y) + (z * Math.cos(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -60000000.0) or not (x <= 40000000.0): tmp = x + z else: tmp = math.sin(y) + (z * math.cos(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -60000000.0) || !(x <= 40000000.0)) tmp = Float64(x + z); else tmp = Float64(sin(y) + Float64(z * cos(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -60000000.0) || ~((x <= 40000000.0))) tmp = x + z; else tmp = sin(y) + (z * cos(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -60000000.0], N[Not[LessEqual[x, 40000000.0]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -60000000 \lor \neg \left(x \leq 40000000\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;\sin y + z \cdot \cos y\\
\end{array}
\end{array}
if x < -6e7 or 4e7 < x Initial program 99.9%
Taylor expanded in y around 0 88.2%
if -6e7 < x < 4e7Initial program 99.9%
Taylor expanded in x around 0 91.3%
Final simplification90.0%
(FPCore (x y z)
:precision binary64
(if (<= y -5.2e+177)
(+ x z)
(if (<= y -1.25e+16)
(sin y)
(if (<= y 0.83)
(+
x
(+ z (* y (+ 1.0 (* y (+ (* z -0.5) (* y -0.16666666666666666)))))))
(if (<= y 1.7e+179) (sin y) (+ x z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.2e+177) {
tmp = x + z;
} else if (y <= -1.25e+16) {
tmp = sin(y);
} else if (y <= 0.83) {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
} else if (y <= 1.7e+179) {
tmp = sin(y);
} else {
tmp = x + 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 <= (-5.2d+177)) then
tmp = x + z
else if (y <= (-1.25d+16)) then
tmp = sin(y)
else if (y <= 0.83d0) then
tmp = x + (z + (y * (1.0d0 + (y * ((z * (-0.5d0)) + (y * (-0.16666666666666666d0)))))))
else if (y <= 1.7d+179) then
tmp = sin(y)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5.2e+177) {
tmp = x + z;
} else if (y <= -1.25e+16) {
tmp = Math.sin(y);
} else if (y <= 0.83) {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
} else if (y <= 1.7e+179) {
tmp = Math.sin(y);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.2e+177: tmp = x + z elif y <= -1.25e+16: tmp = math.sin(y) elif y <= 0.83: tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))) elif y <= 1.7e+179: tmp = math.sin(y) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.2e+177) tmp = Float64(x + z); elseif (y <= -1.25e+16) tmp = sin(y); elseif (y <= 0.83) tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(Float64(z * -0.5) + Float64(y * -0.16666666666666666))))))); elseif (y <= 1.7e+179) tmp = sin(y); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.2e+177) tmp = x + z; elseif (y <= -1.25e+16) tmp = sin(y); elseif (y <= 0.83) tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))); elseif (y <= 1.7e+179) tmp = sin(y); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.2e+177], N[(x + z), $MachinePrecision], If[LessEqual[y, -1.25e+16], N[Sin[y], $MachinePrecision], If[LessEqual[y, 0.83], N[(x + N[(z + N[(y * N[(1.0 + N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.7e+179], N[Sin[y], $MachinePrecision], N[(x + z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+177}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq -1.25 \cdot 10^{+16}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;y \leq 0.83:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(z \cdot -0.5 + y \cdot -0.16666666666666666\right)\right)\right)\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{+179}:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -5.19999999999999959e177 or 1.69999999999999998e179 < y Initial program 99.8%
Taylor expanded in y around 0 42.3%
if -5.19999999999999959e177 < y < -1.25e16 or 0.82999999999999996 < y < 1.69999999999999998e179Initial program 99.8%
Taylor expanded in x around inf 99.7%
Taylor expanded in z around 0 64.7%
+-commutative64.7%
Simplified64.7%
Taylor expanded in x around 0 48.9%
if -1.25e16 < y < 0.82999999999999996Initial program 100.0%
Taylor expanded in y around 0 97.9%
Final simplification72.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -5.4e+113)
t_0
(if (<= z -2.15e-135)
(* z (+ (/ (sin y) z) (+ 1.0 (/ x z))))
(if (<= z 9.5) (+ x (sin y)) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -5.4e+113) {
tmp = t_0;
} else if (z <= -2.15e-135) {
tmp = z * ((sin(y) / z) + (1.0 + (x / z)));
} else if (z <= 9.5) {
tmp = x + sin(y);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * cos(y)
if (z <= (-5.4d+113)) then
tmp = t_0
else if (z <= (-2.15d-135)) then
tmp = z * ((sin(y) / z) + (1.0d0 + (x / z)))
else if (z <= 9.5d0) then
tmp = x + sin(y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double tmp;
if (z <= -5.4e+113) {
tmp = t_0;
} else if (z <= -2.15e-135) {
tmp = z * ((Math.sin(y) / z) + (1.0 + (x / z)));
} else if (z <= 9.5) {
tmp = x + Math.sin(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -5.4e+113: tmp = t_0 elif z <= -2.15e-135: tmp = z * ((math.sin(y) / z) + (1.0 + (x / z))) elif z <= 9.5: tmp = x + math.sin(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -5.4e+113) tmp = t_0; elseif (z <= -2.15e-135) tmp = Float64(z * Float64(Float64(sin(y) / z) + Float64(1.0 + Float64(x / z)))); elseif (z <= 9.5) tmp = Float64(x + sin(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -5.4e+113) tmp = t_0; elseif (z <= -2.15e-135) tmp = z * ((sin(y) / z) + (1.0 + (x / z))); elseif (z <= 9.5) tmp = x + sin(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.4e+113], t$95$0, If[LessEqual[z, -2.15e-135], N[(z * N[(N[(N[Sin[y], $MachinePrecision] / z), $MachinePrecision] + N[(1.0 + N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.5], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -5.4 \cdot 10^{+113}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2.15 \cdot 10^{-135}:\\
\;\;\;\;z \cdot \left(\frac{\sin y}{z} + \left(1 + \frac{x}{z}\right)\right)\\
\mathbf{elif}\;z \leq 9.5:\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -5.40000000000000022e113 or 9.5 < z Initial program 99.9%
Taylor expanded in z around inf 85.7%
if -5.40000000000000022e113 < z < -2.14999999999999999e-135Initial program 100.0%
Taylor expanded in z around inf 97.9%
associate-+r+97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in y around 0 86.9%
if -2.14999999999999999e-135 < z < 9.5Initial program 99.9%
Taylor expanded in z around 0 91.3%
+-commutative91.3%
Simplified91.3%
Final simplification88.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.2e+25) (not (<= z 10.0))) (* z (cos y)) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.2e+25) || !(z <= 10.0)) {
tmp = z * cos(y);
} else {
tmp = x + sin(y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-4.2d+25)) .or. (.not. (z <= 10.0d0))) then
tmp = z * cos(y)
else
tmp = x + sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4.2e+25) || !(z <= 10.0)) {
tmp = z * Math.cos(y);
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.2e+25) or not (z <= 10.0): tmp = z * math.cos(y) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.2e+25) || !(z <= 10.0)) tmp = Float64(z * cos(y)); else tmp = Float64(x + sin(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.2e+25) || ~((z <= 10.0))) tmp = z * cos(y); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.2e+25], N[Not[LessEqual[z, 10.0]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+25} \lor \neg \left(z \leq 10\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -4.1999999999999998e25 or 10 < z Initial program 99.9%
Taylor expanded in z around inf 83.6%
if -4.1999999999999998e25 < z < 10Initial program 99.9%
Taylor expanded in z around 0 87.8%
+-commutative87.8%
Simplified87.8%
Final simplification85.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.1e+113) (not (<= z 4e+111))) (* z (cos y)) (+ x z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.1e+113) || !(z <= 4e+111)) {
tmp = z * cos(y);
} else {
tmp = x + 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 ((z <= (-5.1d+113)) .or. (.not. (z <= 4d+111))) then
tmp = z * cos(y)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5.1e+113) || !(z <= 4e+111)) {
tmp = z * Math.cos(y);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.1e+113) or not (z <= 4e+111): tmp = z * math.cos(y) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.1e+113) || !(z <= 4e+111)) tmp = Float64(z * cos(y)); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.1e+113) || ~((z <= 4e+111))) tmp = z * cos(y); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.1e+113], N[Not[LessEqual[z, 4e+111]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.1 \cdot 10^{+113} \lor \neg \left(z \leq 4 \cdot 10^{+111}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if z < -5.09999999999999994e113 or 3.99999999999999983e111 < z Initial program 99.8%
Taylor expanded in z around inf 89.1%
if -5.09999999999999994e113 < z < 3.99999999999999983e111Initial program 100.0%
Taylor expanded in y around 0 64.1%
Final simplification72.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -30.0) (not (<= y 17.0))) (+ x z) (+ x (+ z (* y (+ 1.0 (* y (+ (* z -0.5) (* y -0.16666666666666666)))))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -30.0) || !(y <= 17.0)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
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 <= (-30.0d0)) .or. (.not. (y <= 17.0d0))) then
tmp = x + z
else
tmp = x + (z + (y * (1.0d0 + (y * ((z * (-0.5d0)) + (y * (-0.16666666666666666d0)))))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -30.0) || !(y <= 17.0)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -30.0) or not (y <= 17.0): tmp = x + z else: tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -30.0) || !(y <= 17.0)) tmp = Float64(x + z); else tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(Float64(z * -0.5) + Float64(y * -0.16666666666666666))))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -30.0) || ~((y <= 17.0))) tmp = x + z; else tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -30.0], N[Not[LessEqual[y, 17.0]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(x + N[(z + N[(y * N[(1.0 + N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -30 \lor \neg \left(y \leq 17\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(z \cdot -0.5 + y \cdot -0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if y < -30 or 17 < y Initial program 99.8%
Taylor expanded in y around 0 31.6%
if -30 < y < 17Initial program 100.0%
Taylor expanded in y around 0 99.3%
Final simplification66.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -55.0) (not (<= y 17.0))) (+ x z) (+ (+ x z) (* y (+ 1.0 (* -0.5 (* y z)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -55.0) || !(y <= 17.0)) {
tmp = x + z;
} else {
tmp = (x + z) + (y * (1.0 + (-0.5 * (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 <= (-55.0d0)) .or. (.not. (y <= 17.0d0))) then
tmp = x + z
else
tmp = (x + z) + (y * (1.0d0 + ((-0.5d0) * (y * z))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -55.0) || !(y <= 17.0)) {
tmp = x + z;
} else {
tmp = (x + z) + (y * (1.0 + (-0.5 * (y * z))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -55.0) or not (y <= 17.0): tmp = x + z else: tmp = (x + z) + (y * (1.0 + (-0.5 * (y * z)))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -55.0) || !(y <= 17.0)) tmp = Float64(x + z); else tmp = Float64(Float64(x + z) + Float64(y * Float64(1.0 + Float64(-0.5 * Float64(y * z))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -55.0) || ~((y <= 17.0))) tmp = x + z; else tmp = (x + z) + (y * (1.0 + (-0.5 * (y * z)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -55.0], N[Not[LessEqual[y, 17.0]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(N[(x + z), $MachinePrecision] + N[(y * N[(1.0 + N[(-0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -55 \lor \neg \left(y \leq 17\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;\left(x + z\right) + y \cdot \left(1 + -0.5 \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if y < -55 or 17 < y Initial program 99.8%
Taylor expanded in y around 0 31.6%
if -55 < y < 17Initial program 100.0%
Taylor expanded in y around 0 99.1%
associate-+r+99.1%
Simplified99.1%
Final simplification65.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.15e+99) (not (<= y 0.195))) (+ x z) (+ z (+ x y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.15e+99) || !(y <= 0.195)) {
tmp = x + z;
} else {
tmp = z + (x + 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 <= (-1.15d+99)) .or. (.not. (y <= 0.195d0))) then
tmp = x + z
else
tmp = z + (x + y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.15e+99) || !(y <= 0.195)) {
tmp = x + z;
} else {
tmp = z + (x + y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.15e+99) or not (y <= 0.195): tmp = x + z else: tmp = z + (x + y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.15e+99) || !(y <= 0.195)) tmp = Float64(x + z); else tmp = Float64(z + Float64(x + y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.15e+99) || ~((y <= 0.195))) tmp = x + z; else tmp = z + (x + y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.15e+99], N[Not[LessEqual[y, 0.195]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+99} \lor \neg \left(y \leq 0.195\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + y\right)\\
\end{array}
\end{array}
if y < -1.1500000000000001e99 or 0.19500000000000001 < y Initial program 99.8%
Taylor expanded in y around 0 32.3%
if -1.1500000000000001e99 < y < 0.19500000000000001Initial program 100.0%
Taylor expanded in y around 0 89.1%
associate-+r+89.1%
+-commutative89.1%
Simplified89.1%
Final simplification65.8%
(FPCore (x y z) :precision binary64 (if (<= x -7.2e+27) x (if (<= x 5.9e+35) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.2e+27) {
tmp = x;
} else if (x <= 5.9e+35) {
tmp = z;
} 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 <= (-7.2d+27)) then
tmp = x
else if (x <= 5.9d+35) then
tmp = z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -7.2e+27) {
tmp = x;
} else if (x <= 5.9e+35) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.2e+27: tmp = x elif x <= 5.9e+35: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.2e+27) tmp = x; elseif (x <= 5.9e+35) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7.2e+27) tmp = x; elseif (x <= 5.9e+35) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.2e+27], x, If[LessEqual[x, 5.9e+35], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+27}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.9 \cdot 10^{+35}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -7.19999999999999966e27 or 5.89999999999999985e35 < x Initial program 99.9%
Taylor expanded in x around inf 99.9%
Taylor expanded in z around 0 73.9%
+-commutative73.9%
Simplified73.9%
Taylor expanded in x around inf 73.9%
if -7.19999999999999966e27 < x < 5.89999999999999985e35Initial program 99.9%
Taylor expanded in y around 0 46.2%
Taylor expanded in x around 0 36.8%
(FPCore (x y z) :precision binary64 (if (<= x -6e-126) x (if (<= x 2.05e-283) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -6e-126) {
tmp = x;
} else if (x <= 2.05e-283) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-6d-126)) then
tmp = x
else if (x <= 2.05d-283) then
tmp = y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -6e-126) {
tmp = x;
} else if (x <= 2.05e-283) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6e-126: tmp = x elif x <= 2.05e-283: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6e-126) tmp = x; elseif (x <= 2.05e-283) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6e-126) tmp = x; elseif (x <= 2.05e-283) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6e-126], x, If[LessEqual[x, 2.05e-283], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{-126}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{-283}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.0000000000000003e-126 or 2.04999999999999993e-283 < x Initial program 99.9%
Taylor expanded in x around inf 99.9%
Taylor expanded in z around 0 56.8%
+-commutative56.8%
Simplified56.8%
Taylor expanded in x around inf 42.9%
if -6.0000000000000003e-126 < x < 2.04999999999999993e-283Initial program 99.9%
Taylor expanded in x around 0 98.1%
Taylor expanded in y around 0 58.0%
Taylor expanded in y around inf 20.5%
(FPCore (x y z) :precision binary64 (+ x z))
double code(double x, double y, double z) {
return x + z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + z
end function
public static double code(double x, double y, double z) {
return x + z;
}
def code(x, y, z): return x + z
function code(x, y, z) return Float64(x + z) end
function tmp = code(x, y, z) tmp = x + z; end
code[x_, y_, z_] := N[(x + z), $MachinePrecision]
\begin{array}{l}
\\
x + z
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 61.8%
(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 99.9%
Taylor expanded in z around 0 54.0%
+-commutative54.0%
Simplified54.0%
Taylor expanded in x around inf 34.8%
herbie shell --seed 2024170
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
:precision binary64
(+ (+ x (sin y)) (* z (cos y))))