
(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 11 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 (fma z (cos y) (+ x (sin y))))
double code(double x, double y, double z) {
return fma(z, cos(y), (x + sin(y)));
}
function code(x, y, z) return fma(z, cos(y), Float64(x + sin(y))) end
code[x_, y_, z_] := N[(z * N[Cos[y], $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \cos y, x + \sin y\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Final simplification99.9%
(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
(let* ((t_0 (* z (cos y))))
(if (<= y -8.2e+164)
t_0
(if (<= y -9.5e+97)
(+ z x)
(if (<= y -66000.0) t_0 (if (<= y 3.3e+19) (+ y (+ z x)) (+ z x)))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (y <= -8.2e+164) {
tmp = t_0;
} else if (y <= -9.5e+97) {
tmp = z + x;
} else if (y <= -66000.0) {
tmp = t_0;
} else if (y <= 3.3e+19) {
tmp = y + (z + x);
} else {
tmp = z + 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) :: t_0
real(8) :: tmp
t_0 = z * cos(y)
if (y <= (-8.2d+164)) then
tmp = t_0
else if (y <= (-9.5d+97)) then
tmp = z + x
else if (y <= (-66000.0d0)) then
tmp = t_0
else if (y <= 3.3d+19) then
tmp = y + (z + x)
else
tmp = z + x
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 (y <= -8.2e+164) {
tmp = t_0;
} else if (y <= -9.5e+97) {
tmp = z + x;
} else if (y <= -66000.0) {
tmp = t_0;
} else if (y <= 3.3e+19) {
tmp = y + (z + x);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if y <= -8.2e+164: tmp = t_0 elif y <= -9.5e+97: tmp = z + x elif y <= -66000.0: tmp = t_0 elif y <= 3.3e+19: tmp = y + (z + x) else: tmp = z + x return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (y <= -8.2e+164) tmp = t_0; elseif (y <= -9.5e+97) tmp = Float64(z + x); elseif (y <= -66000.0) tmp = t_0; elseif (y <= 3.3e+19) tmp = Float64(y + Float64(z + x)); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (y <= -8.2e+164) tmp = t_0; elseif (y <= -9.5e+97) tmp = z + x; elseif (y <= -66000.0) tmp = t_0; elseif (y <= 3.3e+19) tmp = y + (z + x); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.2e+164], t$95$0, If[LessEqual[y, -9.5e+97], N[(z + x), $MachinePrecision], If[LessEqual[y, -66000.0], t$95$0, If[LessEqual[y, 3.3e+19], N[(y + N[(z + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;y \leq -8.2 \cdot 10^{+164}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -9.5 \cdot 10^{+97}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq -66000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+19}:\\
\;\;\;\;y + \left(z + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -8.20000000000000032e164 or -9.49999999999999975e97 < y < -66000Initial program 99.7%
+-commutative99.7%
add-sqr-sqrt57.2%
associate-*r*57.2%
fma-def57.2%
Applied egg-rr57.2%
Taylor expanded in z around inf 56.8%
if -8.20000000000000032e164 < y < -9.49999999999999975e97 or 3.3e19 < y Initial program 99.9%
Taylor expanded in y around 0 59.0%
if -66000 < y < 3.3e19Initial program 100.0%
Taylor expanded in y around 0 97.6%
Final simplification80.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -5e-7)
t_0
(if (<= z 6.4e-59) (+ x (sin y)) (if (<= z 4.4e+215) (+ z x) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -5e-7) {
tmp = t_0;
} else if (z <= 6.4e-59) {
tmp = x + sin(y);
} else if (z <= 4.4e+215) {
tmp = z + x;
} 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 <= (-5d-7)) then
tmp = t_0
else if (z <= 6.4d-59) then
tmp = x + sin(y)
else if (z <= 4.4d+215) then
tmp = z + x
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 <= -5e-7) {
tmp = t_0;
} else if (z <= 6.4e-59) {
tmp = x + Math.sin(y);
} else if (z <= 4.4e+215) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -5e-7: tmp = t_0 elif z <= 6.4e-59: tmp = x + math.sin(y) elif z <= 4.4e+215: tmp = z + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -5e-7) tmp = t_0; elseif (z <= 6.4e-59) tmp = Float64(x + sin(y)); elseif (z <= 4.4e+215) tmp = Float64(z + x); 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 <= -5e-7) tmp = t_0; elseif (z <= 6.4e-59) tmp = x + sin(y); elseif (z <= 4.4e+215) tmp = z + x; 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, -5e-7], t$95$0, If[LessEqual[z, 6.4e-59], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.4e+215], N[(z + x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -5 \cdot 10^{-7}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{-59}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+215}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -4.99999999999999977e-7 or 4.4000000000000003e215 < z Initial program 99.8%
+-commutative99.8%
add-sqr-sqrt81.0%
associate-*r*81.0%
fma-def81.0%
Applied egg-rr81.0%
Taylor expanded in z around inf 86.2%
if -4.99999999999999977e-7 < z < 6.3999999999999998e-59Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
add-cube-cbrt99.7%
associate-*r*99.7%
fma-def99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in z around 0 90.2%
if 6.3999999999999998e-59 < z < 4.4000000000000003e215Initial program 100.0%
Taylor expanded in y around 0 79.0%
Final simplification86.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.5e-26) (not (<= z 4.6e-59))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.5e-26) || !(z <= 4.6e-59)) {
tmp = x + (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 <= (-3.5d-26)) .or. (.not. (z <= 4.6d-59))) then
tmp = x + (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 <= -3.5e-26) || !(z <= 4.6e-59)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.5e-26) or not (z <= 4.6e-59): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.5e-26) || !(z <= 4.6e-59)) tmp = Float64(x + 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 <= -3.5e-26) || ~((z <= 4.6e-59))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.5e-26], N[Not[LessEqual[z, 4.6e-59]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{-26} \lor \neg \left(z \leq 4.6 \cdot 10^{-59}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -3.49999999999999985e-26 or 4.59999999999999959e-59 < z Initial program 99.9%
Taylor expanded in x around inf 99.1%
if -3.49999999999999985e-26 < z < 4.59999999999999959e-59Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
add-cube-cbrt99.8%
associate-*r*99.8%
fma-def99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in z around 0 90.7%
Final simplification95.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.5) (not (<= z 7e-59))) (+ x (* z (cos y))) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.5) || !(z <= 7e-59)) {
tmp = x + (z * cos(y));
} else {
tmp = z + (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.5d0)) .or. (.not. (z <= 7d-59))) then
tmp = x + (z * cos(y))
else
tmp = z + (x + sin(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4.5) || !(z <= 7e-59)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.5) or not (z <= 7e-59): tmp = x + (z * math.cos(y)) else: tmp = z + (x + math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.5) || !(z <= 7e-59)) tmp = Float64(x + Float64(z * cos(y))); else tmp = Float64(z + Float64(x + sin(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.5) || ~((z <= 7e-59))) tmp = x + (z * cos(y)); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.5], N[Not[LessEqual[z, 7e-59]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \lor \neg \left(z \leq 7 \cdot 10^{-59}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -4.5 or 7.0000000000000002e-59 < z Initial program 99.9%
Taylor expanded in x around inf 99.0%
if -4.5 < z < 7.0000000000000002e-59Initial program 100.0%
Taylor expanded in y around 0 100.0%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (<= y -5.8e+27) (+ z x) (if (<= y 0.88) (+ y (+ (+ z x) (* -0.5 (* z (* y y))))) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.8e+27) {
tmp = z + x;
} else if (y <= 0.88) {
tmp = y + ((z + x) + (-0.5 * (z * (y * y))));
} else {
tmp = z + 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 (y <= (-5.8d+27)) then
tmp = z + x
else if (y <= 0.88d0) then
tmp = y + ((z + x) + ((-0.5d0) * (z * (y * y))))
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5.8e+27) {
tmp = z + x;
} else if (y <= 0.88) {
tmp = y + ((z + x) + (-0.5 * (z * (y * y))));
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.8e+27: tmp = z + x elif y <= 0.88: tmp = y + ((z + x) + (-0.5 * (z * (y * y)))) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.8e+27) tmp = Float64(z + x); elseif (y <= 0.88) tmp = Float64(y + Float64(Float64(z + x) + Float64(-0.5 * Float64(z * Float64(y * y))))); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.8e+27) tmp = z + x; elseif (y <= 0.88) tmp = y + ((z + x) + (-0.5 * (z * (y * y)))); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.8e+27], N[(z + x), $MachinePrecision], If[LessEqual[y, 0.88], N[(y + N[(N[(z + x), $MachinePrecision] + N[(-0.5 * N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+27}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 0.88:\\
\;\;\;\;y + \left(\left(z + x\right) + -0.5 \cdot \left(z \cdot \left(y \cdot y\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -5.8000000000000002e27 or 0.880000000000000004 < y Initial program 99.8%
Taylor expanded in y around 0 46.3%
if -5.8000000000000002e27 < y < 0.880000000000000004Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
add-cube-cbrt98.9%
associate-*r*98.9%
fma-def98.9%
pow298.9%
Applied egg-rr98.9%
Taylor expanded in y around 0 97.4%
+-commutative97.4%
pow-base-197.4%
*-lft-identity97.4%
pow-base-197.4%
*-lft-identity97.4%
*-commutative97.4%
unpow297.4%
Simplified97.4%
Final simplification74.8%
(FPCore (x y z) :precision binary64 (if (<= y -1.1e+18) (+ z x) (if (<= y 1.25e+23) (+ y (+ z x)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.1e+18) {
tmp = z + x;
} else if (y <= 1.25e+23) {
tmp = y + (z + x);
} else {
tmp = z + 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 (y <= (-1.1d+18)) then
tmp = z + x
else if (y <= 1.25d+23) then
tmp = y + (z + x)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.1e+18) {
tmp = z + x;
} else if (y <= 1.25e+23) {
tmp = y + (z + x);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.1e+18: tmp = z + x elif y <= 1.25e+23: tmp = y + (z + x) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.1e+18) tmp = Float64(z + x); elseif (y <= 1.25e+23) tmp = Float64(y + Float64(z + x)); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.1e+18) tmp = z + x; elseif (y <= 1.25e+23) tmp = y + (z + x); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.1e+18], N[(z + x), $MachinePrecision], If[LessEqual[y, 1.25e+23], N[(y + N[(z + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{+18}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+23}:\\
\;\;\;\;y + \left(z + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -1.1e18 or 1.25e23 < y Initial program 99.8%
Taylor expanded in y around 0 45.9%
if -1.1e18 < y < 1.25e23Initial program 100.0%
Taylor expanded in y around 0 96.9%
Final simplification74.8%
(FPCore (x y z) :precision binary64 (if (<= x -1.4e-80) x (if (<= x 4.4e-10) (+ y x) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.4e-80) {
tmp = x;
} else if (x <= 4.4e-10) {
tmp = y + x;
} 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 <= (-1.4d-80)) then
tmp = x
else if (x <= 4.4d-10) then
tmp = y + x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.4e-80) {
tmp = x;
} else if (x <= 4.4e-10) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.4e-80: tmp = x elif x <= 4.4e-10: tmp = y + x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.4e-80) tmp = x; elseif (x <= 4.4e-10) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.4e-80) tmp = x; elseif (x <= 4.4e-10) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.4e-80], x, If[LessEqual[x, 4.4e-10], N[(y + x), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-80}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{-10}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.39999999999999995e-80 or 4.3999999999999998e-10 < x Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
add-cube-cbrt99.5%
associate-*r*99.5%
fma-def99.5%
pow299.5%
Applied egg-rr99.5%
Taylor expanded in x around inf 68.7%
if -1.39999999999999995e-80 < x < 4.3999999999999998e-10Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
add-cube-cbrt98.6%
associate-*r*98.6%
fma-def98.6%
pow298.6%
Applied egg-rr98.6%
Taylor expanded in z around 0 35.8%
Taylor expanded in y around 0 20.3%
Final simplification46.8%
(FPCore (x y z) :precision binary64 (+ z x))
double code(double x, double y, double z) {
return z + x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z + x
end function
public static double code(double x, double y, double z) {
return z + x;
}
def code(x, y, z): return z + x
function code(x, y, z) return Float64(z + x) end
function tmp = code(x, y, z) tmp = z + x; end
code[x_, y_, z_] := N[(z + x), $MachinePrecision]
\begin{array}{l}
\\
z + x
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 69.3%
Final simplification69.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%
+-commutative99.9%
*-commutative99.9%
add-cube-cbrt99.1%
associate-*r*99.1%
fma-def99.1%
pow299.1%
Applied egg-rr99.1%
Taylor expanded in x around inf 42.0%
Final simplification42.0%
herbie shell --seed 2023181
(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))))