
(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 13 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%
(FPCore (x y z t)
:precision binary64
(if (or (<= y -2.4e+16)
(not (or (<= y -1.3e-18) (and (not (<= y -1.1e-75)) (<= y 5.8e+54)))))
(* 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.4e+16) || !((y <= -1.3e-18) || (!(y <= -1.1e-75) && (y <= 5.8e+54)))) {
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.4d+16)) .or. (.not. (y <= (-1.3d-18)) .or. (.not. (y <= (-1.1d-75))) .and. (y <= 5.8d+54))) 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.4e+16) || !((y <= -1.3e-18) || (!(y <= -1.1e-75) && (y <= 5.8e+54)))) {
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.4e+16) or not ((y <= -1.3e-18) or (not (y <= -1.1e-75) and (y <= 5.8e+54))): 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.4e+16) || !((y <= -1.3e-18) || (!(y <= -1.1e-75) && (y <= 5.8e+54)))) 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.4e+16) || ~(((y <= -1.3e-18) || (~((y <= -1.1e-75)) && (y <= 5.8e+54))))) 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.4e+16], N[Not[Or[LessEqual[y, -1.3e-18], And[N[Not[LessEqual[y, -1.1e-75]], $MachinePrecision], LessEqual[y, 5.8e+54]]]], $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.4 \cdot 10^{+16} \lor \neg \left(y \leq -1.3 \cdot 10^{-18} \lor \neg \left(y \leq -1.1 \cdot 10^{-75}\right) \land y \leq 5.8 \cdot 10^{+54}\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.4e16 or -1.3e-18 < y < -1.10000000000000003e-75 or 5.7999999999999997e54 < y Initial program 99.9%
Taylor expanded in y around inf 78.0%
Simplified78.0%
if -2.4e16 < y < -1.3e-18 or -1.10000000000000003e-75 < y < 5.7999999999999997e54Initial program 99.9%
Taylor expanded in y around 0 81.0%
Final simplification79.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* 2.0 y)))))
(if (<= x -9.2e+86)
t_1
(if (<= x -1.36e+45)
(* z (* x 2.0))
(if (or (<= x -5.5e-54) (not (<= x 2.6e-14))) t_1 (* y 5.0))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * y));
double tmp;
if (x <= -9.2e+86) {
tmp = t_1;
} else if (x <= -1.36e+45) {
tmp = z * (x * 2.0);
} else if ((x <= -5.5e-54) || !(x <= 2.6e-14)) {
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 + (2.0d0 * y))
if (x <= (-9.2d+86)) then
tmp = t_1
else if (x <= (-1.36d+45)) then
tmp = z * (x * 2.0d0)
else if ((x <= (-5.5d-54)) .or. (.not. (x <= 2.6d-14))) 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 + (2.0 * y));
double tmp;
if (x <= -9.2e+86) {
tmp = t_1;
} else if (x <= -1.36e+45) {
tmp = z * (x * 2.0);
} else if ((x <= -5.5e-54) || !(x <= 2.6e-14)) {
tmp = t_1;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (2.0 * y)) tmp = 0 if x <= -9.2e+86: tmp = t_1 elif x <= -1.36e+45: tmp = z * (x * 2.0) elif (x <= -5.5e-54) or not (x <= 2.6e-14): tmp = t_1 else: tmp = y * 5.0 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(2.0 * y))) tmp = 0.0 if (x <= -9.2e+86) tmp = t_1; elseif (x <= -1.36e+45) tmp = Float64(z * Float64(x * 2.0)); elseif ((x <= -5.5e-54) || !(x <= 2.6e-14)) 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 + (2.0 * y)); tmp = 0.0; if (x <= -9.2e+86) tmp = t_1; elseif (x <= -1.36e+45) tmp = z * (x * 2.0); elseif ((x <= -5.5e-54) || ~((x <= 2.6e-14))) 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[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.2e+86], t$95$1, If[LessEqual[x, -1.36e+45], N[(z * N[(x * 2.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -5.5e-54], N[Not[LessEqual[x, 2.6e-14]], $MachinePrecision]], t$95$1, N[(y * 5.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot y\right)\\
\mathbf{if}\;x \leq -9.2 \cdot 10^{+86}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.36 \cdot 10^{+45}:\\
\;\;\;\;z \cdot \left(x \cdot 2\right)\\
\mathbf{elif}\;x \leq -5.5 \cdot 10^{-54} \lor \neg \left(x \leq 2.6 \cdot 10^{-14}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -9.19999999999999958e86 or -1.36e45 < x < -5.50000000000000046e-54 or 2.59999999999999997e-14 < 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 99.2%
Taylor expanded in z around 0 70.7%
if -9.19999999999999958e86 < x < -1.36e45Initial program 99.8%
Taylor expanded in z around inf 76.3%
Simplified76.3%
if -5.50000000000000046e-54 < x < 2.59999999999999997e-14Initial program 99.8%
Taylor expanded in x around 0 64.6%
Final simplification68.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* 2.0 z)))))
(if (<= x -7.4e-57)
t_1
(if (<= x 2.3e-126)
(+ (* y 5.0) (* x t))
(if (<= x 2.8e+156)
t_1
(if (<= x 6.5e+245) (* (+ y z) (* x 2.0)) (* x (+ t (* 2.0 y)))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * z));
double tmp;
if (x <= -7.4e-57) {
tmp = t_1;
} else if (x <= 2.3e-126) {
tmp = (y * 5.0) + (x * t);
} else if (x <= 2.8e+156) {
tmp = t_1;
} else if (x <= 6.5e+245) {
tmp = (y + z) * (x * 2.0);
} else {
tmp = x * (t + (2.0 * y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (t + (2.0d0 * z))
if (x <= (-7.4d-57)) then
tmp = t_1
else if (x <= 2.3d-126) then
tmp = (y * 5.0d0) + (x * t)
else if (x <= 2.8d+156) then
tmp = t_1
else if (x <= 6.5d+245) then
tmp = (y + z) * (x * 2.0d0)
else
tmp = x * (t + (2.0d0 * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * z));
double tmp;
if (x <= -7.4e-57) {
tmp = t_1;
} else if (x <= 2.3e-126) {
tmp = (y * 5.0) + (x * t);
} else if (x <= 2.8e+156) {
tmp = t_1;
} else if (x <= 6.5e+245) {
tmp = (y + z) * (x * 2.0);
} else {
tmp = x * (t + (2.0 * y));
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (2.0 * z)) tmp = 0 if x <= -7.4e-57: tmp = t_1 elif x <= 2.3e-126: tmp = (y * 5.0) + (x * t) elif x <= 2.8e+156: tmp = t_1 elif x <= 6.5e+245: tmp = (y + z) * (x * 2.0) else: tmp = x * (t + (2.0 * y)) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(2.0 * z))) tmp = 0.0 if (x <= -7.4e-57) tmp = t_1; elseif (x <= 2.3e-126) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); elseif (x <= 2.8e+156) tmp = t_1; elseif (x <= 6.5e+245) tmp = Float64(Float64(y + z) * Float64(x * 2.0)); else tmp = Float64(x * Float64(t + Float64(2.0 * y))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (2.0 * z)); tmp = 0.0; if (x <= -7.4e-57) tmp = t_1; elseif (x <= 2.3e-126) tmp = (y * 5.0) + (x * t); elseif (x <= 2.8e+156) tmp = t_1; elseif (x <= 6.5e+245) tmp = (y + z) * (x * 2.0); else tmp = x * (t + (2.0 * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.4e-57], t$95$1, If[LessEqual[x, 2.3e-126], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.8e+156], t$95$1, If[LessEqual[x, 6.5e+245], N[(N[(y + z), $MachinePrecision] * N[(x * 2.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{if}\;x \leq -7.4 \cdot 10^{-57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-126}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+156}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+245}:\\
\;\;\;\;\left(y + z\right) \cdot \left(x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\
\end{array}
\end{array}
if x < -7.4e-57 or 2.30000000000000011e-126 < x < 2.79999999999999988e156Initial program 100.0%
Taylor expanded in y around 0 73.5%
if -7.4e-57 < x < 2.30000000000000011e-126Initial program 99.8%
Taylor expanded in y around 0 99.8%
Taylor expanded in z around 0 87.9%
if 2.79999999999999988e156 < x < 6.50000000000000035e245Initial 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%
Taylor expanded in t around 0 89.8%
associate-*r*89.8%
*-commutative89.8%
Simplified89.8%
if 6.50000000000000035e245 < 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%
Taylor expanded in z around 0 92.2%
Final simplification80.9%
(FPCore (x y z t)
:precision binary64
(if (<= x -2.3e-53)
(* x t)
(if (<= x 4.5e-10)
(* y 5.0)
(if (or (<= x 5.8e+162) (not (<= x 2.8e+279))) (* x t) (* y (* x 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.3e-53) {
tmp = x * t;
} else if (x <= 4.5e-10) {
tmp = y * 5.0;
} else if ((x <= 5.8e+162) || !(x <= 2.8e+279)) {
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.3d-53)) then
tmp = x * t
else if (x <= 4.5d-10) then
tmp = y * 5.0d0
else if ((x <= 5.8d+162) .or. (.not. (x <= 2.8d+279))) 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.3e-53) {
tmp = x * t;
} else if (x <= 4.5e-10) {
tmp = y * 5.0;
} else if ((x <= 5.8e+162) || !(x <= 2.8e+279)) {
tmp = x * t;
} else {
tmp = y * (x * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.3e-53: tmp = x * t elif x <= 4.5e-10: tmp = y * 5.0 elif (x <= 5.8e+162) or not (x <= 2.8e+279): tmp = x * t else: tmp = y * (x * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.3e-53) tmp = Float64(x * t); elseif (x <= 4.5e-10) tmp = Float64(y * 5.0); elseif ((x <= 5.8e+162) || !(x <= 2.8e+279)) 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.3e-53) tmp = x * t; elseif (x <= 4.5e-10) tmp = y * 5.0; elseif ((x <= 5.8e+162) || ~((x <= 2.8e+279))) tmp = x * t; else tmp = y * (x * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.3e-53], N[(x * t), $MachinePrecision], If[LessEqual[x, 4.5e-10], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 5.8e+162], N[Not[LessEqual[x, 2.8e+279]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{-53}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-10}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{+162} \lor \neg \left(x \leq 2.8 \cdot 10^{+279}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\
\end{array}
\end{array}
if x < -2.3000000000000001e-53 or 4.5e-10 < x < 5.80000000000000012e162 or 2.8000000000000002e279 < x Initial program 100.0%
Taylor expanded in t around inf 42.8%
Simplified42.8%
if -2.3000000000000001e-53 < x < 4.5e-10Initial program 99.8%
Taylor expanded in x around 0 64.6%
if 5.80000000000000012e162 < x < 2.8000000000000002e279Initial program 100.0%
Taylor expanded in y around inf 42.1%
Simplified42.1%
Taylor expanded in x around inf 42.1%
Taylor expanded in x around inf 42.1%
associate-*r*42.1%
*-commutative42.1%
Simplified42.1%
Final simplification52.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5400000.0) (not (<= x 3.4e-34))) (* 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 <= -5400000.0) || !(x <= 3.4e-34)) {
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 <= (-5400000.0d0)) .or. (.not. (x <= 3.4d-34))) 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 <= -5400000.0) || !(x <= 3.4e-34)) {
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 <= -5400000.0) or not (x <= 3.4e-34): 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 <= -5400000.0) || !(x <= 3.4e-34)) 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 <= -5400000.0) || ~((x <= 3.4e-34))) 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, -5400000.0], N[Not[LessEqual[x, 3.4e-34]], $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 -5400000 \lor \neg \left(x \leq 3.4 \cdot 10^{-34}\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 < -5.4e6 or 3.4000000000000001e-34 < 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 -5.4e6 < x < 3.4000000000000001e-34Initial program 99.9%
Taylor expanded in y around 0 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5400000.0) (not (<= x 5.3e-8))) (* 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 <= -5400000.0) || !(x <= 5.3e-8)) {
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 <= (-5400000.0d0)) .or. (.not. (x <= 5.3d-8))) 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 <= -5400000.0) || !(x <= 5.3e-8)) {
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 <= -5400000.0) or not (x <= 5.3e-8): 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 <= -5400000.0) || !(x <= 5.3e-8)) 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 <= -5400000.0) || ~((x <= 5.3e-8))) 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, -5400000.0], N[Not[LessEqual[x, 5.3e-8]], $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 -5400000 \lor \neg \left(x \leq 5.3 \cdot 10^{-8}\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 < -5.4e6 or 5.2999999999999998e-8 < 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 -5.4e6 < x < 5.2999999999999998e-8Initial program 99.8%
Taylor expanded in y around 0 99.8%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (* x 2.0))))
(if (<= x -4.7e-57)
t_1
(if (<= x 1.4e-10) (* y 5.0) (if (<= x 2.5e+156) (* x t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x * 2.0);
double tmp;
if (x <= -4.7e-57) {
tmp = t_1;
} else if (x <= 1.4e-10) {
tmp = y * 5.0;
} else if (x <= 2.5e+156) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z * (x * 2.0d0)
if (x <= (-4.7d-57)) then
tmp = t_1
else if (x <= 1.4d-10) then
tmp = y * 5.0d0
else if (x <= 2.5d+156) then
tmp = x * t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (x * 2.0);
double tmp;
if (x <= -4.7e-57) {
tmp = t_1;
} else if (x <= 1.4e-10) {
tmp = y * 5.0;
} else if (x <= 2.5e+156) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x * 2.0) tmp = 0 if x <= -4.7e-57: tmp = t_1 elif x <= 1.4e-10: tmp = y * 5.0 elif x <= 2.5e+156: tmp = x * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x * 2.0)) tmp = 0.0 if (x <= -4.7e-57) tmp = t_1; elseif (x <= 1.4e-10) tmp = Float64(y * 5.0); elseif (x <= 2.5e+156) tmp = Float64(x * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x * 2.0); tmp = 0.0; if (x <= -4.7e-57) tmp = t_1; elseif (x <= 1.4e-10) tmp = y * 5.0; elseif (x <= 2.5e+156) tmp = x * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.7e-57], t$95$1, If[LessEqual[x, 1.4e-10], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 2.5e+156], N[(x * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x \cdot 2\right)\\
\mathbf{if}\;x \leq -4.7 \cdot 10^{-57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-10}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+156}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.6999999999999998e-57 or 2.49999999999999996e156 < x Initial program 100.0%
Taylor expanded in z around inf 42.0%
Simplified42.0%
if -4.6999999999999998e-57 < x < 1.40000000000000008e-10Initial program 99.8%
Taylor expanded in x around 0 65.1%
if 1.40000000000000008e-10 < x < 2.49999999999999996e156Initial program 100.0%
Taylor expanded in t around inf 50.0%
Simplified50.0%
Final simplification53.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.15e-56) (not (<= x 1.06e-126))) (* 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 <= -2.15e-56) || !(x <= 1.06e-126)) {
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 <= (-2.15d-56)) .or. (.not. (x <= 1.06d-126))) 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 <= -2.15e-56) || !(x <= 1.06e-126)) {
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 <= -2.15e-56) or not (x <= 1.06e-126): 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 <= -2.15e-56) || !(x <= 1.06e-126)) 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 <= -2.15e-56) || ~((x <= 1.06e-126))) 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, -2.15e-56], N[Not[LessEqual[x, 1.06e-126]], $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 -2.15 \cdot 10^{-56} \lor \neg \left(x \leq 1.06 \cdot 10^{-126}\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 < -2.1500000000000001e-56 or 1.0600000000000001e-126 < 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 94.5%
if -2.1500000000000001e-56 < x < 1.0600000000000001e-126Initial program 99.8%
Taylor expanded in y around 0 99.8%
Taylor expanded in z around 0 87.9%
Final simplification92.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.1e-130) (not (<= x 3.5e-130))) (* x (+ t (* 2.0 z))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.1e-130) || !(x <= 3.5e-130)) {
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 <= (-2.1d-130)) .or. (.not. (x <= 3.5d-130))) 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 <= -2.1e-130) || !(x <= 3.5e-130)) {
tmp = x * (t + (2.0 * z));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.1e-130) or not (x <= 3.5e-130): tmp = x * (t + (2.0 * z)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.1e-130) || !(x <= 3.5e-130)) 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 <= -2.1e-130) || ~((x <= 3.5e-130))) 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, -2.1e-130], N[Not[LessEqual[x, 3.5e-130]], $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 -2.1 \cdot 10^{-130} \lor \neg \left(x \leq 3.5 \cdot 10^{-130}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -2.10000000000000002e-130 or 3.4999999999999999e-130 < x Initial program 99.9%
Taylor expanded in y around 0 70.9%
if -2.10000000000000002e-130 < x < 3.4999999999999999e-130Initial program 99.8%
Taylor expanded in x around 0 75.9%
Final simplification72.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 (if (or (<= x -6.2e-53) (not (<= x 1.4e-9))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.2e-53) || !(x <= 1.4e-9)) {
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 <= (-6.2d-53)) .or. (.not. (x <= 1.4d-9))) 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 <= -6.2e-53) || !(x <= 1.4e-9)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6.2e-53) or not (x <= 1.4e-9): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.2e-53) || !(x <= 1.4e-9)) 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 <= -6.2e-53) || ~((x <= 1.4e-9))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.2e-53], N[Not[LessEqual[x, 1.4e-9]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{-53} \lor \neg \left(x \leq 1.4 \cdot 10^{-9}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -6.20000000000000031e-53 or 1.39999999999999992e-9 < x Initial program 100.0%
Taylor expanded in t around inf 39.5%
Simplified39.5%
if -6.20000000000000031e-53 < x < 1.39999999999999992e-9Initial program 99.8%
Taylor expanded in x around 0 64.6%
Final simplification51.2%
(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.8%
Final simplification31.8%
herbie shell --seed 2024100
(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)))