
(FPCore (x y z t) :precision binary64 (+ (- (* (/ 1.0 8.0) x) (/ (* y z) 2.0)) t))
double code(double x, double y, double z, double t) {
return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + 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 = (((1.0d0 / 8.0d0) * x) - ((y * z) / 2.0d0)) + t
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t;
}
def code(x, y, z, t): return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / 8.0) * x) - Float64(Float64(y * z) / 2.0)) + t) end
function tmp = code(x, y, z, t) tmp = (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / 8.0), $MachinePrecision] * x), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{1}{8} \cdot x - \frac{y \cdot z}{2}\right) + t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (- (* (/ 1.0 8.0) x) (/ (* y z) 2.0)) t))
double code(double x, double y, double z, double t) {
return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + 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 = (((1.0d0 / 8.0d0) * x) - ((y * z) / 2.0d0)) + t
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t;
}
def code(x, y, z, t): return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / 8.0) * x) - Float64(Float64(y * z) / 2.0)) + t) end
function tmp = code(x, y, z, t) tmp = (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / 8.0), $MachinePrecision] * x), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{1}{8} \cdot x - \frac{y \cdot z}{2}\right) + t
\end{array}
(FPCore (x y z t) :precision binary64 (+ (- (* 0.125 x) (* y (/ z 2.0))) t))
double code(double x, double y, double z, double t) {
return ((0.125 * x) - (y * (z / 2.0))) + 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 = ((0.125d0 * x) - (y * (z / 2.0d0))) + t
end function
public static double code(double x, double y, double z, double t) {
return ((0.125 * x) - (y * (z / 2.0))) + t;
}
def code(x, y, z, t): return ((0.125 * x) - (y * (z / 2.0))) + t
function code(x, y, z, t) return Float64(Float64(Float64(0.125 * x) - Float64(y * Float64(z / 2.0))) + t) end
function tmp = code(x, y, z, t) tmp = ((0.125 * x) - (y * (z / 2.0))) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(0.125 * x), $MachinePrecision] - N[(y * N[(z / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\left(0.125 \cdot x - y \cdot \frac{z}{2}\right) + t
\end{array}
Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
metadata-eval100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (* z -0.5))))
(if (<= t -3e+128)
t
(if (<= t -1.5e-8)
t_1
(if (<= t -1.6e-167)
(* 0.125 x)
(if (<= t -5.2e-256)
t_1
(if (<= t 3.8e-275)
(* 0.125 x)
(if (<= t 6.1e-248)
t_1
(if (<= t 4e-122) (* 0.125 x) (if (<= t 2.8e+44) t_1 t))))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z * -0.5);
double tmp;
if (t <= -3e+128) {
tmp = t;
} else if (t <= -1.5e-8) {
tmp = t_1;
} else if (t <= -1.6e-167) {
tmp = 0.125 * x;
} else if (t <= -5.2e-256) {
tmp = t_1;
} else if (t <= 3.8e-275) {
tmp = 0.125 * x;
} else if (t <= 6.1e-248) {
tmp = t_1;
} else if (t <= 4e-122) {
tmp = 0.125 * x;
} else if (t <= 2.8e+44) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = y * (z * (-0.5d0))
if (t <= (-3d+128)) then
tmp = t
else if (t <= (-1.5d-8)) then
tmp = t_1
else if (t <= (-1.6d-167)) then
tmp = 0.125d0 * x
else if (t <= (-5.2d-256)) then
tmp = t_1
else if (t <= 3.8d-275) then
tmp = 0.125d0 * x
else if (t <= 6.1d-248) then
tmp = t_1
else if (t <= 4d-122) then
tmp = 0.125d0 * x
else if (t <= 2.8d+44) then
tmp = t_1
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (z * -0.5);
double tmp;
if (t <= -3e+128) {
tmp = t;
} else if (t <= -1.5e-8) {
tmp = t_1;
} else if (t <= -1.6e-167) {
tmp = 0.125 * x;
} else if (t <= -5.2e-256) {
tmp = t_1;
} else if (t <= 3.8e-275) {
tmp = 0.125 * x;
} else if (t <= 6.1e-248) {
tmp = t_1;
} else if (t <= 4e-122) {
tmp = 0.125 * x;
} else if (t <= 2.8e+44) {
tmp = t_1;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z * -0.5) tmp = 0 if t <= -3e+128: tmp = t elif t <= -1.5e-8: tmp = t_1 elif t <= -1.6e-167: tmp = 0.125 * x elif t <= -5.2e-256: tmp = t_1 elif t <= 3.8e-275: tmp = 0.125 * x elif t <= 6.1e-248: tmp = t_1 elif t <= 4e-122: tmp = 0.125 * x elif t <= 2.8e+44: tmp = t_1 else: tmp = t return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z * -0.5)) tmp = 0.0 if (t <= -3e+128) tmp = t; elseif (t <= -1.5e-8) tmp = t_1; elseif (t <= -1.6e-167) tmp = Float64(0.125 * x); elseif (t <= -5.2e-256) tmp = t_1; elseif (t <= 3.8e-275) tmp = Float64(0.125 * x); elseif (t <= 6.1e-248) tmp = t_1; elseif (t <= 4e-122) tmp = Float64(0.125 * x); elseif (t <= 2.8e+44) tmp = t_1; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z * -0.5); tmp = 0.0; if (t <= -3e+128) tmp = t; elseif (t <= -1.5e-8) tmp = t_1; elseif (t <= -1.6e-167) tmp = 0.125 * x; elseif (t <= -5.2e-256) tmp = t_1; elseif (t <= 3.8e-275) tmp = 0.125 * x; elseif (t <= 6.1e-248) tmp = t_1; elseif (t <= 4e-122) tmp = 0.125 * x; elseif (t <= 2.8e+44) tmp = t_1; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z * -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3e+128], t, If[LessEqual[t, -1.5e-8], t$95$1, If[LessEqual[t, -1.6e-167], N[(0.125 * x), $MachinePrecision], If[LessEqual[t, -5.2e-256], t$95$1, If[LessEqual[t, 3.8e-275], N[(0.125 * x), $MachinePrecision], If[LessEqual[t, 6.1e-248], t$95$1, If[LessEqual[t, 4e-122], N[(0.125 * x), $MachinePrecision], If[LessEqual[t, 2.8e+44], t$95$1, t]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(z \cdot -0.5\right)\\
\mathbf{if}\;t \leq -3 \cdot 10^{+128}:\\
\;\;\;\;t\\
\mathbf{elif}\;t \leq -1.5 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.6 \cdot 10^{-167}:\\
\;\;\;\;0.125 \cdot x\\
\mathbf{elif}\;t \leq -5.2 \cdot 10^{-256}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.8 \cdot 10^{-275}:\\
\;\;\;\;0.125 \cdot x\\
\mathbf{elif}\;t \leq 6.1 \cdot 10^{-248}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4 \cdot 10^{-122}:\\
\;\;\;\;0.125 \cdot x\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if t < -2.9999999999999998e128 or 2.8000000000000001e44 < t Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
metadata-eval100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in t around inf 76.1%
if -2.9999999999999998e128 < t < -1.49999999999999987e-8 or -1.6000000000000001e-167 < t < -5.2000000000000002e-256 or 3.79999999999999972e-275 < t < 6.0999999999999999e-248 or 4.00000000000000024e-122 < t < 2.8000000000000001e44Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
metadata-eval100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around inf 61.6%
*-commutative61.6%
associate-*r*61.6%
Simplified61.6%
if -1.49999999999999987e-8 < t < -1.6000000000000001e-167 or -5.2000000000000002e-256 < t < 3.79999999999999972e-275 or 6.0999999999999999e-248 < t < 4.00000000000000024e-122Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
metadata-eval100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 59.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (* y z) -1e+81) (not (<= (* y z) 5000000.0))) (- t (* 0.5 (* y z))) (+ (* 0.125 x) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((y * z) <= -1e+81) || !((y * z) <= 5000000.0)) {
tmp = t - (0.5 * (y * z));
} else {
tmp = (0.125 * 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 (((y * z) <= (-1d+81)) .or. (.not. ((y * z) <= 5000000.0d0))) then
tmp = t - (0.5d0 * (y * z))
else
tmp = (0.125d0 * x) + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((y * z) <= -1e+81) || !((y * z) <= 5000000.0)) {
tmp = t - (0.5 * (y * z));
} else {
tmp = (0.125 * x) + t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((y * z) <= -1e+81) or not ((y * z) <= 5000000.0): tmp = t - (0.5 * (y * z)) else: tmp = (0.125 * x) + t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(y * z) <= -1e+81) || !(Float64(y * z) <= 5000000.0)) tmp = Float64(t - Float64(0.5 * Float64(y * z))); else tmp = Float64(Float64(0.125 * x) + t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((y * z) <= -1e+81) || ~(((y * z) <= 5000000.0))) tmp = t - (0.5 * (y * z)); else tmp = (0.125 * x) + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(y * z), $MachinePrecision], -1e+81], N[Not[LessEqual[N[(y * z), $MachinePrecision], 5000000.0]], $MachinePrecision]], N[(t - N[(0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.125 * x), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -1 \cdot 10^{+81} \lor \neg \left(y \cdot z \leq 5000000\right):\\
\;\;\;\;t - 0.5 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;0.125 \cdot x + t\\
\end{array}
\end{array}
if (*.f64 y z) < -9.99999999999999921e80 or 5e6 < (*.f64 y z) Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
metadata-eval100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around 0 89.2%
if -9.99999999999999921e80 < (*.f64 y z) < 5e6Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
metadata-eval100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 89.9%
Final simplification89.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 0.5 (* y z))))
(if (or (<= t -7e+103) (not (<= t 1.9e+42)))
(- t t_1)
(- (* 0.125 x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = 0.5 * (y * z);
double tmp;
if ((t <= -7e+103) || !(t <= 1.9e+42)) {
tmp = t - t_1;
} else {
tmp = (0.125 * x) - 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 = 0.5d0 * (y * z)
if ((t <= (-7d+103)) .or. (.not. (t <= 1.9d+42))) then
tmp = t - t_1
else
tmp = (0.125d0 * x) - t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 0.5 * (y * z);
double tmp;
if ((t <= -7e+103) || !(t <= 1.9e+42)) {
tmp = t - t_1;
} else {
tmp = (0.125 * x) - t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 0.5 * (y * z) tmp = 0 if (t <= -7e+103) or not (t <= 1.9e+42): tmp = t - t_1 else: tmp = (0.125 * x) - t_1 return tmp
function code(x, y, z, t) t_1 = Float64(0.5 * Float64(y * z)) tmp = 0.0 if ((t <= -7e+103) || !(t <= 1.9e+42)) tmp = Float64(t - t_1); else tmp = Float64(Float64(0.125 * x) - t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 0.5 * (y * z); tmp = 0.0; if ((t <= -7e+103) || ~((t <= 1.9e+42))) tmp = t - t_1; else tmp = (0.125 * x) - t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t, -7e+103], N[Not[LessEqual[t, 1.9e+42]], $MachinePrecision]], N[(t - t$95$1), $MachinePrecision], N[(N[(0.125 * x), $MachinePrecision] - t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.5 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;t \leq -7 \cdot 10^{+103} \lor \neg \left(t \leq 1.9 \cdot 10^{+42}\right):\\
\;\;\;\;t - t\_1\\
\mathbf{else}:\\
\;\;\;\;0.125 \cdot x - t\_1\\
\end{array}
\end{array}
if t < -7e103 or 1.8999999999999999e42 < t Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
metadata-eval100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around 0 92.4%
if -7e103 < t < 1.8999999999999999e42Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
metadata-eval100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in t around 0 91.1%
Final simplification91.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 0.5 (* y z))))
(if (<= t -1.05e+104)
(* t (+ 1.0 (* -0.5 (* y (/ z t)))))
(if (<= t 8.2e+39) (- (* 0.125 x) t_1) (- t t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = 0.5 * (y * z);
double tmp;
if (t <= -1.05e+104) {
tmp = t * (1.0 + (-0.5 * (y * (z / t))));
} else if (t <= 8.2e+39) {
tmp = (0.125 * x) - t_1;
} else {
tmp = t - 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 = 0.5d0 * (y * z)
if (t <= (-1.05d+104)) then
tmp = t * (1.0d0 + ((-0.5d0) * (y * (z / t))))
else if (t <= 8.2d+39) then
tmp = (0.125d0 * x) - t_1
else
tmp = t - t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 0.5 * (y * z);
double tmp;
if (t <= -1.05e+104) {
tmp = t * (1.0 + (-0.5 * (y * (z / t))));
} else if (t <= 8.2e+39) {
tmp = (0.125 * x) - t_1;
} else {
tmp = t - t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 0.5 * (y * z) tmp = 0 if t <= -1.05e+104: tmp = t * (1.0 + (-0.5 * (y * (z / t)))) elif t <= 8.2e+39: tmp = (0.125 * x) - t_1 else: tmp = t - t_1 return tmp
function code(x, y, z, t) t_1 = Float64(0.5 * Float64(y * z)) tmp = 0.0 if (t <= -1.05e+104) tmp = Float64(t * Float64(1.0 + Float64(-0.5 * Float64(y * Float64(z / t))))); elseif (t <= 8.2e+39) tmp = Float64(Float64(0.125 * x) - t_1); else tmp = Float64(t - t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 0.5 * (y * z); tmp = 0.0; if (t <= -1.05e+104) tmp = t * (1.0 + (-0.5 * (y * (z / t)))); elseif (t <= 8.2e+39) tmp = (0.125 * x) - t_1; else tmp = t - t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.05e+104], N[(t * N[(1.0 + N[(-0.5 * N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.2e+39], N[(N[(0.125 * x), $MachinePrecision] - t$95$1), $MachinePrecision], N[(t - t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.5 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;t \leq -1.05 \cdot 10^{+104}:\\
\;\;\;\;t \cdot \left(1 + -0.5 \cdot \left(y \cdot \frac{z}{t}\right)\right)\\
\mathbf{elif}\;t \leq 8.2 \cdot 10^{+39}:\\
\;\;\;\;0.125 \cdot x - t\_1\\
\mathbf{else}:\\
\;\;\;\;t - t\_1\\
\end{array}
\end{array}
if t < -1.0499999999999999e104Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
metadata-eval100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around 0 88.1%
Taylor expanded in t around inf 88.1%
associate-/l*88.1%
Simplified88.1%
if -1.0499999999999999e104 < t < 8.20000000000000008e39Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
metadata-eval100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in t around 0 91.1%
if 8.20000000000000008e39 < t Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
metadata-eval100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around 0 95.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -5e+123) (not (<= y 4.4e-61))) (* y (* z -0.5)) (+ (* 0.125 x) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5e+123) || !(y <= 4.4e-61)) {
tmp = y * (z * -0.5);
} else {
tmp = (0.125 * 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 ((y <= (-5d+123)) .or. (.not. (y <= 4.4d-61))) then
tmp = y * (z * (-0.5d0))
else
tmp = (0.125d0 * x) + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5e+123) || !(y <= 4.4e-61)) {
tmp = y * (z * -0.5);
} else {
tmp = (0.125 * x) + t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -5e+123) or not (y <= 4.4e-61): tmp = y * (z * -0.5) else: tmp = (0.125 * x) + t return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -5e+123) || !(y <= 4.4e-61)) tmp = Float64(y * Float64(z * -0.5)); else tmp = Float64(Float64(0.125 * x) + t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -5e+123) || ~((y <= 4.4e-61))) tmp = y * (z * -0.5); else tmp = (0.125 * x) + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5e+123], N[Not[LessEqual[y, 4.4e-61]], $MachinePrecision]], N[(y * N[(z * -0.5), $MachinePrecision]), $MachinePrecision], N[(N[(0.125 * x), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+123} \lor \neg \left(y \leq 4.4 \cdot 10^{-61}\right):\\
\;\;\;\;y \cdot \left(z \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.125 \cdot x + t\\
\end{array}
\end{array}
if y < -4.99999999999999974e123 or 4.40000000000000017e-61 < y Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
metadata-eval100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around inf 55.1%
*-commutative55.1%
associate-*r*55.1%
Simplified55.1%
if -4.99999999999999974e123 < y < 4.40000000000000017e-61Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
metadata-eval100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 82.3%
Final simplification68.8%
(FPCore (x y z t) :precision binary64 (if (<= t -1.28e+104) t (if (<= t 1.25e+42) (* 0.125 x) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.28e+104) {
tmp = t;
} else if (t <= 1.25e+42) {
tmp = 0.125 * x;
} else {
tmp = 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 (t <= (-1.28d+104)) then
tmp = t
else if (t <= 1.25d+42) then
tmp = 0.125d0 * x
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.28e+104) {
tmp = t;
} else if (t <= 1.25e+42) {
tmp = 0.125 * x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.28e+104: tmp = t elif t <= 1.25e+42: tmp = 0.125 * x else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.28e+104) tmp = t; elseif (t <= 1.25e+42) tmp = Float64(0.125 * x); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.28e+104) tmp = t; elseif (t <= 1.25e+42) tmp = 0.125 * x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.28e+104], t, If[LessEqual[t, 1.25e+42], N[(0.125 * x), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.28 \cdot 10^{+104}:\\
\;\;\;\;t\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{+42}:\\
\;\;\;\;0.125 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if t < -1.27999999999999997e104 or 1.25000000000000002e42 < t Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
metadata-eval100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in t around inf 72.2%
if -1.27999999999999997e104 < t < 1.25000000000000002e42Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
metadata-eval100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 45.9%
(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 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
metadata-eval100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in t around inf 34.5%
(FPCore (x y z t) :precision binary64 (- (+ (/ x 8.0) t) (* (/ z 2.0) y)))
double code(double x, double y, double z, double t) {
return ((x / 8.0) + t) - ((z / 2.0) * 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 = ((x / 8.0d0) + t) - ((z / 2.0d0) * y)
end function
public static double code(double x, double y, double z, double t) {
return ((x / 8.0) + t) - ((z / 2.0) * y);
}
def code(x, y, z, t): return ((x / 8.0) + t) - ((z / 2.0) * y)
function code(x, y, z, t) return Float64(Float64(Float64(x / 8.0) + t) - Float64(Float64(z / 2.0) * y)) end
function tmp = code(x, y, z, t) tmp = ((x / 8.0) + t) - ((z / 2.0) * y); end
code[x_, y_, z_, t_] := N[(N[(N[(x / 8.0), $MachinePrecision] + t), $MachinePrecision] - N[(N[(z / 2.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{x}{8} + t\right) - \frac{z}{2} \cdot y
\end{array}
herbie shell --seed 2024110
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:quartForm from diagrams-solve-0.1, B"
:precision binary64
:alt
(- (+ (/ x 8.0) t) (* (/ z 2.0) y))
(+ (- (* (/ 1.0 8.0) x) (/ (* y z) 2.0)) t))