
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
(FPCore (x y z t) :precision binary64 (fma y 5.0 (* x (+ (* (+ y z) 2.0) t))))
double code(double x, double y, double z, double t) {
return fma(y, 5.0, (x * (((y + z) * 2.0) + t)));
}
function code(x, y, z, t) return fma(y, 5.0, Float64(x * Float64(Float64(Float64(y + z) * 2.0) + t))) end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(x * N[(N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 5, x \cdot \left(\left(y + z\right) \cdot 2 + t\right)\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-def100.0%
*-un-lft-identity100.0%
*-un-lft-identity100.0%
associate-+l+100.0%
*-un-lft-identity100.0%
+-commutative100.0%
*-un-lft-identity100.0%
distribute-rgt-out100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= x -1e+68)
t_1
(if (<= x -6.2e+16)
(* x t)
(if (or (<= x -3.8e-78) (not (<= x 4.4e-30))) t_1 (* y 5.0))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (x <= -1e+68) {
tmp = t_1;
} else if (x <= -6.2e+16) {
tmp = x * t;
} else if ((x <= -3.8e-78) || !(x <= 4.4e-30)) {
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 = 2.0d0 * (x * z)
if (x <= (-1d+68)) then
tmp = t_1
else if (x <= (-6.2d+16)) then
tmp = x * t
else if ((x <= (-3.8d-78)) .or. (.not. (x <= 4.4d-30))) 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 = 2.0 * (x * z);
double tmp;
if (x <= -1e+68) {
tmp = t_1;
} else if (x <= -6.2e+16) {
tmp = x * t;
} else if ((x <= -3.8e-78) || !(x <= 4.4e-30)) {
tmp = t_1;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if x <= -1e+68: tmp = t_1 elif x <= -6.2e+16: tmp = x * t elif (x <= -3.8e-78) or not (x <= 4.4e-30): tmp = t_1 else: tmp = y * 5.0 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * z)) tmp = 0.0 if (x <= -1e+68) tmp = t_1; elseif (x <= -6.2e+16) tmp = Float64(x * t); elseif ((x <= -3.8e-78) || !(x <= 4.4e-30)) tmp = t_1; else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * z); tmp = 0.0; if (x <= -1e+68) tmp = t_1; elseif (x <= -6.2e+16) tmp = x * t; elseif ((x <= -3.8e-78) || ~((x <= 4.4e-30))) tmp = t_1; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1e+68], t$95$1, If[LessEqual[x, -6.2e+16], N[(x * t), $MachinePrecision], If[Or[LessEqual[x, -3.8e-78], N[Not[LessEqual[x, 4.4e-30]], $MachinePrecision]], t$95$1, N[(y * 5.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;x \leq -1 \cdot 10^{+68}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -6.2 \cdot 10^{+16}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -3.8 \cdot 10^{-78} \lor \neg \left(x \leq 4.4 \cdot 10^{-30}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -9.99999999999999953e67 or -6.2e16 < x < -3.7999999999999999e-78 or 4.39999999999999967e-30 < x Initial program 100.0%
Taylor expanded in z around inf 47.2%
if -9.99999999999999953e67 < x < -6.2e16Initial program 100.0%
Taylor expanded in t around inf 59.8%
if -3.7999999999999999e-78 < x < 4.39999999999999967e-30Initial program 99.8%
Taylor expanded in x around 0 66.9%
Final simplification56.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.5e-69) (not (<= x 8e-91))) (* x (+ t (+ (* y 2.0) (* z 2.0)))) (+ (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.5e-69) || !(x <= 8e-91)) {
tmp = x * (t + ((y * 2.0) + (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 <= (-4.5d-69)) .or. (.not. (x <= 8d-91))) then
tmp = x * (t + ((y * 2.0d0) + (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 <= -4.5e-69) || !(x <= 8e-91)) {
tmp = x * (t + ((y * 2.0) + (z * 2.0)));
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.5e-69) or not (x <= 8e-91): tmp = x * (t + ((y * 2.0) + (z * 2.0))) else: tmp = (y * 5.0) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.5e-69) || !(x <= 8e-91)) tmp = Float64(x * Float64(t + Float64(Float64(y * 2.0) + Float64(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 <= -4.5e-69) || ~((x <= 8e-91))) tmp = x * (t + ((y * 2.0) + (z * 2.0))); else tmp = (y * 5.0) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.5e-69], N[Not[LessEqual[x, 8e-91]], $MachinePrecision]], N[(x * N[(t + N[(N[(y * 2.0), $MachinePrecision] + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $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^{-69} \lor \neg \left(x \leq 8 \cdot 10^{-91}\right):\\
\;\;\;\;x \cdot \left(t + \left(y \cdot 2 + z \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\end{array}
\end{array}
if x < -4.50000000000000009e-69 or 8.00000000000000018e-91 < x Initial program 100.0%
Taylor expanded in x around inf 92.2%
if -4.50000000000000009e-69 < x < 8.00000000000000018e-91Initial program 99.8%
+-commutative99.8%
fma-def100.0%
*-un-lft-identity100.0%
*-un-lft-identity100.0%
associate-+l+100.0%
*-un-lft-identity100.0%
+-commutative100.0%
*-un-lft-identity100.0%
distribute-rgt-out100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in t around inf 90.5%
*-commutative90.5%
Simplified90.5%
fma-udef90.5%
Applied egg-rr90.5%
Final simplification91.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.9e-12) (not (<= t 7e+83))) (+ (* y 5.0) (* x t)) (+ (* 2.0 (* x (+ y z))) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.9e-12) || !(t <= 7e+83)) {
tmp = (y * 5.0) + (x * t);
} else {
tmp = (2.0 * (x * (y + 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 ((t <= (-1.9d-12)) .or. (.not. (t <= 7d+83))) then
tmp = (y * 5.0d0) + (x * t)
else
tmp = (2.0d0 * (x * (y + 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 ((t <= -1.9e-12) || !(t <= 7e+83)) {
tmp = (y * 5.0) + (x * t);
} else {
tmp = (2.0 * (x * (y + z))) + (y * 5.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.9e-12) or not (t <= 7e+83): tmp = (y * 5.0) + (x * t) else: tmp = (2.0 * (x * (y + z))) + (y * 5.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.9e-12) || !(t <= 7e+83)) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); else tmp = Float64(Float64(2.0 * Float64(x * Float64(y + z))) + Float64(y * 5.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.9e-12) || ~((t <= 7e+83))) tmp = (y * 5.0) + (x * t); else tmp = (2.0 * (x * (y + z))) + (y * 5.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.9e-12], N[Not[LessEqual[t, 7e+83]], $MachinePrecision]], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{-12} \lor \neg \left(t \leq 7 \cdot 10^{+83}\right):\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + y \cdot 5\\
\end{array}
\end{array}
if t < -1.89999999999999998e-12 or 6.99999999999999954e83 < t Initial program 99.9%
+-commutative99.9%
fma-def100.0%
*-un-lft-identity100.0%
*-un-lft-identity100.0%
associate-+l+100.0%
*-un-lft-identity100.0%
+-commutative100.0%
*-un-lft-identity100.0%
distribute-rgt-out100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in t around inf 86.6%
*-commutative86.6%
Simplified86.6%
fma-udef86.5%
Applied egg-rr86.5%
if -1.89999999999999998e-12 < t < 6.99999999999999954e83Initial program 99.9%
+-commutative99.9%
fma-def100.0%
*-un-lft-identity100.0%
*-un-lft-identity100.0%
associate-+l+100.0%
*-un-lft-identity100.0%
+-commutative100.0%
*-un-lft-identity100.0%
distribute-rgt-out100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in t around 0 93.3%
Final simplification90.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4e+36) (not (<= x 2.5))) (* x (+ t (+ (* y 2.0) (* 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 <= -4e+36) || !(x <= 2.5)) {
tmp = x * (t + ((y * 2.0) + (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 <= (-4d+36)) .or. (.not. (x <= 2.5d0))) then
tmp = x * (t + ((y * 2.0d0) + (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 <= -4e+36) || !(x <= 2.5)) {
tmp = x * (t + ((y * 2.0) + (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 <= -4e+36) or not (x <= 2.5): tmp = x * (t + ((y * 2.0) + (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 <= -4e+36) || !(x <= 2.5)) tmp = Float64(x * Float64(t + Float64(Float64(y * 2.0) + Float64(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 <= -4e+36) || ~((x <= 2.5))) tmp = x * (t + ((y * 2.0) + (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, -4e+36], N[Not[LessEqual[x, 2.5]], $MachinePrecision]], N[(x * N[(t + N[(N[(y * 2.0), $MachinePrecision] + N[(z * 2.0), $MachinePrecision]), $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 -4 \cdot 10^{+36} \lor \neg \left(x \leq 2.5\right):\\
\;\;\;\;x \cdot \left(t + \left(y \cdot 2 + z \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\end{array}
if x < -4.00000000000000017e36 or 2.5 < x Initial program 100.0%
Taylor expanded in x around inf 99.3%
if -4.00000000000000017e36 < x < 2.5Initial program 99.9%
Taylor expanded in y around 0 98.4%
Final simplification98.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.2e-90) (not (<= x 5.6e-99))) (* x (+ t (* z 2.0))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.2e-90) || !(x <= 5.6e-99)) {
tmp = x * (t + (z * 2.0));
} 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 <= (-4.2d-90)) .or. (.not. (x <= 5.6d-99))) then
tmp = x * (t + (z * 2.0d0))
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 <= -4.2e-90) || !(x <= 5.6e-99)) {
tmp = x * (t + (z * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.2e-90) or not (x <= 5.6e-99): tmp = x * (t + (z * 2.0)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.2e-90) || !(x <= 5.6e-99)) tmp = Float64(x * Float64(t + Float64(z * 2.0))); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.2e-90) || ~((x <= 5.6e-99))) tmp = x * (t + (z * 2.0)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.2e-90], N[Not[LessEqual[x, 5.6e-99]], $MachinePrecision]], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{-90} \lor \neg \left(x \leq 5.6 \cdot 10^{-99}\right):\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -4.1999999999999998e-90 or 5.6000000000000001e-99 < x Initial program 100.0%
Taylor expanded in y around 0 75.8%
if -4.1999999999999998e-90 < x < 5.6000000000000001e-99Initial program 99.8%
Taylor expanded in x around 0 70.2%
Final simplification73.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6e+100) (not (<= y 3.1e+85))) (* 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 <= -6e+100) || !(y <= 3.1e+85)) {
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 <= (-6d+100)) .or. (.not. (y <= 3.1d+85))) 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 <= -6e+100) || !(y <= 3.1e+85)) {
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 <= -6e+100) or not (y <= 3.1e+85): 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 <= -6e+100) || !(y <= 3.1e+85)) 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 <= -6e+100) || ~((y <= 3.1e+85))) 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, -6e+100], N[Not[LessEqual[y, 3.1e+85]], $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 -6 \cdot 10^{+100} \lor \neg \left(y \leq 3.1 \cdot 10^{+85}\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 < -5.99999999999999971e100 or 3.10000000000000011e85 < y Initial program 99.9%
Taylor expanded in y around inf 86.0%
Simplified86.0%
if -5.99999999999999971e100 < y < 3.10000000000000011e85Initial program 100.0%
Taylor expanded in y around 0 77.3%
Final simplification80.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.5e-78) (not (<= x 5.6e-91))) (* x (+ t (* z 2.0))) (+ (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.5e-78) || !(x <= 5.6e-91)) {
tmp = x * (t + (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 <= (-3.5d-78)) .or. (.not. (x <= 5.6d-91))) then
tmp = x * (t + (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 <= -3.5e-78) || !(x <= 5.6e-91)) {
tmp = x * (t + (z * 2.0));
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.5e-78) or not (x <= 5.6e-91): tmp = x * (t + (z * 2.0)) else: tmp = (y * 5.0) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.5e-78) || !(x <= 5.6e-91)) tmp = Float64(x * Float64(t + Float64(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 <= -3.5e-78) || ~((x <= 5.6e-91))) tmp = x * (t + (z * 2.0)); else tmp = (y * 5.0) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.5e-78], N[Not[LessEqual[x, 5.6e-91]], $MachinePrecision]], N[(x * N[(t + N[(z * 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 -3.5 \cdot 10^{-78} \lor \neg \left(x \leq 5.6 \cdot 10^{-91}\right):\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\end{array}
\end{array}
if x < -3.4999999999999999e-78 or 5.6e-91 < x Initial program 100.0%
Taylor expanded in y around 0 75.7%
if -3.4999999999999999e-78 < x < 5.6e-91Initial program 99.8%
+-commutative99.8%
fma-def100.0%
*-un-lft-identity100.0%
*-un-lft-identity100.0%
associate-+l+100.0%
*-un-lft-identity100.0%
+-commutative100.0%
*-un-lft-identity100.0%
distribute-rgt-out100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in t around inf 91.4%
*-commutative91.4%
Simplified91.4%
fma-udef91.3%
Applied egg-rr91.3%
Final simplification81.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.25e+76) (not (<= t 1e+54))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.25e+76) || !(t <= 1e+54)) {
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 ((t <= (-1.25d+76)) .or. (.not. (t <= 1d+54))) 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 ((t <= -1.25e+76) || !(t <= 1e+54)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.25e+76) or not (t <= 1e+54): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.25e+76) || !(t <= 1e+54)) 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 ((t <= -1.25e+76) || ~((t <= 1e+54))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.25e+76], N[Not[LessEqual[t, 1e+54]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.25 \cdot 10^{+76} \lor \neg \left(t \leq 10^{+54}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if t < -1.24999999999999998e76 or 1.0000000000000001e54 < t Initial program 99.9%
Taylor expanded in t around inf 67.8%
if -1.24999999999999998e76 < t < 1.0000000000000001e54Initial program 99.9%
Taylor expanded in x around 0 39.7%
Final simplification50.4%
(FPCore (x y z t) :precision binary64 (+ (* x (+ (* (+ y z) 2.0) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * (((y + z) * 2.0) + 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) * 2.0d0) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * (((y + z) * 2.0) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * (((y + z) * 2.0) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(y + z) * 2.0) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * (((y + z) * 2.0) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(y + z\right) \cdot 2 + t\right) + y \cdot 5
\end{array}
Initial program 99.9%
associate-+l+99.9%
*-un-lft-identity99.9%
+-commutative99.9%
*-un-lft-identity99.9%
distribute-rgt-out99.9%
metadata-eval99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (* y 5.0))
double code(double x, double y, double z, double t) {
return y * 5.0;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = y * 5.0d0
end function
public static double code(double x, double y, double z, double t) {
return y * 5.0;
}
def code(x, y, z, t): return y * 5.0
function code(x, y, z, t) return Float64(y * 5.0) end
function tmp = code(x, y, z, t) tmp = y * 5.0; end
code[x_, y_, z_, t_] := N[(y * 5.0), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 31.3%
Final simplification31.3%
herbie shell --seed 2024021
(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)))