
(FPCore (x y z t) :precision binary64 (+ (* (+ (* x y) z) y) t))
double code(double x, double y, double z, double t) {
return (((x * y) + z) * y) + t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * y) + z) * y) + t
end function
public static double code(double x, double y, double z, double t) {
return (((x * y) + z) * y) + t;
}
def code(x, y, z, t): return (((x * y) + z) * y) + t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * y) + z) * y) + t) end
function tmp = code(x, y, z, t) tmp = (((x * y) + z) * y) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * y), $MachinePrecision] + z), $MachinePrecision] * y), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y + z\right) \cdot y + t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* (+ (* x y) z) y) t))
double code(double x, double y, double z, double t) {
return (((x * y) + z) * y) + t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * y) + z) * y) + t
end function
public static double code(double x, double y, double z, double t) {
return (((x * y) + z) * y) + t;
}
def code(x, y, z, t): return (((x * y) + z) * y) + t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * y) + z) * y) + t) end
function tmp = code(x, y, z, t) tmp = (((x * y) + z) * y) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * y), $MachinePrecision] + z), $MachinePrecision] * y), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y + z\right) \cdot y + t
\end{array}
(FPCore (x y z t) :precision binary64 (+ t (* y (+ z (* x y)))))
double code(double x, double y, double z, double t) {
return t + (y * (z + (x * y)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t + (y * (z + (x * y)))
end function
public static double code(double x, double y, double z, double t) {
return t + (y * (z + (x * y)));
}
def code(x, y, z, t): return t + (y * (z + (x * y)))
function code(x, y, z, t) return Float64(t + Float64(y * Float64(z + Float64(x * y)))) end
function tmp = code(x, y, z, t) tmp = t + (y * (z + (x * y))); end
code[x_, y_, z_, t_] := N[(t + N[(y * N[(z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + y \cdot \left(z + x \cdot y\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ t (* y z)))
(t_2 (+ t (* x (* y y))))
(t_3 (* y (+ z (* x y)))))
(if (<= y -24000000.0)
t_3
(if (<= y 1.15e-114)
t_1
(if (<= y 8e-98)
t_2
(if (<= y 3.5e+15) t_1 (if (<= y 2.3e+58) t_2 t_3)))))))
double code(double x, double y, double z, double t) {
double t_1 = t + (y * z);
double t_2 = t + (x * (y * y));
double t_3 = y * (z + (x * y));
double tmp;
if (y <= -24000000.0) {
tmp = t_3;
} else if (y <= 1.15e-114) {
tmp = t_1;
} else if (y <= 8e-98) {
tmp = t_2;
} else if (y <= 3.5e+15) {
tmp = t_1;
} else if (y <= 2.3e+58) {
tmp = t_2;
} else {
tmp = t_3;
}
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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = t + (y * z)
t_2 = t + (x * (y * y))
t_3 = y * (z + (x * y))
if (y <= (-24000000.0d0)) then
tmp = t_3
else if (y <= 1.15d-114) then
tmp = t_1
else if (y <= 8d-98) then
tmp = t_2
else if (y <= 3.5d+15) then
tmp = t_1
else if (y <= 2.3d+58) then
tmp = t_2
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t + (y * z);
double t_2 = t + (x * (y * y));
double t_3 = y * (z + (x * y));
double tmp;
if (y <= -24000000.0) {
tmp = t_3;
} else if (y <= 1.15e-114) {
tmp = t_1;
} else if (y <= 8e-98) {
tmp = t_2;
} else if (y <= 3.5e+15) {
tmp = t_1;
} else if (y <= 2.3e+58) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t): t_1 = t + (y * z) t_2 = t + (x * (y * y)) t_3 = y * (z + (x * y)) tmp = 0 if y <= -24000000.0: tmp = t_3 elif y <= 1.15e-114: tmp = t_1 elif y <= 8e-98: tmp = t_2 elif y <= 3.5e+15: tmp = t_1 elif y <= 2.3e+58: tmp = t_2 else: tmp = t_3 return tmp
function code(x, y, z, t) t_1 = Float64(t + Float64(y * z)) t_2 = Float64(t + Float64(x * Float64(y * y))) t_3 = Float64(y * Float64(z + Float64(x * y))) tmp = 0.0 if (y <= -24000000.0) tmp = t_3; elseif (y <= 1.15e-114) tmp = t_1; elseif (y <= 8e-98) tmp = t_2; elseif (y <= 3.5e+15) tmp = t_1; elseif (y <= 2.3e+58) tmp = t_2; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t + (y * z); t_2 = t + (x * (y * y)); t_3 = y * (z + (x * y)); tmp = 0.0; if (y <= -24000000.0) tmp = t_3; elseif (y <= 1.15e-114) tmp = t_1; elseif (y <= 8e-98) tmp = t_2; elseif (y <= 3.5e+15) tmp = t_1; elseif (y <= 2.3e+58) tmp = t_2; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t + N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t + N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(y * N[(z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -24000000.0], t$95$3, If[LessEqual[y, 1.15e-114], t$95$1, If[LessEqual[y, 8e-98], t$95$2, If[LessEqual[y, 3.5e+15], t$95$1, If[LessEqual[y, 2.3e+58], t$95$2, t$95$3]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + y \cdot z\\
t_2 := t + x \cdot \left(y \cdot y\right)\\
t_3 := y \cdot \left(z + x \cdot y\right)\\
\mathbf{if}\;y \leq -24000000:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-114}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-98}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+15}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+58}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if y < -2.4e7 or 2.30000000000000002e58 < y Initial program 99.9%
fma-def99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in t around 0 96.0%
if -2.4e7 < y < 1.15e-114 or 7.99999999999999951e-98 < y < 3.5e15Initial program 100.0%
Taylor expanded in x around 0 92.1%
if 1.15e-114 < y < 7.99999999999999951e-98 or 3.5e15 < y < 2.30000000000000002e58Initial program 99.9%
*-commutative99.9%
distribute-rgt-in99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 93.0%
unpow293.0%
*-commutative93.0%
Simplified93.0%
Final simplification93.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (* x y))) (t_2 (+ t (* y z))))
(if (<= y -2.05e+157)
t_1
(if (<= y -5.4e+47)
t_2
(if (<= y -7.8e+28) (* x (* y y)) (if (<= y 1.1e+56) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (x * y);
double t_2 = t + (y * z);
double tmp;
if (y <= -2.05e+157) {
tmp = t_1;
} else if (y <= -5.4e+47) {
tmp = t_2;
} else if (y <= -7.8e+28) {
tmp = x * (y * y);
} else if (y <= 1.1e+56) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = y * (x * y)
t_2 = t + (y * z)
if (y <= (-2.05d+157)) then
tmp = t_1
else if (y <= (-5.4d+47)) then
tmp = t_2
else if (y <= (-7.8d+28)) then
tmp = x * (y * y)
else if (y <= 1.1d+56) then
tmp = t_2
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 * (x * y);
double t_2 = t + (y * z);
double tmp;
if (y <= -2.05e+157) {
tmp = t_1;
} else if (y <= -5.4e+47) {
tmp = t_2;
} else if (y <= -7.8e+28) {
tmp = x * (y * y);
} else if (y <= 1.1e+56) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (x * y) t_2 = t + (y * z) tmp = 0 if y <= -2.05e+157: tmp = t_1 elif y <= -5.4e+47: tmp = t_2 elif y <= -7.8e+28: tmp = x * (y * y) elif y <= 1.1e+56: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(x * y)) t_2 = Float64(t + Float64(y * z)) tmp = 0.0 if (y <= -2.05e+157) tmp = t_1; elseif (y <= -5.4e+47) tmp = t_2; elseif (y <= -7.8e+28) tmp = Float64(x * Float64(y * y)); elseif (y <= 1.1e+56) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (x * y); t_2 = t + (y * z); tmp = 0.0; if (y <= -2.05e+157) tmp = t_1; elseif (y <= -5.4e+47) tmp = t_2; elseif (y <= -7.8e+28) tmp = x * (y * y); elseif (y <= 1.1e+56) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t + N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.05e+157], t$95$1, If[LessEqual[y, -5.4e+47], t$95$2, If[LessEqual[y, -7.8e+28], N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e+56], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(x \cdot y\right)\\
t_2 := t + y \cdot z\\
\mathbf{if}\;y \leq -2.05 \cdot 10^{+157}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -5.4 \cdot 10^{+47}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -7.8 \cdot 10^{+28}:\\
\;\;\;\;x \cdot \left(y \cdot y\right)\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+56}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -2.05000000000000008e157 or 1.10000000000000008e56 < y Initial program 99.9%
fma-def99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in t around 0 98.0%
Taylor expanded in y around inf 79.6%
if -2.05000000000000008e157 < y < -5.39999999999999991e47 or -7.7999999999999997e28 < y < 1.10000000000000008e56Initial program 100.0%
Taylor expanded in x around 0 82.8%
if -5.39999999999999991e47 < y < -7.7999999999999997e28Initial program 99.4%
fma-def99.4%
fma-def99.4%
Simplified99.4%
Taylor expanded in t around 0 99.4%
Taylor expanded in y around inf 99.4%
Taylor expanded in y around 0 100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Final simplification82.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (* y y))))
(if (<= y -1.55e+26)
t_1
(if (<= y -4e-98) (* y z) (if (<= y 1.05e-7) t t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (y * y);
double tmp;
if (y <= -1.55e+26) {
tmp = t_1;
} else if (y <= -4e-98) {
tmp = y * z;
} else if (y <= 1.05e-7) {
tmp = 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 * (y * y)
if (y <= (-1.55d+26)) then
tmp = t_1
else if (y <= (-4d-98)) then
tmp = y * z
else if (y <= 1.05d-7) then
tmp = 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 * (y * y);
double tmp;
if (y <= -1.55e+26) {
tmp = t_1;
} else if (y <= -4e-98) {
tmp = y * z;
} else if (y <= 1.05e-7) {
tmp = t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (y * y) tmp = 0 if y <= -1.55e+26: tmp = t_1 elif y <= -4e-98: tmp = y * z elif y <= 1.05e-7: tmp = t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(y * y)) tmp = 0.0 if (y <= -1.55e+26) tmp = t_1; elseif (y <= -4e-98) tmp = Float64(y * z); elseif (y <= 1.05e-7) tmp = t; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (y * y); tmp = 0.0; if (y <= -1.55e+26) tmp = t_1; elseif (y <= -4e-98) tmp = y * z; elseif (y <= 1.05e-7) tmp = t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.55e+26], t$95$1, If[LessEqual[y, -4e-98], N[(y * z), $MachinePrecision], If[LessEqual[y, 1.05e-7], t, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(y \cdot y\right)\\
\mathbf{if}\;y \leq -1.55 \cdot 10^{+26}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-98}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{-7}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -1.55e26 or 1.05e-7 < y Initial program 99.9%
fma-def99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in t around 0 90.7%
Taylor expanded in y around inf 66.8%
Taylor expanded in y around 0 62.9%
unpow262.9%
*-commutative62.9%
Simplified62.9%
if -1.55e26 < y < -3.99999999999999976e-98Initial program 99.9%
fma-def99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in t around 0 69.3%
Taylor expanded in y around 0 55.8%
if -3.99999999999999976e-98 < y < 1.05e-7Initial program 100.0%
fma-def100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in y around 0 68.3%
Final simplification64.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (* x y))))
(if (<= y -1.85e+28)
t_1
(if (<= y -5.5e-98) (* y z) (if (<= y 1.6e-6) t t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (x * y);
double tmp;
if (y <= -1.85e+28) {
tmp = t_1;
} else if (y <= -5.5e-98) {
tmp = y * z;
} else if (y <= 1.6e-6) {
tmp = 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 = y * (x * y)
if (y <= (-1.85d+28)) then
tmp = t_1
else if (y <= (-5.5d-98)) then
tmp = y * z
else if (y <= 1.6d-6) then
tmp = 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 = y * (x * y);
double tmp;
if (y <= -1.85e+28) {
tmp = t_1;
} else if (y <= -5.5e-98) {
tmp = y * z;
} else if (y <= 1.6e-6) {
tmp = t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (x * y) tmp = 0 if y <= -1.85e+28: tmp = t_1 elif y <= -5.5e-98: tmp = y * z elif y <= 1.6e-6: tmp = t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(x * y)) tmp = 0.0 if (y <= -1.85e+28) tmp = t_1; elseif (y <= -5.5e-98) tmp = Float64(y * z); elseif (y <= 1.6e-6) tmp = t; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (x * y); tmp = 0.0; if (y <= -1.85e+28) tmp = t_1; elseif (y <= -5.5e-98) tmp = y * z; elseif (y <= 1.6e-6) tmp = t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.85e+28], t$95$1, If[LessEqual[y, -5.5e-98], N[(y * z), $MachinePrecision], If[LessEqual[y, 1.6e-6], t, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(x \cdot y\right)\\
\mathbf{if}\;y \leq -1.85 \cdot 10^{+28}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -5.5 \cdot 10^{-98}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-6}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -1.85e28 or 1.5999999999999999e-6 < y Initial program 99.9%
fma-def99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in t around 0 90.7%
Taylor expanded in y around inf 66.8%
if -1.85e28 < y < -5.4999999999999997e-98Initial program 99.9%
fma-def99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in t around 0 69.3%
Taylor expanded in y around 0 55.8%
if -5.4999999999999997e-98 < y < 1.5999999999999999e-6Initial program 100.0%
fma-def100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in y around 0 68.3%
Final simplification66.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1750000000.0) (not (<= y 3.2e-7))) (* y (+ z (* x y))) (+ t (* y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1750000000.0) || !(y <= 3.2e-7)) {
tmp = y * (z + (x * y));
} else {
tmp = t + (y * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-1750000000.0d0)) .or. (.not. (y <= 3.2d-7))) then
tmp = y * (z + (x * y))
else
tmp = t + (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1750000000.0) || !(y <= 3.2e-7)) {
tmp = y * (z + (x * y));
} else {
tmp = t + (y * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1750000000.0) or not (y <= 3.2e-7): tmp = y * (z + (x * y)) else: tmp = t + (y * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1750000000.0) || !(y <= 3.2e-7)) tmp = Float64(y * Float64(z + Float64(x * y))); else tmp = Float64(t + Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1750000000.0) || ~((y <= 3.2e-7))) tmp = y * (z + (x * y)); else tmp = t + (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1750000000.0], N[Not[LessEqual[y, 3.2e-7]], $MachinePrecision]], N[(y * N[(z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1750000000 \lor \neg \left(y \leq 3.2 \cdot 10^{-7}\right):\\
\;\;\;\;y \cdot \left(z + x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t + y \cdot z\\
\end{array}
\end{array}
if y < -1.75e9 or 3.2000000000000001e-7 < y Initial program 99.9%
fma-def99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in t around 0 91.0%
if -1.75e9 < y < 3.2000000000000001e-7Initial program 100.0%
Taylor expanded in x around 0 89.5%
Final simplification90.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.2e+25) (not (<= z 1.12e+92))) (+ t (* y z)) (+ t (* y (* x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.2e+25) || !(z <= 1.12e+92)) {
tmp = t + (y * z);
} else {
tmp = t + (y * (x * y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-5.2d+25)) .or. (.not. (z <= 1.12d+92))) then
tmp = t + (y * z)
else
tmp = t + (y * (x * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.2e+25) || !(z <= 1.12e+92)) {
tmp = t + (y * z);
} else {
tmp = t + (y * (x * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.2e+25) or not (z <= 1.12e+92): tmp = t + (y * z) else: tmp = t + (y * (x * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.2e+25) || !(z <= 1.12e+92)) tmp = Float64(t + Float64(y * z)); else tmp = Float64(t + Float64(y * Float64(x * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.2e+25) || ~((z <= 1.12e+92))) tmp = t + (y * z); else tmp = t + (y * (x * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.2e+25], N[Not[LessEqual[z, 1.12e+92]], $MachinePrecision]], N[(t + N[(y * z), $MachinePrecision]), $MachinePrecision], N[(t + N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+25} \lor \neg \left(z \leq 1.12 \cdot 10^{+92}\right):\\
\;\;\;\;t + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t + y \cdot \left(x \cdot y\right)\\
\end{array}
\end{array}
if z < -5.1999999999999997e25 or 1.1199999999999999e92 < z Initial program 100.0%
Taylor expanded in x around 0 84.4%
if -5.1999999999999997e25 < z < 1.1199999999999999e92Initial program 99.9%
Taylor expanded in x around inf 94.2%
Final simplification89.9%
(FPCore (x y z t) :precision binary64 (if (<= z -1.7e+95) (* y z) (if (<= z 8e+27) t (* y z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.7e+95) {
tmp = y * z;
} else if (z <= 8e+27) {
tmp = t;
} else {
tmp = y * z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.7d+95)) then
tmp = y * z
else if (z <= 8d+27) then
tmp = t
else
tmp = y * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.7e+95) {
tmp = y * z;
} else if (z <= 8e+27) {
tmp = t;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.7e+95: tmp = y * z elif z <= 8e+27: tmp = t else: tmp = y * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.7e+95) tmp = Float64(y * z); elseif (z <= 8e+27) tmp = t; else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.7e+95) tmp = y * z; elseif (z <= 8e+27) tmp = t; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.7e+95], N[(y * z), $MachinePrecision], If[LessEqual[z, 8e+27], t, N[(y * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{+95}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+27}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1.70000000000000011e95 or 8.0000000000000001e27 < z Initial program 100.0%
fma-def100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in t around 0 79.7%
Taylor expanded in y around 0 61.1%
if -1.70000000000000011e95 < z < 8.0000000000000001e27Initial program 99.9%
fma-def99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in y around 0 46.4%
Final simplification52.7%
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
return t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t
end function
public static double code(double x, double y, double z, double t) {
return t;
}
def code(x, y, z, t): return t
function code(x, y, z, t) return t end
function tmp = code(x, y, z, t) tmp = t; end
code[x_, y_, z_, t_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 99.9%
fma-def99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in y around 0 35.6%
Final simplification35.6%
herbie shell --seed 2023268
(FPCore (x y z t)
:name "Language.Haskell.HsColour.ColourHighlight:unbase from hscolour-1.23"
:precision binary64
(+ (* (+ (* x y) z) y) t))