
(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-define100.0%
Simplified100.0%
(FPCore (x y z) :precision binary64 (if (<= x -5.6e-14) (* x (+ 1.0 (/ z (/ x (cos y))))) (if (<= x 1.9e-70) (+ (sin y) (* z (cos y))) (fma z (cos y) x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.6e-14) {
tmp = x * (1.0 + (z / (x / cos(y))));
} else if (x <= 1.9e-70) {
tmp = sin(y) + (z * cos(y));
} else {
tmp = fma(z, cos(y), x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -5.6e-14) tmp = Float64(x * Float64(1.0 + Float64(z / Float64(x / cos(y))))); elseif (x <= 1.9e-70) tmp = Float64(sin(y) + Float64(z * cos(y))); else tmp = fma(z, cos(y), x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -5.6e-14], N[(x * N[(1.0 + N[(z / N[(x / N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9e-70], N[(N[Sin[y], $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[Cos[y], $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{-14}:\\
\;\;\;\;x \cdot \left(1 + \frac{z}{\frac{x}{\cos y}}\right)\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-70}:\\
\;\;\;\;\sin y + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \cos y, x\right)\\
\end{array}
\end{array}
if x < -5.6000000000000001e-14Initial program 99.9%
Taylor expanded in x around inf 99.9%
Taylor expanded in z around inf 81.5%
Taylor expanded in x around inf 99.9%
associate-/l*99.9%
Simplified99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
if -5.6000000000000001e-14 < x < 1.8999999999999999e-70Initial program 99.9%
Taylor expanded in x around 0 96.5%
if 1.8999999999999999e-70 < x Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around inf 98.4%
(FPCore (x y z) :precision binary64 (if (<= z -1.9e-73) (fma z (cos y) x) (if (<= z 1.05e-10) (+ x (sin y)) (+ x (* z (cos y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.9e-73) {
tmp = fma(z, cos(y), x);
} else if (z <= 1.05e-10) {
tmp = x + sin(y);
} else {
tmp = x + (z * cos(y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -1.9e-73) tmp = fma(z, cos(y), x); elseif (z <= 1.05e-10) tmp = Float64(x + sin(y)); else tmp = Float64(x + Float64(z * cos(y))); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -1.9e-73], N[(z * N[Cos[y], $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.05e-10], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{-73}:\\
\;\;\;\;\mathsf{fma}\left(z, \cos y, x\right)\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-10}:\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \cos y\\
\end{array}
\end{array}
if z < -1.9000000000000001e-73Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around inf 97.9%
if -1.9000000000000001e-73 < z < 1.05e-10Initial program 100.0%
Taylor expanded in z around 0 95.1%
+-commutative95.1%
Simplified95.1%
if 1.05e-10 < z Initial program 99.9%
Taylor expanded in x around inf 99.9%
Final simplification97.2%
(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
(let* ((t_0 (* z (cos y))))
(if (<= z -4.8e+74)
t_0
(if (<= z -1.45e-73)
(+ z x)
(if (<= z 1.06e+62) (+ x (sin y)) (if (<= z 4.2e+148) (+ z x) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -4.8e+74) {
tmp = t_0;
} else if (z <= -1.45e-73) {
tmp = z + x;
} else if (z <= 1.06e+62) {
tmp = x + sin(y);
} else if (z <= 4.2e+148) {
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 <= (-4.8d+74)) then
tmp = t_0
else if (z <= (-1.45d-73)) then
tmp = z + x
else if (z <= 1.06d+62) then
tmp = x + sin(y)
else if (z <= 4.2d+148) 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 <= -4.8e+74) {
tmp = t_0;
} else if (z <= -1.45e-73) {
tmp = z + x;
} else if (z <= 1.06e+62) {
tmp = x + Math.sin(y);
} else if (z <= 4.2e+148) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -4.8e+74: tmp = t_0 elif z <= -1.45e-73: tmp = z + x elif z <= 1.06e+62: tmp = x + math.sin(y) elif z <= 4.2e+148: 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 <= -4.8e+74) tmp = t_0; elseif (z <= -1.45e-73) tmp = Float64(z + x); elseif (z <= 1.06e+62) tmp = Float64(x + sin(y)); elseif (z <= 4.2e+148) 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 <= -4.8e+74) tmp = t_0; elseif (z <= -1.45e-73) tmp = z + x; elseif (z <= 1.06e+62) tmp = x + sin(y); elseif (z <= 4.2e+148) 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, -4.8e+74], t$95$0, If[LessEqual[z, -1.45e-73], N[(z + x), $MachinePrecision], If[LessEqual[z, 1.06e+62], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e+148], N[(z + x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -4.8 \cdot 10^{+74}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.45 \cdot 10^{-73}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{+62}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+148}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -4.80000000000000017e74 or 4.19999999999999998e148 < z Initial program 99.9%
Taylor expanded in z around inf 83.5%
if -4.80000000000000017e74 < z < -1.45e-73 or 1.0600000000000001e62 < z < 4.19999999999999998e148Initial program 100.0%
Taylor expanded in y around 0 86.1%
+-commutative86.1%
Simplified86.1%
if -1.45e-73 < z < 1.0600000000000001e62Initial program 100.0%
Taylor expanded in z around 0 93.7%
+-commutative93.7%
Simplified93.7%
Final simplification88.5%
(FPCore (x y z) :precision binary64 (if (<= y -4e+62) (+ z x) (if (<= y 1.15e+29) (+ z (+ y x)) (if (<= y 7e+45) (sin y) (+ z x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4e+62) {
tmp = z + x;
} else if (y <= 1.15e+29) {
tmp = z + (y + x);
} else if (y <= 7e+45) {
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 <= (-4d+62)) then
tmp = z + x
else if (y <= 1.15d+29) then
tmp = z + (y + x)
else if (y <= 7d+45) 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 <= -4e+62) {
tmp = z + x;
} else if (y <= 1.15e+29) {
tmp = z + (y + x);
} else if (y <= 7e+45) {
tmp = Math.sin(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4e+62: tmp = z + x elif y <= 1.15e+29: tmp = z + (y + x) elif y <= 7e+45: tmp = math.sin(y) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4e+62) tmp = Float64(z + x); elseif (y <= 1.15e+29) tmp = Float64(z + Float64(y + x)); elseif (y <= 7e+45) tmp = sin(y); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4e+62) tmp = z + x; elseif (y <= 1.15e+29) tmp = z + (y + x); elseif (y <= 7e+45) tmp = sin(y); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4e+62], N[(z + x), $MachinePrecision], If[LessEqual[y, 1.15e+29], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e+45], N[Sin[y], $MachinePrecision], N[(z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{+62}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{+29}:\\
\;\;\;\;z + \left(y + x\right)\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+45}:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -4.00000000000000014e62 or 7.00000000000000046e45 < y Initial program 99.9%
Taylor expanded in y around 0 45.6%
+-commutative45.6%
Simplified45.6%
if -4.00000000000000014e62 < y < 1.1500000000000001e29Initial program 100.0%
Taylor expanded in y around 0 93.3%
+-commutative93.3%
+-commutative93.3%
associate-+l+93.3%
Simplified93.3%
if 1.1500000000000001e29 < y < 7.00000000000000046e45Initial program 100.0%
Taylor expanded in z around 0 83.5%
+-commutative83.5%
Simplified83.5%
Taylor expanded in x around 0 83.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.9e-73) (not (<= z 9e-12))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.9e-73) || !(z <= 9e-12)) {
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.9d-73)) .or. (.not. (z <= 9d-12))) 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.9e-73) || !(z <= 9e-12)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.9e-73) or not (z <= 9e-12): 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.9e-73) || !(z <= 9e-12)) 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.9e-73) || ~((z <= 9e-12))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.9e-73], N[Not[LessEqual[z, 9e-12]], $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.9 \cdot 10^{-73} \lor \neg \left(z \leq 9 \cdot 10^{-12}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -1.9000000000000001e-73 or 8.99999999999999962e-12 < z Initial program 99.9%
Taylor expanded in x around inf 98.6%
if -1.9000000000000001e-73 < z < 8.99999999999999962e-12Initial program 100.0%
Taylor expanded in z around 0 95.1%
+-commutative95.1%
Simplified95.1%
Final simplification97.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.1e-59) (not (<= x 2.4e-7))) (+ z x) (* z (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.1e-59) || !(x <= 2.4e-7)) {
tmp = z + x;
} else {
tmp = z * cos(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 <= (-2.1d-59)) .or. (.not. (x <= 2.4d-7))) then
tmp = z + x
else
tmp = z * cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.1e-59) || !(x <= 2.4e-7)) {
tmp = z + x;
} else {
tmp = z * Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.1e-59) or not (x <= 2.4e-7): tmp = z + x else: tmp = z * math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.1e-59) || !(x <= 2.4e-7)) tmp = Float64(z + x); else tmp = Float64(z * cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.1e-59) || ~((x <= 2.4e-7))) tmp = z + x; else tmp = z * cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.1e-59], N[Not[LessEqual[x, 2.4e-7]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-59} \lor \neg \left(x \leq 2.4 \cdot 10^{-7}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \cos y\\
\end{array}
\end{array}
if x < -2.09999999999999997e-59 or 2.39999999999999979e-7 < x Initial program 100.0%
Taylor expanded in y around 0 85.4%
+-commutative85.4%
Simplified85.4%
if -2.09999999999999997e-59 < x < 2.39999999999999979e-7Initial program 99.9%
Taylor expanded in z around inf 66.1%
Final simplification76.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.7) (not (<= y 5000000000000.0))) (+ z x) (+ (+ z x) (* y (+ 1.0 (* z (* y -0.5)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.7) || !(y <= 5000000000000.0)) {
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 <= (-4.7d0)) .or. (.not. (y <= 5000000000000.0d0))) 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 <= -4.7) || !(y <= 5000000000000.0)) {
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 <= -4.7) or not (y <= 5000000000000.0): 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 <= -4.7) || !(y <= 5000000000000.0)) 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 <= -4.7) || ~((y <= 5000000000000.0))) 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, -4.7], N[Not[LessEqual[y, 5000000000000.0]], $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 -4.7 \lor \neg \left(y \leq 5000000000000\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 < -4.70000000000000018 or 5e12 < y Initial program 99.9%
Taylor expanded in y around 0 46.8%
+-commutative46.8%
Simplified46.8%
if -4.70000000000000018 < y < 5e12Initial program 100.0%
Taylor expanded in y around 0 97.2%
associate-+r+97.2%
+-commutative97.2%
associate-*r*97.2%
Simplified97.2%
Final simplification72.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.9e+63) (not (<= y 4.8e+51))) (+ z x) (+ z (+ y x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.9e+63) || !(y <= 4.8e+51)) {
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 <= (-2.9d+63)) .or. (.not. (y <= 4.8d+51))) 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 <= -2.9e+63) || !(y <= 4.8e+51)) {
tmp = z + x;
} else {
tmp = z + (y + x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.9e+63) or not (y <= 4.8e+51): tmp = z + x else: tmp = z + (y + x) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.9e+63) || !(y <= 4.8e+51)) 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 <= -2.9e+63) || ~((y <= 4.8e+51))) tmp = z + x; else tmp = z + (y + x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.9e+63], N[Not[LessEqual[y, 4.8e+51]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+63} \lor \neg \left(y \leq 4.8 \cdot 10^{+51}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z + \left(y + x\right)\\
\end{array}
\end{array}
if y < -2.8999999999999999e63 or 4.7999999999999997e51 < y Initial program 99.9%
Taylor expanded in y around 0 45.1%
+-commutative45.1%
Simplified45.1%
if -2.8999999999999999e63 < y < 4.7999999999999997e51Initial program 100.0%
Taylor expanded in y around 0 90.0%
+-commutative90.0%
+-commutative90.0%
associate-+l+90.0%
Simplified90.0%
Final simplification72.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.05e-236) (not (<= z 2.15e-169))) (+ z x) (+ y x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.05e-236) || !(z <= 2.15e-169)) {
tmp = z + x;
} else {
tmp = 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 ((z <= (-1.05d-236)) .or. (.not. (z <= 2.15d-169))) then
tmp = z + x
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.05e-236) || !(z <= 2.15e-169)) {
tmp = z + x;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.05e-236) or not (z <= 2.15e-169): tmp = z + x else: tmp = y + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.05e-236) || !(z <= 2.15e-169)) tmp = Float64(z + x); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.05e-236) || ~((z <= 2.15e-169))) tmp = z + x; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.05e-236], N[Not[LessEqual[z, 2.15e-169]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{-236} \lor \neg \left(z \leq 2.15 \cdot 10^{-169}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -1.04999999999999989e-236 or 2.14999999999999992e-169 < z Initial program 99.9%
Taylor expanded in y around 0 70.0%
+-commutative70.0%
Simplified70.0%
if -1.04999999999999989e-236 < z < 2.14999999999999992e-169Initial program 100.0%
Taylor expanded in z around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 72.0%
+-commutative72.0%
Simplified72.0%
Final simplification70.4%
(FPCore (x y z) :precision binary64 (if (<= x -3.6e-60) x (if (<= x 0.00145) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.6e-60) {
tmp = x;
} else if (x <= 0.00145) {
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 <= (-3.6d-60)) then
tmp = x
else if (x <= 0.00145d0) 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 <= -3.6e-60) {
tmp = x;
} else if (x <= 0.00145) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.6e-60: tmp = x elif x <= 0.00145: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.6e-60) tmp = x; elseif (x <= 0.00145) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.6e-60) tmp = x; elseif (x <= 0.00145) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.6e-60], x, If[LessEqual[x, 0.00145], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-60}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 0.00145:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.6e-60 or 0.00145 < x Initial program 100.0%
+-commutative100.0%
add-cube-cbrt99.6%
associate-*l*99.6%
fma-define99.6%
pow299.6%
Applied egg-rr99.6%
Taylor expanded in x around inf 73.0%
if -3.6e-60 < x < 0.00145Initial program 99.9%
Taylor expanded in x around 0 96.7%
Taylor expanded in y around 0 41.6%
(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%
add-cube-cbrt99.2%
associate-*l*99.2%
fma-define99.2%
pow299.2%
Applied egg-rr99.2%
Taylor expanded in x around inf 42.9%
herbie shell --seed 2024087
(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))))