
(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 (if (<= x -1.16e-35) (+ z x) (if (<= x 175000000.0) (+ (sin y) (* z (cos y))) (+ z (+ x (sin y))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.16e-35) {
tmp = z + x;
} else if (x <= 175000000.0) {
tmp = sin(y) + (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 (x <= (-1.16d-35)) then
tmp = z + x
else if (x <= 175000000.0d0) then
tmp = sin(y) + (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 (x <= -1.16e-35) {
tmp = z + x;
} else if (x <= 175000000.0) {
tmp = Math.sin(y) + (z * Math.cos(y));
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.16e-35: tmp = z + x elif x <= 175000000.0: tmp = math.sin(y) + (z * math.cos(y)) else: tmp = z + (x + math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.16e-35) tmp = Float64(z + x); elseif (x <= 175000000.0) tmp = Float64(sin(y) + 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 (x <= -1.16e-35) tmp = z + x; elseif (x <= 175000000.0) tmp = sin(y) + (z * cos(y)); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.16e-35], N[(z + x), $MachinePrecision], If[LessEqual[x, 175000000.0], N[(N[Sin[y], $MachinePrecision] + 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}\;x \leq -1.16 \cdot 10^{-35}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq 175000000:\\
\;\;\;\;\sin y + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if x < -1.16000000000000005e-35Initial program 99.9%
Taylor expanded in y around 0 88.8%
if -1.16000000000000005e-35 < x < 1.75e8Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around 0 93.8%
if 1.75e8 < x Initial program 99.9%
Taylor expanded in y around 0 90.4%
Final simplification91.6%
(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 (<= z -2e+124)
t_0
(if (<= z -2.5e+68)
(+ z x)
(if (<= z -3.5e+54) t_0 (if (<= z 1.02e-41) (+ x (sin y)) (+ z x)))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -2e+124) {
tmp = t_0;
} else if (z <= -2.5e+68) {
tmp = z + x;
} else if (z <= -3.5e+54) {
tmp = t_0;
} else if (z <= 1.02e-41) {
tmp = x + sin(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) :: t_0
real(8) :: tmp
t_0 = z * cos(y)
if (z <= (-2d+124)) then
tmp = t_0
else if (z <= (-2.5d+68)) then
tmp = z + x
else if (z <= (-3.5d+54)) then
tmp = t_0
else if (z <= 1.02d-41) then
tmp = x + sin(y)
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 (z <= -2e+124) {
tmp = t_0;
} else if (z <= -2.5e+68) {
tmp = z + x;
} else if (z <= -3.5e+54) {
tmp = t_0;
} else if (z <= 1.02e-41) {
tmp = x + Math.sin(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -2e+124: tmp = t_0 elif z <= -2.5e+68: tmp = z + x elif z <= -3.5e+54: tmp = t_0 elif z <= 1.02e-41: tmp = x + math.sin(y) else: tmp = z + x return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -2e+124) tmp = t_0; elseif (z <= -2.5e+68) tmp = Float64(z + x); elseif (z <= -3.5e+54) tmp = t_0; elseif (z <= 1.02e-41) tmp = Float64(x + sin(y)); 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 (z <= -2e+124) tmp = t_0; elseif (z <= -2.5e+68) tmp = z + x; elseif (z <= -3.5e+54) tmp = t_0; elseif (z <= 1.02e-41) tmp = x + sin(y); 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[z, -2e+124], t$95$0, If[LessEqual[z, -2.5e+68], N[(z + x), $MachinePrecision], If[LessEqual[z, -3.5e+54], t$95$0, If[LessEqual[z, 1.02e-41], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -2 \cdot 10^{+124}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{+68}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq -3.5 \cdot 10^{+54}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-41}:\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if z < -1.9999999999999999e124 or -2.5000000000000002e68 < z < -3.5000000000000001e54Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
add-cube-cbrt99.1%
associate-*l*99.2%
fma-def99.2%
pow299.2%
Applied egg-rr99.2%
Taylor expanded in z around inf 83.3%
pow-base-183.3%
*-commutative83.3%
*-lft-identity83.3%
Simplified83.3%
if -1.9999999999999999e124 < z < -2.5000000000000002e68 or 1.02e-41 < z Initial program 99.9%
Taylor expanded in y around 0 80.6%
if -3.5000000000000001e54 < z < 1.02e-41Initial program 100.0%
Taylor expanded in z around 0 92.1%
Final simplification86.0%
(FPCore (x y z)
:precision binary64
(if (<= y -2e+223)
(sin y)
(if (<= y -7200.0)
(+ z x)
(if (<= y 2e+145) (+ y (+ z x)) (if (<= y 1.85e+248) (sin y) (+ z x))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2e+223) {
tmp = sin(y);
} else if (y <= -7200.0) {
tmp = z + x;
} else if (y <= 2e+145) {
tmp = y + (z + x);
} else if (y <= 1.85e+248) {
tmp = sin(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 <= (-2d+223)) then
tmp = sin(y)
else if (y <= (-7200.0d0)) then
tmp = z + x
else if (y <= 2d+145) then
tmp = y + (z + x)
else if (y <= 1.85d+248) then
tmp = sin(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 <= -2e+223) {
tmp = Math.sin(y);
} else if (y <= -7200.0) {
tmp = z + x;
} else if (y <= 2e+145) {
tmp = y + (z + x);
} else if (y <= 1.85e+248) {
tmp = Math.sin(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2e+223: tmp = math.sin(y) elif y <= -7200.0: tmp = z + x elif y <= 2e+145: tmp = y + (z + x) elif y <= 1.85e+248: tmp = math.sin(y) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2e+223) tmp = sin(y); elseif (y <= -7200.0) tmp = Float64(z + x); elseif (y <= 2e+145) tmp = Float64(y + Float64(z + x)); elseif (y <= 1.85e+248) tmp = sin(y); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2e+223) tmp = sin(y); elseif (y <= -7200.0) tmp = z + x; elseif (y <= 2e+145) tmp = y + (z + x); elseif (y <= 1.85e+248) tmp = sin(y); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2e+223], N[Sin[y], $MachinePrecision], If[LessEqual[y, -7200.0], N[(z + x), $MachinePrecision], If[LessEqual[y, 2e+145], N[(y + N[(z + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.85e+248], N[Sin[y], $MachinePrecision], N[(z + x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{+223}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;y \leq -7200:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+145}:\\
\;\;\;\;y + \left(z + x\right)\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+248}:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -2.00000000000000009e223 or 2e145 < y < 1.8499999999999999e248Initial program 99.8%
Taylor expanded in x around 0 89.9%
*-commutative89.9%
fma-def89.9%
Simplified89.9%
Taylor expanded in z around 0 40.9%
if -2.00000000000000009e223 < y < -7200 or 1.8499999999999999e248 < y Initial program 99.9%
Taylor expanded in y around 0 49.9%
if -7200 < y < 2e145Initial program 100.0%
Taylor expanded in y around 0 90.7%
Final simplification74.7%
(FPCore (x y z) :precision binary64 (if (<= x -7.6e-44) (+ z x) (if (<= x 320000000.0) (* z (cos y)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.6e-44) {
tmp = z + x;
} else if (x <= 320000000.0) {
tmp = z * cos(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 (x <= (-7.6d-44)) then
tmp = z + x
else if (x <= 320000000.0d0) then
tmp = z * cos(y)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -7.6e-44) {
tmp = z + x;
} else if (x <= 320000000.0) {
tmp = z * Math.cos(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.6e-44: tmp = z + x elif x <= 320000000.0: tmp = z * math.cos(y) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.6e-44) tmp = Float64(z + x); elseif (x <= 320000000.0) tmp = Float64(z * cos(y)); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7.6e-44) tmp = z + x; elseif (x <= 320000000.0) tmp = z * cos(y); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.6e-44], N[(z + x), $MachinePrecision], If[LessEqual[x, 320000000.0], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{-44}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq 320000000:\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -7.6000000000000002e-44 or 3.2e8 < x Initial program 99.9%
Taylor expanded in y around 0 88.7%
if -7.6000000000000002e-44 < x < 3.2e8Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
add-cube-cbrt99.5%
associate-*l*99.5%
fma-def99.5%
pow299.5%
Applied egg-rr99.5%
Taylor expanded in z around inf 63.3%
pow-base-163.3%
*-commutative63.3%
*-lft-identity63.3%
Simplified63.3%
Final simplification76.2%
(FPCore (x y z) :precision binary64 (if (<= z -5.8e+123) (* z (cos y)) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.8e+123) {
tmp = 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 <= (-5.8d+123)) then
tmp = 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 <= -5.8e+123) {
tmp = z * Math.cos(y);
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.8e+123: tmp = z * math.cos(y) else: tmp = z + (x + math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.8e+123) tmp = 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 <= -5.8e+123) tmp = z * cos(y); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.8e+123], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+123}:\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -5.80000000000000019e123Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
add-cube-cbrt99.1%
associate-*l*99.2%
fma-def99.2%
pow299.2%
Applied egg-rr99.2%
Taylor expanded in z around inf 82.7%
pow-base-182.7%
*-commutative82.7%
*-lft-identity82.7%
Simplified82.7%
if -5.80000000000000019e123 < z Initial program 100.0%
Taylor expanded in y around 0 89.6%
Final simplification88.0%
(FPCore (x y z) :precision binary64 (if (<= y -4600.0) (+ z x) (if (<= y 7.2e+36) (+ y (+ z x)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4600.0) {
tmp = z + x;
} else if (y <= 7.2e+36) {
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 <= (-4600.0d0)) then
tmp = z + x
else if (y <= 7.2d+36) 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 <= -4600.0) {
tmp = z + x;
} else if (y <= 7.2e+36) {
tmp = y + (z + x);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4600.0: tmp = z + x elif y <= 7.2e+36: tmp = y + (z + x) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4600.0) tmp = Float64(z + x); elseif (y <= 7.2e+36) 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 <= -4600.0) tmp = z + x; elseif (y <= 7.2e+36) tmp = y + (z + x); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4600.0], N[(z + x), $MachinePrecision], If[LessEqual[y, 7.2e+36], N[(y + N[(z + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4600:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+36}:\\
\;\;\;\;y + \left(z + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -4600 or 7.1999999999999995e36 < y Initial program 99.8%
Taylor expanded in y around 0 38.3%
if -4600 < y < 7.1999999999999995e36Initial program 100.0%
Taylor expanded in y around 0 98.0%
Final simplification71.2%
(FPCore (x y z) :precision binary64 (if (<= x -4.2e+42) x (if (<= x 3e+62) (+ z y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.2e+42) {
tmp = x;
} else if (x <= 3e+62) {
tmp = z + 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 <= (-4.2d+42)) then
tmp = x
else if (x <= 3d+62) then
tmp = z + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4.2e+42) {
tmp = x;
} else if (x <= 3e+62) {
tmp = z + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.2e+42: tmp = x elif x <= 3e+62: tmp = z + y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.2e+42) tmp = x; elseif (x <= 3e+62) tmp = Float64(z + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.2e+42) tmp = x; elseif (x <= 3e+62) tmp = z + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.2e+42], x, If[LessEqual[x, 3e+62], N[(z + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{+42}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+62}:\\
\;\;\;\;z + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.19999999999999991e42 or 3e62 < x Initial program 99.9%
Taylor expanded in x around inf 81.0%
if -4.19999999999999991e42 < x < 3e62Initial program 99.9%
Taylor expanded in x around 0 89.9%
*-commutative89.9%
fma-def89.9%
Simplified89.9%
Taylor expanded in y around 0 46.0%
Final simplification60.1%
(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 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 99.9%
Taylor expanded in x around inf 40.0%
Final simplification40.0%
herbie shell --seed 2023274
(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))))