
(FPCore (x y z) :precision binary64 (+ (+ (+ (+ (+ x y) y) x) z) x))
double code(double x, double y, double z) {
return ((((x + y) + y) + x) + 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 = ((((x + y) + y) + x) + z) + x
end function
public static double code(double x, double y, double z) {
return ((((x + y) + y) + x) + z) + x;
}
def code(x, y, z): return ((((x + y) + y) + x) + z) + x
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x + y) + y) + x) + z) + x) end
function tmp = code(x, y, z) tmp = ((((x + y) + y) + x) + z) + x; end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision] + z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ (+ (+ (+ x y) y) x) z) x))
double code(double x, double y, double z) {
return ((((x + y) + y) + x) + 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 = ((((x + y) + y) + x) + z) + x
end function
public static double code(double x, double y, double z) {
return ((((x + y) + y) + x) + z) + x;
}
def code(x, y, z): return ((((x + y) + y) + x) + z) + x
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x + y) + y) + x) + z) + x) end
function tmp = code(x, y, z) tmp = ((((x + y) + y) + x) + z) + x; end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision] + z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x
\end{array}
(FPCore (x y z) :precision binary64 (- z (fma x -3.0 (* y -2.0))))
double code(double x, double y, double z) {
return z - fma(x, -3.0, (y * -2.0));
}
function code(x, y, z) return Float64(z - fma(x, -3.0, Float64(y * -2.0))) end
code[x_, y_, z_] := N[(z - N[(x * -3.0 + N[(y * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z - \mathsf{fma}\left(x, -3, y \cdot -2\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
unsub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
distribute-neg-in99.9%
distribute-neg-out99.9%
neg-mul-199.9%
count-299.9%
distribute-lft-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-rgt-out99.9%
distribute-neg-out99.9%
fma-define99.9%
Simplified99.9%
(FPCore (x y z)
:precision binary64
(if (<= z -1.95e+26)
(- z (* x -3.0))
(if (<= z 2.05e+157)
(- (* x 3.0) (* y -2.0))
(* z (+ 1.0 (* 3.0 (/ x z)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.95e+26) {
tmp = z - (x * -3.0);
} else if (z <= 2.05e+157) {
tmp = (x * 3.0) - (y * -2.0);
} else {
tmp = z * (1.0 + (3.0 * (x / z)));
}
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.95d+26)) then
tmp = z - (x * (-3.0d0))
else if (z <= 2.05d+157) then
tmp = (x * 3.0d0) - (y * (-2.0d0))
else
tmp = z * (1.0d0 + (3.0d0 * (x / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.95e+26) {
tmp = z - (x * -3.0);
} else if (z <= 2.05e+157) {
tmp = (x * 3.0) - (y * -2.0);
} else {
tmp = z * (1.0 + (3.0 * (x / z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.95e+26: tmp = z - (x * -3.0) elif z <= 2.05e+157: tmp = (x * 3.0) - (y * -2.0) else: tmp = z * (1.0 + (3.0 * (x / z))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.95e+26) tmp = Float64(z - Float64(x * -3.0)); elseif (z <= 2.05e+157) tmp = Float64(Float64(x * 3.0) - Float64(y * -2.0)); else tmp = Float64(z * Float64(1.0 + Float64(3.0 * Float64(x / z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.95e+26) tmp = z - (x * -3.0); elseif (z <= 2.05e+157) tmp = (x * 3.0) - (y * -2.0); else tmp = z * (1.0 + (3.0 * (x / z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.95e+26], N[(z - N[(x * -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.05e+157], N[(N[(x * 3.0), $MachinePrecision] - N[(y * -2.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(1.0 + N[(3.0 * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+26}:\\
\;\;\;\;z - x \cdot -3\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{+157}:\\
\;\;\;\;x \cdot 3 - y \cdot -2\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(1 + 3 \cdot \frac{x}{z}\right)\\
\end{array}
\end{array}
if z < -1.95e26Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
unsub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
distribute-neg-in99.9%
distribute-neg-out99.9%
neg-mul-199.9%
count-299.9%
distribute-lft-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-rgt-out99.9%
distribute-neg-out99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 84.5%
if -1.95e26 < z < 2.05000000000000008e157Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
unsub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
distribute-neg-in99.9%
distribute-neg-out99.9%
neg-mul-199.9%
count-299.9%
distribute-lft-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-rgt-out99.9%
distribute-neg-out99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in z around 0 89.5%
if 2.05000000000000008e157 < z Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
unsub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
distribute-neg-in99.9%
distribute-neg-out99.9%
neg-mul-199.9%
count-299.9%
distribute-lft-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-rgt-out99.9%
distribute-neg-out99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in z around inf 99.9%
Taylor expanded in y around 0 91.7%
Final simplification88.6%
(FPCore (x y z) :precision binary64 (if (<= z -6.4e+118) z (if (<= z 4.6e-191) (* x 3.0) (if (<= z 2.05e+157) (* y 2.0) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -6.4e+118) {
tmp = z;
} else if (z <= 4.6e-191) {
tmp = x * 3.0;
} else if (z <= 2.05e+157) {
tmp = y * 2.0;
} else {
tmp = z;
}
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 <= (-6.4d+118)) then
tmp = z
else if (z <= 4.6d-191) then
tmp = x * 3.0d0
else if (z <= 2.05d+157) then
tmp = y * 2.0d0
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -6.4e+118) {
tmp = z;
} else if (z <= 4.6e-191) {
tmp = x * 3.0;
} else if (z <= 2.05e+157) {
tmp = y * 2.0;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6.4e+118: tmp = z elif z <= 4.6e-191: tmp = x * 3.0 elif z <= 2.05e+157: tmp = y * 2.0 else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6.4e+118) tmp = z; elseif (z <= 4.6e-191) tmp = Float64(x * 3.0); elseif (z <= 2.05e+157) tmp = Float64(y * 2.0); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -6.4e+118) tmp = z; elseif (z <= 4.6e-191) tmp = x * 3.0; elseif (z <= 2.05e+157) tmp = y * 2.0; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6.4e+118], z, If[LessEqual[z, 4.6e-191], N[(x * 3.0), $MachinePrecision], If[LessEqual[z, 2.05e+157], N[(y * 2.0), $MachinePrecision], z]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{+118}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-191}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{+157}:\\
\;\;\;\;y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -6.40000000000000032e118 or 2.05000000000000008e157 < z Initial program 99.9%
associate-+l+99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 79.2%
if -6.40000000000000032e118 < z < 4.60000000000000021e-191Initial program 99.8%
associate-+l+99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
+-commutative99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 49.0%
if 4.60000000000000021e-191 < z < 2.05000000000000008e157Initial program 100.0%
associate-+l+100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
+-commutative100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 52.9%
Final simplification59.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.95e+26) (not (<= z 2.5e+157))) (- z (* x -3.0)) (+ x (* 2.0 (+ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.95e+26) || !(z <= 2.5e+157)) {
tmp = z - (x * -3.0);
} else {
tmp = x + (2.0 * (x + 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.95d+26)) .or. (.not. (z <= 2.5d+157))) then
tmp = z - (x * (-3.0d0))
else
tmp = x + (2.0d0 * (x + y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.95e+26) || !(z <= 2.5e+157)) {
tmp = z - (x * -3.0);
} else {
tmp = x + (2.0 * (x + y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.95e+26) or not (z <= 2.5e+157): tmp = z - (x * -3.0) else: tmp = x + (2.0 * (x + y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.95e+26) || !(z <= 2.5e+157)) tmp = Float64(z - Float64(x * -3.0)); else tmp = Float64(x + Float64(2.0 * Float64(x + y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.95e+26) || ~((z <= 2.5e+157))) tmp = z - (x * -3.0); else tmp = x + (2.0 * (x + y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.95e+26], N[Not[LessEqual[z, 2.5e+157]], $MachinePrecision]], N[(z - N[(x * -3.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+26} \lor \neg \left(z \leq 2.5 \cdot 10^{+157}\right):\\
\;\;\;\;z - x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;x + 2 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if z < -1.95e26 or 2.49999999999999988e157 < z Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
unsub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
distribute-neg-in99.9%
distribute-neg-out99.9%
neg-mul-199.9%
count-299.9%
distribute-lft-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-rgt-out99.9%
distribute-neg-out99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 87.2%
if -1.95e26 < z < 2.49999999999999988e157Initial program 99.9%
associate-+l+99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 89.5%
Final simplification88.6%
(FPCore (x y z) :precision binary64 (if (<= z -1.95e+26) (- z (* x -3.0)) (if (<= z 2.15e+157) (- (* x 3.0) (* y -2.0)) (+ x (+ z (+ x x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.95e+26) {
tmp = z - (x * -3.0);
} else if (z <= 2.15e+157) {
tmp = (x * 3.0) - (y * -2.0);
} else {
tmp = x + (z + (x + 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.95d+26)) then
tmp = z - (x * (-3.0d0))
else if (z <= 2.15d+157) then
tmp = (x * 3.0d0) - (y * (-2.0d0))
else
tmp = x + (z + (x + x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.95e+26) {
tmp = z - (x * -3.0);
} else if (z <= 2.15e+157) {
tmp = (x * 3.0) - (y * -2.0);
} else {
tmp = x + (z + (x + x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.95e+26: tmp = z - (x * -3.0) elif z <= 2.15e+157: tmp = (x * 3.0) - (y * -2.0) else: tmp = x + (z + (x + x)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.95e+26) tmp = Float64(z - Float64(x * -3.0)); elseif (z <= 2.15e+157) tmp = Float64(Float64(x * 3.0) - Float64(y * -2.0)); else tmp = Float64(x + Float64(z + Float64(x + x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.95e+26) tmp = z - (x * -3.0); elseif (z <= 2.15e+157) tmp = (x * 3.0) - (y * -2.0); else tmp = x + (z + (x + x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.95e+26], N[(z - N[(x * -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.15e+157], N[(N[(x * 3.0), $MachinePrecision] - N[(y * -2.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(z + N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+26}:\\
\;\;\;\;z - x \cdot -3\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+157}:\\
\;\;\;\;x \cdot 3 - y \cdot -2\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + \left(x + x\right)\right)\\
\end{array}
\end{array}
if z < -1.95e26Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
unsub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
distribute-neg-in99.9%
distribute-neg-out99.9%
neg-mul-199.9%
count-299.9%
distribute-lft-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-rgt-out99.9%
distribute-neg-out99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 84.5%
if -1.95e26 < z < 2.15e157Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
unsub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
distribute-neg-in99.9%
distribute-neg-out99.9%
neg-mul-199.9%
count-299.9%
distribute-lft-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-rgt-out99.9%
distribute-neg-out99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in z around 0 89.5%
if 2.15e157 < z Initial program 99.9%
Taylor expanded in x around inf 91.7%
Final simplification88.6%
(FPCore (x y z) :precision binary64 (if (<= z -1.95e+26) (- z (* x -3.0)) (if (<= z 2.05e+157) (+ x (* 2.0 (+ x y))) (+ x (+ z (+ x x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.95e+26) {
tmp = z - (x * -3.0);
} else if (z <= 2.05e+157) {
tmp = x + (2.0 * (x + y));
} else {
tmp = x + (z + (x + 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.95d+26)) then
tmp = z - (x * (-3.0d0))
else if (z <= 2.05d+157) then
tmp = x + (2.0d0 * (x + y))
else
tmp = x + (z + (x + x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.95e+26) {
tmp = z - (x * -3.0);
} else if (z <= 2.05e+157) {
tmp = x + (2.0 * (x + y));
} else {
tmp = x + (z + (x + x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.95e+26: tmp = z - (x * -3.0) elif z <= 2.05e+157: tmp = x + (2.0 * (x + y)) else: tmp = x + (z + (x + x)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.95e+26) tmp = Float64(z - Float64(x * -3.0)); elseif (z <= 2.05e+157) tmp = Float64(x + Float64(2.0 * Float64(x + y))); else tmp = Float64(x + Float64(z + Float64(x + x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.95e+26) tmp = z - (x * -3.0); elseif (z <= 2.05e+157) tmp = x + (2.0 * (x + y)); else tmp = x + (z + (x + x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.95e+26], N[(z - N[(x * -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.05e+157], N[(x + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z + N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+26}:\\
\;\;\;\;z - x \cdot -3\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{+157}:\\
\;\;\;\;x + 2 \cdot \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + \left(x + x\right)\right)\\
\end{array}
\end{array}
if z < -1.95e26Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
unsub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
distribute-neg-in99.9%
distribute-neg-out99.9%
neg-mul-199.9%
count-299.9%
distribute-lft-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-rgt-out99.9%
distribute-neg-out99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 84.5%
if -1.95e26 < z < 2.05000000000000008e157Initial program 99.9%
associate-+l+99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 89.5%
if 2.05000000000000008e157 < z Initial program 99.9%
Taylor expanded in x around inf 91.7%
Final simplification88.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.3e-54) (not (<= y 2.75e+65))) (- z (* y -2.0)) (- z (* x -3.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.3e-54) || !(y <= 2.75e+65)) {
tmp = z - (y * -2.0);
} else {
tmp = z - (x * -3.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) :: tmp
if ((y <= (-2.3d-54)) .or. (.not. (y <= 2.75d+65))) then
tmp = z - (y * (-2.0d0))
else
tmp = z - (x * (-3.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.3e-54) || !(y <= 2.75e+65)) {
tmp = z - (y * -2.0);
} else {
tmp = z - (x * -3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.3e-54) or not (y <= 2.75e+65): tmp = z - (y * -2.0) else: tmp = z - (x * -3.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.3e-54) || !(y <= 2.75e+65)) tmp = Float64(z - Float64(y * -2.0)); else tmp = Float64(z - Float64(x * -3.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.3e-54) || ~((y <= 2.75e+65))) tmp = z - (y * -2.0); else tmp = z - (x * -3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.3e-54], N[Not[LessEqual[y, 2.75e+65]], $MachinePrecision]], N[(z - N[(y * -2.0), $MachinePrecision]), $MachinePrecision], N[(z - N[(x * -3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{-54} \lor \neg \left(y \leq 2.75 \cdot 10^{+65}\right):\\
\;\;\;\;z - y \cdot -2\\
\mathbf{else}:\\
\;\;\;\;z - x \cdot -3\\
\end{array}
\end{array}
if y < -2.2999999999999999e-54 or 2.7499999999999998e65 < y Initial program 99.9%
+-commutative99.9%
associate-+l+100.0%
remove-double-neg100.0%
unsub-neg100.0%
+-commutative100.0%
+-commutative100.0%
associate-+l+100.0%
associate-+r+100.0%
associate-+r+100.0%
distribute-neg-in100.0%
distribute-neg-out100.0%
neg-mul-1100.0%
count-2100.0%
distribute-lft-neg-in100.0%
metadata-eval100.0%
metadata-eval100.0%
distribute-rgt-out100.0%
distribute-neg-out100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around 0 85.2%
if -2.2999999999999999e-54 < y < 2.7499999999999998e65Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
remove-double-neg99.8%
unsub-neg99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
associate-+r+99.8%
associate-+r+99.9%
distribute-neg-in99.9%
distribute-neg-out99.9%
neg-mul-199.9%
count-299.9%
distribute-lft-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-rgt-out99.9%
distribute-neg-out99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 90.6%
Final simplification87.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.15e+164) (not (<= y 7.5e+90))) (* y 2.0) (- z (* x -3.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.15e+164) || !(y <= 7.5e+90)) {
tmp = y * 2.0;
} else {
tmp = z - (x * -3.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) :: tmp
if ((y <= (-1.15d+164)) .or. (.not. (y <= 7.5d+90))) then
tmp = y * 2.0d0
else
tmp = z - (x * (-3.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.15e+164) || !(y <= 7.5e+90)) {
tmp = y * 2.0;
} else {
tmp = z - (x * -3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.15e+164) or not (y <= 7.5e+90): tmp = y * 2.0 else: tmp = z - (x * -3.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.15e+164) || !(y <= 7.5e+90)) tmp = Float64(y * 2.0); else tmp = Float64(z - Float64(x * -3.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.15e+164) || ~((y <= 7.5e+90))) tmp = y * 2.0; else tmp = z - (x * -3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.15e+164], N[Not[LessEqual[y, 7.5e+90]], $MachinePrecision]], N[(y * 2.0), $MachinePrecision], N[(z - N[(x * -3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+164} \lor \neg \left(y \leq 7.5 \cdot 10^{+90}\right):\\
\;\;\;\;y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;z - x \cdot -3\\
\end{array}
\end{array}
if y < -1.15e164 or 7.50000000000000014e90 < y Initial program 100.0%
associate-+l+100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
+-commutative100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 75.8%
if -1.15e164 < y < 7.50000000000000014e90Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
unsub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
distribute-neg-in99.9%
distribute-neg-out99.9%
neg-mul-199.9%
count-299.9%
distribute-lft-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-rgt-out99.9%
distribute-neg-out99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 83.6%
Final simplification81.3%
(FPCore (x y z) :precision binary64 (if (<= z -1.95e+26) z (if (<= z 2.15e+157) (* y 2.0) z)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.95e+26) {
tmp = z;
} else if (z <= 2.15e+157) {
tmp = y * 2.0;
} else {
tmp = z;
}
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.95d+26)) then
tmp = z
else if (z <= 2.15d+157) then
tmp = y * 2.0d0
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.95e+26) {
tmp = z;
} else if (z <= 2.15e+157) {
tmp = y * 2.0;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.95e+26: tmp = z elif z <= 2.15e+157: tmp = y * 2.0 else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.95e+26) tmp = z; elseif (z <= 2.15e+157) tmp = Float64(y * 2.0); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.95e+26) tmp = z; elseif (z <= 2.15e+157) tmp = y * 2.0; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.95e+26], z, If[LessEqual[z, 2.15e+157], N[(y * 2.0), $MachinePrecision], z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+26}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+157}:\\
\;\;\;\;y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -1.95e26 or 2.15e157 < z Initial program 99.9%
associate-+l+99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 71.8%
if -1.95e26 < z < 2.15e157Initial program 99.9%
associate-+l+99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around inf 47.2%
Final simplification56.5%
(FPCore (x y z) :precision binary64 (- (+ z (* x 3.0)) (* y -2.0)))
double code(double x, double y, double z) {
return (z + (x * 3.0)) - (y * -2.0);
}
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 * 3.0d0)) - (y * (-2.0d0))
end function
public static double code(double x, double y, double z) {
return (z + (x * 3.0)) - (y * -2.0);
}
def code(x, y, z): return (z + (x * 3.0)) - (y * -2.0)
function code(x, y, z) return Float64(Float64(z + Float64(x * 3.0)) - Float64(y * -2.0)) end
function tmp = code(x, y, z) tmp = (z + (x * 3.0)) - (y * -2.0); end
code[x_, y_, z_] := N[(N[(z + N[(x * 3.0), $MachinePrecision]), $MachinePrecision] - N[(y * -2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(z + x \cdot 3\right) - y \cdot -2
\end{array}
Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
unsub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
distribute-neg-in99.9%
distribute-neg-out99.9%
neg-mul-199.9%
count-299.9%
distribute-lft-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-rgt-out99.9%
distribute-neg-out99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (+ (* 2.0 (+ x y)) (+ z x)))
double code(double x, double y, double z) {
return (2.0 * (x + y)) + (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 = (2.0d0 * (x + y)) + (z + x)
end function
public static double code(double x, double y, double z) {
return (2.0 * (x + y)) + (z + x);
}
def code(x, y, z): return (2.0 * (x + y)) + (z + x)
function code(x, y, z) return Float64(Float64(2.0 * Float64(x + y)) + Float64(z + x)) end
function tmp = code(x, y, z) tmp = (2.0 * (x + y)) + (z + x); end
code[x_, y_, z_] := N[(N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(z + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(x + y\right) + \left(z + x\right)
\end{array}
Initial program 99.9%
associate-+l+99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 z)
double code(double x, double y, double z) {
return z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z
end function
public static double code(double x, double y, double z) {
return z;
}
def code(x, y, z): return z
function code(x, y, z) return z end
function tmp = code(x, y, z) tmp = z; end
code[x_, y_, z_] := z
\begin{array}{l}
\\
z
\end{array}
Initial program 99.9%
associate-+l+99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 35.1%
herbie shell --seed 2024091
(FPCore (x y z)
:name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendInside from plot-0.2.3.4"
:precision binary64
(+ (+ (+ (+ (+ x y) y) x) z) x))