
(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 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
(FPCore (x y z t) :precision binary64 (fma y 5.0 (* x (fma (+ y z) 2.0 t))))
double code(double x, double y, double z, double t) {
return fma(y, 5.0, (x * fma((y + z), 2.0, t)));
}
function code(x, y, z, t) return fma(y, 5.0, Float64(x * fma(Float64(y + z), 2.0, t))) end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(x * N[(N[(y + z), $MachinePrecision] * 2.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 5, x \cdot \mathsf{fma}\left(y + z, 2, t\right)\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
*-commutative100.0%
fma-def100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (fma x (+ t (* (+ y z) 2.0)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return fma(x, (t + ((y + z) * 2.0)), (y * 5.0));
}
function code(x, y, z, t) return fma(x, Float64(t + Float64(Float64(y + z) * 2.0)), Float64(y * 5.0)) end
code[x_, y_, z_, t_] := N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, t + \left(y + z\right) \cdot 2, y \cdot 5\right)
\end{array}
Initial program 99.9%
fma-def99.9%
+-commutative99.9%
associate-+l+99.9%
count-299.9%
+-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(if (<= x -2.2e+135)
(* x t)
(if (<= x -2.12e+71)
(* 2.0 (* x z))
(if (<= x -1.25e-7)
(* x t)
(if (<= x 3.3e-16)
(* y 5.0)
(if (or (<= x 6.8e+110) (not (<= x 1.95e+145)))
(* x t)
(* y (* x 2.0))))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.2e+135) {
tmp = x * t;
} else if (x <= -2.12e+71) {
tmp = 2.0 * (x * z);
} else if (x <= -1.25e-7) {
tmp = x * t;
} else if (x <= 3.3e-16) {
tmp = y * 5.0;
} else if ((x <= 6.8e+110) || !(x <= 1.95e+145)) {
tmp = x * t;
} else {
tmp = y * (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 <= (-2.2d+135)) then
tmp = x * t
else if (x <= (-2.12d+71)) then
tmp = 2.0d0 * (x * z)
else if (x <= (-1.25d-7)) then
tmp = x * t
else if (x <= 3.3d-16) then
tmp = y * 5.0d0
else if ((x <= 6.8d+110) .or. (.not. (x <= 1.95d+145))) then
tmp = x * t
else
tmp = y * (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 <= -2.2e+135) {
tmp = x * t;
} else if (x <= -2.12e+71) {
tmp = 2.0 * (x * z);
} else if (x <= -1.25e-7) {
tmp = x * t;
} else if (x <= 3.3e-16) {
tmp = y * 5.0;
} else if ((x <= 6.8e+110) || !(x <= 1.95e+145)) {
tmp = x * t;
} else {
tmp = y * (x * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.2e+135: tmp = x * t elif x <= -2.12e+71: tmp = 2.0 * (x * z) elif x <= -1.25e-7: tmp = x * t elif x <= 3.3e-16: tmp = y * 5.0 elif (x <= 6.8e+110) or not (x <= 1.95e+145): tmp = x * t else: tmp = y * (x * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.2e+135) tmp = Float64(x * t); elseif (x <= -2.12e+71) tmp = Float64(2.0 * Float64(x * z)); elseif (x <= -1.25e-7) tmp = Float64(x * t); elseif (x <= 3.3e-16) tmp = Float64(y * 5.0); elseif ((x <= 6.8e+110) || !(x <= 1.95e+145)) tmp = Float64(x * t); else tmp = Float64(y * Float64(x * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.2e+135) tmp = x * t; elseif (x <= -2.12e+71) tmp = 2.0 * (x * z); elseif (x <= -1.25e-7) tmp = x * t; elseif (x <= 3.3e-16) tmp = y * 5.0; elseif ((x <= 6.8e+110) || ~((x <= 1.95e+145))) tmp = x * t; else tmp = y * (x * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.2e+135], N[(x * t), $MachinePrecision], If[LessEqual[x, -2.12e+71], N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.25e-7], N[(x * t), $MachinePrecision], If[LessEqual[x, 3.3e-16], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 6.8e+110], N[Not[LessEqual[x, 1.95e+145]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{+135}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -2.12 \cdot 10^{+71}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;x \leq -1.25 \cdot 10^{-7}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{-16}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{+110} \lor \neg \left(x \leq 1.95 \cdot 10^{+145}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\
\end{array}
\end{array}
if x < -2.1999999999999999e135 or -2.12e71 < x < -1.24999999999999994e-7 or 3.29999999999999988e-16 < x < 6.8000000000000003e110 or 1.9499999999999999e145 < x Initial program 100.0%
Taylor expanded in t around inf 56.4%
if -2.1999999999999999e135 < x < -2.12e71Initial program 100.0%
Taylor expanded in z around inf 67.3%
if -1.24999999999999994e-7 < x < 3.29999999999999988e-16Initial program 99.9%
Taylor expanded in x around 0 63.5%
if 6.8000000000000003e110 < x < 1.9499999999999999e145Initial program 100.0%
fma-def100.0%
+-commutative100.0%
associate-+l+100.0%
count-2100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Taylor expanded in y around inf 55.9%
associate-*r*55.9%
Simplified55.9%
Final simplification60.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* y 2.0)))))
(if (<= x -9e+103)
t_1
(if (<= x -3.2e+71)
(* 2.0 (* x z))
(if (or (<= x -4e-8) (not (<= x 4.5e-17))) t_1 (* y 5.0))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (y * 2.0));
double tmp;
if (x <= -9e+103) {
tmp = t_1;
} else if (x <= -3.2e+71) {
tmp = 2.0 * (x * z);
} else if ((x <= -4e-8) || !(x <= 4.5e-17)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x * (t + (y * 2.0d0))
if (x <= (-9d+103)) then
tmp = t_1
else if (x <= (-3.2d+71)) then
tmp = 2.0d0 * (x * z)
else if ((x <= (-4d-8)) .or. (.not. (x <= 4.5d-17))) then
tmp = t_1
else
tmp = y * 5.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t + (y * 2.0));
double tmp;
if (x <= -9e+103) {
tmp = t_1;
} else if (x <= -3.2e+71) {
tmp = 2.0 * (x * z);
} else if ((x <= -4e-8) || !(x <= 4.5e-17)) {
tmp = t_1;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (y * 2.0)) tmp = 0 if x <= -9e+103: tmp = t_1 elif x <= -3.2e+71: tmp = 2.0 * (x * z) elif (x <= -4e-8) or not (x <= 4.5e-17): tmp = t_1 else: tmp = y * 5.0 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(y * 2.0))) tmp = 0.0 if (x <= -9e+103) tmp = t_1; elseif (x <= -3.2e+71) tmp = Float64(2.0 * Float64(x * z)); elseif ((x <= -4e-8) || !(x <= 4.5e-17)) tmp = t_1; else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (y * 2.0)); tmp = 0.0; if (x <= -9e+103) tmp = t_1; elseif (x <= -3.2e+71) tmp = 2.0 * (x * z); elseif ((x <= -4e-8) || ~((x <= 4.5e-17))) tmp = t_1; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9e+103], t$95$1, If[LessEqual[x, -3.2e+71], N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -4e-8], N[Not[LessEqual[x, 4.5e-17]], $MachinePrecision]], t$95$1, N[(y * 5.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + y \cdot 2\right)\\
\mathbf{if}\;x \leq -9 \cdot 10^{+103}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -3.2 \cdot 10^{+71}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;x \leq -4 \cdot 10^{-8} \lor \neg \left(x \leq 4.5 \cdot 10^{-17}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -9.00000000000000002e103 or -3.20000000000000023e71 < x < -4.0000000000000001e-8 or 4.49999999999999978e-17 < x Initial program 100.0%
fma-def100.0%
+-commutative100.0%
associate-+l+100.0%
count-2100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 99.4%
Taylor expanded in z around 0 76.4%
if -9.00000000000000002e103 < x < -3.20000000000000023e71Initial program 100.0%
Taylor expanded in z around inf 82.1%
if -4.0000000000000001e-8 < x < 4.49999999999999978e-17Initial program 99.9%
Taylor expanded in x around 0 63.5%
Final simplification70.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* z 2.0)))))
(if (<= x -5.5e-145)
t_1
(if (<= x -1.15e-180)
(* y 5.0)
(if (<= x -1.8e-197)
t_1
(if (<= x 4.5e-20) (* y 5.0) (* x (+ t (* y 2.0)))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (z * 2.0));
double tmp;
if (x <= -5.5e-145) {
tmp = t_1;
} else if (x <= -1.15e-180) {
tmp = y * 5.0;
} else if (x <= -1.8e-197) {
tmp = t_1;
} else if (x <= 4.5e-20) {
tmp = y * 5.0;
} 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) :: t_1
real(8) :: tmp
t_1 = x * (t + (z * 2.0d0))
if (x <= (-5.5d-145)) then
tmp = t_1
else if (x <= (-1.15d-180)) then
tmp = y * 5.0d0
else if (x <= (-1.8d-197)) then
tmp = t_1
else if (x <= 4.5d-20) then
tmp = y * 5.0d0
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 t_1 = x * (t + (z * 2.0));
double tmp;
if (x <= -5.5e-145) {
tmp = t_1;
} else if (x <= -1.15e-180) {
tmp = y * 5.0;
} else if (x <= -1.8e-197) {
tmp = t_1;
} else if (x <= 4.5e-20) {
tmp = y * 5.0;
} else {
tmp = x * (t + (y * 2.0));
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (z * 2.0)) tmp = 0 if x <= -5.5e-145: tmp = t_1 elif x <= -1.15e-180: tmp = y * 5.0 elif x <= -1.8e-197: tmp = t_1 elif x <= 4.5e-20: tmp = y * 5.0 else: tmp = x * (t + (y * 2.0)) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(z * 2.0))) tmp = 0.0 if (x <= -5.5e-145) tmp = t_1; elseif (x <= -1.15e-180) tmp = Float64(y * 5.0); elseif (x <= -1.8e-197) tmp = t_1; elseif (x <= 4.5e-20) tmp = Float64(y * 5.0); else tmp = Float64(x * Float64(t + Float64(y * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (z * 2.0)); tmp = 0.0; if (x <= -5.5e-145) tmp = t_1; elseif (x <= -1.15e-180) tmp = y * 5.0; elseif (x <= -1.8e-197) tmp = t_1; elseif (x <= 4.5e-20) tmp = y * 5.0; else tmp = x * (t + (y * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.5e-145], t$95$1, If[LessEqual[x, -1.15e-180], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, -1.8e-197], t$95$1, If[LessEqual[x, 4.5e-20], N[(y * 5.0), $MachinePrecision], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + z \cdot 2\right)\\
\mathbf{if}\;x \leq -5.5 \cdot 10^{-145}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.15 \cdot 10^{-180}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq -1.8 \cdot 10^{-197}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-20}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\end{array}
\end{array}
if x < -5.50000000000000015e-145 or -1.14999999999999998e-180 < x < -1.7999999999999999e-197Initial program 99.9%
Taylor expanded in y around 0 72.9%
if -5.50000000000000015e-145 < x < -1.14999999999999998e-180 or -1.7999999999999999e-197 < x < 4.5000000000000001e-20Initial program 99.9%
Taylor expanded in x around 0 74.0%
if 4.5000000000000001e-20 < x Initial program 100.0%
fma-def100.0%
+-commutative100.0%
associate-+l+100.0%
count-2100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 99.0%
Taylor expanded in z around 0 75.9%
Final simplification74.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -720000000000.0) (not (<= x 2.5))) (* x (+ t (* (+ y z) 2.0))) (+ (* y 5.0) (* x (+ t (* z 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -720000000000.0) || !(x <= 2.5)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (x * (t + (z * 2.0)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-720000000000.0d0)) .or. (.not. (x <= 2.5d0))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (y * 5.0d0) + (x * (t + (z * 2.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -720000000000.0) || !(x <= 2.5)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (x * (t + (z * 2.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -720000000000.0) or not (x <= 2.5): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (y * 5.0) + (x * (t + (z * 2.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -720000000000.0) || !(x <= 2.5)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(z * 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -720000000000.0) || ~((x <= 2.5))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (y * 5.0) + (x * (t + (z * 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -720000000000.0], N[Not[LessEqual[x, 2.5]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -720000000000 \lor \neg \left(x \leq 2.5\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\end{array}
if x < -7.2e11 or 2.5 < x Initial program 100.0%
fma-def100.0%
+-commutative100.0%
associate-+l+100.0%
count-2100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 99.4%
if -7.2e11 < x < 2.5Initial program 99.9%
Taylor expanded in y around 0 99.6%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (+ (* x (+ t (+ y (+ z (+ y z))))) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * (t + (y + (z + (y + z))))) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (y * 5.0);
}
def code(x, y, z, t): return (x * (t + (y + (z + (y + z))))) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(t + Float64(y + Float64(z + Float64(y + z))))) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * (t + (y + (z + (y + z))))) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(t + N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) + y \cdot 5
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -5.5e+94)
t_1
(if (<= y -6e-44)
(+ (* y 5.0) (* x t))
(if (<= y 1.35e+51) (* x (+ t (* z 2.0))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -5.5e+94) {
tmp = t_1;
} else if (y <= -6e-44) {
tmp = (y * 5.0) + (x * t);
} else if (y <= 1.35e+51) {
tmp = x * (t + (z * 2.0));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * (5.0d0 + (x * 2.0d0))
if (y <= (-5.5d+94)) then
tmp = t_1
else if (y <= (-6d-44)) then
tmp = (y * 5.0d0) + (x * t)
else if (y <= 1.35d+51) then
tmp = x * (t + (z * 2.0d0))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -5.5e+94) {
tmp = t_1;
} else if (y <= -6e-44) {
tmp = (y * 5.0) + (x * t);
} else if (y <= 1.35e+51) {
tmp = x * (t + (z * 2.0));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (5.0 + (x * 2.0)) tmp = 0 if y <= -5.5e+94: tmp = t_1 elif y <= -6e-44: tmp = (y * 5.0) + (x * t) elif y <= 1.35e+51: tmp = x * (t + (z * 2.0)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(5.0 + Float64(x * 2.0))) tmp = 0.0 if (y <= -5.5e+94) tmp = t_1; elseif (y <= -6e-44) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); elseif (y <= 1.35e+51) tmp = Float64(x * Float64(t + Float64(z * 2.0))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (5.0 + (x * 2.0)); tmp = 0.0; if (y <= -5.5e+94) tmp = t_1; elseif (y <= -6e-44) tmp = (y * 5.0) + (x * t); elseif (y <= 1.35e+51) tmp = x * (t + (z * 2.0)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.5e+94], t$95$1, If[LessEqual[y, -6e-44], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+51], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -5.5 \cdot 10^{+94}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -6 \cdot 10^{-44}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+51}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -5.4999999999999997e94 or 1.34999999999999996e51 < y Initial program 99.9%
Taylor expanded in y around inf 83.0%
Simplified83.0%
if -5.4999999999999997e94 < y < -6.0000000000000005e-44Initial program 99.8%
Taylor expanded in y around 0 90.0%
Taylor expanded in z around 0 79.9%
if -6.0000000000000005e-44 < y < 1.34999999999999996e51Initial program 100.0%
Taylor expanded in y around 0 85.6%
Final simplification83.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -720000000000.0) (not (<= x 6.3e-7))) (* x (+ t (* (+ y z) 2.0))) (+ (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -720000000000.0) || !(x <= 6.3e-7)) {
tmp = x * (t + ((y + z) * 2.0));
} 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 <= (-720000000000.0d0)) .or. (.not. (x <= 6.3d-7))) then
tmp = x * (t + ((y + z) * 2.0d0))
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 <= -720000000000.0) || !(x <= 6.3e-7)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -720000000000.0) or not (x <= 6.3e-7): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (y * 5.0) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -720000000000.0) || !(x <= 6.3e-7)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); 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 <= -720000000000.0) || ~((x <= 6.3e-7))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (y * 5.0) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -720000000000.0], N[Not[LessEqual[x, 6.3e-7]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -720000000000 \lor \neg \left(x \leq 6.3 \cdot 10^{-7}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\end{array}
\end{array}
if x < -7.2e11 or 6.30000000000000003e-7 < x Initial program 100.0%
fma-def100.0%
+-commutative100.0%
associate-+l+100.0%
count-2100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 99.4%
if -7.2e11 < x < 6.30000000000000003e-7Initial program 99.9%
Taylor expanded in y around 0 99.6%
Taylor expanded in z around 0 78.2%
Final simplification88.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6.5e-8) (not (<= x 4.6e-16))) (* x (+ t (* (+ y z) 2.0))) (+ (* 2.0 (* x z)) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.5e-8) || !(x <= 4.6e-16)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (2.0 * (x * z)) + (y * 5.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-6.5d-8)) .or. (.not. (x <= 4.6d-16))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (2.0d0 * (x * z)) + (y * 5.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.5e-8) || !(x <= 4.6e-16)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (2.0 * (x * z)) + (y * 5.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6.5e-8) or not (x <= 4.6e-16): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (2.0 * (x * z)) + (y * 5.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.5e-8) || !(x <= 4.6e-16)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(2.0 * Float64(x * z)) + Float64(y * 5.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -6.5e-8) || ~((x <= 4.6e-16))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (2.0 * (x * z)) + (y * 5.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.5e-8], N[Not[LessEqual[x, 4.6e-16]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-8} \lor \neg \left(x \leq 4.6 \cdot 10^{-16}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right) + y \cdot 5\\
\end{array}
\end{array}
if x < -6.49999999999999997e-8 or 4.5999999999999998e-16 < x Initial program 100.0%
fma-def100.0%
+-commutative100.0%
associate-+l+100.0%
count-2100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 99.4%
if -6.49999999999999997e-8 < x < 4.5999999999999998e-16Initial program 99.9%
Taylor expanded in y around 0 99.5%
Taylor expanded in t around 0 85.5%
Final simplification92.6%
(FPCore (x y z t)
:precision binary64
(if (<= x -1.65e+133)
(* x t)
(if (<= x -9.5e+70)
(* 2.0 (* x z))
(if (or (<= x -4e-8) (not (<= x 5.5e-13))) (* x t) (* y 5.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.65e+133) {
tmp = x * t;
} else if (x <= -9.5e+70) {
tmp = 2.0 * (x * z);
} else if ((x <= -4e-8) || !(x <= 5.5e-13)) {
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 <= (-1.65d+133)) then
tmp = x * t
else if (x <= (-9.5d+70)) then
tmp = 2.0d0 * (x * z)
else if ((x <= (-4d-8)) .or. (.not. (x <= 5.5d-13))) 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 <= -1.65e+133) {
tmp = x * t;
} else if (x <= -9.5e+70) {
tmp = 2.0 * (x * z);
} else if ((x <= -4e-8) || !(x <= 5.5e-13)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.65e+133: tmp = x * t elif x <= -9.5e+70: tmp = 2.0 * (x * z) elif (x <= -4e-8) or not (x <= 5.5e-13): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.65e+133) tmp = Float64(x * t); elseif (x <= -9.5e+70) tmp = Float64(2.0 * Float64(x * z)); elseif ((x <= -4e-8) || !(x <= 5.5e-13)) 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 <= -1.65e+133) tmp = x * t; elseif (x <= -9.5e+70) tmp = 2.0 * (x * z); elseif ((x <= -4e-8) || ~((x <= 5.5e-13))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.65e+133], N[(x * t), $MachinePrecision], If[LessEqual[x, -9.5e+70], N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -4e-8], N[Not[LessEqual[x, 5.5e-13]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{+133}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -9.5 \cdot 10^{+70}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;x \leq -4 \cdot 10^{-8} \lor \neg \left(x \leq 5.5 \cdot 10^{-13}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.65e133 or -9.5000000000000002e70 < x < -4.0000000000000001e-8 or 5.49999999999999979e-13 < x Initial program 100.0%
Taylor expanded in t around inf 51.6%
if -1.65e133 < x < -9.5000000000000002e70Initial program 100.0%
Taylor expanded in z around inf 67.3%
if -4.0000000000000001e-8 < x < 5.49999999999999979e-13Initial program 99.9%
Taylor expanded in x around 0 63.5%
Final simplification58.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1e+49) (not (<= y 4.6e+50))) (* y (+ 5.0 (* x 2.0))) (* x (+ t (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1e+49) || !(y <= 4.6e+50)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-1d+49)) .or. (.not. (y <= 4.6d+50))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = x * (t + (z * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1e+49) || !(y <= 4.6e+50)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1e+49) or not (y <= 4.6e+50): tmp = y * (5.0 + (x * 2.0)) else: tmp = x * (t + (z * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1e+49) || !(y <= 4.6e+50)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(x * Float64(t + Float64(z * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1e+49) || ~((y <= 4.6e+50))) tmp = y * (5.0 + (x * 2.0)); else tmp = x * (t + (z * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1e+49], N[Not[LessEqual[y, 4.6e+50]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+49} \lor \neg \left(y \leq 4.6 \cdot 10^{+50}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\end{array}
if y < -9.99999999999999946e48 or 4.59999999999999994e50 < y Initial program 99.9%
Taylor expanded in y around inf 79.6%
Simplified79.6%
if -9.99999999999999946e48 < y < 4.59999999999999994e50Initial program 100.0%
Taylor expanded in y around 0 81.5%
Final simplification80.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.12e-7) (not (<= x 5.4e-18))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.12e-7) || !(x <= 5.4e-18)) {
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 <= (-1.12d-7)) .or. (.not. (x <= 5.4d-18))) 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 <= -1.12e-7) || !(x <= 5.4e-18)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.12e-7) or not (x <= 5.4e-18): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.12e-7) || !(x <= 5.4e-18)) 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 <= -1.12e-7) || ~((x <= 5.4e-18))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.12e-7], N[Not[LessEqual[x, 5.4e-18]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.12 \cdot 10^{-7} \lor \neg \left(x \leq 5.4 \cdot 10^{-18}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.12e-7 or 5.39999999999999977e-18 < x Initial program 100.0%
Taylor expanded in t around inf 47.0%
if -1.12e-7 < x < 5.39999999999999977e-18Initial program 99.9%
Taylor expanded in x around 0 63.5%
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 99.9%
Taylor expanded in x around 0 32.5%
Final simplification32.5%
herbie shell --seed 2023301
(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)))