
(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 (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-define99.9%
Simplified99.9%
(FPCore (x y z) :precision binary64 (if (<= z -6500.0) (+ x (* z (cos y))) (if (<= z 0.75) (+ z (+ x (sin y))) (fma z (cos y) x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -6500.0) {
tmp = x + (z * cos(y));
} else if (z <= 0.75) {
tmp = z + (x + sin(y));
} else {
tmp = fma(z, cos(y), x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -6500.0) tmp = Float64(x + Float64(z * cos(y))); elseif (z <= 0.75) tmp = Float64(z + Float64(x + sin(y))); else tmp = fma(z, cos(y), x); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -6500.0], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.75], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[Cos[y], $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6500:\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{elif}\;z \leq 0.75:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \cos y, x\right)\\
\end{array}
\end{array}
if z < -6500Initial program 99.8%
Taylor expanded in x around inf 98.7%
if -6500 < z < 0.75Initial program 100.0%
Taylor expanded in y around 0 98.7%
if 0.75 < z Initial program 99.8%
+-commutative99.8%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around inf 99.9%
Final simplification99.0%
(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%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -2.8e+99)
t_0
(if (<= z -3.2e-44)
(+ z x)
(if (<= z 4.2e-132) (+ x (sin y)) (if (<= z 3.5e+165) (+ z x) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -2.8e+99) {
tmp = t_0;
} else if (z <= -3.2e-44) {
tmp = z + x;
} else if (z <= 4.2e-132) {
tmp = x + sin(y);
} else if (z <= 3.5e+165) {
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 <= (-2.8d+99)) then
tmp = t_0
else if (z <= (-3.2d-44)) then
tmp = z + x
else if (z <= 4.2d-132) then
tmp = x + sin(y)
else if (z <= 3.5d+165) 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 <= -2.8e+99) {
tmp = t_0;
} else if (z <= -3.2e-44) {
tmp = z + x;
} else if (z <= 4.2e-132) {
tmp = x + Math.sin(y);
} else if (z <= 3.5e+165) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -2.8e+99: tmp = t_0 elif z <= -3.2e-44: tmp = z + x elif z <= 4.2e-132: tmp = x + math.sin(y) elif z <= 3.5e+165: 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 <= -2.8e+99) tmp = t_0; elseif (z <= -3.2e-44) tmp = Float64(z + x); elseif (z <= 4.2e-132) tmp = Float64(x + sin(y)); elseif (z <= 3.5e+165) 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 <= -2.8e+99) tmp = t_0; elseif (z <= -3.2e-44) tmp = z + x; elseif (z <= 4.2e-132) tmp = x + sin(y); elseif (z <= 3.5e+165) 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, -2.8e+99], t$95$0, If[LessEqual[z, -3.2e-44], N[(z + x), $MachinePrecision], If[LessEqual[z, 4.2e-132], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e+165], N[(z + x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{+99}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{-44}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-132}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+165}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.8e99 or 3.49999999999999996e165 < z Initial program 99.8%
Taylor expanded in z around inf 86.5%
if -2.8e99 < z < -3.19999999999999995e-44 or 4.2000000000000002e-132 < z < 3.49999999999999996e165Initial program 99.9%
Taylor expanded in y around 0 75.0%
+-commutative75.0%
Simplified75.0%
if -3.19999999999999995e-44 < z < 4.2000000000000002e-132Initial program 100.0%
Taylor expanded in z around 0 94.8%
+-commutative94.8%
Simplified94.8%
Final simplification85.5%
(FPCore (x y z) :precision binary64 (if (<= x -7.4e-16) (+ z x) (if (<= x 6.2e-106) (* z (cos y)) (if (<= x 2.5e-58) (sin y) (+ z x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.4e-16) {
tmp = z + x;
} else if (x <= 6.2e-106) {
tmp = z * cos(y);
} else if (x <= 2.5e-58) {
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 (x <= (-7.4d-16)) then
tmp = z + x
else if (x <= 6.2d-106) then
tmp = z * cos(y)
else if (x <= 2.5d-58) 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 (x <= -7.4e-16) {
tmp = z + x;
} else if (x <= 6.2e-106) {
tmp = z * Math.cos(y);
} else if (x <= 2.5e-58) {
tmp = Math.sin(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.4e-16: tmp = z + x elif x <= 6.2e-106: tmp = z * math.cos(y) elif x <= 2.5e-58: tmp = math.sin(y) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.4e-16) tmp = Float64(z + x); elseif (x <= 6.2e-106) tmp = Float64(z * cos(y)); elseif (x <= 2.5e-58) tmp = sin(y); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7.4e-16) tmp = z + x; elseif (x <= 6.2e-106) tmp = z * cos(y); elseif (x <= 2.5e-58) tmp = sin(y); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.4e-16], N[(z + x), $MachinePrecision], If[LessEqual[x, 6.2e-106], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.5e-58], N[Sin[y], $MachinePrecision], N[(z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.4 \cdot 10^{-16}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{-106}:\\
\;\;\;\;z \cdot \cos y\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-58}:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -7.3999999999999999e-16 or 2.49999999999999989e-58 < x Initial program 99.9%
Taylor expanded in y around 0 85.6%
+-commutative85.6%
Simplified85.6%
if -7.3999999999999999e-16 < x < 6.19999999999999971e-106Initial program 99.9%
Taylor expanded in z around inf 68.0%
if 6.19999999999999971e-106 < x < 2.49999999999999989e-58Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in z around 0 74.0%
(FPCore (x y z) :precision binary64 (if (<= x -1.85e+14) (+ z x) (if (<= x 2e-113) (+ z (+ y x)) (if (<= x 4.3e-58) (sin y) (+ z x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.85e+14) {
tmp = z + x;
} else if (x <= 2e-113) {
tmp = z + (y + x);
} else if (x <= 4.3e-58) {
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 (x <= (-1.85d+14)) then
tmp = z + x
else if (x <= 2d-113) then
tmp = z + (y + x)
else if (x <= 4.3d-58) 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 (x <= -1.85e+14) {
tmp = z + x;
} else if (x <= 2e-113) {
tmp = z + (y + x);
} else if (x <= 4.3e-58) {
tmp = Math.sin(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.85e+14: tmp = z + x elif x <= 2e-113: tmp = z + (y + x) elif x <= 4.3e-58: tmp = math.sin(y) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.85e+14) tmp = Float64(z + x); elseif (x <= 2e-113) tmp = Float64(z + Float64(y + x)); elseif (x <= 4.3e-58) tmp = sin(y); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.85e+14) tmp = z + x; elseif (x <= 2e-113) tmp = z + (y + x); elseif (x <= 4.3e-58) tmp = sin(y); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.85e+14], N[(z + x), $MachinePrecision], If[LessEqual[x, 2e-113], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.3e-58], N[Sin[y], $MachinePrecision], N[(z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{+14}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-113}:\\
\;\;\;\;z + \left(y + x\right)\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{-58}:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -1.85e14 or 4.2999999999999999e-58 < x Initial program 99.9%
Taylor expanded in y around 0 85.1%
+-commutative85.1%
Simplified85.1%
if -1.85e14 < x < 1.99999999999999996e-113Initial program 99.9%
Taylor expanded in y around 0 52.2%
+-commutative52.2%
+-commutative52.2%
associate-+l+52.2%
Simplified52.2%
if 1.99999999999999996e-113 < x < 4.2999999999999999e-58Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in z around 0 68.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -6500.0) (not (<= z 0.65))) (+ x (* z (cos y))) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6500.0) || !(z <= 0.65)) {
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 <= (-6500.0d0)) .or. (.not. (z <= 0.65d0))) 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 <= -6500.0) || !(z <= 0.65)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6500.0) or not (z <= 0.65): 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 <= -6500.0) || !(z <= 0.65)) 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 <= -6500.0) || ~((z <= 0.65))) tmp = x + (z * cos(y)); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6500.0], N[Not[LessEqual[z, 0.65]], $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 -6500 \lor \neg \left(z \leq 0.65\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -6500 or 0.650000000000000022 < z Initial program 99.8%
Taylor expanded in x around inf 99.2%
if -6500 < z < 0.650000000000000022Initial program 100.0%
Taylor expanded in y around 0 98.7%
Final simplification99.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.6e-38) (not (<= z 1.46e-137))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.6e-38) || !(z <= 1.46e-137)) {
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 <= (-4.6d-38)) .or. (.not. (z <= 1.46d-137))) 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 <= -4.6e-38) || !(z <= 1.46e-137)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.6e-38) or not (z <= 1.46e-137): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.6e-38) || !(z <= 1.46e-137)) 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 <= -4.6e-38) || ~((z <= 1.46e-137))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.6e-38], N[Not[LessEqual[z, 1.46e-137]], $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 -4.6 \cdot 10^{-38} \lor \neg \left(z \leq 1.46 \cdot 10^{-137}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -4.60000000000000003e-38 or 1.46e-137 < z Initial program 99.9%
Taylor expanded in x around inf 94.1%
if -4.60000000000000003e-38 < z < 1.46e-137Initial program 100.0%
Taylor expanded in z around 0 94.8%
+-commutative94.8%
Simplified94.8%
Final simplification94.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -3e+16) (not (<= y 1900000000000.0))) (+ z x) (+ (+ z x) (* y (+ 1.0 (* -0.5 (* z y)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3e+16) || !(y <= 1900000000000.0)) {
tmp = z + x;
} else {
tmp = (z + x) + (y * (1.0 + (-0.5 * (z * 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 <= (-3d+16)) .or. (.not. (y <= 1900000000000.0d0))) then
tmp = z + x
else
tmp = (z + x) + (y * (1.0d0 + ((-0.5d0) * (z * y))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3e+16) || !(y <= 1900000000000.0)) {
tmp = z + x;
} else {
tmp = (z + x) + (y * (1.0 + (-0.5 * (z * y))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3e+16) or not (y <= 1900000000000.0): tmp = z + x else: tmp = (z + x) + (y * (1.0 + (-0.5 * (z * y)))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3e+16) || !(y <= 1900000000000.0)) tmp = Float64(z + x); else tmp = Float64(Float64(z + x) + Float64(y * Float64(1.0 + Float64(-0.5 * Float64(z * y))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3e+16) || ~((y <= 1900000000000.0))) tmp = z + x; else tmp = (z + x) + (y * (1.0 + (-0.5 * (z * y)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3e+16], N[Not[LessEqual[y, 1900000000000.0]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(z + x), $MachinePrecision] + N[(y * N[(1.0 + N[(-0.5 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+16} \lor \neg \left(y \leq 1900000000000\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\left(z + x\right) + y \cdot \left(1 + -0.5 \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if y < -3e16 or 1.9e12 < y Initial program 99.8%
Taylor expanded in y around 0 37.4%
+-commutative37.4%
Simplified37.4%
if -3e16 < y < 1.9e12Initial program 100.0%
Taylor expanded in y around 0 97.3%
associate-+r+97.3%
+-commutative97.3%
*-commutative97.3%
Simplified97.3%
Final simplification67.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.55e+31) (not (<= y 8.2e+15))) (+ z x) (+ z (+ y x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.55e+31) || !(y <= 8.2e+15)) {
tmp = z + x;
} else {
tmp = z + (y + 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 <= (-3.55d+31)) .or. (.not. (y <= 8.2d+15))) then
tmp = z + x
else
tmp = z + (y + x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3.55e+31) || !(y <= 8.2e+15)) {
tmp = z + x;
} else {
tmp = z + (y + x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.55e+31) or not (y <= 8.2e+15): tmp = z + x else: tmp = z + (y + x) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.55e+31) || !(y <= 8.2e+15)) tmp = Float64(z + x); else tmp = Float64(z + Float64(y + x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.55e+31) || ~((y <= 8.2e+15))) tmp = z + x; else tmp = z + (y + x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.55e+31], N[Not[LessEqual[y, 8.2e+15]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.55 \cdot 10^{+31} \lor \neg \left(y \leq 8.2 \cdot 10^{+15}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z + \left(y + x\right)\\
\end{array}
\end{array}
if y < -3.5499999999999998e31 or 8.2e15 < y Initial program 99.8%
Taylor expanded in y around 0 37.9%
+-commutative37.9%
Simplified37.9%
if -3.5499999999999998e31 < y < 8.2e15Initial program 100.0%
Taylor expanded in y around 0 93.9%
+-commutative93.9%
+-commutative93.9%
associate-+l+93.9%
Simplified93.9%
Final simplification67.4%
(FPCore (x y z) :precision binary64 (if (<= x -5.6e-40) x (if (<= x 0.18) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.6e-40) {
tmp = x;
} else if (x <= 0.18) {
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 <= (-5.6d-40)) then
tmp = x
else if (x <= 0.18d0) 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 <= -5.6e-40) {
tmp = x;
} else if (x <= 0.18) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.6e-40: tmp = x elif x <= 0.18: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.6e-40) tmp = x; elseif (x <= 0.18) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.6e-40) tmp = x; elseif (x <= 0.18) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.6e-40], x, If[LessEqual[x, 0.18], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{-40}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 0.18:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.5999999999999999e-40 or 0.17999999999999999 < x Initial program 99.9%
Taylor expanded in z around -inf 80.7%
mul-1-neg80.7%
distribute-rgt-neg-in80.7%
distribute-lft-out80.7%
mul-1-neg80.7%
remove-double-neg80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in x around inf 80.2%
if -5.5999999999999999e-40 < x < 0.17999999999999999Initial program 99.9%
Taylor expanded in y around 0 45.4%
+-commutative45.4%
Simplified45.4%
Taylor expanded in z around inf 39.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 64.2%
+-commutative64.2%
Simplified64.2%
(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 z around -inf 91.0%
mul-1-neg91.0%
distribute-rgt-neg-in91.0%
distribute-lft-out91.0%
mul-1-neg91.0%
remove-double-neg91.0%
+-commutative91.0%
Simplified91.0%
Taylor expanded in x around inf 41.2%
herbie shell --seed 2024116
(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))))