
(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 (fma x 3.0 (fma y 2.0 z)))
double code(double x, double y, double z) {
return fma(x, 3.0, fma(y, 2.0, z));
}
function code(x, y, z) return fma(x, 3.0, fma(y, 2.0, z)) end
code[x_, y_, z_] := N[(x * 3.0 + N[(y * 2.0 + z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, 3, \mathsf{fma}\left(y, 2, z\right)\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
count-299.9%
associate-+l+99.9%
associate-+r+99.9%
distribute-rgt1-in99.9%
*-commutative99.9%
fma-def100.0%
metadata-eval100.0%
count-2100.0%
*-commutative100.0%
fma-def100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (<= x -8.5e+75)
(* x 3.0)
(if (<= x -1.8e-106)
(* y 2.0)
(if (<= x -1.05e-183)
z
(if (<= x 2.9e-301)
(* y 2.0)
(if (<= x 4.1e-255)
z
(if (<= x 9e-82) (* y 2.0) (if (<= x 3.4e+53) z (* x 3.0)))))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -8.5e+75) {
tmp = x * 3.0;
} else if (x <= -1.8e-106) {
tmp = y * 2.0;
} else if (x <= -1.05e-183) {
tmp = z;
} else if (x <= 2.9e-301) {
tmp = y * 2.0;
} else if (x <= 4.1e-255) {
tmp = z;
} else if (x <= 9e-82) {
tmp = y * 2.0;
} else if (x <= 3.4e+53) {
tmp = z;
} 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 <= (-8.5d+75)) then
tmp = x * 3.0d0
else if (x <= (-1.8d-106)) then
tmp = y * 2.0d0
else if (x <= (-1.05d-183)) then
tmp = z
else if (x <= 2.9d-301) then
tmp = y * 2.0d0
else if (x <= 4.1d-255) then
tmp = z
else if (x <= 9d-82) then
tmp = y * 2.0d0
else if (x <= 3.4d+53) then
tmp = z
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 <= -8.5e+75) {
tmp = x * 3.0;
} else if (x <= -1.8e-106) {
tmp = y * 2.0;
} else if (x <= -1.05e-183) {
tmp = z;
} else if (x <= 2.9e-301) {
tmp = y * 2.0;
} else if (x <= 4.1e-255) {
tmp = z;
} else if (x <= 9e-82) {
tmp = y * 2.0;
} else if (x <= 3.4e+53) {
tmp = z;
} else {
tmp = x * 3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -8.5e+75: tmp = x * 3.0 elif x <= -1.8e-106: tmp = y * 2.0 elif x <= -1.05e-183: tmp = z elif x <= 2.9e-301: tmp = y * 2.0 elif x <= 4.1e-255: tmp = z elif x <= 9e-82: tmp = y * 2.0 elif x <= 3.4e+53: tmp = z else: tmp = x * 3.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -8.5e+75) tmp = Float64(x * 3.0); elseif (x <= -1.8e-106) tmp = Float64(y * 2.0); elseif (x <= -1.05e-183) tmp = z; elseif (x <= 2.9e-301) tmp = Float64(y * 2.0); elseif (x <= 4.1e-255) tmp = z; elseif (x <= 9e-82) tmp = Float64(y * 2.0); elseif (x <= 3.4e+53) tmp = z; else tmp = Float64(x * 3.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -8.5e+75) tmp = x * 3.0; elseif (x <= -1.8e-106) tmp = y * 2.0; elseif (x <= -1.05e-183) tmp = z; elseif (x <= 2.9e-301) tmp = y * 2.0; elseif (x <= 4.1e-255) tmp = z; elseif (x <= 9e-82) tmp = y * 2.0; elseif (x <= 3.4e+53) tmp = z; else tmp = x * 3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -8.5e+75], N[(x * 3.0), $MachinePrecision], If[LessEqual[x, -1.8e-106], N[(y * 2.0), $MachinePrecision], If[LessEqual[x, -1.05e-183], z, If[LessEqual[x, 2.9e-301], N[(y * 2.0), $MachinePrecision], If[LessEqual[x, 4.1e-255], z, If[LessEqual[x, 9e-82], N[(y * 2.0), $MachinePrecision], If[LessEqual[x, 3.4e+53], z, N[(x * 3.0), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{+75}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;x \leq -1.8 \cdot 10^{-106}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;x \leq -1.05 \cdot 10^{-183}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-301}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-255}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-82}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{+53}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x \cdot 3\\
\end{array}
\end{array}
if x < -8.4999999999999993e75 or 3.39999999999999998e53 < x Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 71.1%
if -8.4999999999999993e75 < x < -1.80000000000000006e-106 or -1.0500000000000001e-183 < x < 2.89999999999999984e-301 or 4.1e-255 < x < 8.9999999999999997e-82Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in y around inf 60.4%
if -1.80000000000000006e-106 < x < -1.0500000000000001e-183 or 2.89999999999999984e-301 < x < 4.1e-255 or 8.9999999999999997e-82 < x < 3.39999999999999998e53Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in z around inf 61.6%
Final simplification65.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.4e+84) (not (<= y 8.6e+49))) (+ x (* 2.0 (+ x y))) (+ z (* x 3.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.4e+84) || !(y <= 8.6e+49)) {
tmp = x + (2.0 * (x + 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 <= (-2.4d+84)) .or. (.not. (y <= 8.6d+49))) then
tmp = x + (2.0d0 * (x + 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 <= -2.4e+84) || !(y <= 8.6e+49)) {
tmp = x + (2.0 * (x + y));
} else {
tmp = z + (x * 3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.4e+84) or not (y <= 8.6e+49): tmp = x + (2.0 * (x + y)) else: tmp = z + (x * 3.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.4e+84) || !(y <= 8.6e+49)) tmp = Float64(x + Float64(2.0 * Float64(x + 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 <= -2.4e+84) || ~((y <= 8.6e+49))) tmp = x + (2.0 * (x + y)); else tmp = z + (x * 3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.4e+84], N[Not[LessEqual[y, 8.6e+49]], $MachinePrecision]], N[(x + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z + N[(x * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{+84} \lor \neg \left(y \leq 8.6 \cdot 10^{+49}\right):\\
\;\;\;\;x + 2 \cdot \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;z + x \cdot 3\\
\end{array}
\end{array}
if y < -2.4e84 or 8.5999999999999998e49 < y Initial program 99.9%
+-commutative99.9%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in z around 0 93.8%
if -2.4e84 < y < 8.5999999999999998e49Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 89.9%
Final simplification91.3%
(FPCore (x y z) :precision binary64 (if (<= y -7.4e+84) (+ (* x 3.0) (* y 2.0)) (if (<= y 1.08e+52) (+ z (* x 3.0)) (+ x (* 2.0 (+ x y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7.4e+84) {
tmp = (x * 3.0) + (y * 2.0);
} else if (y <= 1.08e+52) {
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 (y <= (-7.4d+84)) then
tmp = (x * 3.0d0) + (y * 2.0d0)
else if (y <= 1.08d+52) 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 (y <= -7.4e+84) {
tmp = (x * 3.0) + (y * 2.0);
} else if (y <= 1.08e+52) {
tmp = z + (x * 3.0);
} else {
tmp = x + (2.0 * (x + y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7.4e+84: tmp = (x * 3.0) + (y * 2.0) elif y <= 1.08e+52: tmp = z + (x * 3.0) else: tmp = x + (2.0 * (x + y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7.4e+84) tmp = Float64(Float64(x * 3.0) + Float64(y * 2.0)); elseif (y <= 1.08e+52) 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 (y <= -7.4e+84) tmp = (x * 3.0) + (y * 2.0); elseif (y <= 1.08e+52) tmp = z + (x * 3.0); else tmp = x + (2.0 * (x + y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7.4e+84], N[(N[(x * 3.0), $MachinePrecision] + N[(y * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.08e+52], 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}\;y \leq -7.4 \cdot 10^{+84}:\\
\;\;\;\;x \cdot 3 + y \cdot 2\\
\mathbf{elif}\;y \leq 1.08 \cdot 10^{+52}:\\
\;\;\;\;z + x \cdot 3\\
\mathbf{else}:\\
\;\;\;\;x + 2 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -7.4e84Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in z around 0 95.8%
if -7.4e84 < y < 1.07999999999999997e52Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 89.9%
if 1.07999999999999997e52 < y Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in z around 0 92.0%
Final simplification91.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -7.5e+106) (not (<= x 5.75e+54))) (* x 3.0) (+ z (* y 2.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -7.5e+106) || !(x <= 5.75e+54)) {
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 <= (-7.5d+106)) .or. (.not. (x <= 5.75d+54))) 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 <= -7.5e+106) || !(x <= 5.75e+54)) {
tmp = x * 3.0;
} else {
tmp = z + (y * 2.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -7.5e+106) or not (x <= 5.75e+54): tmp = x * 3.0 else: tmp = z + (y * 2.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -7.5e+106) || !(x <= 5.75e+54)) 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 <= -7.5e+106) || ~((x <= 5.75e+54))) tmp = x * 3.0; else tmp = z + (y * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -7.5e+106], N[Not[LessEqual[x, 5.75e+54]], $MachinePrecision]], N[(x * 3.0), $MachinePrecision], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{+106} \lor \neg \left(x \leq 5.75 \cdot 10^{+54}\right):\\
\;\;\;\;x \cdot 3\\
\mathbf{else}:\\
\;\;\;\;z + y \cdot 2\\
\end{array}
\end{array}
if x < -7.50000000000000058e106 or 5.74999999999999968e54 < x Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 73.3%
if -7.50000000000000058e106 < x < 5.74999999999999968e54Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around 0 86.8%
Final simplification81.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -6.5e-7) (not (<= y 1e+60))) (+ z (* y 2.0)) (+ z (* x 3.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.5e-7) || !(y <= 1e+60)) {
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 <= (-6.5d-7)) .or. (.not. (y <= 1d+60))) 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 <= -6.5e-7) || !(y <= 1e+60)) {
tmp = z + (y * 2.0);
} else {
tmp = z + (x * 3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6.5e-7) or not (y <= 1e+60): tmp = z + (y * 2.0) else: tmp = z + (x * 3.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6.5e-7) || !(y <= 1e+60)) 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 <= -6.5e-7) || ~((y <= 1e+60))) tmp = z + (y * 2.0); else tmp = z + (x * 3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6.5e-7], N[Not[LessEqual[y, 1e+60]], $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 -6.5 \cdot 10^{-7} \lor \neg \left(y \leq 10^{+60}\right):\\
\;\;\;\;z + y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;z + x \cdot 3\\
\end{array}
\end{array}
if y < -6.50000000000000024e-7 or 9.9999999999999995e59 < y Initial program 99.9%
+-commutative99.9%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around 0 79.1%
if -6.50000000000000024e-7 < y < 9.9999999999999995e59Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 94.0%
Final simplification87.1%
(FPCore (x y z) :precision binary64 (+ x (+ z (* 2.0 (+ x y)))))
double code(double x, double y, double z) {
return x + (z + (2.0 * (x + y)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (z + (2.0d0 * (x + y)))
end function
public static double code(double x, double y, double z) {
return x + (z + (2.0 * (x + y)));
}
def code(x, y, z): return x + (z + (2.0 * (x + y)))
function code(x, y, z) return Float64(x + Float64(z + Float64(2.0 * Float64(x + y)))) end
function tmp = code(x, y, z) tmp = x + (z + (2.0 * (x + y))); end
code[x_, y_, z_] := N[(x + N[(z + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z + 2 \cdot \left(x + y\right)\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (+ (* x 3.0) (+ z (* y 2.0))))
double code(double x, double y, double z) {
return (x * 3.0) + (z + (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 = (x * 3.0d0) + (z + (y * 2.0d0))
end function
public static double code(double x, double y, double z) {
return (x * 3.0) + (z + (y * 2.0));
}
def code(x, y, z): return (x * 3.0) + (z + (y * 2.0))
function code(x, y, z) return Float64(Float64(x * 3.0) + Float64(z + Float64(y * 2.0))) end
function tmp = code(x, y, z) tmp = (x * 3.0) + (z + (y * 2.0)); end
code[x_, y_, z_] := N[(N[(x * 3.0), $MachinePrecision] + N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 3 + \left(z + y \cdot 2\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= y -1.32e+85) (* y 2.0) (if (<= y 3.8e+49) z (* y 2.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.32e+85) {
tmp = y * 2.0;
} else if (y <= 3.8e+49) {
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 <= (-1.32d+85)) then
tmp = y * 2.0d0
else if (y <= 3.8d+49) 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 <= -1.32e+85) {
tmp = y * 2.0;
} else if (y <= 3.8e+49) {
tmp = z;
} else {
tmp = y * 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.32e+85: tmp = y * 2.0 elif y <= 3.8e+49: tmp = z else: tmp = y * 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.32e+85) tmp = Float64(y * 2.0); elseif (y <= 3.8e+49) tmp = z; else tmp = Float64(y * 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.32e+85) tmp = y * 2.0; elseif (y <= 3.8e+49) tmp = z; else tmp = y * 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.32e+85], N[(y * 2.0), $MachinePrecision], If[LessEqual[y, 3.8e+49], z, N[(y * 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.32 \cdot 10^{+85}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+49}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;y \cdot 2\\
\end{array}
\end{array}
if y < -1.32000000000000007e85 or 3.7999999999999999e49 < y Initial program 99.9%
+-commutative99.9%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in y around inf 71.3%
if -1.32000000000000007e85 < y < 3.7999999999999999e49Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in z around inf 41.5%
Final simplification52.7%
(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%
count-299.9%
Simplified99.9%
Taylor expanded in z around inf 29.2%
Final simplification29.2%
herbie shell --seed 2023240
(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))