
(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 9 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%
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%
fma-def99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= z -1.35e+96)
z
(if (<= z -6e-91)
(* y 2.0)
(if (<= z 9.5e-257)
(* x 3.0)
(if (<= z 2.15e-127) (* y 2.0) (if (<= z 1.15e+44) (* x 3.0) z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.35e+96) {
tmp = z;
} else if (z <= -6e-91) {
tmp = y * 2.0;
} else if (z <= 9.5e-257) {
tmp = x * 3.0;
} else if (z <= 2.15e-127) {
tmp = y * 2.0;
} else if (z <= 1.15e+44) {
tmp = x * 3.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.35d+96)) then
tmp = z
else if (z <= (-6d-91)) then
tmp = y * 2.0d0
else if (z <= 9.5d-257) then
tmp = x * 3.0d0
else if (z <= 2.15d-127) then
tmp = y * 2.0d0
else if (z <= 1.15d+44) then
tmp = x * 3.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.35e+96) {
tmp = z;
} else if (z <= -6e-91) {
tmp = y * 2.0;
} else if (z <= 9.5e-257) {
tmp = x * 3.0;
} else if (z <= 2.15e-127) {
tmp = y * 2.0;
} else if (z <= 1.15e+44) {
tmp = x * 3.0;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.35e+96: tmp = z elif z <= -6e-91: tmp = y * 2.0 elif z <= 9.5e-257: tmp = x * 3.0 elif z <= 2.15e-127: tmp = y * 2.0 elif z <= 1.15e+44: tmp = x * 3.0 else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.35e+96) tmp = z; elseif (z <= -6e-91) tmp = Float64(y * 2.0); elseif (z <= 9.5e-257) tmp = Float64(x * 3.0); elseif (z <= 2.15e-127) tmp = Float64(y * 2.0); elseif (z <= 1.15e+44) tmp = Float64(x * 3.0); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.35e+96) tmp = z; elseif (z <= -6e-91) tmp = y * 2.0; elseif (z <= 9.5e-257) tmp = x * 3.0; elseif (z <= 2.15e-127) tmp = y * 2.0; elseif (z <= 1.15e+44) tmp = x * 3.0; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.35e+96], z, If[LessEqual[z, -6e-91], N[(y * 2.0), $MachinePrecision], If[LessEqual[z, 9.5e-257], N[(x * 3.0), $MachinePrecision], If[LessEqual[z, 2.15e-127], N[(y * 2.0), $MachinePrecision], If[LessEqual[z, 1.15e+44], N[(x * 3.0), $MachinePrecision], z]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+96}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq -6 \cdot 10^{-91}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{-257}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{-127}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+44}:\\
\;\;\;\;x \cdot 3\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -1.35000000000000011e96 or 1.15000000000000002e44 < 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 74.5%
if -1.35000000000000011e96 < z < -6.0000000000000004e-91 or 9.49999999999999941e-257 < z < 2.14999999999999992e-127Initial 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 56.5%
if -6.0000000000000004e-91 < z < 9.49999999999999941e-257 or 2.14999999999999992e-127 < z < 1.15000000000000002e44Initial 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 x around inf 59.0%
Final simplification64.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.5e+94) (not (<= y 9e+203))) (* y 2.0) (- z (* x -3.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.5e+94) || !(y <= 9e+203)) {
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 <= (-2.5d+94)) .or. (.not. (y <= 9d+203))) 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 <= -2.5e+94) || !(y <= 9e+203)) {
tmp = y * 2.0;
} else {
tmp = z - (x * -3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.5e+94) or not (y <= 9e+203): tmp = y * 2.0 else: tmp = z - (x * -3.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.5e+94) || !(y <= 9e+203)) 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 <= -2.5e+94) || ~((y <= 9e+203))) tmp = y * 2.0; else tmp = z - (x * -3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.5e+94], N[Not[LessEqual[y, 9e+203]], $MachinePrecision]], N[(y * 2.0), $MachinePrecision], N[(z - N[(x * -3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{+94} \lor \neg \left(y \leq 9 \cdot 10^{+203}\right):\\
\;\;\;\;y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;z - x \cdot -3\\
\end{array}
\end{array}
if y < -2.50000000000000005e94 or 9.0000000000000006e203 < y 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 y around inf 84.5%
if -2.50000000000000005e94 < y < 9.0000000000000006e203Initial 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%
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%
fma-def99.9%
Simplified99.9%
Taylor expanded in y around 0 83.2%
Final simplification83.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -760000.0) (not (<= y 0.0066))) (- z (* y -2.0)) (- z (* x -3.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -760000.0) || !(y <= 0.0066)) {
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 <= (-760000.0d0)) .or. (.not. (y <= 0.0066d0))) 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 <= -760000.0) || !(y <= 0.0066)) {
tmp = z - (y * -2.0);
} else {
tmp = z - (x * -3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -760000.0) or not (y <= 0.0066): tmp = z - (y * -2.0) else: tmp = z - (x * -3.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -760000.0) || !(y <= 0.0066)) 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 <= -760000.0) || ~((y <= 0.0066))) tmp = z - (y * -2.0); else tmp = z - (x * -3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -760000.0], N[Not[LessEqual[y, 0.0066]], $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 -760000 \lor \neg \left(y \leq 0.0066\right):\\
\;\;\;\;z - y \cdot -2\\
\mathbf{else}:\\
\;\;\;\;z - x \cdot -3\\
\end{array}
\end{array}
if y < -7.6e5 or 0.0066 < y 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+100.0%
distribute-neg-in100.0%
distribute-neg-out100.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%
fma-def100.0%
Simplified100.0%
Taylor expanded in x around 0 80.4%
if -7.6e5 < y < 0.0066Initial 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%
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%
fma-def99.9%
Simplified99.9%
Taylor expanded in y around 0 93.9%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (<= y -1.25e-31) (+ x (* 2.0 (+ x y))) (if (<= y 0.0085) (- z (* x -3.0)) (- z (* y -2.0)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.25e-31) {
tmp = x + (2.0 * (x + y));
} else if (y <= 0.0085) {
tmp = z - (x * -3.0);
} else {
tmp = z - (y * -2.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.25d-31)) then
tmp = x + (2.0d0 * (x + y))
else if (y <= 0.0085d0) then
tmp = z - (x * (-3.0d0))
else
tmp = z - (y * (-2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.25e-31) {
tmp = x + (2.0 * (x + y));
} else if (y <= 0.0085) {
tmp = z - (x * -3.0);
} else {
tmp = z - (y * -2.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.25e-31: tmp = x + (2.0 * (x + y)) elif y <= 0.0085: tmp = z - (x * -3.0) else: tmp = z - (y * -2.0) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.25e-31) tmp = Float64(x + Float64(2.0 * Float64(x + y))); elseif (y <= 0.0085) tmp = Float64(z - Float64(x * -3.0)); else tmp = Float64(z - Float64(y * -2.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.25e-31) tmp = x + (2.0 * (x + y)); elseif (y <= 0.0085) tmp = z - (x * -3.0); else tmp = z - (y * -2.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.25e-31], N[(x + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.0085], N[(z - N[(x * -3.0), $MachinePrecision]), $MachinePrecision], N[(z - N[(y * -2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{-31}:\\
\;\;\;\;x + 2 \cdot \left(x + y\right)\\
\mathbf{elif}\;y \leq 0.0085:\\
\;\;\;\;z - x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;z - y \cdot -2\\
\end{array}
\end{array}
if y < -1.25e-31Initial 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 90.3%
if -1.25e-31 < y < 0.0085000000000000006Initial 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%
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%
fma-def99.9%
Simplified99.9%
Taylor expanded in y around 0 94.4%
if 0.0085000000000000006 < y Initial program 100.0%
+-commutative100.0%
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+99.9%
distribute-neg-in99.9%
distribute-neg-out99.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%
fma-def100.0%
Simplified100.0%
Taylor expanded in x around 0 79.5%
Final simplification90.1%
(FPCore (x y z) :precision binary64 (if (<= y -7.7e-31) (- (* x 3.0) (* y -2.0)) (if (<= y 0.0085) (- z (* x -3.0)) (- z (* y -2.0)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7.7e-31) {
tmp = (x * 3.0) - (y * -2.0);
} else if (y <= 0.0085) {
tmp = z - (x * -3.0);
} else {
tmp = z - (y * -2.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 <= (-7.7d-31)) then
tmp = (x * 3.0d0) - (y * (-2.0d0))
else if (y <= 0.0085d0) then
tmp = z - (x * (-3.0d0))
else
tmp = z - (y * (-2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -7.7e-31) {
tmp = (x * 3.0) - (y * -2.0);
} else if (y <= 0.0085) {
tmp = z - (x * -3.0);
} else {
tmp = z - (y * -2.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7.7e-31: tmp = (x * 3.0) - (y * -2.0) elif y <= 0.0085: tmp = z - (x * -3.0) else: tmp = z - (y * -2.0) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7.7e-31) tmp = Float64(Float64(x * 3.0) - Float64(y * -2.0)); elseif (y <= 0.0085) tmp = Float64(z - Float64(x * -3.0)); else tmp = Float64(z - Float64(y * -2.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -7.7e-31) tmp = (x * 3.0) - (y * -2.0); elseif (y <= 0.0085) tmp = z - (x * -3.0); else tmp = z - (y * -2.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7.7e-31], N[(N[(x * 3.0), $MachinePrecision] - N[(y * -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.0085], N[(z - N[(x * -3.0), $MachinePrecision]), $MachinePrecision], N[(z - N[(y * -2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.7 \cdot 10^{-31}:\\
\;\;\;\;x \cdot 3 - y \cdot -2\\
\mathbf{elif}\;y \leq 0.0085:\\
\;\;\;\;z - x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;z - y \cdot -2\\
\end{array}
\end{array}
if y < -7.70000000000000012e-31Initial 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%
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%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in z around 0 90.3%
if -7.70000000000000012e-31 < y < 0.0085000000000000006Initial 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%
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%
fma-def99.9%
Simplified99.9%
Taylor expanded in y around 0 94.4%
if 0.0085000000000000006 < y Initial program 100.0%
+-commutative100.0%
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+99.9%
distribute-neg-in99.9%
distribute-neg-out99.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%
fma-def100.0%
Simplified100.0%
Taylor expanded in x around 0 79.5%
Final simplification90.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -31.0) (not (<= y 1.5e-61))) (* y 2.0) z))
double code(double x, double y, double z) {
double tmp;
if ((y <= -31.0) || !(y <= 1.5e-61)) {
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 ((y <= (-31.0d0)) .or. (.not. (y <= 1.5d-61))) 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 ((y <= -31.0) || !(y <= 1.5e-61)) {
tmp = y * 2.0;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -31.0) or not (y <= 1.5e-61): tmp = y * 2.0 else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -31.0) || !(y <= 1.5e-61)) tmp = Float64(y * 2.0); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -31.0) || ~((y <= 1.5e-61))) tmp = y * 2.0; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -31.0], N[Not[LessEqual[y, 1.5e-61]], $MachinePrecision]], N[(y * 2.0), $MachinePrecision], z]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -31 \lor \neg \left(y \leq 1.5 \cdot 10^{-61}\right):\\
\;\;\;\;y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if y < -31 or 1.50000000000000006e-61 < y 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 y around inf 61.9%
if -31 < y < 1.50000000000000006e-61Initial 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 51.0%
Final simplification56.0%
(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.6%
Final simplification35.6%
herbie shell --seed 2024019
(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))