
(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 15 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 5.0 y (* x (+ t (* 2.0 (+ y z))))))
double code(double x, double y, double z, double t) {
return fma(5.0, y, (x * (t + (2.0 * (y + z)))));
}
function code(x, y, z, t) return fma(5.0, y, Float64(x * Float64(t + Float64(2.0 * Float64(y + z))))) end
code[x_, y_, z_, t_] := N[(5.0 * y + N[(x * N[(t + N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(5, y, x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\right)
\end{array}
Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in t around 0 97.2%
*-commutative97.2%
fma-define97.2%
*-commutative97.2%
Applied egg-rr97.2%
Taylor expanded in x around 0 99.9%
fma-define100.0%
Simplified100.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.2e-12) (not (<= x 2.3e-103))) (* x (+ t (+ (* 2.0 (+ y z)) (* 5.0 (/ y x))))) (+ (* 5.0 y) (* x (+ t (* 2.0 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.2e-12) || !(x <= 2.3e-103)) {
tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x))));
} else {
tmp = (5.0 * y) + (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 ((x <= (-7.2d-12)) .or. (.not. (x <= 2.3d-103))) then
tmp = x * (t + ((2.0d0 * (y + z)) + (5.0d0 * (y / x))))
else
tmp = (5.0d0 * y) + (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 ((x <= -7.2e-12) || !(x <= 2.3e-103)) {
tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x))));
} else {
tmp = (5.0 * y) + (x * (t + (2.0 * z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.2e-12) or not (x <= 2.3e-103): tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x)))) else: tmp = (5.0 * y) + (x * (t + (2.0 * z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7.2e-12) || !(x <= 2.3e-103)) tmp = Float64(x * Float64(t + Float64(Float64(2.0 * Float64(y + z)) + Float64(5.0 * Float64(y / x))))); else tmp = Float64(Float64(5.0 * y) + Float64(x * Float64(t + Float64(2.0 * z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -7.2e-12) || ~((x <= 2.3e-103))) tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x)))); else tmp = (5.0 * y) + (x * (t + (2.0 * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.2e-12], N[Not[LessEqual[x, 2.3e-103]], $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[(5.0 * y), $MachinePrecision] + N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-12} \lor \neg \left(x \leq 2.3 \cdot 10^{-103}\right):\\
\;\;\;\;x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \frac{y}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;5 \cdot y + x \cdot \left(t + 2 \cdot z\right)\\
\end{array}
\end{array}
if x < -7.2e-12 or 2.3000000000000001e-103 < x Initial 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 -7.2e-12 < x < 2.3000000000000001e-103Initial program 99.9%
Taylor expanded in y around 0 99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(if (<= x -2.1e+92)
(* x (+ t (* y 2.0)))
(if (or (<= x -1.4e-211) (not (<= x 1.6e-156)))
(* x (+ t (* 2.0 z)))
(* 5.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.1e+92) {
tmp = x * (t + (y * 2.0));
} else if ((x <= -1.4e-211) || !(x <= 1.6e-156)) {
tmp = x * (t + (2.0 * z));
} else {
tmp = 5.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) :: tmp
if (x <= (-2.1d+92)) then
tmp = x * (t + (y * 2.0d0))
else if ((x <= (-1.4d-211)) .or. (.not. (x <= 1.6d-156))) then
tmp = x * (t + (2.0d0 * z))
else
tmp = 5.0d0 * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.1e+92) {
tmp = x * (t + (y * 2.0));
} else if ((x <= -1.4e-211) || !(x <= 1.6e-156)) {
tmp = x * (t + (2.0 * z));
} else {
tmp = 5.0 * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.1e+92: tmp = x * (t + (y * 2.0)) elif (x <= -1.4e-211) or not (x <= 1.6e-156): tmp = x * (t + (2.0 * z)) else: tmp = 5.0 * y return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.1e+92) tmp = Float64(x * Float64(t + Float64(y * 2.0))); elseif ((x <= -1.4e-211) || !(x <= 1.6e-156)) tmp = Float64(x * Float64(t + Float64(2.0 * z))); else tmp = Float64(5.0 * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.1e+92) tmp = x * (t + (y * 2.0)); elseif ((x <= -1.4e-211) || ~((x <= 1.6e-156))) tmp = x * (t + (2.0 * z)); else tmp = 5.0 * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.1e+92], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -1.4e-211], N[Not[LessEqual[x, 1.6e-156]], $MachinePrecision]], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(5.0 * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+92}:\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{-211} \lor \neg \left(x \leq 1.6 \cdot 10^{-156}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;5 \cdot y\\
\end{array}
\end{array}
if x < -2.09999999999999986e92Initial 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%
Taylor expanded in z around 0 80.8%
if -2.09999999999999986e92 < x < -1.3999999999999999e-211 or 1.59999999999999991e-156 < x Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 81.4%
Taylor expanded in y around 0 71.4%
if -1.3999999999999999e-211 < x < 1.59999999999999991e-156Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 66.4%
Simplified66.4%
Taylor expanded in x around 0 66.4%
Final simplification71.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.5) (not (<= x 1.05e-6))) (* x (+ t (* 2.0 (+ y z)))) (+ (* 5.0 y) (* x (+ t (* 2.0 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.5) || !(x <= 1.05e-6)) {
tmp = x * (t + (2.0 * (y + z)));
} else {
tmp = (5.0 * y) + (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 ((x <= (-2.5d0)) .or. (.not. (x <= 1.05d-6))) then
tmp = x * (t + (2.0d0 * (y + z)))
else
tmp = (5.0d0 * y) + (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 ((x <= -2.5) || !(x <= 1.05e-6)) {
tmp = x * (t + (2.0 * (y + z)));
} else {
tmp = (5.0 * y) + (x * (t + (2.0 * z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.5) or not (x <= 1.05e-6): tmp = x * (t + (2.0 * (y + z))) else: tmp = (5.0 * y) + (x * (t + (2.0 * z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.5) || !(x <= 1.05e-6)) tmp = Float64(x * Float64(t + Float64(2.0 * Float64(y + z)))); else tmp = Float64(Float64(5.0 * y) + Float64(x * Float64(t + Float64(2.0 * z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.5) || ~((x <= 1.05e-6))) tmp = x * (t + (2.0 * (y + z))); else tmp = (5.0 * y) + (x * (t + (2.0 * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.5], N[Not[LessEqual[x, 1.05e-6]], $MachinePrecision]], N[(x * N[(t + N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(5.0 * y), $MachinePrecision] + N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \lor \neg \left(x \leq 1.05 \cdot 10^{-6}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;5 \cdot y + x \cdot \left(t + 2 \cdot z\right)\\
\end{array}
\end{array}
if x < -2.5 or 1.0499999999999999e-6 < 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.9%
if -2.5 < x < 1.0499999999999999e-6Initial program 99.9%
Taylor expanded in y around 0 98.7%
Final simplification98.8%
(FPCore (x y z t)
:precision binary64
(if (<= z -390000000000.0)
(+ (* 5.0 y) (* 2.0 (* x z)))
(if (<= z 8.5e+127)
(+ (* y (+ 5.0 (* x 2.0))) (* x t))
(* x (+ t (* 2.0 (+ y z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -390000000000.0) {
tmp = (5.0 * y) + (2.0 * (x * z));
} else if (z <= 8.5e+127) {
tmp = (y * (5.0 + (x * 2.0))) + (x * t);
} else {
tmp = x * (t + (2.0 * (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 (z <= (-390000000000.0d0)) then
tmp = (5.0d0 * y) + (2.0d0 * (x * z))
else if (z <= 8.5d+127) then
tmp = (y * (5.0d0 + (x * 2.0d0))) + (x * t)
else
tmp = x * (t + (2.0d0 * (y + z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -390000000000.0) {
tmp = (5.0 * y) + (2.0 * (x * z));
} else if (z <= 8.5e+127) {
tmp = (y * (5.0 + (x * 2.0))) + (x * t);
} else {
tmp = x * (t + (2.0 * (y + z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -390000000000.0: tmp = (5.0 * y) + (2.0 * (x * z)) elif z <= 8.5e+127: tmp = (y * (5.0 + (x * 2.0))) + (x * t) else: tmp = x * (t + (2.0 * (y + z))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -390000000000.0) tmp = Float64(Float64(5.0 * y) + Float64(2.0 * Float64(x * z))); elseif (z <= 8.5e+127) tmp = Float64(Float64(y * Float64(5.0 + Float64(x * 2.0))) + Float64(x * t)); else tmp = Float64(x * Float64(t + Float64(2.0 * Float64(y + z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -390000000000.0) tmp = (5.0 * y) + (2.0 * (x * z)); elseif (z <= 8.5e+127) tmp = (y * (5.0 + (x * 2.0))) + (x * t); else tmp = x * (t + (2.0 * (y + z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -390000000000.0], N[(N[(5.0 * y), $MachinePrecision] + N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e+127], N[(N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -390000000000:\\
\;\;\;\;5 \cdot y + 2 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+127}:\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right) + x \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\
\end{array}
\end{array}
if z < -3.9e11Initial program 100.0%
Taylor expanded in z around inf 84.3%
if -3.9e11 < z < 8.4999999999999997e127Initial program 99.8%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around 0 99.9%
Taylor expanded in t around inf 93.2%
*-commutative93.2%
Simplified93.2%
if 8.4999999999999997e127 < z Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 89.2%
Final simplification89.9%
(FPCore (x y z t)
:precision binary64
(if (<= t -3.8e+24)
(* x t)
(if (<= t -1.95e-86)
(* 5.0 y)
(if (<= t 1.85e+96) (* x (* 2.0 z)) (* x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.8e+24) {
tmp = x * t;
} else if (t <= -1.95e-86) {
tmp = 5.0 * y;
} else if (t <= 1.85e+96) {
tmp = x * (2.0 * z);
} 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 (t <= (-3.8d+24)) then
tmp = x * t
else if (t <= (-1.95d-86)) then
tmp = 5.0d0 * y
else if (t <= 1.85d+96) then
tmp = x * (2.0d0 * z)
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 (t <= -3.8e+24) {
tmp = x * t;
} else if (t <= -1.95e-86) {
tmp = 5.0 * y;
} else if (t <= 1.85e+96) {
tmp = x * (2.0 * z);
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.8e+24: tmp = x * t elif t <= -1.95e-86: tmp = 5.0 * y elif t <= 1.85e+96: tmp = x * (2.0 * z) else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.8e+24) tmp = Float64(x * t); elseif (t <= -1.95e-86) tmp = Float64(5.0 * y); elseif (t <= 1.85e+96) tmp = Float64(x * Float64(2.0 * z)); else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -3.8e+24) tmp = x * t; elseif (t <= -1.95e-86) tmp = 5.0 * y; elseif (t <= 1.85e+96) tmp = x * (2.0 * z); else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.8e+24], N[(x * t), $MachinePrecision], If[LessEqual[t, -1.95e-86], N[(5.0 * y), $MachinePrecision], If[LessEqual[t, 1.85e+96], N[(x * N[(2.0 * z), $MachinePrecision]), $MachinePrecision], N[(x * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+24}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;t \leq -1.95 \cdot 10^{-86}:\\
\;\;\;\;5 \cdot y\\
\mathbf{elif}\;t \leq 1.85 \cdot 10^{+96}:\\
\;\;\;\;x \cdot \left(2 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if t < -3.80000000000000015e24 or 1.84999999999999996e96 < t Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in t around 0 94.1%
*-commutative94.1%
fma-define94.1%
*-commutative94.1%
Applied egg-rr94.1%
Taylor expanded in x around 0 99.9%
fma-define100.0%
Simplified100.0%
Taylor expanded in t around inf 58.3%
*-commutative58.3%
Simplified58.3%
if -3.80000000000000015e24 < t < -1.9500000000000001e-86Initial program 99.6%
fma-define99.6%
associate-+l+99.6%
+-commutative99.6%
count-299.6%
Simplified99.6%
Taylor expanded in y around inf 71.6%
Simplified54.2%
Taylor expanded in x around 0 54.2%
if -1.9500000000000001e-86 < t < 1.84999999999999996e96Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in t around 0 99.9%
*-commutative99.9%
fma-define99.9%
*-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 52.0%
associate-*r*52.0%
*-commutative52.0%
associate-*l*52.0%
Simplified52.0%
Final simplification55.1%
(FPCore (x y z t) :precision binary64 (if (<= x 1e+41) (+ (* 2.0 (* x (+ y z))) (+ (* 5.0 y) (* x t))) (* x (+ t (* 2.0 (+ y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1e+41) {
tmp = (2.0 * (x * (y + z))) + ((5.0 * y) + (x * t));
} else {
tmp = x * (t + (2.0 * (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 (x <= 1d+41) then
tmp = (2.0d0 * (x * (y + z))) + ((5.0d0 * y) + (x * t))
else
tmp = x * (t + (2.0d0 * (y + z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1e+41) {
tmp = (2.0 * (x * (y + z))) + ((5.0 * y) + (x * t));
} else {
tmp = x * (t + (2.0 * (y + z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 1e+41: tmp = (2.0 * (x * (y + z))) + ((5.0 * y) + (x * t)) else: tmp = x * (t + (2.0 * (y + z))) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 1e+41) tmp = Float64(Float64(2.0 * Float64(x * Float64(y + z))) + Float64(Float64(5.0 * y) + Float64(x * t))); else tmp = Float64(x * Float64(t + Float64(2.0 * Float64(y + z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 1e+41) tmp = (2.0 * (x * (y + z))) + ((5.0 * y) + (x * t)); else tmp = x * (t + (2.0 * (y + z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 1e+41], N[(N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(5.0 * y), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{+41}:\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + \left(5 \cdot y + x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\
\end{array}
\end{array}
if x < 1.00000000000000001e41Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in t around 0 98.9%
if 1.00000000000000001e41 < 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%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.02e-18) (not (<= x 1.7e-85))) (* x (+ t (* 2.0 (+ y z)))) (+ (* 5.0 y) (* 2.0 (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.02e-18) || !(x <= 1.7e-85)) {
tmp = x * (t + (2.0 * (y + z)));
} else {
tmp = (5.0 * y) + (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 <= (-1.02d-18)) .or. (.not. (x <= 1.7d-85))) then
tmp = x * (t + (2.0d0 * (y + z)))
else
tmp = (5.0d0 * y) + (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 <= -1.02e-18) || !(x <= 1.7e-85)) {
tmp = x * (t + (2.0 * (y + z)));
} else {
tmp = (5.0 * y) + (2.0 * (x * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.02e-18) or not (x <= 1.7e-85): tmp = x * (t + (2.0 * (y + z))) else: tmp = (5.0 * y) + (2.0 * (x * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.02e-18) || !(x <= 1.7e-85)) tmp = Float64(x * Float64(t + Float64(2.0 * Float64(y + z)))); else tmp = Float64(Float64(5.0 * y) + Float64(2.0 * Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.02e-18) || ~((x <= 1.7e-85))) tmp = x * (t + (2.0 * (y + z))); else tmp = (5.0 * y) + (2.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.02e-18], N[Not[LessEqual[x, 1.7e-85]], $MachinePrecision]], N[(x * N[(t + N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(5.0 * y), $MachinePrecision] + N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.02 \cdot 10^{-18} \lor \neg \left(x \leq 1.7 \cdot 10^{-85}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;5 \cdot y + 2 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -1.02e-18 or 1.7e-85 < x Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 95.2%
if -1.02e-18 < x < 1.7e-85Initial program 99.9%
Taylor expanded in z around inf 80.8%
Final simplification89.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.5e-18) (not (<= x 2.9e-146))) (* x (+ t (* 2.0 (+ y z)))) (+ (* 5.0 y) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.5e-18) || !(x <= 2.9e-146)) {
tmp = x * (t + (2.0 * (y + z)));
} else {
tmp = (5.0 * y) + (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-18)) .or. (.not. (x <= 2.9d-146))) then
tmp = x * (t + (2.0d0 * (y + z)))
else
tmp = (5.0d0 * y) + (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-18) || !(x <= 2.9e-146)) {
tmp = x * (t + (2.0 * (y + z)));
} else {
tmp = (5.0 * y) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.5e-18) or not (x <= 2.9e-146): tmp = x * (t + (2.0 * (y + z))) else: tmp = (5.0 * y) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.5e-18) || !(x <= 2.9e-146)) tmp = Float64(x * Float64(t + Float64(2.0 * Float64(y + z)))); else tmp = Float64(Float64(5.0 * y) + Float64(x * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.5e-18) || ~((x <= 2.9e-146))) tmp = x * (t + (2.0 * (y + z))); else tmp = (5.0 * y) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.5e-18], N[Not[LessEqual[x, 2.9e-146]], $MachinePrecision]], N[(x * N[(t + N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(5.0 * y), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{-18} \lor \neg \left(x \leq 2.9 \cdot 10^{-146}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;5 \cdot y + x \cdot t\\
\end{array}
\end{array}
if x < -4.49999999999999994e-18 or 2.90000000000000011e-146 < x Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 92.5%
if -4.49999999999999994e-18 < x < 2.90000000000000011e-146Initial program 99.9%
Taylor expanded in t around inf 80.5%
Simplified80.5%
Final simplification88.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.16e+114) (not (<= y 4.2e+32))) (* 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 <= -2.16e+114) || !(y <= 4.2e+32)) {
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 <= (-2.16d+114)) .or. (.not. (y <= 4.2d+32))) 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 <= -2.16e+114) || !(y <= 4.2e+32)) {
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 <= -2.16e+114) or not (y <= 4.2e+32): 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 <= -2.16e+114) || !(y <= 4.2e+32)) 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 <= -2.16e+114) || ~((y <= 4.2e+32))) 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, -2.16e+114], N[Not[LessEqual[y, 4.2e+32]], $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 -2.16 \cdot 10^{+114} \lor \neg \left(y \leq 4.2 \cdot 10^{+32}\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 < -2.16000000000000009e114 or 4.2000000000000001e32 < y Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 80.5%
if -2.16000000000000009e114 < y < 4.2000000000000001e32Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 83.7%
Taylor expanded in y around 0 80.6%
Final simplification80.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -390000000000.0) (not (<= z 1.9e+126))) (* x (* 2.0 z)) (* x (+ t (* y 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -390000000000.0) || !(z <= 1.9e+126)) {
tmp = x * (2.0 * z);
} else {
tmp = x * (t + (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 ((z <= (-390000000000.0d0)) .or. (.not. (z <= 1.9d+126))) then
tmp = x * (2.0d0 * z)
else
tmp = x * (t + (y * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -390000000000.0) || !(z <= 1.9e+126)) {
tmp = x * (2.0 * z);
} else {
tmp = x * (t + (y * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -390000000000.0) or not (z <= 1.9e+126): tmp = x * (2.0 * z) else: tmp = x * (t + (y * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -390000000000.0) || !(z <= 1.9e+126)) tmp = Float64(x * Float64(2.0 * z)); else tmp = Float64(x * Float64(t + Float64(y * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -390000000000.0) || ~((z <= 1.9e+126))) tmp = x * (2.0 * z); else tmp = x * (t + (y * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -390000000000.0], N[Not[LessEqual[z, 1.9e+126]], $MachinePrecision]], N[(x * N[(2.0 * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -390000000000 \lor \neg \left(z \leq 1.9 \cdot 10^{+126}\right):\\
\;\;\;\;x \cdot \left(2 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\end{array}
\end{array}
if z < -3.9e11 or 1.90000000000000008e126 < z Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in t around 0 93.9%
*-commutative93.9%
fma-define93.9%
*-commutative93.9%
Applied egg-rr93.9%
Taylor expanded in z around inf 66.8%
associate-*r*66.8%
*-commutative66.8%
associate-*l*66.8%
Simplified66.8%
if -3.9e11 < z < 1.90000000000000008e126Initial program 99.8%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 67.2%
Taylor expanded in z around 0 61.1%
Final simplification63.7%
(FPCore (x y z t) :precision binary64 (+ (* x (+ t (+ y (+ z (+ y z))))) (* 5.0 y)))
double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (5.0 * y);
}
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))))) + (5.0d0 * y)
end function
public static double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (5.0 * y);
}
def code(x, y, z, t): return (x * (t + (y + (z + (y + z))))) + (5.0 * y)
function code(x, y, z, t) return Float64(Float64(x * Float64(t + Float64(y + Float64(z + Float64(y + z))))) + Float64(5.0 * y)) end
function tmp = code(x, y, z, t) tmp = (x * (t + (y + (z + (y + z))))) + (5.0 * y); end
code[x_, y_, z_, t_] := N[(N[(x * N[(t + N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(5.0 * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) + 5 \cdot y
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (+ (* x (+ t (* 2.0 z))) (* y (+ 5.0 (* x 2.0)))))
double code(double x, double y, double z, double t) {
return (x * (t + (2.0 * z))) + (y * (5.0 + (x * 2.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 + (2.0d0 * z))) + (y * (5.0d0 + (x * 2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return (x * (t + (2.0 * z))) + (y * (5.0 + (x * 2.0)));
}
def code(x, y, z, t): return (x * (t + (2.0 * z))) + (y * (5.0 + (x * 2.0)))
function code(x, y, z, t) return Float64(Float64(x * Float64(t + Float64(2.0 * z))) + Float64(y * Float64(5.0 + Float64(x * 2.0)))) end
function tmp = code(x, y, z, t) tmp = (x * (t + (2.0 * z))) + (y * (5.0 + (x * 2.0))); end
code[x_, y_, z_, t_] := 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}
\\
x \cdot \left(t + 2 \cdot z\right) + y \cdot \left(5 + x \cdot 2\right)
\end{array}
Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around 0 97.6%
Final simplification97.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7.5e+25) (not (<= t 1.8e+104))) (* x t) (* 5.0 y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.5e+25) || !(t <= 1.8e+104)) {
tmp = x * t;
} else {
tmp = 5.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) :: tmp
if ((t <= (-7.5d+25)) .or. (.not. (t <= 1.8d+104))) then
tmp = x * t
else
tmp = 5.0d0 * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.5e+25) || !(t <= 1.8e+104)) {
tmp = x * t;
} else {
tmp = 5.0 * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7.5e+25) or not (t <= 1.8e+104): tmp = x * t else: tmp = 5.0 * y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7.5e+25) || !(t <= 1.8e+104)) tmp = Float64(x * t); else tmp = Float64(5.0 * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -7.5e+25) || ~((t <= 1.8e+104))) tmp = x * t; else tmp = 5.0 * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7.5e+25], N[Not[LessEqual[t, 1.8e+104]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(5.0 * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{+25} \lor \neg \left(t \leq 1.8 \cdot 10^{+104}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;5 \cdot y\\
\end{array}
\end{array}
if t < -7.49999999999999993e25 or 1.8e104 < t Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in t around 0 94.0%
*-commutative94.0%
fma-define94.0%
*-commutative94.0%
Applied egg-rr94.0%
Taylor expanded in x around 0 99.9%
fma-define100.0%
Simplified100.0%
Taylor expanded in t around inf 58.7%
*-commutative58.7%
Simplified58.7%
if -7.49999999999999993e25 < t < 1.8e104Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 53.8%
Simplified33.6%
Taylor expanded in x around 0 33.6%
Final simplification45.1%
(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%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in t around 0 97.2%
*-commutative97.2%
fma-define97.2%
*-commutative97.2%
Applied egg-rr97.2%
Taylor expanded in x around 0 99.9%
fma-define100.0%
Simplified100.0%
Taylor expanded in t around inf 29.4%
*-commutative29.4%
Simplified29.4%
herbie shell --seed 2024151
(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)))