
(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 11 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 y 5.0 (* x (+ t (* (+ y z) 2.0)))))
double code(double x, double y, double z, double t) {
return fma(y, 5.0, (x * (t + ((y + z) * 2.0))));
}
function code(x, y, z, t) return fma(y, 5.0, Float64(x * Float64(t + Float64(Float64(y + z) * 2.0)))) end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 5, x \cdot \left(t + \left(y + z\right) \cdot 2\right)\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
fma-def100.0%
associate-+l+100.0%
*-un-lft-identity100.0%
+-commutative100.0%
*-un-lft-identity100.0%
distribute-rgt-out100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.5e-35) (not (<= x 3.75e-7))) (* x (+ (* z 2.0) (+ t (* y 2.0)))) (+ (* y 5.0) (* x (+ (* z 2.0) (* y 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.5e-35) || !(x <= 3.75e-7)) {
tmp = x * ((z * 2.0) + (t + (y * 2.0)));
} else {
tmp = (y * 5.0) + (x * ((z * 2.0) + (y * 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 <= (-7.5d-35)) .or. (.not. (x <= 3.75d-7))) then
tmp = x * ((z * 2.0d0) + (t + (y * 2.0d0)))
else
tmp = (y * 5.0d0) + (x * ((z * 2.0d0) + (y * 2.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.5e-35) || !(x <= 3.75e-7)) {
tmp = x * ((z * 2.0) + (t + (y * 2.0)));
} else {
tmp = (y * 5.0) + (x * ((z * 2.0) + (y * 2.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.5e-35) or not (x <= 3.75e-7): tmp = x * ((z * 2.0) + (t + (y * 2.0))) else: tmp = (y * 5.0) + (x * ((z * 2.0) + (y * 2.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7.5e-35) || !(x <= 3.75e-7)) tmp = Float64(x * Float64(Float64(z * 2.0) + Float64(t + Float64(y * 2.0)))); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(Float64(z * 2.0) + Float64(y * 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -7.5e-35) || ~((x <= 3.75e-7))) tmp = x * ((z * 2.0) + (t + (y * 2.0))); else tmp = (y * 5.0) + (x * ((z * 2.0) + (y * 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.5e-35], N[Not[LessEqual[x, 3.75e-7]], $MachinePrecision]], N[(x * N[(N[(z * 2.0), $MachinePrecision] + N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(N[(z * 2.0), $MachinePrecision] + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{-35} \lor \neg \left(x \leq 3.75 \cdot 10^{-7}\right):\\
\;\;\;\;x \cdot \left(z \cdot 2 + \left(t + y \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(z \cdot 2 + y \cdot 2\right)\\
\end{array}
\end{array}
if x < -7.5e-35 or 3.7500000000000001e-7 < x Initial program 100.0%
Taylor expanded in x around inf 99.5%
if -7.5e-35 < x < 3.7500000000000001e-7Initial program 99.9%
Taylor expanded in t around 0 83.4%
Final simplification92.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (* (+ y z) 2.0))))
(if (<= x -9.4e-39)
t_1
(if (<= x 1.15e-84)
(* y 5.0)
(if (or (<= x 3.1e+162) (not (<= x 6e+253))) t_1 (* x t))))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y + z) * 2.0);
double tmp;
if (x <= -9.4e-39) {
tmp = t_1;
} else if (x <= 1.15e-84) {
tmp = y * 5.0;
} else if ((x <= 3.1e+162) || !(x <= 6e+253)) {
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 = x * ((y + z) * 2.0d0)
if (x <= (-9.4d-39)) then
tmp = t_1
else if (x <= 1.15d-84) then
tmp = y * 5.0d0
else if ((x <= 3.1d+162) .or. (.not. (x <= 6d+253))) 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 = x * ((y + z) * 2.0);
double tmp;
if (x <= -9.4e-39) {
tmp = t_1;
} else if (x <= 1.15e-84) {
tmp = y * 5.0;
} else if ((x <= 3.1e+162) || !(x <= 6e+253)) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y + z) * 2.0) tmp = 0 if x <= -9.4e-39: tmp = t_1 elif x <= 1.15e-84: tmp = y * 5.0 elif (x <= 3.1e+162) or not (x <= 6e+253): tmp = t_1 else: tmp = x * t return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y + z) * 2.0)) tmp = 0.0 if (x <= -9.4e-39) tmp = t_1; elseif (x <= 1.15e-84) tmp = Float64(y * 5.0); elseif ((x <= 3.1e+162) || !(x <= 6e+253)) tmp = t_1; else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y + z) * 2.0); tmp = 0.0; if (x <= -9.4e-39) tmp = t_1; elseif (x <= 1.15e-84) tmp = y * 5.0; elseif ((x <= 3.1e+162) || ~((x <= 6e+253))) tmp = t_1; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.4e-39], t$95$1, If[LessEqual[x, 1.15e-84], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 3.1e+162], N[Not[LessEqual[x, 6e+253]], $MachinePrecision]], t$95$1, N[(x * t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\left(y + z\right) \cdot 2\right)\\
\mathbf{if}\;x \leq -9.4 \cdot 10^{-39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-84}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{+162} \lor \neg \left(x \leq 6 \cdot 10^{+253}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -9.4000000000000005e-39 or 1.1499999999999999e-84 < x < 3.1e162 or 5.9999999999999996e253 < x Initial program 100.0%
Taylor expanded in x around inf 96.7%
Taylor expanded in t around 0 73.2%
distribute-lft-in73.2%
*-commutative73.2%
+-commutative73.2%
Simplified73.2%
if -9.4000000000000005e-39 < x < 1.1499999999999999e-84Initial program 99.9%
Taylor expanded in x around 0 64.0%
if 3.1e162 < x < 5.9999999999999996e253Initial program 100.0%
Taylor expanded in t around inf 64.9%
Final simplification68.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (* (+ y z) 2.0))))
(if (<= x -1.25e-38)
t_1
(if (<= x 1.2e-84)
(* y (+ 5.0 (* x 2.0)))
(if (or (<= x 3.1e+162) (not (<= x 6e+253))) t_1 (* x t))))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y + z) * 2.0);
double tmp;
if (x <= -1.25e-38) {
tmp = t_1;
} else if (x <= 1.2e-84) {
tmp = y * (5.0 + (x * 2.0));
} else if ((x <= 3.1e+162) || !(x <= 6e+253)) {
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 = x * ((y + z) * 2.0d0)
if (x <= (-1.25d-38)) then
tmp = t_1
else if (x <= 1.2d-84) then
tmp = y * (5.0d0 + (x * 2.0d0))
else if ((x <= 3.1d+162) .or. (.not. (x <= 6d+253))) 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 = x * ((y + z) * 2.0);
double tmp;
if (x <= -1.25e-38) {
tmp = t_1;
} else if (x <= 1.2e-84) {
tmp = y * (5.0 + (x * 2.0));
} else if ((x <= 3.1e+162) || !(x <= 6e+253)) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y + z) * 2.0) tmp = 0 if x <= -1.25e-38: tmp = t_1 elif x <= 1.2e-84: tmp = y * (5.0 + (x * 2.0)) elif (x <= 3.1e+162) or not (x <= 6e+253): tmp = t_1 else: tmp = x * t return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y + z) * 2.0)) tmp = 0.0 if (x <= -1.25e-38) tmp = t_1; elseif (x <= 1.2e-84) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); elseif ((x <= 3.1e+162) || !(x <= 6e+253)) tmp = t_1; else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y + z) * 2.0); tmp = 0.0; if (x <= -1.25e-38) tmp = t_1; elseif (x <= 1.2e-84) tmp = y * (5.0 + (x * 2.0)); elseif ((x <= 3.1e+162) || ~((x <= 6e+253))) tmp = t_1; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.25e-38], t$95$1, If[LessEqual[x, 1.2e-84], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 3.1e+162], N[Not[LessEqual[x, 6e+253]], $MachinePrecision]], t$95$1, N[(x * t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\left(y + z\right) \cdot 2\right)\\
\mathbf{if}\;x \leq -1.25 \cdot 10^{-38}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-84}:\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{+162} \lor \neg \left(x \leq 6 \cdot 10^{+253}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -1.25000000000000008e-38 or 1.20000000000000009e-84 < x < 3.1e162 or 5.9999999999999996e253 < x Initial program 100.0%
Taylor expanded in x around inf 96.7%
Taylor expanded in t around 0 73.2%
distribute-lft-in73.2%
*-commutative73.2%
+-commutative73.2%
Simplified73.2%
if -1.25000000000000008e-38 < x < 1.20000000000000009e-84Initial program 99.9%
Taylor expanded in y around inf 64.0%
if 3.1e162 < x < 5.9999999999999996e253Initial program 100.0%
Taylor expanded in t around inf 64.9%
Final simplification68.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.2e-35) (not (<= x 7.4e-7))) (* x (+ (* z 2.0) (+ t (* y 2.0)))) (+ (* y 5.0) (* 2.0 (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.2e-35) || !(x <= 7.4e-7)) {
tmp = x * ((z * 2.0) + (t + (y * 2.0)));
} else {
tmp = (y * 5.0) + (2.0 * (x * 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) :: tmp
if ((x <= (-7.2d-35)) .or. (.not. (x <= 7.4d-7))) then
tmp = x * ((z * 2.0d0) + (t + (y * 2.0d0)))
else
tmp = (y * 5.0d0) + (2.0d0 * (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.2e-35) || !(x <= 7.4e-7)) {
tmp = x * ((z * 2.0) + (t + (y * 2.0)));
} else {
tmp = (y * 5.0) + (2.0 * (x * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.2e-35) or not (x <= 7.4e-7): tmp = x * ((z * 2.0) + (t + (y * 2.0))) else: tmp = (y * 5.0) + (2.0 * (x * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7.2e-35) || !(x <= 7.4e-7)) tmp = Float64(x * Float64(Float64(z * 2.0) + Float64(t + Float64(y * 2.0)))); else tmp = Float64(Float64(y * 5.0) + Float64(2.0 * Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -7.2e-35) || ~((x <= 7.4e-7))) tmp = x * ((z * 2.0) + (t + (y * 2.0))); else tmp = (y * 5.0) + (2.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.2e-35], N[Not[LessEqual[x, 7.4e-7]], $MachinePrecision]], N[(x * N[(N[(z * 2.0), $MachinePrecision] + N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-35} \lor \neg \left(x \leq 7.4 \cdot 10^{-7}\right):\\
\;\;\;\;x \cdot \left(z \cdot 2 + \left(t + y \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -7.20000000000000038e-35 or 7.40000000000000009e-7 < x Initial program 100.0%
Taylor expanded in x around inf 99.5%
if -7.20000000000000038e-35 < x < 7.40000000000000009e-7Initial program 99.9%
+-commutative99.9%
fma-def100.0%
associate-+l+100.0%
*-un-lft-identity100.0%
+-commutative100.0%
*-un-lft-identity100.0%
distribute-rgt-out100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 83.0%
fma-udef83.0%
Applied egg-rr83.0%
Final simplification92.4%
(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 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= x -1.2e+139)
(* x (* y 2.0))
(if (<= x -7.4e-39)
t_1
(if (<= x 1.2e-84) (* y 5.0) (if (<= x 1.5e+55) 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 <= -1.2e+139) {
tmp = x * (y * 2.0);
} else if (x <= -7.4e-39) {
tmp = t_1;
} else if (x <= 1.2e-84) {
tmp = y * 5.0;
} else if (x <= 1.5e+55) {
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 <= (-1.2d+139)) then
tmp = x * (y * 2.0d0)
else if (x <= (-7.4d-39)) then
tmp = t_1
else if (x <= 1.2d-84) then
tmp = y * 5.0d0
else if (x <= 1.5d+55) 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 <= -1.2e+139) {
tmp = x * (y * 2.0);
} else if (x <= -7.4e-39) {
tmp = t_1;
} else if (x <= 1.2e-84) {
tmp = y * 5.0;
} else if (x <= 1.5e+55) {
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 <= -1.2e+139: tmp = x * (y * 2.0) elif x <= -7.4e-39: tmp = t_1 elif x <= 1.2e-84: tmp = y * 5.0 elif x <= 1.5e+55: 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 <= -1.2e+139) tmp = Float64(x * Float64(y * 2.0)); elseif (x <= -7.4e-39) tmp = t_1; elseif (x <= 1.2e-84) tmp = Float64(y * 5.0); elseif (x <= 1.5e+55) 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 <= -1.2e+139) tmp = x * (y * 2.0); elseif (x <= -7.4e-39) tmp = t_1; elseif (x <= 1.2e-84) tmp = y * 5.0; elseif (x <= 1.5e+55) 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, -1.2e+139], N[(x * N[(y * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7.4e-39], t$95$1, If[LessEqual[x, 1.2e-84], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.5e+55], 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 -1.2 \cdot 10^{+139}:\\
\;\;\;\;x \cdot \left(y \cdot 2\right)\\
\mathbf{elif}\;x \leq -7.4 \cdot 10^{-39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-84}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+55}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -1.20000000000000004e139Initial program 100.0%
Taylor expanded in x around inf 100.0%
Taylor expanded in y around inf 50.4%
associate-*r*50.4%
Simplified50.4%
if -1.20000000000000004e139 < x < -7.40000000000000029e-39 or 1.20000000000000009e-84 < x < 1.50000000000000008e55Initial program 100.0%
Taylor expanded in z around inf 54.4%
if -7.40000000000000029e-39 < x < 1.20000000000000009e-84Initial program 99.9%
Taylor expanded in x around 0 64.0%
if 1.50000000000000008e55 < x Initial program 100.0%
Taylor expanded in t around inf 51.8%
Final simplification56.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= x -8.5e-39)
t_1
(if (<= x 1.05e-84) (* y 5.0) (if (<= x 3.6e+55) 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.5e-39) {
tmp = t_1;
} else if (x <= 1.05e-84) {
tmp = y * 5.0;
} else if (x <= 3.6e+55) {
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.5d-39)) then
tmp = t_1
else if (x <= 1.05d-84) then
tmp = y * 5.0d0
else if (x <= 3.6d+55) 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.5e-39) {
tmp = t_1;
} else if (x <= 1.05e-84) {
tmp = y * 5.0;
} else if (x <= 3.6e+55) {
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.5e-39: tmp = t_1 elif x <= 1.05e-84: tmp = y * 5.0 elif x <= 3.6e+55: 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.5e-39) tmp = t_1; elseif (x <= 1.05e-84) tmp = Float64(y * 5.0); elseif (x <= 3.6e+55) 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.5e-39) tmp = t_1; elseif (x <= 1.05e-84) tmp = y * 5.0; elseif (x <= 3.6e+55) 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.5e-39], t$95$1, If[LessEqual[x, 1.05e-84], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 3.6e+55], 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.5 \cdot 10^{-39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{-84}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{+55}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -8.5000000000000005e-39 or 1.04999999999999999e-84 < x < 3.59999999999999987e55Initial program 100.0%
Taylor expanded in z around inf 48.1%
if -8.5000000000000005e-39 < x < 1.04999999999999999e-84Initial program 99.9%
Taylor expanded in x around 0 64.0%
if 3.59999999999999987e55 < x Initial program 100.0%
Taylor expanded in t around inf 51.8%
Final simplification54.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.2e+21) (not (<= y 6.4e+99))) (* y (+ 5.0 (* x 2.0))) (* x (+ t (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.2e+21) || !(y <= 6.4e+99)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (z * 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 ((y <= (-2.2d+21)) .or. (.not. (y <= 6.4d+99))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = x * (t + (z * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.2e+21) || !(y <= 6.4e+99)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.2e+21) or not (y <= 6.4e+99): tmp = y * (5.0 + (x * 2.0)) else: tmp = x * (t + (z * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.2e+21) || !(y <= 6.4e+99)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(x * Float64(t + Float64(z * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.2e+21) || ~((y <= 6.4e+99))) tmp = y * (5.0 + (x * 2.0)); else tmp = x * (t + (z * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.2e+21], N[Not[LessEqual[y, 6.4e+99]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{+21} \lor \neg \left(y \leq 6.4 \cdot 10^{+99}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\end{array}
if y < -2.2e21 or 6.39999999999999999e99 < y Initial program 99.9%
Taylor expanded in y around inf 79.4%
if -2.2e21 < y < 6.39999999999999999e99Initial program 100.0%
Taylor expanded in y around 0 82.1%
Final simplification81.0%
(FPCore (x y z t) :precision binary64 (if (<= x -7.4e-35) (* x t) (if (<= x 0.00039) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.4e-35) {
tmp = x * t;
} else if (x <= 0.00039) {
tmp = y * 5.0;
} 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) :: tmp
if (x <= (-7.4d-35)) then
tmp = x * t
else if (x <= 0.00039d0) then
tmp = y * 5.0d0
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.4e-35) {
tmp = x * t;
} else if (x <= 0.00039) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7.4e-35: tmp = x * t elif x <= 0.00039: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7.4e-35) tmp = Float64(x * t); elseif (x <= 0.00039) tmp = Float64(y * 5.0); else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7.4e-35) tmp = x * t; elseif (x <= 0.00039) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7.4e-35], N[(x * t), $MachinePrecision], If[LessEqual[x, 0.00039], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.4 \cdot 10^{-35}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 0.00039:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -7.3999999999999998e-35 or 3.89999999999999993e-4 < x Initial program 100.0%
Taylor expanded in t around inf 37.7%
if -7.3999999999999998e-35 < x < 3.89999999999999993e-4Initial program 99.9%
Taylor expanded in x around 0 58.8%
Final simplification46.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 100.0%
Taylor expanded in x around 0 26.9%
Final simplification26.9%
herbie shell --seed 2023268
(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)))