
(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 10 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%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
*-lft-identity99.9%
metadata-eval99.9%
count-299.9%
distribute-rgt-out99.9%
fma-define99.9%
metadata-eval99.9%
metadata-eval99.9%
count-299.9%
*-commutative99.9%
Simplified99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (* y 2.0))))
(if (<= y -1.26e+65)
t_0
(if (<= y -3.3e-135) (* x 3.0) (if (<= y 3.7e+28) z t_0)))))
double code(double x, double y, double z) {
double t_0 = x + (y * 2.0);
double tmp;
if (y <= -1.26e+65) {
tmp = t_0;
} else if (y <= -3.3e-135) {
tmp = x * 3.0;
} else if (y <= 3.7e+28) {
tmp = z;
} 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 = x + (y * 2.0d0)
if (y <= (-1.26d+65)) then
tmp = t_0
else if (y <= (-3.3d-135)) then
tmp = x * 3.0d0
else if (y <= 3.7d+28) then
tmp = z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (y * 2.0);
double tmp;
if (y <= -1.26e+65) {
tmp = t_0;
} else if (y <= -3.3e-135) {
tmp = x * 3.0;
} else if (y <= 3.7e+28) {
tmp = z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x + (y * 2.0) tmp = 0 if y <= -1.26e+65: tmp = t_0 elif y <= -3.3e-135: tmp = x * 3.0 elif y <= 3.7e+28: tmp = z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x + Float64(y * 2.0)) tmp = 0.0 if (y <= -1.26e+65) tmp = t_0; elseif (y <= -3.3e-135) tmp = Float64(x * 3.0); elseif (y <= 3.7e+28) tmp = z; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (y * 2.0); tmp = 0.0; if (y <= -1.26e+65) tmp = t_0; elseif (y <= -3.3e-135) tmp = x * 3.0; elseif (y <= 3.7e+28) tmp = z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.26e+65], t$95$0, If[LessEqual[y, -3.3e-135], N[(x * 3.0), $MachinePrecision], If[LessEqual[y, 3.7e+28], z, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + y \cdot 2\\
\mathbf{if}\;y \leq -1.26 \cdot 10^{+65}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -3.3 \cdot 10^{-135}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{+28}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.2599999999999999e65 or 3.6999999999999999e28 < 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 z around 0 84.4%
Taylor expanded in x around 0 72.6%
if -1.2599999999999999e65 < y < -3.2999999999999999e-135Initial 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 67.3%
Taylor expanded in x around inf 55.6%
*-commutative55.6%
Simplified55.6%
if -3.2999999999999999e-135 < y < 3.6999999999999999e28Initial program 99.8%
+-commutative99.8%
associate-+l+99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
*-lft-identity99.9%
metadata-eval99.9%
count-299.9%
distribute-rgt-out99.9%
fma-define99.9%
metadata-eval99.9%
metadata-eval99.9%
count-299.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 54.8%
Final simplification61.6%
(FPCore (x y z) :precision binary64 (if (<= y -4.6e+66) (* y 2.0) (if (<= y -5.5e-134) (* x 3.0) (if (<= y 5.6e+34) z (* y 2.0)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.6e+66) {
tmp = y * 2.0;
} else if (y <= -5.5e-134) {
tmp = x * 3.0;
} else if (y <= 5.6e+34) {
tmp = z;
} else {
tmp = 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 <= (-4.6d+66)) then
tmp = y * 2.0d0
else if (y <= (-5.5d-134)) then
tmp = x * 3.0d0
else if (y <= 5.6d+34) then
tmp = z
else
tmp = y * 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4.6e+66) {
tmp = y * 2.0;
} else if (y <= -5.5e-134) {
tmp = x * 3.0;
} else if (y <= 5.6e+34) {
tmp = z;
} else {
tmp = y * 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.6e+66: tmp = y * 2.0 elif y <= -5.5e-134: tmp = x * 3.0 elif y <= 5.6e+34: tmp = z else: tmp = y * 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.6e+66) tmp = Float64(y * 2.0); elseif (y <= -5.5e-134) tmp = Float64(x * 3.0); elseif (y <= 5.6e+34) tmp = z; else tmp = Float64(y * 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4.6e+66) tmp = y * 2.0; elseif (y <= -5.5e-134) tmp = x * 3.0; elseif (y <= 5.6e+34) tmp = z; else tmp = y * 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.6e+66], N[(y * 2.0), $MachinePrecision], If[LessEqual[y, -5.5e-134], N[(x * 3.0), $MachinePrecision], If[LessEqual[y, 5.6e+34], z, N[(y * 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.6 \cdot 10^{+66}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;y \leq -5.5 \cdot 10^{-134}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{+34}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;y \cdot 2\\
\end{array}
\end{array}
if y < -4.6e66 or 5.60000000000000016e34 < y Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
+-commutative100.0%
associate-+l+100.0%
associate-+r+100.0%
associate-+r+100.0%
*-lft-identity100.0%
metadata-eval100.0%
count-2100.0%
distribute-rgt-out100.0%
fma-define100.0%
metadata-eval100.0%
metadata-eval100.0%
count-2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 86.0%
Taylor expanded in z around 0 70.9%
if -4.6e66 < y < -5.5000000000000002e-134Initial 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 67.3%
Taylor expanded in x around inf 55.6%
*-commutative55.6%
Simplified55.6%
if -5.5000000000000002e-134 < y < 5.60000000000000016e34Initial program 99.8%
+-commutative99.8%
associate-+l+99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
*-lft-identity99.9%
metadata-eval99.9%
count-299.9%
distribute-rgt-out99.9%
fma-define99.9%
metadata-eval99.9%
metadata-eval99.9%
count-299.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 54.8%
Final simplification60.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -7.5e+64) (not (<= y 2.25e+21))) (+ z (* y 2.0)) (+ z (* x 3.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7.5e+64) || !(y <= 2.25e+21)) {
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 <= (-7.5d+64)) .or. (.not. (y <= 2.25d+21))) 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 <= -7.5e+64) || !(y <= 2.25e+21)) {
tmp = z + (y * 2.0);
} else {
tmp = z + (x * 3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7.5e+64) or not (y <= 2.25e+21): tmp = z + (y * 2.0) else: tmp = z + (x * 3.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7.5e+64) || !(y <= 2.25e+21)) 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 <= -7.5e+64) || ~((y <= 2.25e+21))) tmp = z + (y * 2.0); else tmp = z + (x * 3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7.5e+64], N[Not[LessEqual[y, 2.25e+21]], $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 -7.5 \cdot 10^{+64} \lor \neg \left(y \leq 2.25 \cdot 10^{+21}\right):\\
\;\;\;\;z + y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;z + x \cdot 3\\
\end{array}
\end{array}
if y < -7.5000000000000005e64 or 2.25e21 < y Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
+-commutative100.0%
associate-+l+100.0%
associate-+r+100.0%
associate-+r+100.0%
*-lft-identity100.0%
metadata-eval100.0%
count-2100.0%
distribute-rgt-out100.0%
fma-define100.0%
metadata-eval100.0%
metadata-eval100.0%
count-2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 86.4%
if -7.5000000000000005e64 < y < 2.25e21Initial program 99.8%
+-commutative99.8%
associate-+l+99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
*-lft-identity99.9%
metadata-eval99.9%
count-299.9%
distribute-rgt-out99.9%
fma-define99.9%
metadata-eval99.9%
metadata-eval99.9%
count-299.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 93.0%
Final simplification90.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.15e+238) (not (<= x 7.6e+225))) (* x 3.0) (+ z (* y 2.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.15e+238) || !(x <= 7.6e+225)) {
tmp = 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 <= (-1.15d+238)) .or. (.not. (x <= 7.6d+225))) then
tmp = 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 <= -1.15e+238) || !(x <= 7.6e+225)) {
tmp = x * 3.0;
} else {
tmp = z + (y * 2.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.15e+238) or not (x <= 7.6e+225): tmp = x * 3.0 else: tmp = z + (y * 2.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.15e+238) || !(x <= 7.6e+225)) tmp = 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 <= -1.15e+238) || ~((x <= 7.6e+225))) tmp = x * 3.0; else tmp = z + (y * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.15e+238], N[Not[LessEqual[x, 7.6e+225]], $MachinePrecision]], N[(x * 3.0), $MachinePrecision], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{+238} \lor \neg \left(x \leq 7.6 \cdot 10^{+225}\right):\\
\;\;\;\;x \cdot 3\\
\mathbf{else}:\\
\;\;\;\;z + y \cdot 2\\
\end{array}
\end{array}
if x < -1.15000000000000001e238 or 7.6000000000000002e225 < x Initial 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 93.8%
Taylor expanded in x around inf 90.7%
*-commutative90.7%
Simplified90.7%
if -1.15000000000000001e238 < x < 7.6000000000000002e225Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
*-lft-identity99.9%
metadata-eval99.9%
count-299.9%
distribute-rgt-out99.9%
fma-define100.0%
metadata-eval100.0%
metadata-eval100.0%
count-2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 77.7%
Final simplification79.5%
(FPCore (x y z) :precision binary64 (if (<= y -2.65e+67) (+ x (* 2.0 (+ x y))) (if (<= y 6.4e+21) (+ z (* x 3.0)) (+ z (* y 2.0)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.65e+67) {
tmp = x + (2.0 * (x + y));
} else if (y <= 6.4e+21) {
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 <= (-2.65d+67)) then
tmp = x + (2.0d0 * (x + y))
else if (y <= 6.4d+21) 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 <= -2.65e+67) {
tmp = x + (2.0 * (x + y));
} else if (y <= 6.4e+21) {
tmp = z + (x * 3.0);
} else {
tmp = z + (y * 2.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.65e+67: tmp = x + (2.0 * (x + y)) elif y <= 6.4e+21: tmp = z + (x * 3.0) else: tmp = z + (y * 2.0) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.65e+67) tmp = Float64(x + Float64(2.0 * Float64(x + y))); elseif (y <= 6.4e+21) 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 <= -2.65e+67) tmp = x + (2.0 * (x + y)); elseif (y <= 6.4e+21) tmp = z + (x * 3.0); else tmp = z + (y * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.65e+67], N[(x + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.4e+21], 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 -2.65 \cdot 10^{+67}:\\
\;\;\;\;x + 2 \cdot \left(x + y\right)\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{+21}:\\
\;\;\;\;z + x \cdot 3\\
\mathbf{else}:\\
\;\;\;\;z + y \cdot 2\\
\end{array}
\end{array}
if y < -2.65e67Initial 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 0 87.1%
if -2.65e67 < y < 6.4e21Initial program 99.8%
+-commutative99.8%
associate-+l+99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
*-lft-identity99.9%
metadata-eval99.9%
count-299.9%
distribute-rgt-out99.9%
fma-define99.9%
metadata-eval99.9%
metadata-eval99.9%
count-299.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 93.0%
if 6.4e21 < y Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
+-commutative100.0%
associate-+l+100.0%
associate-+r+100.0%
associate-+r+100.0%
*-lft-identity100.0%
metadata-eval100.0%
count-2100.0%
distribute-rgt-out100.0%
fma-define100.0%
metadata-eval100.0%
metadata-eval100.0%
count-2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 91.5%
Final simplification91.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.85e+66) (not (<= y 2.6e+45))) (* y 2.0) z))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.85e+66) || !(y <= 2.6e+45)) {
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 <= (-1.85d+66)) .or. (.not. (y <= 2.6d+45))) 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 <= -1.85e+66) || !(y <= 2.6e+45)) {
tmp = y * 2.0;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.85e+66) or not (y <= 2.6e+45): tmp = y * 2.0 else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.85e+66) || !(y <= 2.6e+45)) tmp = Float64(y * 2.0); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.85e+66) || ~((y <= 2.6e+45))) tmp = y * 2.0; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.85e+66], N[Not[LessEqual[y, 2.6e+45]], $MachinePrecision]], N[(y * 2.0), $MachinePrecision], z]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.85 \cdot 10^{+66} \lor \neg \left(y \leq 2.6 \cdot 10^{+45}\right):\\
\;\;\;\;y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if y < -1.85e66 or 2.60000000000000007e45 < y Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
+-commutative100.0%
associate-+l+100.0%
associate-+r+100.0%
associate-+r+100.0%
*-lft-identity100.0%
metadata-eval100.0%
count-2100.0%
distribute-rgt-out100.0%
fma-define100.0%
metadata-eval100.0%
metadata-eval100.0%
count-2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 86.0%
Taylor expanded in z around 0 70.9%
if -1.85e66 < y < 2.60000000000000007e45Initial program 99.8%
+-commutative99.8%
associate-+l+99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
*-lft-identity99.9%
metadata-eval99.9%
count-299.9%
distribute-rgt-out99.9%
fma-define99.9%
metadata-eval99.9%
metadata-eval99.9%
count-299.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 50.8%
Final simplification58.3%
(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(z + Float64(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[(z + N[(N[(x * 3.0), $MachinePrecision] + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z + \left(x \cdot 3 + y \cdot 2\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
*-lft-identity99.9%
metadata-eval99.9%
count-299.9%
distribute-rgt-out99.9%
fma-define99.9%
metadata-eval99.9%
metadata-eval99.9%
count-299.9%
*-commutative99.9%
Simplified99.9%
fma-undefine99.9%
+-commutative99.9%
Applied egg-rr99.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%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
*-lft-identity99.9%
metadata-eval99.9%
count-299.9%
distribute-rgt-out99.9%
fma-define99.9%
metadata-eval99.9%
metadata-eval99.9%
count-299.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 37.9%
(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%
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 63.3%
Taylor expanded in x around 0 37.6%
Taylor expanded in x around inf 7.6%
herbie shell --seed 2024165
(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))