
(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 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
(FPCore (x y z t) :precision binary64 (fma x (+ (* 2.0 (+ y z)) t) (* y 5.0)))
double code(double x, double y, double z, double t) {
return fma(x, ((2.0 * (y + z)) + t), (y * 5.0));
}
function code(x, y, z, t) return fma(x, Float64(Float64(2.0 * Float64(y + z)) + t), Float64(y * 5.0)) end
code[x_, y_, z_, t_] := N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)
\end{array}
Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* 2.0 y)))))
(if (<= y -3.9e+46)
(* y 5.0)
(if (<= y -4.8e-74)
t_1
(if (<= y -1.15e-99)
(* y 5.0)
(if (<= y 2.45e+28)
(* x (+ t (* 2.0 z)))
(if (<= y 1.02e+101) (* y 5.0) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * y));
double tmp;
if (y <= -3.9e+46) {
tmp = y * 5.0;
} else if (y <= -4.8e-74) {
tmp = t_1;
} else if (y <= -1.15e-99) {
tmp = y * 5.0;
} else if (y <= 2.45e+28) {
tmp = x * (t + (2.0 * z));
} else if (y <= 1.02e+101) {
tmp = y * 5.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 = x * (t + (2.0d0 * y))
if (y <= (-3.9d+46)) then
tmp = y * 5.0d0
else if (y <= (-4.8d-74)) then
tmp = t_1
else if (y <= (-1.15d-99)) then
tmp = y * 5.0d0
else if (y <= 2.45d+28) then
tmp = x * (t + (2.0d0 * z))
else if (y <= 1.02d+101) then
tmp = y * 5.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 = x * (t + (2.0 * y));
double tmp;
if (y <= -3.9e+46) {
tmp = y * 5.0;
} else if (y <= -4.8e-74) {
tmp = t_1;
} else if (y <= -1.15e-99) {
tmp = y * 5.0;
} else if (y <= 2.45e+28) {
tmp = x * (t + (2.0 * z));
} else if (y <= 1.02e+101) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (2.0 * y)) tmp = 0 if y <= -3.9e+46: tmp = y * 5.0 elif y <= -4.8e-74: tmp = t_1 elif y <= -1.15e-99: tmp = y * 5.0 elif y <= 2.45e+28: tmp = x * (t + (2.0 * z)) elif y <= 1.02e+101: tmp = y * 5.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(2.0 * y))) tmp = 0.0 if (y <= -3.9e+46) tmp = Float64(y * 5.0); elseif (y <= -4.8e-74) tmp = t_1; elseif (y <= -1.15e-99) tmp = Float64(y * 5.0); elseif (y <= 2.45e+28) tmp = Float64(x * Float64(t + Float64(2.0 * z))); elseif (y <= 1.02e+101) tmp = Float64(y * 5.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (2.0 * y)); tmp = 0.0; if (y <= -3.9e+46) tmp = y * 5.0; elseif (y <= -4.8e-74) tmp = t_1; elseif (y <= -1.15e-99) tmp = y * 5.0; elseif (y <= 2.45e+28) tmp = x * (t + (2.0 * z)); elseif (y <= 1.02e+101) tmp = y * 5.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.9e+46], N[(y * 5.0), $MachinePrecision], If[LessEqual[y, -4.8e-74], t$95$1, If[LessEqual[y, -1.15e-99], N[(y * 5.0), $MachinePrecision], If[LessEqual[y, 2.45e+28], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.02e+101], N[(y * 5.0), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot y\right)\\
\mathbf{if}\;y \leq -3.9 \cdot 10^{+46}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq -4.8 \cdot 10^{-74}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.15 \cdot 10^{-99}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq 2.45 \cdot 10^{+28}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{+101}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.89999999999999995e46 or -4.7999999999999998e-74 < y < -1.1499999999999999e-99 or 2.4499999999999998e28 < y < 1.02000000000000002e101Initial program 99.9%
Taylor expanded in x around 0 67.3%
if -3.89999999999999995e46 < y < -4.7999999999999998e-74 or 1.02000000000000002e101 < y Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 65.3%
Taylor expanded in z around 0 57.7%
*-commutative57.7%
Simplified57.7%
if -1.1499999999999999e-99 < y < 2.4499999999999998e28Initial program 100.0%
Taylor expanded in y around 0 88.1%
Final simplification75.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ (* 2.0 (+ y z)) t))))
(if (<= x -1.12e-69)
t_1
(if (<= x -2.7e-126)
(+ (* 2.0 (* x z)) (* y 5.0))
(if (<= x -2.1e-153)
(* x (+ t (* 2.0 z)))
(if (<= x 1.75e-15) (+ (* y 5.0) (* x t)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((2.0 * (y + z)) + t);
double tmp;
if (x <= -1.12e-69) {
tmp = t_1;
} else if (x <= -2.7e-126) {
tmp = (2.0 * (x * z)) + (y * 5.0);
} else if (x <= -2.1e-153) {
tmp = x * (t + (2.0 * z));
} else if (x <= 1.75e-15) {
tmp = (y * 5.0) + (x * t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * ((2.0d0 * (y + z)) + t)
if (x <= (-1.12d-69)) then
tmp = t_1
else if (x <= (-2.7d-126)) then
tmp = (2.0d0 * (x * z)) + (y * 5.0d0)
else if (x <= (-2.1d-153)) then
tmp = x * (t + (2.0d0 * z))
else if (x <= 1.75d-15) then
tmp = (y * 5.0d0) + (x * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * ((2.0 * (y + z)) + t);
double tmp;
if (x <= -1.12e-69) {
tmp = t_1;
} else if (x <= -2.7e-126) {
tmp = (2.0 * (x * z)) + (y * 5.0);
} else if (x <= -2.1e-153) {
tmp = x * (t + (2.0 * z));
} else if (x <= 1.75e-15) {
tmp = (y * 5.0) + (x * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((2.0 * (y + z)) + t) tmp = 0 if x <= -1.12e-69: tmp = t_1 elif x <= -2.7e-126: tmp = (2.0 * (x * z)) + (y * 5.0) elif x <= -2.1e-153: tmp = x * (t + (2.0 * z)) elif x <= 1.75e-15: tmp = (y * 5.0) + (x * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)) tmp = 0.0 if (x <= -1.12e-69) tmp = t_1; elseif (x <= -2.7e-126) tmp = Float64(Float64(2.0 * Float64(x * z)) + Float64(y * 5.0)); elseif (x <= -2.1e-153) tmp = Float64(x * Float64(t + Float64(2.0 * z))); elseif (x <= 1.75e-15) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((2.0 * (y + z)) + t); tmp = 0.0; if (x <= -1.12e-69) tmp = t_1; elseif (x <= -2.7e-126) tmp = (2.0 * (x * z)) + (y * 5.0); elseif (x <= -2.1e-153) tmp = x * (t + (2.0 * z)); elseif (x <= 1.75e-15) tmp = (y * 5.0) + (x * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.12e-69], t$95$1, If[LessEqual[x, -2.7e-126], N[(N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.1e-153], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.75e-15], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{if}\;x \leq -1.12 \cdot 10^{-69}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.7 \cdot 10^{-126}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right) + y \cdot 5\\
\mathbf{elif}\;x \leq -2.1 \cdot 10^{-153}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-15}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.12e-69 or 1.75e-15 < 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 96.1%
if -1.12e-69 < x < -2.69999999999999995e-126Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in t around 0 93.6%
if -2.69999999999999995e-126 < x < -2.10000000000000004e-153Initial program 100.0%
Taylor expanded in y around 0 100.0%
if -2.10000000000000004e-153 < x < 1.75e-15Initial program 99.9%
Taylor expanded in y around 0 99.8%
Taylor expanded in z around 0 89.9%
Final simplification93.8%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -1.5e-83)
(and (not (<= x -1.2e-126))
(or (<= x -4.4e-154) (not (<= x 2.9e-91)))))
(* x (+ t (* 2.0 z)))
(* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.5e-83) || (!(x <= -1.2e-126) && ((x <= -4.4e-154) || !(x <= 2.9e-91)))) {
tmp = x * (t + (2.0 * z));
} else {
tmp = y * 5.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.5d-83)) .or. (.not. (x <= (-1.2d-126))) .and. (x <= (-4.4d-154)) .or. (.not. (x <= 2.9d-91))) then
tmp = x * (t + (2.0d0 * z))
else
tmp = y * 5.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.5e-83) || (!(x <= -1.2e-126) && ((x <= -4.4e-154) || !(x <= 2.9e-91)))) {
tmp = x * (t + (2.0 * z));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.5e-83) or (not (x <= -1.2e-126) and ((x <= -4.4e-154) or not (x <= 2.9e-91))): tmp = x * (t + (2.0 * z)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.5e-83) || (!(x <= -1.2e-126) && ((x <= -4.4e-154) || !(x <= 2.9e-91)))) tmp = Float64(x * Float64(t + Float64(2.0 * z))); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.5e-83) || (~((x <= -1.2e-126)) && ((x <= -4.4e-154) || ~((x <= 2.9e-91))))) tmp = x * (t + (2.0 * z)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.5e-83], And[N[Not[LessEqual[x, -1.2e-126]], $MachinePrecision], Or[LessEqual[x, -4.4e-154], N[Not[LessEqual[x, 2.9e-91]], $MachinePrecision]]]], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-83} \lor \neg \left(x \leq -1.2 \cdot 10^{-126}\right) \land \left(x \leq -4.4 \cdot 10^{-154} \lor \neg \left(x \leq 2.9 \cdot 10^{-91}\right)\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.50000000000000005e-83 or -1.20000000000000003e-126 < x < -4.40000000000000015e-154 or 2.9000000000000001e-91 < x Initial program 100.0%
Taylor expanded in y around 0 73.3%
if -1.50000000000000005e-83 < x < -1.20000000000000003e-126 or -4.40000000000000015e-154 < x < 2.9000000000000001e-91Initial program 99.9%
Taylor expanded in x around 0 74.4%
Final simplification73.7%
(FPCore (x y z t)
:precision binary64
(if (<= x -2.2e-69)
(* x t)
(if (<= x 5.8e-19)
(* y 5.0)
(if (or (<= x 5.6e+43) (not (<= x 5.2e+149))) (* x t) (* z (* x 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.2e-69) {
tmp = x * t;
} else if (x <= 5.8e-19) {
tmp = y * 5.0;
} else if ((x <= 5.6e+43) || !(x <= 5.2e+149)) {
tmp = x * t;
} else {
tmp = z * (x * 2.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-2.2d-69)) then
tmp = x * t
else if (x <= 5.8d-19) then
tmp = y * 5.0d0
else if ((x <= 5.6d+43) .or. (.not. (x <= 5.2d+149))) then
tmp = x * t
else
tmp = z * (x * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.2e-69) {
tmp = x * t;
} else if (x <= 5.8e-19) {
tmp = y * 5.0;
} else if ((x <= 5.6e+43) || !(x <= 5.2e+149)) {
tmp = x * t;
} else {
tmp = z * (x * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.2e-69: tmp = x * t elif x <= 5.8e-19: tmp = y * 5.0 elif (x <= 5.6e+43) or not (x <= 5.2e+149): tmp = x * t else: tmp = z * (x * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.2e-69) tmp = Float64(x * t); elseif (x <= 5.8e-19) tmp = Float64(y * 5.0); elseif ((x <= 5.6e+43) || !(x <= 5.2e+149)) tmp = Float64(x * t); else tmp = Float64(z * Float64(x * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.2e-69) tmp = x * t; elseif (x <= 5.8e-19) tmp = y * 5.0; elseif ((x <= 5.6e+43) || ~((x <= 5.2e+149))) tmp = x * t; else tmp = z * (x * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.2e-69], N[(x * t), $MachinePrecision], If[LessEqual[x, 5.8e-19], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 5.6e+43], N[Not[LessEqual[x, 5.2e+149]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(z * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-69}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-19}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{+43} \lor \neg \left(x \leq 5.2 \cdot 10^{+149}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot 2\right)\\
\end{array}
\end{array}
if x < -2.2e-69 or 5.8e-19 < x < 5.60000000000000038e43 or 5.19999999999999957e149 < x Initial program 100.0%
Taylor expanded in t around inf 52.6%
Simplified52.6%
if -2.2e-69 < x < 5.8e-19Initial program 99.9%
Taylor expanded in x around 0 64.9%
if 5.60000000000000038e43 < x < 5.19999999999999957e149Initial program 100.0%
Taylor expanded in z around inf 53.7%
Simplified53.7%
Final simplification58.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6.8e-14) (not (<= x 5e-58))) (* x (+ t (+ (* 2.0 (+ y z)) (* 5.0 (/ y x))))) (+ (* y 5.0) (* x (+ t (* 2.0 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.8e-14) || !(x <= 5e-58)) {
tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x))));
} else {
tmp = (y * 5.0) + (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 <= (-6.8d-14)) .or. (.not. (x <= 5d-58))) then
tmp = x * (t + ((2.0d0 * (y + z)) + (5.0d0 * (y / x))))
else
tmp = (y * 5.0d0) + (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 <= -6.8e-14) || !(x <= 5e-58)) {
tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x))));
} else {
tmp = (y * 5.0) + (x * (t + (2.0 * z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6.8e-14) or not (x <= 5e-58): tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x)))) else: tmp = (y * 5.0) + (x * (t + (2.0 * z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.8e-14) || !(x <= 5e-58)) tmp = Float64(x * Float64(t + Float64(Float64(2.0 * Float64(y + z)) + Float64(5.0 * Float64(y / x))))); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(2.0 * z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -6.8e-14) || ~((x <= 5e-58))) tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x)))); else tmp = (y * 5.0) + (x * (t + (2.0 * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.8e-14], N[Not[LessEqual[x, 5e-58]], $MachinePrecision]], N[(x * N[(t + N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + N[(5.0 * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-14} \lor \neg \left(x \leq 5 \cdot 10^{-58}\right):\\
\;\;\;\;x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \frac{y}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + 2 \cdot z\right)\\
\end{array}
\end{array}
if x < -6.80000000000000006e-14 or 4.99999999999999977e-58 < 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%
if -6.80000000000000006e-14 < x < 4.99999999999999977e-58Initial program 99.9%
Taylor expanded in y around 0 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.5) (not (<= x 0.108))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* y 5.0) (* x (+ t (* 2.0 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.5) || !(x <= 0.108)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (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 <= 0.108d0))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (y * 5.0d0) + (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 <= 0.108)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * (t + (2.0 * z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.5) or not (x <= 0.108): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (y * 5.0) + (x * (t + (2.0 * z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.5) || !(x <= 0.108)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(y * 5.0) + 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 <= 0.108))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (y * 5.0) + (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, 0.108]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \lor \neg \left(x \leq 0.108\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + 2 \cdot z\right)\\
\end{array}
\end{array}
if x < -2.5 or 0.107999999999999999 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 98.6%
if -2.5 < x < 0.107999999999999999Initial program 99.9%
Taylor expanded in y around 0 98.5%
Final simplification98.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.35e-82) (not (<= x 1.8e-15))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.35e-82) || !(x <= 1.8e-15)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.35d-82)) .or. (.not. (x <= 1.8d-15))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (y * 5.0d0) + (x * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.35e-82) || !(x <= 1.8e-15)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.35e-82) or not (x <= 1.8e-15): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (y * 5.0) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.35e-82) || !(x <= 1.8e-15)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(y * 5.0) + Float64(x * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.35e-82) || ~((x <= 1.8e-15))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (y * 5.0) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.35e-82], N[Not[LessEqual[x, 1.8e-15]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{-82} \lor \neg \left(x \leq 1.8 \cdot 10^{-15}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\end{array}
\end{array}
if x < -1.3500000000000001e-82 or 1.8000000000000001e-15 < 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 95.0%
if -1.3500000000000001e-82 < x < 1.8000000000000001e-15Initial program 99.9%
Taylor expanded in y around 0 99.9%
Taylor expanded in z around 0 88.2%
Final simplification92.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.15e-99) (not (<= y 9.2e+26))) (* y (+ 5.0 (* x 2.0))) (* x (+ t (* 2.0 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.15e-99) || !(y <= 9.2e+26)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (2.0 * z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-1.15d-99)) .or. (.not. (y <= 9.2d+26))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = x * (t + (2.0d0 * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.15e-99) || !(y <= 9.2e+26)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (2.0 * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.15e-99) or not (y <= 9.2e+26): tmp = y * (5.0 + (x * 2.0)) else: tmp = x * (t + (2.0 * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.15e-99) || !(y <= 9.2e+26)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(x * Float64(t + Float64(2.0 * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.15e-99) || ~((y <= 9.2e+26))) tmp = y * (5.0 + (x * 2.0)); else tmp = x * (t + (2.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.15e-99], N[Not[LessEqual[y, 9.2e+26]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{-99} \lor \neg \left(y \leq 9.2 \cdot 10^{+26}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\end{array}
\end{array}
if y < -1.1499999999999999e-99 or 9.2000000000000002e26 < y Initial program 99.9%
Taylor expanded in y around inf 82.5%
Simplified82.5%
if -1.1499999999999999e-99 < y < 9.2000000000000002e26Initial program 100.0%
Taylor expanded in y around 0 88.1%
Final simplification85.3%
(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 (if (or (<= x -2.35e-67) (not (<= x 7.2e-19))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.35e-67) || !(x <= 7.2e-19)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-2.35d-67)) .or. (.not. (x <= 7.2d-19))) then
tmp = x * t
else
tmp = y * 5.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.35e-67) || !(x <= 7.2e-19)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.35e-67) or not (x <= 7.2e-19): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.35e-67) || !(x <= 7.2e-19)) tmp = Float64(x * t); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.35e-67) || ~((x <= 7.2e-19))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.35e-67], N[Not[LessEqual[x, 7.2e-19]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.35 \cdot 10^{-67} \lor \neg \left(x \leq 7.2 \cdot 10^{-19}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -2.35000000000000002e-67 or 7.2000000000000002e-19 < x Initial program 100.0%
Taylor expanded in t around inf 47.4%
Simplified47.4%
if -2.35000000000000002e-67 < x < 7.2000000000000002e-19Initial program 99.9%
Taylor expanded in x around 0 64.9%
Final simplification55.1%
(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 2024055
(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)))