
(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 y))))
(if (<= x -5.8e+119)
t_1
(if (<= x -8.2e-36)
(* x t)
(if (<= x 0.15)
(* y 5.0)
(if (or (<= x 1.15e+227) (not (<= x 6.2e+298))) t_1 (* x t)))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * y);
double tmp;
if (x <= -5.8e+119) {
tmp = t_1;
} else if (x <= -8.2e-36) {
tmp = x * t;
} else if (x <= 0.15) {
tmp = y * 5.0;
} else if ((x <= 1.15e+227) || !(x <= 6.2e+298)) {
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 * y)
if (x <= (-5.8d+119)) then
tmp = t_1
else if (x <= (-8.2d-36)) then
tmp = x * t
else if (x <= 0.15d0) then
tmp = y * 5.0d0
else if ((x <= 1.15d+227) .or. (.not. (x <= 6.2d+298))) 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 * y);
double tmp;
if (x <= -5.8e+119) {
tmp = t_1;
} else if (x <= -8.2e-36) {
tmp = x * t;
} else if (x <= 0.15) {
tmp = y * 5.0;
} else if ((x <= 1.15e+227) || !(x <= 6.2e+298)) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * y) tmp = 0 if x <= -5.8e+119: tmp = t_1 elif x <= -8.2e-36: tmp = x * t elif x <= 0.15: tmp = y * 5.0 elif (x <= 1.15e+227) or not (x <= 6.2e+298): tmp = t_1 else: tmp = x * t return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * y)) tmp = 0.0 if (x <= -5.8e+119) tmp = t_1; elseif (x <= -8.2e-36) tmp = Float64(x * t); elseif (x <= 0.15) tmp = Float64(y * 5.0); elseif ((x <= 1.15e+227) || !(x <= 6.2e+298)) 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 * y); tmp = 0.0; if (x <= -5.8e+119) tmp = t_1; elseif (x <= -8.2e-36) tmp = x * t; elseif (x <= 0.15) tmp = y * 5.0; elseif ((x <= 1.15e+227) || ~((x <= 6.2e+298))) 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 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.8e+119], t$95$1, If[LessEqual[x, -8.2e-36], N[(x * t), $MachinePrecision], If[LessEqual[x, 0.15], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 1.15e+227], N[Not[LessEqual[x, 6.2e+298]], $MachinePrecision]], t$95$1, N[(x * t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot y\right)\\
\mathbf{if}\;x \leq -5.8 \cdot 10^{+119}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -8.2 \cdot 10^{-36}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 0.15:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+227} \lor \neg \left(x \leq 6.2 \cdot 10^{+298}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -5.80000000000000014e119 or 0.149999999999999994 < x < 1.1499999999999999e227 or 6.2000000000000004e298 < 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%
Taylor expanded in t around 0 81.5%
Taylor expanded in y around inf 50.1%
*-commutative50.1%
Simplified50.1%
if -5.80000000000000014e119 < x < -8.20000000000000025e-36 or 1.1499999999999999e227 < x < 6.2000000000000004e298Initial program 100.0%
Taylor expanded in t around inf 56.8%
Simplified56.8%
Taylor expanded in t around inf 56.8%
Taylor expanded in t around inf 54.8%
*-commutative54.8%
Simplified54.8%
if -8.20000000000000025e-36 < x < 0.149999999999999994Initial program 99.9%
Taylor expanded in x around 0 60.6%
Simplified60.6%
Final simplification55.4%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -5.3e-5)
(not (or (<= x 2.5e-143) (and (not (<= x 4.4e-85)) (<= x 1.75e-11)))))
(* 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 <= -5.3e-5) || !((x <= 2.5e-143) || (!(x <= 4.4e-85) && (x <= 1.75e-11)))) {
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 <= (-5.3d-5)) .or. (.not. (x <= 2.5d-143) .or. (.not. (x <= 4.4d-85)) .and. (x <= 1.75d-11))) 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 <= -5.3e-5) || !((x <= 2.5e-143) || (!(x <= 4.4e-85) && (x <= 1.75e-11)))) {
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 <= -5.3e-5) or not ((x <= 2.5e-143) or (not (x <= 4.4e-85) and (x <= 1.75e-11))): 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 <= -5.3e-5) || !((x <= 2.5e-143) || (!(x <= 4.4e-85) && (x <= 1.75e-11)))) 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 <= -5.3e-5) || ~(((x <= 2.5e-143) || (~((x <= 4.4e-85)) && (x <= 1.75e-11))))) 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, -5.3e-5], N[Not[Or[LessEqual[x, 2.5e-143], And[N[Not[LessEqual[x, 4.4e-85]], $MachinePrecision], LessEqual[x, 1.75e-11]]]], $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 -5.3 \cdot 10^{-5} \lor \neg \left(x \leq 2.5 \cdot 10^{-143} \lor \neg \left(x \leq 4.4 \cdot 10^{-85}\right) \land x \leq 1.75 \cdot 10^{-11}\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 < -5.3000000000000001e-5 or 2.5000000000000001e-143 < x < 4.4e-85 or 1.7500000000000001e-11 < x Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 98.1%
if -5.3000000000000001e-5 < x < 2.5000000000000001e-143 or 4.4e-85 < x < 1.7500000000000001e-11Initial program 99.9%
Taylor expanded in t around inf 78.1%
Simplified78.1%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.1e-193) (not (<= x 3.4e-156))) (* x (+ t (+ (* 2.0 (+ y z)) (* 5.0 (/ y x))))) (+ (* y 5.0) (* 2.0 (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.1e-193) || !(x <= 3.4e-156)) {
tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x))));
} 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 <= (-4.1d-193)) .or. (.not. (x <= 3.4d-156))) then
tmp = x * (t + ((2.0d0 * (y + z)) + (5.0d0 * (y / x))))
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 <= -4.1e-193) || !(x <= 3.4e-156)) {
tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x))));
} else {
tmp = (y * 5.0) + (2.0 * (x * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.1e-193) or not (x <= 3.4e-156): tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x)))) else: tmp = (y * 5.0) + (2.0 * (x * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.1e-193) || !(x <= 3.4e-156)) tmp = Float64(x * Float64(t + Float64(Float64(2.0 * Float64(y + z)) + Float64(5.0 * Float64(y / x))))); 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 <= -4.1e-193) || ~((x <= 3.4e-156))) tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x)))); else tmp = (y * 5.0) + (2.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.1e-193], N[Not[LessEqual[x, 3.4e-156]], $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[(y * 5.0), $MachinePrecision] + N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.1 \cdot 10^{-193} \lor \neg \left(x \leq 3.4 \cdot 10^{-156}\right):\\
\;\;\;\;x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \frac{y}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -4.10000000000000003e-193 or 3.3999999999999999e-156 < x Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 99.0%
if -4.10000000000000003e-193 < x < 3.3999999999999999e-156Initial program 99.9%
Taylor expanded in z around inf 94.0%
Simplified94.0%
Final simplification98.1%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.25e+104)
(* y 5.0)
(if (<= y 3e-53)
(* x (* 2.0 z))
(if (<= y 3.1e+138) (* y 5.0) (* 2.0 (* x y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.25e+104) {
tmp = y * 5.0;
} else if (y <= 3e-53) {
tmp = x * (2.0 * z);
} else if (y <= 3.1e+138) {
tmp = y * 5.0;
} else {
tmp = 2.0 * (x * 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) :: tmp
if (y <= (-1.25d+104)) then
tmp = y * 5.0d0
else if (y <= 3d-53) then
tmp = x * (2.0d0 * z)
else if (y <= 3.1d+138) then
tmp = y * 5.0d0
else
tmp = 2.0d0 * (x * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.25e+104) {
tmp = y * 5.0;
} else if (y <= 3e-53) {
tmp = x * (2.0 * z);
} else if (y <= 3.1e+138) {
tmp = y * 5.0;
} else {
tmp = 2.0 * (x * y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.25e+104: tmp = y * 5.0 elif y <= 3e-53: tmp = x * (2.0 * z) elif y <= 3.1e+138: tmp = y * 5.0 else: tmp = 2.0 * (x * y) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.25e+104) tmp = Float64(y * 5.0); elseif (y <= 3e-53) tmp = Float64(x * Float64(2.0 * z)); elseif (y <= 3.1e+138) tmp = Float64(y * 5.0); else tmp = Float64(2.0 * Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.25e+104) tmp = y * 5.0; elseif (y <= 3e-53) tmp = x * (2.0 * z); elseif (y <= 3.1e+138) tmp = y * 5.0; else tmp = 2.0 * (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.25e+104], N[(y * 5.0), $MachinePrecision], If[LessEqual[y, 3e-53], N[(x * N[(2.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e+138], N[(y * 5.0), $MachinePrecision], N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+104}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-53}:\\
\;\;\;\;x \cdot \left(2 \cdot z\right)\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+138}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot y\right)\\
\end{array}
\end{array}
if y < -1.2499999999999999e104 or 3.0000000000000002e-53 < y < 3.0999999999999998e138Initial program 99.9%
Taylor expanded in x around 0 53.2%
Simplified53.2%
if -1.2499999999999999e104 < y < 3.0000000000000002e-53Initial program 99.9%
Taylor expanded in z around inf 100.0%
Taylor expanded in t around 0 68.6%
Taylor expanded in y around 0 51.0%
*-commutative51.0%
associate-*l*51.0%
Simplified51.0%
if 3.0999999999999998e138 < y Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 76.1%
Taylor expanded in t around 0 70.0%
Taylor expanded in y around inf 65.4%
*-commutative65.4%
Simplified65.4%
Final simplification54.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7e-31) (not (<= x 3.5e-40))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* y 5.0) (* 2.0 (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7e-31) || !(x <= 3.5e-40)) {
tmp = x * ((2.0 * (y + z)) + t);
} 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 <= (-7d-31)) .or. (.not. (x <= 3.5d-40))) then
tmp = x * ((2.0d0 * (y + z)) + t)
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 <= -7e-31) || !(x <= 3.5e-40)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (2.0 * (x * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7e-31) or not (x <= 3.5e-40): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (y * 5.0) + (2.0 * (x * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7e-31) || !(x <= 3.5e-40)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); 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 <= -7e-31) || ~((x <= 3.5e-40))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (y * 5.0) + (2.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7e-31], N[Not[LessEqual[x, 3.5e-40]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $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 \cdot 10^{-31} \lor \neg \left(x \leq 3.5 \cdot 10^{-40}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -6.99999999999999971e-31 or 3.5000000000000002e-40 < 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 98.1%
if -6.99999999999999971e-31 < x < 3.5000000000000002e-40Initial program 99.9%
Taylor expanded in z around inf 87.9%
Simplified87.9%
Final simplification93.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.2e-29) (not (<= x 1.75e-20))) (* 2.0 (* x (+ y z))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.2e-29) || !(x <= 1.75e-20)) {
tmp = 2.0 * (x * (y + 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-29)) .or. (.not. (x <= 1.75d-20))) then
tmp = 2.0d0 * (x * (y + 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-29) || !(x <= 1.75e-20)) {
tmp = 2.0 * (x * (y + z));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5.2e-29) or not (x <= 1.75e-20): tmp = 2.0 * (x * (y + z)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5.2e-29) || !(x <= 1.75e-20)) tmp = Float64(2.0 * Float64(x * Float64(y + 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-29) || ~((x <= 1.75e-20))) tmp = 2.0 * (x * (y + z)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.2e-29], N[Not[LessEqual[x, 1.75e-20]], $MachinePrecision]], N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{-29} \lor \neg \left(x \leq 1.75 \cdot 10^{-20}\right):\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -5.2000000000000004e-29 or 1.75000000000000002e-20 < 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%
Taylor expanded in t around 0 73.0%
if -5.2000000000000004e-29 < x < 1.75000000000000002e-20Initial program 99.9%
Taylor expanded in x around 0 60.1%
Simplified60.1%
Final simplification67.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.6e+103) (not (<= y 2.1e-53))) (* y (+ 5.0 (* x 2.0))) (* 2.0 (* x (+ y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.6e+103) || !(y <= 2.1e-53)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = 2.0 * (x * (y + 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 ((y <= (-2.6d+103)) .or. (.not. (y <= 2.1d-53))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = 2.0d0 * (x * (y + z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.6e+103) || !(y <= 2.1e-53)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = 2.0 * (x * (y + z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.6e+103) or not (y <= 2.1e-53): tmp = y * (5.0 + (x * 2.0)) else: tmp = 2.0 * (x * (y + z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.6e+103) || !(y <= 2.1e-53)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(2.0 * Float64(x * Float64(y + z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.6e+103) || ~((y <= 2.1e-53))) tmp = y * (5.0 + (x * 2.0)); else tmp = 2.0 * (x * (y + z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.6e+103], N[Not[LessEqual[y, 2.1e-53]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{+103} \lor \neg \left(y \leq 2.1 \cdot 10^{-53}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\
\end{array}
\end{array}
if y < -2.6000000000000002e103 or 2.09999999999999977e-53 < y Initial program 99.9%
Taylor expanded in y around inf 79.1%
Simplified79.1%
if -2.6000000000000002e103 < y < 2.09999999999999977e-53Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 89.6%
Taylor expanded in t around 0 58.6%
Final simplification68.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.1e+36) (not (<= x 4.4e-7))) (* 2.0 (* x (+ y z))) (+ (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.1e+36) || !(x <= 4.4e-7)) {
tmp = 2.0 * (x * (y + z));
} 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 <= (-1.1d+36)) .or. (.not. (x <= 4.4d-7))) then
tmp = 2.0d0 * (x * (y + z))
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 <= -1.1e+36) || !(x <= 4.4e-7)) {
tmp = 2.0 * (x * (y + z));
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.1e+36) or not (x <= 4.4e-7): tmp = 2.0 * (x * (y + z)) else: tmp = (y * 5.0) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.1e+36) || !(x <= 4.4e-7)) tmp = Float64(2.0 * Float64(x * Float64(y + z))); 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 <= -1.1e+36) || ~((x <= 4.4e-7))) tmp = 2.0 * (x * (y + z)); else tmp = (y * 5.0) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.1e+36], N[Not[LessEqual[x, 4.4e-7]], $MachinePrecision]], N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{+36} \lor \neg \left(x \leq 4.4 \cdot 10^{-7}\right):\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\end{array}
\end{array}
if x < -1.1e36 or 4.4000000000000002e-7 < 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%
Taylor expanded in t around 0 76.8%
if -1.1e36 < x < 4.4000000000000002e-7Initial program 99.9%
Taylor expanded in t around inf 72.7%
Simplified72.7%
Final simplification74.8%
(FPCore (x y z t) :precision binary64 (+ (* y 5.0) (* x (+ t (+ y (+ y (* 2.0 z)))))))
double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (y + (2.0 * z)))));
}
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) + (x * (t + (y + (y + (2.0d0 * z)))))
end function
public static double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (y + (2.0 * z)))));
}
def code(x, y, z, t): return (y * 5.0) + (x * (t + (y + (y + (2.0 * z)))))
function code(x, y, z, t) return Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + Float64(y + Float64(2.0 * z)))))) end
function tmp = code(x, y, z, t) tmp = (y * 5.0) + (x * (t + (y + (y + (2.0 * z))))); end
code[x_, y_, z_, t_] := N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + N[(y + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5 + x \cdot \left(t + \left(y + \left(y + 2 \cdot z\right)\right)\right)
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (+ (* y 5.0) (* x (+ t (+ y (+ z (+ y z)))))))
double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (z + (y + z)))));
}
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) + (x * (t + (y + (z + (y + z)))))
end function
public static double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (z + (y + z)))));
}
def code(x, y, z, t): return (y * 5.0) + (x * (t + (y + (z + (y + z)))))
function code(x, y, z, t) return Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + Float64(z + Float64(y + z)))))) end
function tmp = code(x, y, z, t) tmp = (y * 5.0) + (x * (t + (y + (z + (y + z))))); end
code[x_, y_, z_, t_] := N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5 + x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.9e-31) (not (<= x 1.9e+17))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.9e-31) || !(x <= 1.9e+17)) {
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 <= (-2.9d-31)) .or. (.not. (x <= 1.9d+17))) 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 <= -2.9e-31) || !(x <= 1.9e+17)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.9e-31) or not (x <= 1.9e+17): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.9e-31) || !(x <= 1.9e+17)) 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 <= -2.9e-31) || ~((x <= 1.9e+17))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.9e-31], N[Not[LessEqual[x, 1.9e+17]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{-31} \lor \neg \left(x \leq 1.9 \cdot 10^{+17}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -2.9000000000000001e-31 or 1.9e17 < x Initial program 100.0%
Taylor expanded in t around inf 38.1%
Simplified38.1%
Taylor expanded in t around inf 40.6%
Taylor expanded in t around inf 36.8%
*-commutative36.8%
Simplified36.8%
if -2.9000000000000001e-31 < x < 1.9e17Initial program 99.9%
Taylor expanded in x around 0 59.1%
Simplified59.1%
Final simplification46.6%
(FPCore (x y z t) :precision binary64 (* x t))
double code(double x, double y, double z, double t) {
return x * t;
}
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
end function
public static double code(double x, double y, double z, double t) {
return x * t;
}
def code(x, y, z, t): return x * t
function code(x, y, z, t) return Float64(x * t) end
function tmp = code(x, y, z, t) tmp = x * t; end
code[x_, y_, z_, t_] := N[(x * t), $MachinePrecision]
\begin{array}{l}
\\
x \cdot t
\end{array}
Initial program 99.9%
Taylor expanded in t around inf 52.7%
Simplified52.7%
Taylor expanded in t around inf 51.9%
Taylor expanded in t around inf 27.3%
*-commutative27.3%
Simplified27.3%
Final simplification27.3%
herbie shell --seed 2024067
(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)))