
(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 12 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%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= z -1350000.0) (fma z (cos y) x) (if (<= z 5.2e-12) (+ z (+ x (sin y))) (+ x (* z (cos y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1350000.0) {
tmp = fma(z, cos(y), x);
} else if (z <= 5.2e-12) {
tmp = z + (x + sin(y));
} else {
tmp = x + (z * cos(y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -1350000.0) tmp = fma(z, cos(y), x); elseif (z <= 5.2e-12) tmp = Float64(z + Float64(x + sin(y))); else tmp = Float64(x + Float64(z * cos(y))); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -1350000.0], N[(z * N[Cos[y], $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 5.2e-12], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1350000:\\
\;\;\;\;\mathsf{fma}\left(z, \cos y, x\right)\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-12}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \cos y\\
\end{array}
\end{array}
if z < -1.35e6Initial program 99.8%
+-commutative99.8%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around inf 99.3%
if -1.35e6 < z < 5.19999999999999965e-12Initial program 100.0%
Taylor expanded in y around 0 99.2%
if 5.19999999999999965e-12 < z Initial program 99.8%
Taylor expanded in x around inf 99.8%
Final simplification99.4%
(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 -1.85e+40)
t_0
(if (<= z -2.7e-274)
(+ z x)
(if (<= z 1.65e-287) (+ y x) (if (<= z 3.4e+80) (+ z x) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -1.85e+40) {
tmp = t_0;
} else if (z <= -2.7e-274) {
tmp = z + x;
} else if (z <= 1.65e-287) {
tmp = y + x;
} else if (z <= 3.4e+80) {
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 <= (-1.85d+40)) then
tmp = t_0
else if (z <= (-2.7d-274)) then
tmp = z + x
else if (z <= 1.65d-287) then
tmp = y + x
else if (z <= 3.4d+80) 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 <= -1.85e+40) {
tmp = t_0;
} else if (z <= -2.7e-274) {
tmp = z + x;
} else if (z <= 1.65e-287) {
tmp = y + x;
} else if (z <= 3.4e+80) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -1.85e+40: tmp = t_0 elif z <= -2.7e-274: tmp = z + x elif z <= 1.65e-287: tmp = y + x elif z <= 3.4e+80: 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 <= -1.85e+40) tmp = t_0; elseif (z <= -2.7e-274) tmp = Float64(z + x); elseif (z <= 1.65e-287) tmp = Float64(y + x); elseif (z <= 3.4e+80) 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 <= -1.85e+40) tmp = t_0; elseif (z <= -2.7e-274) tmp = z + x; elseif (z <= 1.65e-287) tmp = y + x; elseif (z <= 3.4e+80) 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, -1.85e+40], t$95$0, If[LessEqual[z, -2.7e-274], N[(z + x), $MachinePrecision], If[LessEqual[z, 1.65e-287], N[(y + x), $MachinePrecision], If[LessEqual[z, 3.4e+80], N[(z + x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -1.85 \cdot 10^{+40}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2.7 \cdot 10^{-274}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-287}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{+80}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.85e40 or 3.39999999999999992e80 < z Initial program 99.8%
Taylor expanded in z around inf 93.0%
if -1.85e40 < z < -2.7e-274 or 1.64999999999999987e-287 < z < 3.39999999999999992e80Initial program 99.9%
Taylor expanded in y around 0 76.7%
+-commutative76.7%
Simplified76.7%
if -2.7e-274 < z < 1.64999999999999987e-287Initial program 100.0%
Taylor expanded in y around 0 82.4%
associate-+r+82.4%
+-commutative82.4%
associate-*r*82.4%
Simplified82.4%
Taylor expanded in z around 0 82.4%
Final simplification83.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -8200000000.0)
t_0
(if (<= z 2.8e-33) (+ x (sin y)) (if (<= z 2.1e+89) (+ z x) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -8200000000.0) {
tmp = t_0;
} else if (z <= 2.8e-33) {
tmp = x + sin(y);
} else if (z <= 2.1e+89) {
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 <= (-8200000000.0d0)) then
tmp = t_0
else if (z <= 2.8d-33) then
tmp = x + sin(y)
else if (z <= 2.1d+89) 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 <= -8200000000.0) {
tmp = t_0;
} else if (z <= 2.8e-33) {
tmp = x + Math.sin(y);
} else if (z <= 2.1e+89) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -8200000000.0: tmp = t_0 elif z <= 2.8e-33: tmp = x + math.sin(y) elif z <= 2.1e+89: 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 <= -8200000000.0) tmp = t_0; elseif (z <= 2.8e-33) tmp = Float64(x + sin(y)); elseif (z <= 2.1e+89) 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 <= -8200000000.0) tmp = t_0; elseif (z <= 2.8e-33) tmp = x + sin(y); elseif (z <= 2.1e+89) 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, -8200000000.0], t$95$0, If[LessEqual[z, 2.8e-33], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.1e+89], N[(z + x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -8200000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-33}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+89}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -8.2e9 or 2.09999999999999986e89 < z Initial program 99.8%
Taylor expanded in z around inf 90.0%
if -8.2e9 < z < 2.8e-33Initial program 100.0%
Taylor expanded in z around 0 89.2%
+-commutative89.2%
Simplified89.2%
if 2.8e-33 < z < 2.09999999999999986e89Initial program 99.9%
Taylor expanded in y around 0 90.7%
+-commutative90.7%
Simplified90.7%
Final simplification89.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -6e-70) (not (<= z 1.22e-30))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6e-70) || !(z <= 1.22e-30)) {
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 <= (-6d-70)) .or. (.not. (z <= 1.22d-30))) 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 <= -6e-70) || !(z <= 1.22e-30)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6e-70) or not (z <= 1.22e-30): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6e-70) || !(z <= 1.22e-30)) 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 <= -6e-70) || ~((z <= 1.22e-30))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6e-70], N[Not[LessEqual[z, 1.22e-30]], $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 -6 \cdot 10^{-70} \lor \neg \left(z \leq 1.22 \cdot 10^{-30}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -6.0000000000000003e-70 or 1.22e-30 < z Initial program 99.8%
Taylor expanded in x around inf 97.4%
if -6.0000000000000003e-70 < z < 1.22e-30Initial program 100.0%
Taylor expanded in z around 0 93.3%
+-commutative93.3%
Simplified93.3%
Final simplification95.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -1350000.0) (not (<= z 5.2e-12))) (+ x (* z (cos y))) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1350000.0) || !(z <= 5.2e-12)) {
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 <= (-1350000.0d0)) .or. (.not. (z <= 5.2d-12))) 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 <= -1350000.0) || !(z <= 5.2e-12)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1350000.0) or not (z <= 5.2e-12): 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 <= -1350000.0) || !(z <= 5.2e-12)) 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 <= -1350000.0) || ~((z <= 5.2e-12))) tmp = x + (z * cos(y)); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1350000.0], N[Not[LessEqual[z, 5.2e-12]], $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 -1350000 \lor \neg \left(z \leq 5.2 \cdot 10^{-12}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -1.35e6 or 5.19999999999999965e-12 < z Initial program 99.8%
Taylor expanded in x around inf 99.6%
if -1.35e6 < z < 5.19999999999999965e-12Initial program 100.0%
Taylor expanded in y around 0 99.2%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.25e+29) (not (<= y 2.3e+32))) (+ z x) (+ (+ z x) (* y (+ 1.0 (* z (* y -0.5)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.25e+29) || !(y <= 2.3e+32)) {
tmp = z + x;
} else {
tmp = (z + x) + (y * (1.0 + (z * (y * -0.5))));
}
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.25d+29)) .or. (.not. (y <= 2.3d+32))) then
tmp = z + x
else
tmp = (z + x) + (y * (1.0d0 + (z * (y * (-0.5d0)))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.25e+29) || !(y <= 2.3e+32)) {
tmp = z + x;
} else {
tmp = (z + x) + (y * (1.0 + (z * (y * -0.5))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.25e+29) or not (y <= 2.3e+32): tmp = z + x else: tmp = (z + x) + (y * (1.0 + (z * (y * -0.5)))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.25e+29) || !(y <= 2.3e+32)) tmp = Float64(z + x); else tmp = Float64(Float64(z + x) + Float64(y * Float64(1.0 + Float64(z * Float64(y * -0.5))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.25e+29) || ~((y <= 2.3e+32))) tmp = z + x; else tmp = (z + x) + (y * (1.0 + (z * (y * -0.5)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.25e+29], N[Not[LessEqual[y, 2.3e+32]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(z + x), $MachinePrecision] + N[(y * N[(1.0 + N[(z * N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+29} \lor \neg \left(y \leq 2.3 \cdot 10^{+32}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\left(z + x\right) + y \cdot \left(1 + z \cdot \left(y \cdot -0.5\right)\right)\\
\end{array}
\end{array}
if y < -1.25e29 or 2.3e32 < y Initial program 99.8%
Taylor expanded in y around 0 45.4%
+-commutative45.4%
Simplified45.4%
if -1.25e29 < y < 2.3e32Initial program 100.0%
Taylor expanded in y around 0 93.2%
associate-+r+93.2%
+-commutative93.2%
associate-*r*93.2%
Simplified93.2%
Final simplification73.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -390000.0) (not (<= y 1.6e+53))) (+ z x) (+ z (+ y x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -390000.0) || !(y <= 1.6e+53)) {
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 <= (-390000.0d0)) .or. (.not. (y <= 1.6d+53))) 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 <= -390000.0) || !(y <= 1.6e+53)) {
tmp = z + x;
} else {
tmp = z + (y + x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -390000.0) or not (y <= 1.6e+53): tmp = z + x else: tmp = z + (y + x) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -390000.0) || !(y <= 1.6e+53)) 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 <= -390000.0) || ~((y <= 1.6e+53))) tmp = z + x; else tmp = z + (y + x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -390000.0], N[Not[LessEqual[y, 1.6e+53]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -390000 \lor \neg \left(y \leq 1.6 \cdot 10^{+53}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z + \left(y + x\right)\\
\end{array}
\end{array}
if y < -3.9e5 or 1.6e53 < y Initial program 99.8%
Taylor expanded in y around 0 43.5%
+-commutative43.5%
Simplified43.5%
if -3.9e5 < y < 1.6e53Initial program 100.0%
Taylor expanded in y around 0 95.1%
+-commutative95.1%
+-commutative95.1%
associate-+l+95.1%
Simplified95.1%
Final simplification73.3%
(FPCore (x y z) :precision binary64 (if (<= x -2.8e+53) x (if (<= x 0.29) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.8e+53) {
tmp = x;
} else if (x <= 0.29) {
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 <= (-2.8d+53)) then
tmp = x
else if (x <= 0.29d0) 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 <= -2.8e+53) {
tmp = x;
} else if (x <= 0.29) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.8e+53: tmp = x elif x <= 0.29: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.8e+53) tmp = x; elseif (x <= 0.29) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.8e+53) tmp = x; elseif (x <= 0.29) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.8e+53], x, If[LessEqual[x, 0.29], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{+53}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 0.29:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.8e53 or 0.28999999999999998 < x Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
add-cube-cbrt99.8%
associate-*l*99.8%
fma-define99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 72.5%
if -2.8e53 < x < 0.28999999999999998Initial program 99.9%
Taylor expanded in z around inf 67.6%
Taylor expanded in y around 0 48.3%
Final simplification59.5%
(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.2%
+-commutative69.2%
Simplified69.2%
Final simplification69.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%
+-commutative99.9%
*-commutative99.9%
add-cube-cbrt99.7%
associate-*l*99.6%
fma-define99.6%
pow299.6%
Applied egg-rr99.6%
Taylor expanded in x around inf 39.0%
Final simplification39.0%
herbie shell --seed 2024095
(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))))