
(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 (+ (+ 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}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.5e-34) (not (<= x 3e-7))) (+ (+ x (sin y)) z) (+ (sin y) (* z (cos y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.5e-34) || !(x <= 3e-7)) {
tmp = (x + sin(y)) + 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 <= (-3.5d-34)) .or. (.not. (x <= 3d-7))) then
tmp = (x + sin(y)) + 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 <= -3.5e-34) || !(x <= 3e-7)) {
tmp = (x + Math.sin(y)) + z;
} else {
tmp = Math.sin(y) + (z * Math.cos(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.5e-34) or not (x <= 3e-7): tmp = (x + math.sin(y)) + z else: tmp = math.sin(y) + (z * math.cos(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.5e-34) || !(x <= 3e-7)) tmp = Float64(Float64(x + sin(y)) + 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 <= -3.5e-34) || ~((x <= 3e-7))) tmp = (x + sin(y)) + z; else tmp = sin(y) + (z * cos(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.5e-34], N[Not[LessEqual[x, 3e-7]], $MachinePrecision]], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + 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 -3.5 \cdot 10^{-34} \lor \neg \left(x \leq 3 \cdot 10^{-7}\right):\\
\;\;\;\;\left(x + \sin y\right) + z\\
\mathbf{else}:\\
\;\;\;\;\sin y + z \cdot \cos y\\
\end{array}
\end{array}
if x < -3.5e-34 or 2.9999999999999999e-7 < x Initial program 100.0%
Taylor expanded in y around 0 92.4%
if -3.5e-34 < x < 2.9999999999999999e-7Initial program 99.8%
Taylor expanded in x around 0 96.2%
Final simplification94.2%
(FPCore (x y z) :precision binary64 (if (<= z -6.6e-10) (+ x z) (if (<= z 1.5e-8) (+ x (sin y)) (* z (cos y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -6.6e-10) {
tmp = x + z;
} else if (z <= 1.5e-8) {
tmp = x + sin(y);
} else {
tmp = 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 (z <= (-6.6d-10)) then
tmp = x + z
else if (z <= 1.5d-8) then
tmp = x + sin(y)
else
tmp = z * cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -6.6e-10) {
tmp = x + z;
} else if (z <= 1.5e-8) {
tmp = x + Math.sin(y);
} else {
tmp = z * Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6.6e-10: tmp = x + z elif z <= 1.5e-8: tmp = x + math.sin(y) else: tmp = z * math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6.6e-10) tmp = Float64(x + z); elseif (z <= 1.5e-8) tmp = Float64(x + sin(y)); else tmp = Float64(z * cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -6.6e-10) tmp = x + z; elseif (z <= 1.5e-8) tmp = x + sin(y); else tmp = z * cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6.6e-10], N[(x + z), $MachinePrecision], If[LessEqual[z, 1.5e-8], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{-10}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-8}:\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \cos y\\
\end{array}
\end{array}
if z < -6.6e-10Initial program 99.8%
Taylor expanded in y around 0 82.5%
+-commutative82.5%
Simplified82.5%
if -6.6e-10 < z < 1.49999999999999987e-8Initial program 100.0%
Taylor expanded in z around 0 91.9%
+-commutative91.9%
Simplified91.9%
if 1.49999999999999987e-8 < z Initial program 99.9%
Taylor expanded in z around inf 86.4%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (<= z 1.5e-8) (+ (+ x (sin y)) z) (* z (cos y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.5e-8) {
tmp = (x + sin(y)) + z;
} else {
tmp = 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 (z <= 1.5d-8) then
tmp = (x + sin(y)) + z
else
tmp = z * cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.5e-8) {
tmp = (x + Math.sin(y)) + z;
} else {
tmp = z * Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.5e-8: tmp = (x + math.sin(y)) + z else: tmp = z * math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.5e-8) tmp = Float64(Float64(x + sin(y)) + z); else tmp = Float64(z * cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.5e-8) tmp = (x + sin(y)) + z; else tmp = z * cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.5e-8], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.5 \cdot 10^{-8}:\\
\;\;\;\;\left(x + \sin y\right) + z\\
\mathbf{else}:\\
\;\;\;\;z \cdot \cos y\\
\end{array}
\end{array}
if z < 1.49999999999999987e-8Initial program 99.9%
Taylor expanded in y around 0 93.8%
if 1.49999999999999987e-8 < z Initial program 99.9%
Taylor expanded in z around inf 86.4%
Final simplification91.9%
(FPCore (x y z) :precision binary64 (if (<= z 2.9e-16) (+ x z) (* z (cos y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 2.9e-16) {
tmp = x + z;
} else {
tmp = 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 (z <= 2.9d-16) then
tmp = x + z
else
tmp = z * cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 2.9e-16) {
tmp = x + z;
} else {
tmp = z * Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 2.9e-16: tmp = x + z else: tmp = z * math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 2.9e-16) tmp = Float64(x + z); else tmp = Float64(z * cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 2.9e-16) tmp = x + z; else tmp = z * cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 2.9e-16], N[(x + z), $MachinePrecision], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.9 \cdot 10^{-16}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;z \cdot \cos y\\
\end{array}
\end{array}
if z < 2.8999999999999998e-16Initial program 99.9%
Taylor expanded in y around 0 71.6%
+-commutative71.6%
Simplified71.6%
if 2.8999999999999998e-16 < z Initial program 99.8%
Taylor expanded in z around inf 81.9%
Final simplification74.4%
(FPCore (x y z)
:precision binary64
(if (<= y -5.5e+248)
(sin y)
(if (or (<= y -65000000000.0) (not (<= y 7200000000.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 <= -5.5e+248) {
tmp = sin(y);
} else if ((y <= -65000000000.0) || !(y <= 7200000000.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 <= (-5.5d+248)) then
tmp = sin(y)
else if ((y <= (-65000000000.0d0)) .or. (.not. (y <= 7200000000.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 <= -5.5e+248) {
tmp = Math.sin(y);
} else if ((y <= -65000000000.0) || !(y <= 7200000000.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 <= -5.5e+248: tmp = math.sin(y) elif (y <= -65000000000.0) or not (y <= 7200000000.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 <= -5.5e+248) tmp = sin(y); elseif ((y <= -65000000000.0) || !(y <= 7200000000.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 <= -5.5e+248) tmp = sin(y); elseif ((y <= -65000000000.0) || ~((y <= 7200000000.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[LessEqual[y, -5.5e+248], N[Sin[y], $MachinePrecision], If[Or[LessEqual[y, -65000000000.0], N[Not[LessEqual[y, 7200000000.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 -5.5 \cdot 10^{+248}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;y \leq -65000000000 \lor \neg \left(y \leq 7200000000\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 < -5.4999999999999996e248Initial program 99.7%
Taylor expanded in x around 0 83.9%
Taylor expanded in z around 0 66.2%
if -5.4999999999999996e248 < y < -6.5e10 or 7.2e9 < y Initial program 99.8%
Taylor expanded in y around 0 44.8%
+-commutative44.8%
Simplified44.8%
if -6.5e10 < y < 7.2e9Initial program 100.0%
Taylor expanded in y around 0 98.7%
Final simplification75.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -42000000.0) (not (<= y 15000000000.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 <= -42000000.0) || !(y <= 15000000000.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 <= (-42000000.0d0)) .or. (.not. (y <= 15000000000.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 <= -42000000.0) || !(y <= 15000000000.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 <= -42000000.0) or not (y <= 15000000000.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 <= -42000000.0) || !(y <= 15000000000.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 <= -42000000.0) || ~((y <= 15000000000.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, -42000000.0], N[Not[LessEqual[y, 15000000000.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 -42000000 \lor \neg \left(y \leq 15000000000\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 < -4.2e7 or 1.5e10 < y Initial program 99.8%
Taylor expanded in y around 0 42.5%
+-commutative42.5%
Simplified42.5%
if -4.2e7 < y < 1.5e10Initial program 100.0%
Taylor expanded in y around 0 98.7%
Final simplification73.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -245000000.0) (not (<= y 11.0))) (+ x z) (+ (+ x z) (* y (+ 1.0 (* -0.5 (* y z)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -245000000.0) || !(y <= 11.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 <= (-245000000.0d0)) .or. (.not. (y <= 11.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 <= -245000000.0) || !(y <= 11.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 <= -245000000.0) or not (y <= 11.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 <= -245000000.0) || !(y <= 11.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 <= -245000000.0) || ~((y <= 11.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, -245000000.0], N[Not[LessEqual[y, 11.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 -245000000 \lor \neg \left(y \leq 11\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 < -2.45e8 or 11 < y Initial program 99.8%
Taylor expanded in y around 0 41.9%
+-commutative41.9%
Simplified41.9%
if -2.45e8 < y < 11Initial program 100.0%
Taylor expanded in y around 0 99.4%
associate-+r+99.4%
+-commutative99.4%
*-commutative99.4%
Simplified99.4%
Final simplification72.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.85e+29) (not (<= y 3.1e+73))) (+ x z) (+ z (+ x y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.85e+29) || !(y <= 3.1e+73)) {
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 <= (-2.85d+29)) .or. (.not. (y <= 3.1d+73))) 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 <= -2.85e+29) || !(y <= 3.1e+73)) {
tmp = x + z;
} else {
tmp = z + (x + y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.85e+29) or not (y <= 3.1e+73): tmp = x + z else: tmp = z + (x + y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.85e+29) || !(y <= 3.1e+73)) 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 <= -2.85e+29) || ~((y <= 3.1e+73))) tmp = x + z; else tmp = z + (x + y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.85e+29], N[Not[LessEqual[y, 3.1e+73]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.85 \cdot 10^{+29} \lor \neg \left(y \leq 3.1 \cdot 10^{+73}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + y\right)\\
\end{array}
\end{array}
if y < -2.85e29 or 3.1e73 < y Initial program 99.8%
Taylor expanded in y around 0 43.0%
+-commutative43.0%
Simplified43.0%
if -2.85e29 < y < 3.1e73Initial program 100.0%
Taylor expanded in y around 0 89.9%
+-commutative89.9%
+-commutative89.9%
associate-+l+89.9%
Simplified89.9%
Final simplification72.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.9e-161) (not (<= x 1.9e-14))) (+ x z) (+ y z)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.9e-161) || !(x <= 1.9e-14)) {
tmp = x + z;
} else {
tmp = 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 <= (-1.9d-161)) .or. (.not. (x <= 1.9d-14))) then
tmp = x + z
else
tmp = y + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.9e-161) || !(x <= 1.9e-14)) {
tmp = x + z;
} else {
tmp = y + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.9e-161) or not (x <= 1.9e-14): tmp = x + z else: tmp = y + z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.9e-161) || !(x <= 1.9e-14)) tmp = Float64(x + z); else tmp = Float64(y + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.9e-161) || ~((x <= 1.9e-14))) tmp = x + z; else tmp = y + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.9e-161], N[Not[LessEqual[x, 1.9e-14]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(y + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{-161} \lor \neg \left(x \leq 1.9 \cdot 10^{-14}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;y + z\\
\end{array}
\end{array}
if x < -1.9000000000000001e-161 or 1.9000000000000001e-14 < x Initial program 99.9%
Taylor expanded in y around 0 80.3%
+-commutative80.3%
Simplified80.3%
if -1.9000000000000001e-161 < x < 1.9000000000000001e-14Initial program 99.9%
Taylor expanded in x around 0 98.6%
Taylor expanded in y around 0 54.1%
+-commutative54.1%
Simplified54.1%
Final simplification70.8%
(FPCore (x y z) :precision binary64 (if (<= x -3.9e-8) x (if (<= x 2.1e-85) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.9e-8) {
tmp = x;
} else if (x <= 2.1e-85) {
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 <= (-3.9d-8)) then
tmp = x
else if (x <= 2.1d-85) 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 <= -3.9e-8) {
tmp = x;
} else if (x <= 2.1e-85) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.9e-8: tmp = x elif x <= 2.1e-85: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.9e-8) tmp = x; elseif (x <= 2.1e-85) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.9e-8) tmp = x; elseif (x <= 2.1e-85) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.9e-8], x, If[LessEqual[x, 2.1e-85], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{-8}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{-85}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.89999999999999985e-8 or 2.1e-85 < x Initial program 100.0%
Taylor expanded in x around inf 70.8%
if -3.89999999999999985e-8 < x < 2.1e-85Initial program 99.8%
Taylor expanded in x around 0 95.6%
Taylor expanded in y around 0 43.0%
Final simplification57.7%
(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 67.3%
+-commutative67.3%
Simplified67.3%
Final simplification67.3%
(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.6%
Final simplification40.6%
herbie shell --seed 2024067
(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))))