
(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 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 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (* 2.0 y))))
(if (<= x -1.1e+146)
(* x t)
(if (<= x -3.8e+67)
t_1
(if (<= x -4.2e+34)
(* x t)
(if (<= x -9.6e+19)
t_1
(if (<= x -2e-57)
(* 2.0 (* x z))
(if (<= x 2.4e-59)
(* y 5.0)
(if (or (<= x 4.7e+79) (not (<= x 1.45e+147)))
(* x t)
t_1)))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (2.0 * y);
double tmp;
if (x <= -1.1e+146) {
tmp = x * t;
} else if (x <= -3.8e+67) {
tmp = t_1;
} else if (x <= -4.2e+34) {
tmp = x * t;
} else if (x <= -9.6e+19) {
tmp = t_1;
} else if (x <= -2e-57) {
tmp = 2.0 * (x * z);
} else if (x <= 2.4e-59) {
tmp = y * 5.0;
} else if ((x <= 4.7e+79) || !(x <= 1.45e+147)) {
tmp = x * t;
} 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 = x * (2.0d0 * y)
if (x <= (-1.1d+146)) then
tmp = x * t
else if (x <= (-3.8d+67)) then
tmp = t_1
else if (x <= (-4.2d+34)) then
tmp = x * t
else if (x <= (-9.6d+19)) then
tmp = t_1
else if (x <= (-2d-57)) then
tmp = 2.0d0 * (x * z)
else if (x <= 2.4d-59) then
tmp = y * 5.0d0
else if ((x <= 4.7d+79) .or. (.not. (x <= 1.45d+147))) then
tmp = x * t
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 = x * (2.0 * y);
double tmp;
if (x <= -1.1e+146) {
tmp = x * t;
} else if (x <= -3.8e+67) {
tmp = t_1;
} else if (x <= -4.2e+34) {
tmp = x * t;
} else if (x <= -9.6e+19) {
tmp = t_1;
} else if (x <= -2e-57) {
tmp = 2.0 * (x * z);
} else if (x <= 2.4e-59) {
tmp = y * 5.0;
} else if ((x <= 4.7e+79) || !(x <= 1.45e+147)) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (2.0 * y) tmp = 0 if x <= -1.1e+146: tmp = x * t elif x <= -3.8e+67: tmp = t_1 elif x <= -4.2e+34: tmp = x * t elif x <= -9.6e+19: tmp = t_1 elif x <= -2e-57: tmp = 2.0 * (x * z) elif x <= 2.4e-59: tmp = y * 5.0 elif (x <= 4.7e+79) or not (x <= 1.45e+147): tmp = x * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(2.0 * y)) tmp = 0.0 if (x <= -1.1e+146) tmp = Float64(x * t); elseif (x <= -3.8e+67) tmp = t_1; elseif (x <= -4.2e+34) tmp = Float64(x * t); elseif (x <= -9.6e+19) tmp = t_1; elseif (x <= -2e-57) tmp = Float64(2.0 * Float64(x * z)); elseif (x <= 2.4e-59) tmp = Float64(y * 5.0); elseif ((x <= 4.7e+79) || !(x <= 1.45e+147)) tmp = Float64(x * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (2.0 * y); tmp = 0.0; if (x <= -1.1e+146) tmp = x * t; elseif (x <= -3.8e+67) tmp = t_1; elseif (x <= -4.2e+34) tmp = x * t; elseif (x <= -9.6e+19) tmp = t_1; elseif (x <= -2e-57) tmp = 2.0 * (x * z); elseif (x <= 2.4e-59) tmp = y * 5.0; elseif ((x <= 4.7e+79) || ~((x <= 1.45e+147))) tmp = x * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.1e+146], N[(x * t), $MachinePrecision], If[LessEqual[x, -3.8e+67], t$95$1, If[LessEqual[x, -4.2e+34], N[(x * t), $MachinePrecision], If[LessEqual[x, -9.6e+19], t$95$1, If[LessEqual[x, -2e-57], N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.4e-59], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 4.7e+79], N[Not[LessEqual[x, 1.45e+147]], $MachinePrecision]], N[(x * t), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(2 \cdot y\right)\\
\mathbf{if}\;x \leq -1.1 \cdot 10^{+146}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -3.8 \cdot 10^{+67}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -4.2 \cdot 10^{+34}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -9.6 \cdot 10^{+19}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-57}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-59}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 4.7 \cdot 10^{+79} \lor \neg \left(x \leq 1.45 \cdot 10^{+147}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1.0999999999999999e146 or -3.8000000000000002e67 < x < -4.20000000000000035e34 or 2.40000000000000015e-59 < x < 4.70000000000000023e79 or 1.4499999999999999e147 < x Initial program 100.0%
Taylor expanded in t around inf 55.5%
Simplified55.5%
if -1.0999999999999999e146 < x < -3.8000000000000002e67 or -4.20000000000000035e34 < x < -9.6e19 or 4.70000000000000023e79 < x < 1.4499999999999999e147Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
distribute-lft-in100.0%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 65.1%
associate-*r*65.1%
*-commutative65.1%
associate-*r*65.1%
Simplified65.1%
if -9.6e19 < x < -1.99999999999999991e-57Initial program 99.7%
Taylor expanded in z around inf 47.0%
if -1.99999999999999991e-57 < x < 2.40000000000000015e-59Initial program 99.9%
Taylor expanded in x around 0 69.9%
Final simplification61.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* 2.0 z)))))
(if (<= x -1.55e-57)
t_1
(if (<= x 4.3e-63)
(* y 5.0)
(if (or (<= x 1.08e+82) (not (<= x 1.05e+144))) t_1 (* x (* 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 <= -1.55e-57) {
tmp = t_1;
} else if (x <= 4.3e-63) {
tmp = y * 5.0;
} else if ((x <= 1.08e+82) || !(x <= 1.05e+144)) {
tmp = t_1;
} else {
tmp = x * (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 <= (-1.55d-57)) then
tmp = t_1
else if (x <= 4.3d-63) then
tmp = y * 5.0d0
else if ((x <= 1.08d+82) .or. (.not. (x <= 1.05d+144))) then
tmp = t_1
else
tmp = x * (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 <= -1.55e-57) {
tmp = t_1;
} else if (x <= 4.3e-63) {
tmp = y * 5.0;
} else if ((x <= 1.08e+82) || !(x <= 1.05e+144)) {
tmp = t_1;
} else {
tmp = x * (2.0 * y);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (2.0 * z)) tmp = 0 if x <= -1.55e-57: tmp = t_1 elif x <= 4.3e-63: tmp = y * 5.0 elif (x <= 1.08e+82) or not (x <= 1.05e+144): tmp = t_1 else: tmp = x * (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 <= -1.55e-57) tmp = t_1; elseif (x <= 4.3e-63) tmp = Float64(y * 5.0); elseif ((x <= 1.08e+82) || !(x <= 1.05e+144)) tmp = t_1; else tmp = Float64(x * 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 <= -1.55e-57) tmp = t_1; elseif (x <= 4.3e-63) tmp = y * 5.0; elseif ((x <= 1.08e+82) || ~((x <= 1.05e+144))) tmp = t_1; else tmp = x * (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, -1.55e-57], t$95$1, If[LessEqual[x, 4.3e-63], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 1.08e+82], N[Not[LessEqual[x, 1.05e+144]], $MachinePrecision]], t$95$1, N[(x * N[(2.0 * y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{if}\;x \leq -1.55 \cdot 10^{-57}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{-63}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{+82} \lor \neg \left(x \leq 1.05 \cdot 10^{+144}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(2 \cdot y\right)\\
\end{array}
\end{array}
if x < -1.54999999999999988e-57 or 4.2999999999999999e-63 < x < 1.08e82 or 1.04999999999999998e144 < x Initial program 100.0%
Taylor expanded in y around 0 77.4%
if -1.54999999999999988e-57 < x < 4.2999999999999999e-63Initial program 99.9%
Taylor expanded in x around 0 70.6%
if 1.08e82 < x < 1.04999999999999998e144Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
distribute-lft-in100.0%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 69.6%
associate-*r*69.6%
*-commutative69.6%
associate-*r*69.6%
Simplified69.6%
Final simplification74.5%
(FPCore (x y z t)
:precision binary64
(if (<= x -7.6e+152)
(* x t)
(if (<= x -2.65e+72)
(* 2.0 (* x z))
(if (or (<= x -1.65e-57) (not (<= x 1.85e-59))) (* x t) (* y 5.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.6e+152) {
tmp = x * t;
} else if (x <= -2.65e+72) {
tmp = 2.0 * (x * z);
} else if ((x <= -1.65e-57) || !(x <= 1.85e-59)) {
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 <= (-7.6d+152)) then
tmp = x * t
else if (x <= (-2.65d+72)) then
tmp = 2.0d0 * (x * z)
else if ((x <= (-1.65d-57)) .or. (.not. (x <= 1.85d-59))) 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 <= -7.6e+152) {
tmp = x * t;
} else if (x <= -2.65e+72) {
tmp = 2.0 * (x * z);
} else if ((x <= -1.65e-57) || !(x <= 1.85e-59)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7.6e+152: tmp = x * t elif x <= -2.65e+72: tmp = 2.0 * (x * z) elif (x <= -1.65e-57) or not (x <= 1.85e-59): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7.6e+152) tmp = Float64(x * t); elseif (x <= -2.65e+72) tmp = Float64(2.0 * Float64(x * z)); elseif ((x <= -1.65e-57) || !(x <= 1.85e-59)) 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 <= -7.6e+152) tmp = x * t; elseif (x <= -2.65e+72) tmp = 2.0 * (x * z); elseif ((x <= -1.65e-57) || ~((x <= 1.85e-59))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7.6e+152], N[(x * t), $MachinePrecision], If[LessEqual[x, -2.65e+72], N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -1.65e-57], N[Not[LessEqual[x, 1.85e-59]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{+152}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -2.65 \cdot 10^{+72}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;x \leq -1.65 \cdot 10^{-57} \lor \neg \left(x \leq 1.85 \cdot 10^{-59}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -7.6000000000000001e152 or -2.6500000000000001e72 < x < -1.6499999999999999e-57 or 1.85e-59 < x Initial program 100.0%
Taylor expanded in t around inf 49.8%
Simplified49.8%
if -7.6000000000000001e152 < x < -2.6500000000000001e72Initial program 99.9%
Taylor expanded in z around inf 48.0%
if -1.6499999999999999e-57 < x < 1.85e-59Initial program 99.9%
Taylor expanded in x around 0 69.9%
Final simplification57.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.1e-47) (not (<= x 8.6e-60))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* y 5.0) (* x (+ t (+ y y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.1e-47) || !(x <= 8.6e-60)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * (t + (y + 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 ((x <= (-4.1d-47)) .or. (.not. (x <= 8.6d-60))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (y * 5.0d0) + (x * (t + (y + y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.1e-47) || !(x <= 8.6e-60)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * (t + (y + y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.1e-47) or not (x <= 8.6e-60): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (y * 5.0) + (x * (t + (y + y))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.1e-47) || !(x <= 8.6e-60)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.1e-47) || ~((x <= 8.6e-60))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (y * 5.0) + (x * (t + (y + y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.1e-47], N[Not[LessEqual[x, 8.6e-60]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.1 \cdot 10^{-47} \lor \neg \left(x \leq 8.6 \cdot 10^{-60}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + \left(y + y\right)\right)\\
\end{array}
\end{array}
if x < -4.10000000000000002e-47 or 8.6000000000000001e-60 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 98.8%
if -4.10000000000000002e-47 < x < 8.6000000000000001e-60Initial program 99.9%
Taylor expanded in y around inf 82.6%
Final simplification93.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.65e-57) (not (<= x 3.3e-62))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* y 5.0) (* (+ y z) (* x 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.65e-57) || !(x <= 3.3e-62)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + ((y + z) * (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 <= (-1.65d-57)) .or. (.not. (x <= 3.3d-62))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (y * 5.0d0) + ((y + z) * (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 <= -1.65e-57) || !(x <= 3.3e-62)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + ((y + z) * (x * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.65e-57) or not (x <= 3.3e-62): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (y * 5.0) + ((y + z) * (x * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.65e-57) || !(x <= 3.3e-62)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(y * 5.0) + Float64(Float64(y + z) * Float64(x * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.65e-57) || ~((x <= 3.3e-62))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (y * 5.0) + ((y + z) * (x * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.65e-57], N[Not[LessEqual[x, 3.3e-62]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(N[(y + z), $MachinePrecision] * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{-57} \lor \neg \left(x \leq 3.3 \cdot 10^{-62}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + \left(y + z\right) \cdot \left(x \cdot 2\right)\\
\end{array}
\end{array}
if x < -1.6499999999999999e-57 or 3.30000000000000004e-62 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 98.8%
if -1.6499999999999999e-57 < x < 3.30000000000000004e-62Initial program 99.9%
Taylor expanded in t around 0 86.6%
Simplified86.6%
Final simplification94.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.5e-47) (not (<= x 1.4e-62))) (* 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 <= -4.5e-47) || !(x <= 1.4e-62)) {
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 <= (-4.5d-47)) .or. (.not. (x <= 1.4d-62))) 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 <= -4.5e-47) || !(x <= 1.4e-62)) {
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 <= -4.5e-47) or not (x <= 1.4e-62): 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 <= -4.5e-47) || !(x <= 1.4e-62)) 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 <= -4.5e-47) || ~((x <= 1.4e-62))) 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, -4.5e-47], N[Not[LessEqual[x, 1.4e-62]], $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 -4.5 \cdot 10^{-47} \lor \neg \left(x \leq 1.4 \cdot 10^{-62}\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 < -4.5e-47 or 1.40000000000000001e-62 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 98.8%
if -4.5e-47 < x < 1.40000000000000001e-62Initial program 99.9%
distribute-rgt-in99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
*-commutative99.9%
*-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in t around inf 82.6%
Simplified82.6%
Final simplification93.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.6e+32) (not (<= y 9.8e+26))) (* y (+ 5.0 (* x 2.0))) (* x (+ t (* 2.0 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.6e+32) || !(y <= 9.8e+26)) {
tmp = y * (5.0 + (x * 2.0));
} 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) :: tmp
if ((y <= (-7.6d+32)) .or. (.not. (y <= 9.8d+26))) then
tmp = y * (5.0d0 + (x * 2.0d0))
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 tmp;
if ((y <= -7.6e+32) || !(y <= 9.8e+26)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (2.0 * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.6e+32) or not (y <= 9.8e+26): tmp = y * (5.0 + (x * 2.0)) else: tmp = x * (t + (2.0 * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.6e+32) || !(y <= 9.8e+26)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(x * Float64(t + Float64(2.0 * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.6e+32) || ~((y <= 9.8e+26))) tmp = y * (5.0 + (x * 2.0)); else tmp = x * (t + (2.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.6e+32], N[Not[LessEqual[y, 9.8e+26]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{+32} \lor \neg \left(y \leq 9.8 \cdot 10^{+26}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\end{array}
\end{array}
if y < -7.6000000000000006e32 or 9.79999999999999947e26 < y Initial program 99.9%
Taylor expanded in y around inf 82.7%
Simplified82.7%
if -7.6000000000000006e32 < y < 9.79999999999999947e26Initial program 100.0%
Taylor expanded in y around 0 83.6%
Final simplification83.2%
(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 100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.45e-57) (not (<= x 1.45e-59))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.45e-57) || !(x <= 1.45e-59)) {
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.45d-57)) .or. (.not. (x <= 1.45d-59))) 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.45e-57) || !(x <= 1.45e-59)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.45e-57) or not (x <= 1.45e-59): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.45e-57) || !(x <= 1.45e-59)) 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.45e-57) || ~((x <= 1.45e-59))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.45e-57], N[Not[LessEqual[x, 1.45e-59]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.45 \cdot 10^{-57} \lor \neg \left(x \leq 1.45 \cdot 10^{-59}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -2.44999999999999994e-57 or 1.45000000000000008e-59 < x Initial program 100.0%
Taylor expanded in t around inf 46.6%
Simplified46.6%
if -2.44999999999999994e-57 < x < 1.45000000000000008e-59Initial program 99.9%
Taylor expanded in x around 0 69.9%
Final simplification55.0%
(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 27.2%
Final simplification27.2%
herbie shell --seed 2024018
(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)))