
(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 8 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 (+ (* 2.0 (+ x y)) (+ x z)))
double code(double x, double y, double z) {
return (2.0 * (x + y)) + (x + z);
}
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)) + (x + z)
end function
public static double code(double x, double y, double z) {
return (2.0 * (x + y)) + (x + z);
}
def code(x, y, z): return (2.0 * (x + y)) + (x + z)
function code(x, y, z) return Float64(Float64(2.0 * Float64(x + y)) + Float64(x + z)) end
function tmp = code(x, y, z) tmp = (2.0 * (x + y)) + (x + z); end
code[x_, y_, z_] := N[(N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(x + z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(x + y\right) + \left(x + z\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
(if (<= x -1.95e+131)
(* x 3.0)
(if (<= x -1.1e-178)
(* 2.0 y)
(if (<= x 2.15e-241)
z
(if (<= x 3.2e-191)
(* 2.0 y)
(if (<= x 8.2e-129)
z
(if (<= x 2.9e-44)
(* 2.0 y)
(if (<= x 0.078) z (if (<= x 3.5e+26) (* 2.0 y) (* x 3.0))))))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.95e+131) {
tmp = x * 3.0;
} else if (x <= -1.1e-178) {
tmp = 2.0 * y;
} else if (x <= 2.15e-241) {
tmp = z;
} else if (x <= 3.2e-191) {
tmp = 2.0 * y;
} else if (x <= 8.2e-129) {
tmp = z;
} else if (x <= 2.9e-44) {
tmp = 2.0 * y;
} else if (x <= 0.078) {
tmp = z;
} else if (x <= 3.5e+26) {
tmp = 2.0 * y;
} else {
tmp = 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 (x <= (-1.95d+131)) then
tmp = x * 3.0d0
else if (x <= (-1.1d-178)) then
tmp = 2.0d0 * y
else if (x <= 2.15d-241) then
tmp = z
else if (x <= 3.2d-191) then
tmp = 2.0d0 * y
else if (x <= 8.2d-129) then
tmp = z
else if (x <= 2.9d-44) then
tmp = 2.0d0 * y
else if (x <= 0.078d0) then
tmp = z
else if (x <= 3.5d+26) then
tmp = 2.0d0 * y
else
tmp = x * 3.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.95e+131) {
tmp = x * 3.0;
} else if (x <= -1.1e-178) {
tmp = 2.0 * y;
} else if (x <= 2.15e-241) {
tmp = z;
} else if (x <= 3.2e-191) {
tmp = 2.0 * y;
} else if (x <= 8.2e-129) {
tmp = z;
} else if (x <= 2.9e-44) {
tmp = 2.0 * y;
} else if (x <= 0.078) {
tmp = z;
} else if (x <= 3.5e+26) {
tmp = 2.0 * y;
} else {
tmp = x * 3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.95e+131: tmp = x * 3.0 elif x <= -1.1e-178: tmp = 2.0 * y elif x <= 2.15e-241: tmp = z elif x <= 3.2e-191: tmp = 2.0 * y elif x <= 8.2e-129: tmp = z elif x <= 2.9e-44: tmp = 2.0 * y elif x <= 0.078: tmp = z elif x <= 3.5e+26: tmp = 2.0 * y else: tmp = x * 3.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.95e+131) tmp = Float64(x * 3.0); elseif (x <= -1.1e-178) tmp = Float64(2.0 * y); elseif (x <= 2.15e-241) tmp = z; elseif (x <= 3.2e-191) tmp = Float64(2.0 * y); elseif (x <= 8.2e-129) tmp = z; elseif (x <= 2.9e-44) tmp = Float64(2.0 * y); elseif (x <= 0.078) tmp = z; elseif (x <= 3.5e+26) tmp = Float64(2.0 * y); else tmp = Float64(x * 3.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.95e+131) tmp = x * 3.0; elseif (x <= -1.1e-178) tmp = 2.0 * y; elseif (x <= 2.15e-241) tmp = z; elseif (x <= 3.2e-191) tmp = 2.0 * y; elseif (x <= 8.2e-129) tmp = z; elseif (x <= 2.9e-44) tmp = 2.0 * y; elseif (x <= 0.078) tmp = z; elseif (x <= 3.5e+26) tmp = 2.0 * y; else tmp = x * 3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.95e+131], N[(x * 3.0), $MachinePrecision], If[LessEqual[x, -1.1e-178], N[(2.0 * y), $MachinePrecision], If[LessEqual[x, 2.15e-241], z, If[LessEqual[x, 3.2e-191], N[(2.0 * y), $MachinePrecision], If[LessEqual[x, 8.2e-129], z, If[LessEqual[x, 2.9e-44], N[(2.0 * y), $MachinePrecision], If[LessEqual[x, 0.078], z, If[LessEqual[x, 3.5e+26], N[(2.0 * y), $MachinePrecision], N[(x * 3.0), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.95 \cdot 10^{+131}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;x \leq -1.1 \cdot 10^{-178}:\\
\;\;\;\;2 \cdot y\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{-241}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-191}:\\
\;\;\;\;2 \cdot y\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-129}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-44}:\\
\;\;\;\;2 \cdot y\\
\mathbf{elif}\;x \leq 0.078:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{+26}:\\
\;\;\;\;2 \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot 3\\
\end{array}
\end{array}
if x < -1.95e131 or 3.4999999999999999e26 < x Initial program 99.8%
associate-+l+99.8%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 71.4%
if -1.95e131 < x < -1.1000000000000001e-178 or 2.1499999999999999e-241 < x < 3.2000000000000003e-191 or 8.1999999999999999e-129 < x < 2.9000000000000001e-44 or 0.0779999999999999999 < x < 3.4999999999999999e26Initial 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 64.9%
if -1.1000000000000001e-178 < x < 2.1499999999999999e-241 or 3.2000000000000003e-191 < x < 8.1999999999999999e-129 or 2.9000000000000001e-44 < x < 0.0779999999999999999Initial 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 z around inf 66.7%
Final simplification67.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (+ z (* 2.0 x)))) (t_1 (- z (* y -2.0))))
(if (<= x -3.9e+151)
t_0
(if (<= x -3.8e+78)
t_1
(if (<= x -3.3e-54)
(+ x (* 2.0 (+ x y)))
(if (<= x 3.5e+17) t_1 t_0))))))
double code(double x, double y, double z) {
double t_0 = x + (z + (2.0 * x));
double t_1 = z - (y * -2.0);
double tmp;
if (x <= -3.9e+151) {
tmp = t_0;
} else if (x <= -3.8e+78) {
tmp = t_1;
} else if (x <= -3.3e-54) {
tmp = x + (2.0 * (x + y));
} else if (x <= 3.5e+17) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = x + (z + (2.0d0 * x))
t_1 = z - (y * (-2.0d0))
if (x <= (-3.9d+151)) then
tmp = t_0
else if (x <= (-3.8d+78)) then
tmp = t_1
else if (x <= (-3.3d-54)) then
tmp = x + (2.0d0 * (x + y))
else if (x <= 3.5d+17) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (z + (2.0 * x));
double t_1 = z - (y * -2.0);
double tmp;
if (x <= -3.9e+151) {
tmp = t_0;
} else if (x <= -3.8e+78) {
tmp = t_1;
} else if (x <= -3.3e-54) {
tmp = x + (2.0 * (x + y));
} else if (x <= 3.5e+17) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x + (z + (2.0 * x)) t_1 = z - (y * -2.0) tmp = 0 if x <= -3.9e+151: tmp = t_0 elif x <= -3.8e+78: tmp = t_1 elif x <= -3.3e-54: tmp = x + (2.0 * (x + y)) elif x <= 3.5e+17: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x + Float64(z + Float64(2.0 * x))) t_1 = Float64(z - Float64(y * -2.0)) tmp = 0.0 if (x <= -3.9e+151) tmp = t_0; elseif (x <= -3.8e+78) tmp = t_1; elseif (x <= -3.3e-54) tmp = Float64(x + Float64(2.0 * Float64(x + y))); elseif (x <= 3.5e+17) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (z + (2.0 * x)); t_1 = z - (y * -2.0); tmp = 0.0; if (x <= -3.9e+151) tmp = t_0; elseif (x <= -3.8e+78) tmp = t_1; elseif (x <= -3.3e-54) tmp = x + (2.0 * (x + y)); elseif (x <= 3.5e+17) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(z + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z - N[(y * -2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.9e+151], t$95$0, If[LessEqual[x, -3.8e+78], t$95$1, If[LessEqual[x, -3.3e-54], N[(x + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e+17], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \left(z + 2 \cdot x\right)\\
t_1 := z - y \cdot -2\\
\mathbf{if}\;x \leq -3.9 \cdot 10^{+151}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -3.8 \cdot 10^{+78}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -3.3 \cdot 10^{-54}:\\
\;\;\;\;x + 2 \cdot \left(x + y\right)\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -3.89999999999999976e151 or 3.5e17 < x Initial program 99.8%
associate-+l+99.8%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 91.5%
if -3.89999999999999976e151 < x < -3.7999999999999999e78 or -3.29999999999999993e-54 < x < 3.5e17Initial 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 x around 0 94.1%
metadata-eval94.1%
cancel-sign-sub-inv94.1%
*-commutative94.1%
Simplified94.1%
if -3.7999999999999999e78 < x < -3.29999999999999993e-54Initial 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 z around 0 94.5%
Final simplification93.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- z (* x -3.0))) (t_1 (- z (* y -2.0))))
(if (<= x -4.2e+151)
t_0
(if (<= x -1.6e+78)
t_1
(if (<= x -1.85e-53)
(+ x (* 2.0 (+ x y)))
(if (<= x 1.95e+26) t_1 t_0))))))
double code(double x, double y, double z) {
double t_0 = z - (x * -3.0);
double t_1 = z - (y * -2.0);
double tmp;
if (x <= -4.2e+151) {
tmp = t_0;
} else if (x <= -1.6e+78) {
tmp = t_1;
} else if (x <= -1.85e-53) {
tmp = x + (2.0 * (x + y));
} else if (x <= 1.95e+26) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = z - (x * (-3.0d0))
t_1 = z - (y * (-2.0d0))
if (x <= (-4.2d+151)) then
tmp = t_0
else if (x <= (-1.6d+78)) then
tmp = t_1
else if (x <= (-1.85d-53)) then
tmp = x + (2.0d0 * (x + y))
else if (x <= 1.95d+26) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z - (x * -3.0);
double t_1 = z - (y * -2.0);
double tmp;
if (x <= -4.2e+151) {
tmp = t_0;
} else if (x <= -1.6e+78) {
tmp = t_1;
} else if (x <= -1.85e-53) {
tmp = x + (2.0 * (x + y));
} else if (x <= 1.95e+26) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z - (x * -3.0) t_1 = z - (y * -2.0) tmp = 0 if x <= -4.2e+151: tmp = t_0 elif x <= -1.6e+78: tmp = t_1 elif x <= -1.85e-53: tmp = x + (2.0 * (x + y)) elif x <= 1.95e+26: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z - Float64(x * -3.0)) t_1 = Float64(z - Float64(y * -2.0)) tmp = 0.0 if (x <= -4.2e+151) tmp = t_0; elseif (x <= -1.6e+78) tmp = t_1; elseif (x <= -1.85e-53) tmp = Float64(x + Float64(2.0 * Float64(x + y))); elseif (x <= 1.95e+26) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z - (x * -3.0); t_1 = z - (y * -2.0); tmp = 0.0; if (x <= -4.2e+151) tmp = t_0; elseif (x <= -1.6e+78) tmp = t_1; elseif (x <= -1.85e-53) tmp = x + (2.0 * (x + y)); elseif (x <= 1.95e+26) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z - N[(x * -3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z - N[(y * -2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.2e+151], t$95$0, If[LessEqual[x, -1.6e+78], t$95$1, If[LessEqual[x, -1.85e-53], N[(x + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.95e+26], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z - x \cdot -3\\
t_1 := z - y \cdot -2\\
\mathbf{if}\;x \leq -4.2 \cdot 10^{+151}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{+78}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{-53}:\\
\;\;\;\;x + 2 \cdot \left(x + y\right)\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -4.2000000000000001e151 or 1.95e26 < x Initial 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.8%
distribute-neg-in99.8%
distribute-neg-out99.8%
neg-mul-199.8%
count-299.8%
distribute-lft-neg-in99.8%
metadata-eval99.8%
metadata-eval99.8%
distribute-rgt-out99.8%
distribute-neg-out99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in y around 0 91.4%
if -4.2000000000000001e151 < x < -1.59999999999999997e78 or -1.84999999999999991e-53 < x < 1.95e26Initial 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 x around 0 94.1%
metadata-eval94.1%
cancel-sign-sub-inv94.1%
*-commutative94.1%
Simplified94.1%
if -1.59999999999999997e78 < x < -1.84999999999999991e-53Initial 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 z around 0 94.5%
Final simplification93.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.8e+82) (not (<= y 1.45e+133))) (* 2.0 y) (- z (* x -3.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.8e+82) || !(y <= 1.45e+133)) {
tmp = 2.0 * y;
} 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.8d+82)) .or. (.not. (y <= 1.45d+133))) then
tmp = 2.0d0 * y
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.8e+82) || !(y <= 1.45e+133)) {
tmp = 2.0 * y;
} else {
tmp = z - (x * -3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.8e+82) or not (y <= 1.45e+133): tmp = 2.0 * y else: tmp = z - (x * -3.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.8e+82) || !(y <= 1.45e+133)) tmp = Float64(2.0 * y); 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.8e+82) || ~((y <= 1.45e+133))) tmp = 2.0 * y; else tmp = z - (x * -3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.8e+82], N[Not[LessEqual[y, 1.45e+133]], $MachinePrecision]], N[(2.0 * y), $MachinePrecision], N[(z - N[(x * -3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{+82} \lor \neg \left(y \leq 1.45 \cdot 10^{+133}\right):\\
\;\;\;\;2 \cdot y\\
\mathbf{else}:\\
\;\;\;\;z - x \cdot -3\\
\end{array}
\end{array}
if y < -1.80000000000000007e82 or 1.4500000000000001e133 < 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 69.8%
if -1.80000000000000007e82 < y < 1.4500000000000001e133Initial 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.8%
distribute-neg-in99.8%
distribute-neg-out99.8%
neg-mul-199.8%
count-299.8%
distribute-lft-neg-in99.8%
metadata-eval99.8%
metadata-eval99.8%
distribute-rgt-out99.8%
distribute-neg-out99.8%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 83.7%
Final simplification79.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.9e+151) (not (<= x 5.8e+19))) (- z (* x -3.0)) (- z (* y -2.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.9e+151) || !(x <= 5.8e+19)) {
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 ((x <= (-3.9d+151)) .or. (.not. (x <= 5.8d+19))) 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 ((x <= -3.9e+151) || !(x <= 5.8e+19)) {
tmp = z - (x * -3.0);
} else {
tmp = z - (y * -2.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.9e+151) or not (x <= 5.8e+19): tmp = z - (x * -3.0) else: tmp = z - (y * -2.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.9e+151) || !(x <= 5.8e+19)) 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 ((x <= -3.9e+151) || ~((x <= 5.8e+19))) tmp = z - (x * -3.0); else tmp = z - (y * -2.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.9e+151], N[Not[LessEqual[x, 5.8e+19]], $MachinePrecision]], N[(z - N[(x * -3.0), $MachinePrecision]), $MachinePrecision], N[(z - N[(y * -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{+151} \lor \neg \left(x \leq 5.8 \cdot 10^{+19}\right):\\
\;\;\;\;z - x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;z - y \cdot -2\\
\end{array}
\end{array}
if x < -3.89999999999999976e151 or 5.8e19 < x Initial 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.8%
distribute-neg-in99.8%
distribute-neg-out99.8%
neg-mul-199.8%
count-299.8%
distribute-lft-neg-in99.8%
metadata-eval99.8%
metadata-eval99.8%
distribute-rgt-out99.8%
distribute-neg-out99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in y around 0 91.4%
if -3.89999999999999976e151 < x < 5.8e19Initial 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 x around 0 89.5%
metadata-eval89.5%
cancel-sign-sub-inv89.5%
*-commutative89.5%
Simplified89.5%
Final simplification90.2%
(FPCore (x y z) :precision binary64 (if (<= z -1.32e+167) z (if (<= z 3.9e+59) (* 2.0 y) z)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.32e+167) {
tmp = z;
} else if (z <= 3.9e+59) {
tmp = 2.0 * y;
} 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.32d+167)) then
tmp = z
else if (z <= 3.9d+59) then
tmp = 2.0d0 * y
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.32e+167) {
tmp = z;
} else if (z <= 3.9e+59) {
tmp = 2.0 * y;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.32e+167: tmp = z elif z <= 3.9e+59: tmp = 2.0 * y else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.32e+167) tmp = z; elseif (z <= 3.9e+59) tmp = Float64(2.0 * y); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.32e+167) tmp = z; elseif (z <= 3.9e+59) tmp = 2.0 * y; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.32e+167], z, If[LessEqual[z, 3.9e+59], N[(2.0 * y), $MachinePrecision], z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.32 \cdot 10^{+167}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+59}:\\
\;\;\;\;2 \cdot y\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -1.3200000000000001e167 or 3.90000000000000021e59 < 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 67.3%
if -1.3200000000000001e167 < z < 3.90000000000000021e59Initial 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 46.6%
Final simplification54.0%
(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 32.4%
Final simplification32.4%
herbie shell --seed 2024077
(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))