
(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-def99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (cos y)))) (if (or (<= x -2.3e-65) (not (<= x 5e-79))) (+ x t_0) (+ (sin y) t_0))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if ((x <= -2.3e-65) || !(x <= 5e-79)) {
tmp = x + t_0;
} else {
tmp = sin(y) + 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 ((x <= (-2.3d-65)) .or. (.not. (x <= 5d-79))) then
tmp = x + t_0
else
tmp = sin(y) + 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 ((x <= -2.3e-65) || !(x <= 5e-79)) {
tmp = x + t_0;
} else {
tmp = Math.sin(y) + t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if (x <= -2.3e-65) or not (x <= 5e-79): tmp = x + t_0 else: tmp = math.sin(y) + t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if ((x <= -2.3e-65) || !(x <= 5e-79)) tmp = Float64(x + t_0); else tmp = Float64(sin(y) + t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if ((x <= -2.3e-65) || ~((x <= 5e-79))) tmp = x + t_0; else tmp = sin(y) + t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -2.3e-65], N[Not[LessEqual[x, 5e-79]], $MachinePrecision]], N[(x + t$95$0), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] + t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;x \leq -2.3 \cdot 10^{-65} \lor \neg \left(x \leq 5 \cdot 10^{-79}\right):\\
\;\;\;\;x + t_0\\
\mathbf{else}:\\
\;\;\;\;\sin y + t_0\\
\end{array}
\end{array}
if x < -2.3e-65 or 4.99999999999999999e-79 < x Initial program 100.0%
Taylor expanded in x around inf 97.7%
if -2.3e-65 < x < 4.99999999999999999e-79Initial program 99.8%
Taylor expanded in x around 0 96.9%
Final simplification97.4%
(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 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.52e-121) (not (<= z 3.4e-66))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.52e-121) || !(z <= 3.4e-66)) {
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 <= (-1.52d-121)) .or. (.not. (z <= 3.4d-66))) 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 <= -1.52e-121) || !(z <= 3.4e-66)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.52e-121) or not (z <= 3.4e-66): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.52e-121) || !(z <= 3.4e-66)) 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 <= -1.52e-121) || ~((z <= 3.4e-66))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.52e-121], N[Not[LessEqual[z, 3.4e-66]], $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 -1.52 \cdot 10^{-121} \lor \neg \left(z \leq 3.4 \cdot 10^{-66}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -1.52e-121 or 3.39999999999999997e-66 < z Initial program 99.9%
Taylor expanded in x around inf 95.8%
if -1.52e-121 < z < 3.39999999999999997e-66Initial program 100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in z around 0 96.6%
+-commutative96.6%
Simplified96.6%
Final simplification96.1%
(FPCore (x y z) :precision binary64 (if (<= x -5.6e-84) (+ z x) (if (<= x 1.55e-138) (* z (cos y)) (if (<= x 3.3e-79) (sin y) (+ z x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.6e-84) {
tmp = z + x;
} else if (x <= 1.55e-138) {
tmp = z * cos(y);
} else if (x <= 3.3e-79) {
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 <= (-5.6d-84)) then
tmp = z + x
else if (x <= 1.55d-138) then
tmp = z * cos(y)
else if (x <= 3.3d-79) 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 <= -5.6e-84) {
tmp = z + x;
} else if (x <= 1.55e-138) {
tmp = z * Math.cos(y);
} else if (x <= 3.3e-79) {
tmp = Math.sin(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.6e-84: tmp = z + x elif x <= 1.55e-138: tmp = z * math.cos(y) elif x <= 3.3e-79: tmp = math.sin(y) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.6e-84) tmp = Float64(z + x); elseif (x <= 1.55e-138) tmp = Float64(z * cos(y)); elseif (x <= 3.3e-79) tmp = sin(y); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.6e-84) tmp = z + x; elseif (x <= 1.55e-138) tmp = z * cos(y); elseif (x <= 3.3e-79) tmp = sin(y); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.6e-84], N[(z + x), $MachinePrecision], If[LessEqual[x, 1.55e-138], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.3e-79], N[Sin[y], $MachinePrecision], N[(z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{-84}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-138}:\\
\;\;\;\;z \cdot \cos y\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{-79}:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -5.59999999999999964e-84 or 3.2999999999999998e-79 < x Initial program 100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in y around 0 85.9%
+-commutative85.9%
Simplified85.9%
if -5.59999999999999964e-84 < x < 1.5499999999999999e-138Initial program 99.8%
+-commutative99.8%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around inf 58.6%
if 1.5499999999999999e-138 < x < 3.2999999999999998e-79Initial program 99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in x around 0 89.0%
Taylor expanded in z around 0 78.6%
Final simplification76.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.00052) (not (<= y 2.85e-5))) (+ x (sin y)) (+ x (+ (+ z y) (* -0.5 (* z (* y y)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.00052) || !(y <= 2.85e-5)) {
tmp = x + sin(y);
} else {
tmp = x + ((z + y) + (-0.5 * (z * (y * 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 <= (-0.00052d0)) .or. (.not. (y <= 2.85d-5))) then
tmp = x + sin(y)
else
tmp = x + ((z + y) + ((-0.5d0) * (z * (y * y))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -0.00052) || !(y <= 2.85e-5)) {
tmp = x + Math.sin(y);
} else {
tmp = x + ((z + y) + (-0.5 * (z * (y * y))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.00052) or not (y <= 2.85e-5): tmp = x + math.sin(y) else: tmp = x + ((z + y) + (-0.5 * (z * (y * y)))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.00052) || !(y <= 2.85e-5)) tmp = Float64(x + sin(y)); else tmp = Float64(x + Float64(Float64(z + y) + Float64(-0.5 * Float64(z * Float64(y * y))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.00052) || ~((y <= 2.85e-5))) tmp = x + sin(y); else tmp = x + ((z + y) + (-0.5 * (z * (y * y)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.00052], N[Not[LessEqual[y, 2.85e-5]], $MachinePrecision]], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z + y), $MachinePrecision] + N[(-0.5 * N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00052 \lor \neg \left(y \leq 2.85 \cdot 10^{-5}\right):\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \left(\left(z + y\right) + -0.5 \cdot \left(z \cdot \left(y \cdot y\right)\right)\right)\\
\end{array}
\end{array}
if y < -5.19999999999999954e-4 or 2.8500000000000002e-5 < y Initial program 99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in z around 0 64.8%
+-commutative64.8%
Simplified64.8%
if -5.19999999999999954e-4 < y < 2.8500000000000002e-5Initial program 100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification84.2%
(FPCore (x y z) :precision binary64 (if (<= y -15.6) (+ z x) (if (<= y 9.5e+49) (+ z (+ y x)) (sin y))))
double code(double x, double y, double z) {
double tmp;
if (y <= -15.6) {
tmp = z + x;
} else if (y <= 9.5e+49) {
tmp = z + (y + x);
} else {
tmp = 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 (y <= (-15.6d0)) then
tmp = z + x
else if (y <= 9.5d+49) then
tmp = z + (y + x)
else
tmp = sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -15.6) {
tmp = z + x;
} else if (y <= 9.5e+49) {
tmp = z + (y + x);
} else {
tmp = Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -15.6: tmp = z + x elif y <= 9.5e+49: tmp = z + (y + x) else: tmp = math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -15.6) tmp = Float64(z + x); elseif (y <= 9.5e+49) tmp = Float64(z + Float64(y + x)); else tmp = sin(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -15.6) tmp = z + x; elseif (y <= 9.5e+49) tmp = z + (y + x); else tmp = sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -15.6], N[(z + x), $MachinePrecision], If[LessEqual[y, 9.5e+49], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision], N[Sin[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -15.6:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{+49}:\\
\;\;\;\;z + \left(y + x\right)\\
\mathbf{else}:\\
\;\;\;\;\sin y\\
\end{array}
\end{array}
if y < -15.5999999999999996Initial program 99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in y around 0 40.2%
+-commutative40.2%
Simplified40.2%
if -15.5999999999999996 < y < 9.49999999999999969e49Initial program 100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in y around 0 96.9%
+-commutative96.9%
+-commutative96.9%
associate-+l+96.9%
Simplified96.9%
if 9.49999999999999969e49 < y Initial program 99.8%
+-commutative99.8%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around 0 72.8%
Taylor expanded in z around 0 33.1%
Final simplification73.2%
(FPCore (x y z) :precision binary64 (if (<= y -450.0) (+ z x) (if (<= y 14000.0) (+ x (+ (+ z y) (* -0.5 (* z (* y y))))) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -450.0) {
tmp = z + x;
} else if (y <= 14000.0) {
tmp = x + ((z + y) + (-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 <= (-450.0d0)) then
tmp = z + x
else if (y <= 14000.0d0) then
tmp = x + ((z + y) + ((-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 <= -450.0) {
tmp = z + x;
} else if (y <= 14000.0) {
tmp = x + ((z + y) + (-0.5 * (z * (y * y))));
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -450.0: tmp = z + x elif y <= 14000.0: tmp = x + ((z + y) + (-0.5 * (z * (y * y)))) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -450.0) tmp = Float64(z + x); elseif (y <= 14000.0) tmp = Float64(x + Float64(Float64(z + y) + 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 <= -450.0) tmp = z + x; elseif (y <= 14000.0) tmp = x + ((z + y) + (-0.5 * (z * (y * y)))); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -450.0], N[(z + x), $MachinePrecision], If[LessEqual[y, 14000.0], N[(x + N[(N[(z + y), $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 -450:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 14000:\\
\;\;\;\;x + \left(\left(z + y\right) + -0.5 \cdot \left(z \cdot \left(y \cdot y\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -450 or 14000 < y Initial program 99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in y around 0 38.3%
+-commutative38.3%
Simplified38.3%
if -450 < y < 14000Initial program 100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in y around 0 98.9%
associate-+r+98.9%
+-commutative98.9%
*-commutative98.9%
unpow298.9%
Simplified98.9%
Final simplification73.1%
(FPCore (x y z) :precision binary64 (if (<= y -15.6) (+ z x) (if (<= y 2800.0) (+ z (+ y x)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -15.6) {
tmp = z + x;
} else if (y <= 2800.0) {
tmp = z + (y + 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 <= (-15.6d0)) then
tmp = z + x
else if (y <= 2800.0d0) then
tmp = z + (y + 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 <= -15.6) {
tmp = z + x;
} else if (y <= 2800.0) {
tmp = z + (y + x);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -15.6: tmp = z + x elif y <= 2800.0: tmp = z + (y + x) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -15.6) tmp = Float64(z + x); elseif (y <= 2800.0) tmp = Float64(z + Float64(y + x)); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -15.6) tmp = z + x; elseif (y <= 2800.0) tmp = z + (y + x); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -15.6], N[(z + x), $MachinePrecision], If[LessEqual[y, 2800.0], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -15.6:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 2800:\\
\;\;\;\;z + \left(y + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -15.5999999999999996 or 2800 < y Initial program 99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in y around 0 38.3%
+-commutative38.3%
Simplified38.3%
if -15.5999999999999996 < y < 2800Initial program 100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in y around 0 98.9%
+-commutative98.9%
+-commutative98.9%
associate-+l+98.9%
Simplified98.9%
Final simplification73.1%
(FPCore (x y z) :precision binary64 (if (<= x -1.95e-119) (+ z x) (if (<= x 9e-102) (+ z y) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.95e-119) {
tmp = z + x;
} else if (x <= 9e-102) {
tmp = z + 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.95d-119)) then
tmp = z + x
else if (x <= 9d-102) then
tmp = z + 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.95e-119) {
tmp = z + x;
} else if (x <= 9e-102) {
tmp = z + y;
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.95e-119: tmp = z + x elif x <= 9e-102: tmp = z + y else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.95e-119) tmp = Float64(z + x); elseif (x <= 9e-102) tmp = Float64(z + y); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.95e-119) tmp = z + x; elseif (x <= 9e-102) tmp = z + y; else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.95e-119], N[(z + x), $MachinePrecision], If[LessEqual[x, 9e-102], N[(z + y), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.95 \cdot 10^{-119}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-102}:\\
\;\;\;\;z + y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -1.94999999999999995e-119 or 8.99999999999999999e-102 < x Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in y around 0 81.7%
+-commutative81.7%
Simplified81.7%
if -1.94999999999999995e-119 < x < 8.99999999999999999e-102Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around 0 99.7%
Taylor expanded in y around 0 53.4%
+-commutative53.4%
Simplified53.4%
Final simplification72.2%
(FPCore (x y z) :precision binary64 (if (<= x -2.65e-65) x (if (<= x 6.6e-18) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.65e-65) {
tmp = x;
} else if (x <= 6.6e-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 <= (-2.65d-65)) then
tmp = x
else if (x <= 6.6d-18) 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.65e-65) {
tmp = x;
} else if (x <= 6.6e-18) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.65e-65: tmp = x elif x <= 6.6e-18: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.65e-65) tmp = x; elseif (x <= 6.6e-18) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.65e-65) tmp = x; elseif (x <= 6.6e-18) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.65e-65], x, If[LessEqual[x, 6.6e-18], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.65 \cdot 10^{-65}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{-18}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.65000000000000019e-65 or 6.6000000000000003e-18 < x Initial program 100.0%
Taylor expanded in x around inf 98.1%
Taylor expanded in x around inf 70.8%
if -2.65000000000000019e-65 < x < 6.6000000000000003e-18Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around inf 58.5%
Taylor expanded in y around 0 39.8%
Final simplification56.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%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in y around 0 67.3%
+-commutative67.3%
Simplified67.3%
Final simplification67.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%
Taylor expanded in x around inf 81.7%
Taylor expanded in x around inf 41.5%
Final simplification41.5%
herbie shell --seed 2023271
(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))))