
(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 (+ (* 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 100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (if (<= x -3.6e-16) (+ x z) (if (<= x 6.2e-15) (+ (sin y) (* z (cos y))) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.6e-16) {
tmp = x + z;
} else if (x <= 6.2e-15) {
tmp = sin(y) + (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 (x <= (-3.6d-16)) then
tmp = x + z
else if (x <= 6.2d-15) then
tmp = sin(y) + (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 (x <= -3.6e-16) {
tmp = x + z;
} else if (x <= 6.2e-15) {
tmp = Math.sin(y) + (z * Math.cos(y));
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.6e-16: tmp = x + z elif x <= 6.2e-15: tmp = math.sin(y) + (z * math.cos(y)) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.6e-16) tmp = Float64(x + z); elseif (x <= 6.2e-15) tmp = Float64(sin(y) + Float64(z * cos(y))); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.6e-16) tmp = x + z; elseif (x <= 6.2e-15) tmp = sin(y) + (z * cos(y)); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.6e-16], N[(x + z), $MachinePrecision], If[LessEqual[x, 6.2e-15], N[(N[Sin[y], $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-16}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{-15}:\\
\;\;\;\;\sin y + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if x < -3.59999999999999983e-16 or 6.1999999999999998e-15 < x Initial program 100.0%
Taylor expanded in y around 0 88.7%
if -3.59999999999999983e-16 < x < 6.1999999999999998e-15Initial program 99.9%
Taylor expanded in x around 0 88.8%
Final simplification88.7%
(FPCore (x y z)
:precision binary64
(if (<= y -11.0)
(+ x z)
(if (<= y 1.7e+29)
(+ y (+ (+ x z) (* -0.5 (* z (* y y)))))
(if (<= y 8e+140) (sin y) (+ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -11.0) {
tmp = x + z;
} else if (y <= 1.7e+29) {
tmp = y + ((x + z) + (-0.5 * (z * (y * y))));
} else if (y <= 8e+140) {
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 <= (-11.0d0)) then
tmp = x + z
else if (y <= 1.7d+29) then
tmp = y + ((x + z) + ((-0.5d0) * (z * (y * y))))
else if (y <= 8d+140) 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 <= -11.0) {
tmp = x + z;
} else if (y <= 1.7e+29) {
tmp = y + ((x + z) + (-0.5 * (z * (y * y))));
} else if (y <= 8e+140) {
tmp = Math.sin(y);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -11.0: tmp = x + z elif y <= 1.7e+29: tmp = y + ((x + z) + (-0.5 * (z * (y * y)))) elif y <= 8e+140: tmp = math.sin(y) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -11.0) tmp = Float64(x + z); elseif (y <= 1.7e+29) tmp = Float64(y + Float64(Float64(x + z) + Float64(-0.5 * Float64(z * Float64(y * y))))); elseif (y <= 8e+140) tmp = sin(y); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -11.0) tmp = x + z; elseif (y <= 1.7e+29) tmp = y + ((x + z) + (-0.5 * (z * (y * y)))); elseif (y <= 8e+140) tmp = sin(y); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -11.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 1.7e+29], N[(y + N[(N[(x + z), $MachinePrecision] + N[(-0.5 * N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e+140], N[Sin[y], $MachinePrecision], N[(x + z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -11:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{+29}:\\
\;\;\;\;y + \left(\left(x + z\right) + -0.5 \cdot \left(z \cdot \left(y \cdot y\right)\right)\right)\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+140}:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -11 or 8.00000000000000047e140 < y Initial program 99.9%
Taylor expanded in y around 0 43.3%
if -11 < y < 1.69999999999999991e29Initial program 100.0%
+-commutative100.0%
add-cube-cbrt99.0%
associate-*l*99.0%
fma-def99.0%
pow299.0%
Applied egg-rr99.0%
Taylor expanded in y around 0 97.2%
+-commutative97.2%
+-commutative97.2%
pow-base-197.2%
*-lft-identity97.2%
pow-base-197.2%
*-lft-identity97.2%
*-commutative97.2%
unpow297.2%
Simplified97.2%
if 1.69999999999999991e29 < y < 8.00000000000000047e140Initial program 100.0%
Taylor expanded in x around 0 73.0%
add-cube-cbrt72.6%
pow372.7%
Applied egg-rr72.7%
Taylor expanded in z around 0 59.7%
Final simplification73.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.3e+54) (not (<= z 5.5e+136))) (* z (cos y)) (+ x z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.3e+54) || !(z <= 5.5e+136)) {
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 <= (-1.3d+54)) .or. (.not. (z <= 5.5d+136))) 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 <= -1.3e+54) || !(z <= 5.5e+136)) {
tmp = z * Math.cos(y);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.3e+54) or not (z <= 5.5e+136): tmp = z * math.cos(y) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.3e+54) || !(z <= 5.5e+136)) 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 <= -1.3e+54) || ~((z <= 5.5e+136))) tmp = z * cos(y); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.3e+54], N[Not[LessEqual[z, 5.5e+136]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+54} \lor \neg \left(z \leq 5.5 \cdot 10^{+136}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if z < -1.30000000000000003e54 or 5.50000000000000039e136 < z Initial program 99.9%
+-commutative99.9%
add-sqr-sqrt68.1%
associate-*r*68.1%
fma-def68.1%
Applied egg-rr68.1%
Taylor expanded in z around inf 88.5%
if -1.30000000000000003e54 < z < 5.50000000000000039e136Initial program 100.0%
Taylor expanded in y around 0 70.7%
Final simplification76.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -3700000000000.0) (not (<= z 3.3e-12))) (* z (cos y)) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3700000000000.0) || !(z <= 3.3e-12)) {
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 <= (-3700000000000.0d0)) .or. (.not. (z <= 3.3d-12))) 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 <= -3700000000000.0) || !(z <= 3.3e-12)) {
tmp = z * Math.cos(y);
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3700000000000.0) or not (z <= 3.3e-12): tmp = z * math.cos(y) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3700000000000.0) || !(z <= 3.3e-12)) 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 <= -3700000000000.0) || ~((z <= 3.3e-12))) tmp = z * cos(y); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3700000000000.0], N[Not[LessEqual[z, 3.3e-12]], $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 -3700000000000 \lor \neg \left(z \leq 3.3 \cdot 10^{-12}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -3.7e12 or 3.3000000000000001e-12 < z Initial program 99.9%
+-commutative99.9%
add-sqr-sqrt69.4%
associate-*r*69.4%
fma-def69.4%
Applied egg-rr69.4%
Taylor expanded in z around inf 81.7%
if -3.7e12 < z < 3.3000000000000001e-12Initial program 100.0%
Taylor expanded in z around 0 92.0%
Final simplification87.2%
(FPCore (x y z)
:precision binary64
(if (<= y -11.0)
(+ x z)
(if (<= y 980000000000.0)
(+ y (+ (+ x z) (* -0.5 (* z (* y y)))))
(+ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -11.0) {
tmp = x + z;
} else if (y <= 980000000000.0) {
tmp = y + ((x + z) + (-0.5 * (z * (y * 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 <= (-11.0d0)) then
tmp = x + z
else if (y <= 980000000000.0d0) then
tmp = y + ((x + z) + ((-0.5d0) * (z * (y * 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 <= -11.0) {
tmp = x + z;
} else if (y <= 980000000000.0) {
tmp = y + ((x + z) + (-0.5 * (z * (y * y))));
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -11.0: tmp = x + z elif y <= 980000000000.0: tmp = y + ((x + z) + (-0.5 * (z * (y * y)))) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -11.0) tmp = Float64(x + z); elseif (y <= 980000000000.0) tmp = Float64(y + Float64(Float64(x + z) + Float64(-0.5 * Float64(z * Float64(y * y))))); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -11.0) tmp = x + z; elseif (y <= 980000000000.0) tmp = y + ((x + z) + (-0.5 * (z * (y * y)))); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -11.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 980000000000.0], N[(y + N[(N[(x + z), $MachinePrecision] + N[(-0.5 * N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -11:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 980000000000:\\
\;\;\;\;y + \left(\left(x + z\right) + -0.5 \cdot \left(z \cdot \left(y \cdot y\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -11 or 9.8e11 < y Initial program 99.9%
Taylor expanded in y around 0 42.2%
if -11 < y < 9.8e11Initial program 100.0%
+-commutative100.0%
add-cube-cbrt99.0%
associate-*l*99.0%
fma-def99.0%
pow299.0%
Applied egg-rr99.0%
Taylor expanded in y around 0 97.9%
+-commutative97.9%
+-commutative97.9%
pow-base-197.9%
*-lft-identity97.9%
pow-base-197.9%
*-lft-identity97.9%
*-commutative97.9%
unpow297.9%
Simplified97.9%
Final simplification71.8%
(FPCore (x y z) :precision binary64 (if (<= y -1.4e+33) (+ x z) (if (<= y 0.0031) (+ y (+ x z)) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.4e+33) {
tmp = x + z;
} else if (y <= 0.0031) {
tmp = y + (x + z);
} 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 <= (-1.4d+33)) then
tmp = x + z
else if (y <= 0.0031d0) then
tmp = y + (x + z)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.4e+33) {
tmp = x + z;
} else if (y <= 0.0031) {
tmp = y + (x + z);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.4e+33: tmp = x + z elif y <= 0.0031: tmp = y + (x + z) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.4e+33) tmp = Float64(x + z); elseif (y <= 0.0031) tmp = Float64(y + Float64(x + z)); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.4e+33) tmp = x + z; elseif (y <= 0.0031) tmp = y + (x + z); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.4e+33], N[(x + z), $MachinePrecision], If[LessEqual[y, 0.0031], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{+33}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 0.0031:\\
\;\;\;\;y + \left(x + z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -1.4e33 or 0.00309999999999999989 < y Initial program 99.9%
Taylor expanded in y around 0 42.3%
if -1.4e33 < y < 0.00309999999999999989Initial program 100.0%
Taylor expanded in y around 0 96.1%
Final simplification71.5%
(FPCore (x y z) :precision binary64 (if (<= x -1.42e+19) x (if (<= x 8.5e-34) (+ y z) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.42e+19) {
tmp = x;
} else if (x <= 8.5e-34) {
tmp = y + 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 <= (-1.42d+19)) then
tmp = x
else if (x <= 8.5d-34) then
tmp = y + z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.42e+19) {
tmp = x;
} else if (x <= 8.5e-34) {
tmp = y + z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.42e+19: tmp = x elif x <= 8.5e-34: tmp = y + z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.42e+19) tmp = x; elseif (x <= 8.5e-34) tmp = Float64(y + z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.42e+19) tmp = x; elseif (x <= 8.5e-34) tmp = y + z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.42e+19], x, If[LessEqual[x, 8.5e-34], N[(y + z), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.42 \cdot 10^{+19}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-34}:\\
\;\;\;\;y + z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.42e19 or 8.5000000000000001e-34 < x Initial program 100.0%
Taylor expanded in x around inf 71.0%
if -1.42e19 < x < 8.5000000000000001e-34Initial program 99.9%
Taylor expanded in x around 0 88.3%
add-cube-cbrt87.2%
pow387.2%
Applied egg-rr87.2%
Taylor expanded in y around 0 43.3%
pow-base-143.3%
*-lft-identity43.3%
Simplified43.3%
Final simplification57.4%
(FPCore (x y z) :precision binary64 (if (<= z -6.2e+25) z (if (<= z 5.8e+93) x z)))
double code(double x, double y, double z) {
double tmp;
if (z <= -6.2e+25) {
tmp = z;
} else if (z <= 5.8e+93) {
tmp = x;
} else {
tmp = 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 <= (-6.2d+25)) then
tmp = z
else if (z <= 5.8d+93) then
tmp = x
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -6.2e+25) {
tmp = z;
} else if (z <= 5.8e+93) {
tmp = x;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6.2e+25: tmp = z elif z <= 5.8e+93: tmp = x else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6.2e+25) tmp = z; elseif (z <= 5.8e+93) tmp = x; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -6.2e+25) tmp = z; elseif (z <= 5.8e+93) tmp = x; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6.2e+25], z, If[LessEqual[z, 5.8e+93], x, z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+25}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{+93}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -6.1999999999999996e25 or 5.7999999999999997e93 < z Initial program 99.9%
+-commutative99.9%
add-sqr-sqrt71.5%
associate-*r*71.5%
fma-def71.5%
Applied egg-rr71.5%
Taylor expanded in z around inf 85.8%
Taylor expanded in y around 0 51.5%
if -6.1999999999999996e25 < z < 5.7999999999999997e93Initial program 100.0%
Taylor expanded in x around inf 60.2%
Final simplification56.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 100.0%
Taylor expanded in y around 0 67.7%
Final simplification67.7%
(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 100.0%
Taylor expanded in x around inf 42.6%
Final simplification42.6%
herbie shell --seed 2023279
(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))))