
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
(FPCore (x y z t) :precision binary64 (fma x (+ (* 2.0 (+ y z)) t) (* y 5.0)))
double code(double x, double y, double z, double t) {
return fma(x, ((2.0 * (y + z)) + t), (y * 5.0));
}
function code(x, y, z, t) return fma(x, Float64(Float64(2.0 * Float64(y + z)) + t), Float64(y * 5.0)) end
code[x_, y_, z_, t_] := N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)
\end{array}
Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= x -8.2e+217)
t_1
(if (<= x -3e+194)
(* x t)
(if (<= x -1.9e+74)
t_1
(if (<= x -5.2e-87)
(* x t)
(if (<= x 2.1e-26)
(* y 5.0)
(if (or (<= x 1.12e+210) (not (<= x 3.5e+246)))
t_1
(* x t)))))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (x <= -8.2e+217) {
tmp = t_1;
} else if (x <= -3e+194) {
tmp = x * t;
} else if (x <= -1.9e+74) {
tmp = t_1;
} else if (x <= -5.2e-87) {
tmp = x * t;
} else if (x <= 2.1e-26) {
tmp = y * 5.0;
} else if ((x <= 1.12e+210) || !(x <= 3.5e+246)) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 2.0d0 * (x * z)
if (x <= (-8.2d+217)) then
tmp = t_1
else if (x <= (-3d+194)) then
tmp = x * t
else if (x <= (-1.9d+74)) then
tmp = t_1
else if (x <= (-5.2d-87)) then
tmp = x * t
else if (x <= 2.1d-26) then
tmp = y * 5.0d0
else if ((x <= 1.12d+210) .or. (.not. (x <= 3.5d+246))) then
tmp = t_1
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (x <= -8.2e+217) {
tmp = t_1;
} else if (x <= -3e+194) {
tmp = x * t;
} else if (x <= -1.9e+74) {
tmp = t_1;
} else if (x <= -5.2e-87) {
tmp = x * t;
} else if (x <= 2.1e-26) {
tmp = y * 5.0;
} else if ((x <= 1.12e+210) || !(x <= 3.5e+246)) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if x <= -8.2e+217: tmp = t_1 elif x <= -3e+194: tmp = x * t elif x <= -1.9e+74: tmp = t_1 elif x <= -5.2e-87: tmp = x * t elif x <= 2.1e-26: tmp = y * 5.0 elif (x <= 1.12e+210) or not (x <= 3.5e+246): tmp = t_1 else: tmp = x * t return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * z)) tmp = 0.0 if (x <= -8.2e+217) tmp = t_1; elseif (x <= -3e+194) tmp = Float64(x * t); elseif (x <= -1.9e+74) tmp = t_1; elseif (x <= -5.2e-87) tmp = Float64(x * t); elseif (x <= 2.1e-26) tmp = Float64(y * 5.0); elseif ((x <= 1.12e+210) || !(x <= 3.5e+246)) tmp = t_1; else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * z); tmp = 0.0; if (x <= -8.2e+217) tmp = t_1; elseif (x <= -3e+194) tmp = x * t; elseif (x <= -1.9e+74) tmp = t_1; elseif (x <= -5.2e-87) tmp = x * t; elseif (x <= 2.1e-26) tmp = y * 5.0; elseif ((x <= 1.12e+210) || ~((x <= 3.5e+246))) tmp = t_1; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.2e+217], t$95$1, If[LessEqual[x, -3e+194], N[(x * t), $MachinePrecision], If[LessEqual[x, -1.9e+74], t$95$1, If[LessEqual[x, -5.2e-87], N[(x * t), $MachinePrecision], If[LessEqual[x, 2.1e-26], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 1.12e+210], N[Not[LessEqual[x, 3.5e+246]], $MachinePrecision]], t$95$1, N[(x * t), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;x \leq -8.2 \cdot 10^{+217}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -3 \cdot 10^{+194}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -1.9 \cdot 10^{+74}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-87}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{-26}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{+210} \lor \neg \left(x \leq 3.5 \cdot 10^{+246}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -8.2000000000000005e217 or -3.0000000000000003e194 < x < -1.8999999999999999e74 or 2.10000000000000008e-26 < x < 1.12000000000000005e210 or 3.49999999999999975e246 < x Initial program 99.9%
Taylor expanded in z around inf 55.6%
if -8.2000000000000005e217 < x < -3.0000000000000003e194 or -1.8999999999999999e74 < x < -5.20000000000000005e-87 or 1.12000000000000005e210 < x < 3.49999999999999975e246Initial program 100.0%
Taylor expanded in t around inf 53.5%
Simplified53.5%
if -5.20000000000000005e-87 < x < 2.10000000000000008e-26Initial program 99.9%
Taylor expanded in x around 0 67.6%
Final simplification59.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* 2.0 z)))))
(if (<= x -4e-87)
t_1
(if (<= x 2.8e-70)
(* y 5.0)
(if (or (<= x 1.46e+85) (not (<= x 7.3e+227)))
t_1
(* x (+ t (* 2.0 y))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * z));
double tmp;
if (x <= -4e-87) {
tmp = t_1;
} else if (x <= 2.8e-70) {
tmp = y * 5.0;
} else if ((x <= 1.46e+85) || !(x <= 7.3e+227)) {
tmp = t_1;
} else {
tmp = x * (t + (2.0 * y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (t + (2.0d0 * z))
if (x <= (-4d-87)) then
tmp = t_1
else if (x <= 2.8d-70) then
tmp = y * 5.0d0
else if ((x <= 1.46d+85) .or. (.not. (x <= 7.3d+227))) then
tmp = t_1
else
tmp = x * (t + (2.0d0 * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * z));
double tmp;
if (x <= -4e-87) {
tmp = t_1;
} else if (x <= 2.8e-70) {
tmp = y * 5.0;
} else if ((x <= 1.46e+85) || !(x <= 7.3e+227)) {
tmp = t_1;
} else {
tmp = x * (t + (2.0 * y));
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (2.0 * z)) tmp = 0 if x <= -4e-87: tmp = t_1 elif x <= 2.8e-70: tmp = y * 5.0 elif (x <= 1.46e+85) or not (x <= 7.3e+227): tmp = t_1 else: tmp = x * (t + (2.0 * y)) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(2.0 * z))) tmp = 0.0 if (x <= -4e-87) tmp = t_1; elseif (x <= 2.8e-70) tmp = Float64(y * 5.0); elseif ((x <= 1.46e+85) || !(x <= 7.3e+227)) tmp = t_1; else tmp = Float64(x * Float64(t + Float64(2.0 * y))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (2.0 * z)); tmp = 0.0; if (x <= -4e-87) tmp = t_1; elseif (x <= 2.8e-70) tmp = y * 5.0; elseif ((x <= 1.46e+85) || ~((x <= 7.3e+227))) tmp = t_1; else tmp = x * (t + (2.0 * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4e-87], t$95$1, If[LessEqual[x, 2.8e-70], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 1.46e+85], N[Not[LessEqual[x, 7.3e+227]], $MachinePrecision]], t$95$1, N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{if}\;x \leq -4 \cdot 10^{-87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-70}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.46 \cdot 10^{+85} \lor \neg \left(x \leq 7.3 \cdot 10^{+227}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\
\end{array}
\end{array}
if x < -4.00000000000000007e-87 or 2.7999999999999999e-70 < x < 1.46e85 or 7.30000000000000026e227 < x Initial program 100.0%
Taylor expanded in y around 0 80.0%
if -4.00000000000000007e-87 < x < 2.7999999999999999e-70Initial program 99.9%
Taylor expanded in x around 0 69.8%
if 1.46e85 < x < 7.30000000000000026e227Initial program 100.0%
Taylor expanded in y around 0 90.6%
Taylor expanded in z around 0 75.6%
Taylor expanded in x around inf 78.7%
*-commutative78.7%
Simplified78.7%
Final simplification76.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -1.2e+156)
t_1
(if (<= y -2.8e+78)
(* x (+ t (* 2.0 y)))
(if (or (<= y -9e+55) (not (<= y 4e+62))) t_1 (* x (+ t (* 2.0 z))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -1.2e+156) {
tmp = t_1;
} else if (y <= -2.8e+78) {
tmp = x * (t + (2.0 * y));
} else if ((y <= -9e+55) || !(y <= 4e+62)) {
tmp = t_1;
} else {
tmp = x * (t + (2.0 * z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * (5.0d0 + (x * 2.0d0))
if (y <= (-1.2d+156)) then
tmp = t_1
else if (y <= (-2.8d+78)) then
tmp = x * (t + (2.0d0 * y))
else if ((y <= (-9d+55)) .or. (.not. (y <= 4d+62))) then
tmp = t_1
else
tmp = x * (t + (2.0d0 * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -1.2e+156) {
tmp = t_1;
} else if (y <= -2.8e+78) {
tmp = x * (t + (2.0 * y));
} else if ((y <= -9e+55) || !(y <= 4e+62)) {
tmp = t_1;
} else {
tmp = x * (t + (2.0 * z));
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (5.0 + (x * 2.0)) tmp = 0 if y <= -1.2e+156: tmp = t_1 elif y <= -2.8e+78: tmp = x * (t + (2.0 * y)) elif (y <= -9e+55) or not (y <= 4e+62): tmp = t_1 else: tmp = x * (t + (2.0 * z)) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(5.0 + Float64(x * 2.0))) tmp = 0.0 if (y <= -1.2e+156) tmp = t_1; elseif (y <= -2.8e+78) tmp = Float64(x * Float64(t + Float64(2.0 * y))); elseif ((y <= -9e+55) || !(y <= 4e+62)) tmp = t_1; else tmp = Float64(x * Float64(t + Float64(2.0 * z))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (5.0 + (x * 2.0)); tmp = 0.0; if (y <= -1.2e+156) tmp = t_1; elseif (y <= -2.8e+78) tmp = x * (t + (2.0 * y)); elseif ((y <= -9e+55) || ~((y <= 4e+62))) tmp = t_1; else tmp = x * (t + (2.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.2e+156], t$95$1, If[LessEqual[y, -2.8e+78], N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -9e+55], N[Not[LessEqual[y, 4e+62]], $MachinePrecision]], t$95$1, N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -1.2 \cdot 10^{+156}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.8 \cdot 10^{+78}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\
\mathbf{elif}\;y \leq -9 \cdot 10^{+55} \lor \neg \left(y \leq 4 \cdot 10^{+62}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\end{array}
\end{array}
if y < -1.2000000000000001e156 or -2.8000000000000001e78 < y < -8.99999999999999996e55 or 4.00000000000000014e62 < y Initial program 99.9%
Taylor expanded in y around inf 86.1%
Simplified86.1%
if -1.2000000000000001e156 < y < -2.8000000000000001e78Initial program 100.0%
Taylor expanded in y around 0 89.5%
Taylor expanded in z around 0 84.2%
Taylor expanded in x around inf 79.0%
*-commutative79.0%
Simplified79.0%
if -8.99999999999999996e55 < y < 4.00000000000000014e62Initial program 99.9%
Taylor expanded in y around 0 78.9%
Final simplification81.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -290.0) (not (<= x 1.35e-80))) (* x (+ t (+ (* 2.0 (+ y z)) (* 5.0 (/ y x))))) (+ (* x (+ t (* 2.0 z))) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -290.0) || !(x <= 1.35e-80)) {
tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x))));
} else {
tmp = (x * (t + (2.0 * z))) + (y * 5.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-290.0d0)) .or. (.not. (x <= 1.35d-80))) then
tmp = x * (t + ((2.0d0 * (y + z)) + (5.0d0 * (y / x))))
else
tmp = (x * (t + (2.0d0 * z))) + (y * 5.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -290.0) || !(x <= 1.35e-80)) {
tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x))));
} else {
tmp = (x * (t + (2.0 * z))) + (y * 5.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -290.0) or not (x <= 1.35e-80): tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x)))) else: tmp = (x * (t + (2.0 * z))) + (y * 5.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -290.0) || !(x <= 1.35e-80)) tmp = Float64(x * Float64(t + Float64(Float64(2.0 * Float64(y + z)) + Float64(5.0 * Float64(y / x))))); else tmp = Float64(Float64(x * Float64(t + Float64(2.0 * z))) + Float64(y * 5.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -290.0) || ~((x <= 1.35e-80))) tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x)))); else tmp = (x * (t + (2.0 * z))) + (y * 5.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -290.0], N[Not[LessEqual[x, 1.35e-80]], $MachinePrecision]], N[(x * N[(t + N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + N[(5.0 * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -290 \lor \neg \left(x \leq 1.35 \cdot 10^{-80}\right):\\
\;\;\;\;x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \frac{y}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right) + y \cdot 5\\
\end{array}
\end{array}
if x < -290 or 1.3500000000000001e-80 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -290 < x < 1.3500000000000001e-80Initial program 99.9%
Taylor expanded in y around 0 99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -3.5e+143)
t_1
(if (<= y -1.12e+24)
(+ (* y 5.0) (* x t))
(if (<= y 6e+61) (* x (+ t (* 2.0 z))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -3.5e+143) {
tmp = t_1;
} else if (y <= -1.12e+24) {
tmp = (y * 5.0) + (x * t);
} else if (y <= 6e+61) {
tmp = x * (t + (2.0 * z));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * (5.0d0 + (x * 2.0d0))
if (y <= (-3.5d+143)) then
tmp = t_1
else if (y <= (-1.12d+24)) then
tmp = (y * 5.0d0) + (x * t)
else if (y <= 6d+61) then
tmp = x * (t + (2.0d0 * z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -3.5e+143) {
tmp = t_1;
} else if (y <= -1.12e+24) {
tmp = (y * 5.0) + (x * t);
} else if (y <= 6e+61) {
tmp = x * (t + (2.0 * z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (5.0 + (x * 2.0)) tmp = 0 if y <= -3.5e+143: tmp = t_1 elif y <= -1.12e+24: tmp = (y * 5.0) + (x * t) elif y <= 6e+61: tmp = x * (t + (2.0 * z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(5.0 + Float64(x * 2.0))) tmp = 0.0 if (y <= -3.5e+143) tmp = t_1; elseif (y <= -1.12e+24) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); elseif (y <= 6e+61) tmp = Float64(x * Float64(t + Float64(2.0 * z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (5.0 + (x * 2.0)); tmp = 0.0; if (y <= -3.5e+143) tmp = t_1; elseif (y <= -1.12e+24) tmp = (y * 5.0) + (x * t); elseif (y <= 6e+61) tmp = x * (t + (2.0 * z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.5e+143], t$95$1, If[LessEqual[y, -1.12e+24], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e+61], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -3.5 \cdot 10^{+143}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.12 \cdot 10^{+24}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+61}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.50000000000000008e143 or 6e61 < y Initial program 99.9%
Taylor expanded in y around inf 86.7%
Simplified86.7%
if -3.50000000000000008e143 < y < -1.12e24Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
flip-+0.0%
pow20.0%
pow20.0%
Applied egg-rr0.0%
Simplified73.3%
Taylor expanded in x around 0 73.3%
if -1.12e24 < y < 6e61Initial program 99.9%
Taylor expanded in y around 0 80.4%
Final simplification81.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -290.0) (not (<= x 2.5))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* x (+ t (* 2.0 z))) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -290.0) || !(x <= 2.5)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (x * (t + (2.0 * z))) + (y * 5.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-290.0d0)) .or. (.not. (x <= 2.5d0))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (x * (t + (2.0d0 * z))) + (y * 5.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -290.0) || !(x <= 2.5)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (x * (t + (2.0 * z))) + (y * 5.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -290.0) or not (x <= 2.5): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (x * (t + (2.0 * z))) + (y * 5.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -290.0) || !(x <= 2.5)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(x * Float64(t + Float64(2.0 * z))) + Float64(y * 5.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -290.0) || ~((x <= 2.5))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (x * (t + (2.0 * z))) + (y * 5.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -290.0], N[Not[LessEqual[x, 2.5]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -290 \lor \neg \left(x \leq 2.5\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right) + y \cdot 5\\
\end{array}
\end{array}
if x < -290 or 2.5 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 99.8%
if -290 < x < 2.5Initial program 99.9%
Taylor expanded in y around 0 99.3%
Final simplification99.6%
(FPCore (x y z t) :precision binary64 (if (<= x -2e+195) (* x (+ (* 2.0 (+ y z)) t)) (+ (* x (+ t (* 2.0 z))) (* y (+ 5.0 (* x 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2e+195) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (x * (t + (2.0 * z))) + (y * (5.0 + (x * 2.0)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-2d+195)) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (x * (t + (2.0d0 * z))) + (y * (5.0d0 + (x * 2.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2e+195) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (x * (t + (2.0 * z))) + (y * (5.0 + (x * 2.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2e+195: tmp = x * ((2.0 * (y + z)) + t) else: tmp = (x * (t + (2.0 * z))) + (y * (5.0 + (x * 2.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2e+195) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(x * Float64(t + Float64(2.0 * z))) + Float64(y * Float64(5.0 + Float64(x * 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2e+195) tmp = x * ((2.0 * (y + z)) + t); else tmp = (x * (t + (2.0 * z))) + (y * (5.0 + (x * 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2e+195], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{+195}:\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right) + y \cdot \left(5 + x \cdot 2\right)\\
\end{array}
\end{array}
if x < -1.99999999999999995e195Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 99.9%
if -1.99999999999999995e195 < x Initial program 99.9%
Taylor expanded in y around 0 98.2%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.6e-36) (not (<= x 1.68e-28))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.6e-36) || !(x <= 1.68e-28)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-3.6d-36)) .or. (.not. (x <= 1.68d-28))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (y * 5.0d0) + (x * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.6e-36) || !(x <= 1.68e-28)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.6e-36) or not (x <= 1.68e-28): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (y * 5.0) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.6e-36) || !(x <= 1.68e-28)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(y * 5.0) + Float64(x * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.6e-36) || ~((x <= 1.68e-28))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (y * 5.0) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.6e-36], N[Not[LessEqual[x, 1.68e-28]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-36} \lor \neg \left(x \leq 1.68 \cdot 10^{-28}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\end{array}
\end{array}
if x < -3.60000000000000032e-36 or 1.67999999999999992e-28 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 99.2%
if -3.60000000000000032e-36 < x < 1.67999999999999992e-28Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
flip-+0.0%
pow20.0%
pow20.0%
Applied egg-rr0.0%
Simplified83.9%
Taylor expanded in x around 0 83.9%
Final simplification92.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.2e-87) (not (<= x 2.7e-68))) (* x (+ t (* 2.0 z))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.2e-87) || !(x <= 2.7e-68)) {
tmp = x * (t + (2.0 * z));
} else {
tmp = y * 5.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-5.2d-87)) .or. (.not. (x <= 2.7d-68))) then
tmp = x * (t + (2.0d0 * z))
else
tmp = y * 5.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.2e-87) || !(x <= 2.7e-68)) {
tmp = x * (t + (2.0 * z));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5.2e-87) or not (x <= 2.7e-68): tmp = x * (t + (2.0 * z)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5.2e-87) || !(x <= 2.7e-68)) tmp = Float64(x * Float64(t + Float64(2.0 * z))); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -5.2e-87) || ~((x <= 2.7e-68))) tmp = x * (t + (2.0 * z)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.2e-87], N[Not[LessEqual[x, 2.7e-68]], $MachinePrecision]], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{-87} \lor \neg \left(x \leq 2.7 \cdot 10^{-68}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -5.20000000000000005e-87 or 2.7000000000000002e-68 < x Initial program 100.0%
Taylor expanded in y around 0 76.3%
if -5.20000000000000005e-87 < x < 2.7000000000000002e-68Initial program 99.9%
Taylor expanded in x around 0 69.8%
Final simplification74.1%
(FPCore (x y z t) :precision binary64 (+ (* x (+ t (+ y (+ z (+ y z))))) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * (t + (y + (z + (y + z))))) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (y * 5.0);
}
def code(x, y, z, t): return (x * (t + (y + (z + (y + z))))) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(t + Float64(y + Float64(z + Float64(y + z))))) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * (t + (y + (z + (y + z))))) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(t + N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) + y \cdot 5
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.6e-87) (not (<= x 1.36e-70))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.6e-87) || !(x <= 1.36e-70)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-5.6d-87)) .or. (.not. (x <= 1.36d-70))) then
tmp = x * t
else
tmp = y * 5.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.6e-87) || !(x <= 1.36e-70)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5.6e-87) or not (x <= 1.36e-70): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5.6e-87) || !(x <= 1.36e-70)) tmp = Float64(x * t); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -5.6e-87) || ~((x <= 1.36e-70))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.6e-87], N[Not[LessEqual[x, 1.36e-70]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{-87} \lor \neg \left(x \leq 1.36 \cdot 10^{-70}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -5.6000000000000002e-87 or 1.36000000000000001e-70 < x Initial program 100.0%
Taylor expanded in t around inf 39.3%
Simplified39.3%
if -5.6000000000000002e-87 < x < 1.36000000000000001e-70Initial program 99.9%
Taylor expanded in x around 0 69.8%
Final simplification49.9%
(FPCore (x y z t) :precision binary64 (* y 5.0))
double code(double x, double y, double z, double t) {
return y * 5.0;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = y * 5.0d0
end function
public static double code(double x, double y, double z, double t) {
return y * 5.0;
}
def code(x, y, z, t): return y * 5.0
function code(x, y, z, t) return Float64(y * 5.0) end
function tmp = code(x, y, z, t) tmp = y * 5.0; end
code[x_, y_, z_, t_] := N[(y * 5.0), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 28.1%
Final simplification28.1%
herbie shell --seed 2024130
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B"
:precision binary64
(+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))