
(FPCore (x y z t a b c) :precision binary64 (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
def code(x, y, z, t, a, b, c): return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c) end
function tmp = code(x, y, z, t, a, b, c) tmp = (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c) :precision binary64 (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
def code(x, y, z, t, a, b, c): return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c) end
function tmp = code(x, y, z, t, a, b, c) tmp = (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\end{array}
(FPCore (x y z t a b c) :precision binary64 (+ (fma x y (fma z (/ t 16.0) (/ (* a b) -4.0))) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(x, y, fma(z, (t / 16.0), ((a * b) / -4.0))) + c;
}
function code(x, y, z, t, a, b, c) return Float64(fma(x, y, fma(z, Float64(t / 16.0), Float64(Float64(a * b) / -4.0))) + c) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(x * y + N[(z * N[(t / 16.0), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] / -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c
\end{array}
Initial program 97.6%
associate--l+97.6%
fma-define99.2%
associate-/l*99.2%
fma-neg99.6%
distribute-neg-frac299.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a b c) :precision binary64 (+ c (- (fma x y (* z (/ t 16.0))) (* a (/ b 4.0)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return c + (fma(x, y, (z * (t / 16.0))) - (a * (b / 4.0)));
}
function code(x, y, z, t, a, b, c) return Float64(c + Float64(fma(x, y, Float64(z * Float64(t / 16.0))) - Float64(a * Float64(b / 4.0)))) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(c + N[(N[(x * y + N[(z * N[(t / 16.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * N[(b / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c + \left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right)
\end{array}
Initial program 97.6%
associate-+l-97.6%
*-commutative97.6%
associate-+l-97.6%
fma-define98.0%
*-commutative98.0%
associate-/l*98.0%
associate-/l*98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)))) (if (<= t_1 INFINITY) (+ c t_1) (+ c (* a (* b -0.25))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = c + t_1;
} else {
tmp = c + (a * (b * -0.25));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0);
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = c + t_1;
} else {
tmp = c + (a * (b * -0.25));
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0) tmp = 0 if t_1 <= math.inf: tmp = c + t_1 else: tmp = c + (a * (b * -0.25)) return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) tmp = 0.0 if (t_1 <= Inf) tmp = Float64(c + t_1); else tmp = Float64(c + Float64(a * Float64(b * -0.25))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0); tmp = 0.0; if (t_1 <= Inf) tmp = c + t_1; else tmp = c + (a * (b * -0.25)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], N[(c + t$95$1), $MachinePrecision], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;c + t\_1\\
\mathbf{else}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\end{array}
\end{array}
if (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) 16)) (/.f64 (*.f64 a b) 4)) < +inf.0Initial program 100.0%
if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) 16)) (/.f64 (*.f64 a b) 4)) Initial program 0.0%
Taylor expanded in a around inf 66.7%
*-commutative66.7%
associate-*r*66.7%
Simplified66.7%
Final simplification99.2%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* z t) 0.0625)) (t_2 (* (* a b) 0.25)))
(if (<= (* a b) -1e+107)
(+ c (- t_1 t_2))
(if (or (<= (* a b) -1e-96) (not (<= (* a b) 2e+42)))
(+ c (- (* x y) t_2))
(+ c (+ (* x y) t_1))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (z * t) * 0.0625;
double t_2 = (a * b) * 0.25;
double tmp;
if ((a * b) <= -1e+107) {
tmp = c + (t_1 - t_2);
} else if (((a * b) <= -1e-96) || !((a * b) <= 2e+42)) {
tmp = c + ((x * y) - t_2);
} else {
tmp = c + ((x * y) + t_1);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z * t) * 0.0625d0
t_2 = (a * b) * 0.25d0
if ((a * b) <= (-1d+107)) then
tmp = c + (t_1 - t_2)
else if (((a * b) <= (-1d-96)) .or. (.not. ((a * b) <= 2d+42))) then
tmp = c + ((x * y) - t_2)
else
tmp = c + ((x * y) + t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (z * t) * 0.0625;
double t_2 = (a * b) * 0.25;
double tmp;
if ((a * b) <= -1e+107) {
tmp = c + (t_1 - t_2);
} else if (((a * b) <= -1e-96) || !((a * b) <= 2e+42)) {
tmp = c + ((x * y) - t_2);
} else {
tmp = c + ((x * y) + t_1);
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = (z * t) * 0.0625 t_2 = (a * b) * 0.25 tmp = 0 if (a * b) <= -1e+107: tmp = c + (t_1 - t_2) elif ((a * b) <= -1e-96) or not ((a * b) <= 2e+42): tmp = c + ((x * y) - t_2) else: tmp = c + ((x * y) + t_1) return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(z * t) * 0.0625) t_2 = Float64(Float64(a * b) * 0.25) tmp = 0.0 if (Float64(a * b) <= -1e+107) tmp = Float64(c + Float64(t_1 - t_2)); elseif ((Float64(a * b) <= -1e-96) || !(Float64(a * b) <= 2e+42)) tmp = Float64(c + Float64(Float64(x * y) - t_2)); else tmp = Float64(c + Float64(Float64(x * y) + t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = (z * t) * 0.0625; t_2 = (a * b) * 0.25; tmp = 0.0; if ((a * b) <= -1e+107) tmp = c + (t_1 - t_2); elseif (((a * b) <= -1e-96) || ~(((a * b) <= 2e+42))) tmp = c + ((x * y) - t_2); else tmp = c + ((x * y) + t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1e+107], N[(c + N[(t$95$1 - t$95$2), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(a * b), $MachinePrecision], -1e-96], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2e+42]], $MachinePrecision]], N[(c + N[(N[(x * y), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z \cdot t\right) \cdot 0.0625\\
t_2 := \left(a \cdot b\right) \cdot 0.25\\
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+107}:\\
\;\;\;\;c + \left(t\_1 - t\_2\right)\\
\mathbf{elif}\;a \cdot b \leq -1 \cdot 10^{-96} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{+42}\right):\\
\;\;\;\;c + \left(x \cdot y - t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + t\_1\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -9.9999999999999997e106Initial program 94.7%
Taylor expanded in x around 0 91.9%
if -9.9999999999999997e106 < (*.f64 a b) < -9.9999999999999991e-97 or 2.00000000000000009e42 < (*.f64 a b) Initial program 96.0%
Taylor expanded in z around 0 87.8%
if -9.9999999999999991e-97 < (*.f64 a b) < 2.00000000000000009e42Initial program 100.0%
Taylor expanded in a around 0 97.7%
Final simplification93.0%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* a b) -1e-96) (not (<= (* a b) 2e+42))) (+ c (- (* x y) (* (* a b) 0.25))) (+ c (+ (* x y) (* (* z t) 0.0625)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((a * b) <= -1e-96) || !((a * b) <= 2e+42)) {
tmp = c + ((x * y) - ((a * b) * 0.25));
} else {
tmp = c + ((x * y) + ((z * t) * 0.0625));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (((a * b) <= (-1d-96)) .or. (.not. ((a * b) <= 2d+42))) then
tmp = c + ((x * y) - ((a * b) * 0.25d0))
else
tmp = c + ((x * y) + ((z * t) * 0.0625d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((a * b) <= -1e-96) || !((a * b) <= 2e+42)) {
tmp = c + ((x * y) - ((a * b) * 0.25));
} else {
tmp = c + ((x * y) + ((z * t) * 0.0625));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((a * b) <= -1e-96) or not ((a * b) <= 2e+42): tmp = c + ((x * y) - ((a * b) * 0.25)) else: tmp = c + ((x * y) + ((z * t) * 0.0625)) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(a * b) <= -1e-96) || !(Float64(a * b) <= 2e+42)) tmp = Float64(c + Float64(Float64(x * y) - Float64(Float64(a * b) * 0.25))); else tmp = Float64(c + Float64(Float64(x * y) + Float64(Float64(z * t) * 0.0625))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (((a * b) <= -1e-96) || ~(((a * b) <= 2e+42))) tmp = c + ((x * y) - ((a * b) * 0.25)); else tmp = c + ((x * y) + ((z * t) * 0.0625)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -1e-96], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2e+42]], $MachinePrecision]], N[(c + N[(N[(x * y), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{-96} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{+42}\right):\\
\;\;\;\;c + \left(x \cdot y - \left(a \cdot b\right) \cdot 0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + \left(z \cdot t\right) \cdot 0.0625\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -9.9999999999999991e-97 or 2.00000000000000009e42 < (*.f64 a b) Initial program 95.6%
Taylor expanded in z around 0 85.6%
if -9.9999999999999991e-97 < (*.f64 a b) < 2.00000000000000009e42Initial program 100.0%
Taylor expanded in a around 0 97.7%
Final simplification91.2%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* x y) -6.2e+153)
(+ c (* x y))
(if (<= (* x y) 1.65e+24)
(+ c (* a (* b -0.25)))
(+ (* x y) (* (* z t) 0.0625)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((x * y) <= -6.2e+153) {
tmp = c + (x * y);
} else if ((x * y) <= 1.65e+24) {
tmp = c + (a * (b * -0.25));
} else {
tmp = (x * y) + ((z * t) * 0.0625);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if ((x * y) <= (-6.2d+153)) then
tmp = c + (x * y)
else if ((x * y) <= 1.65d+24) then
tmp = c + (a * (b * (-0.25d0)))
else
tmp = (x * y) + ((z * t) * 0.0625d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((x * y) <= -6.2e+153) {
tmp = c + (x * y);
} else if ((x * y) <= 1.65e+24) {
tmp = c + (a * (b * -0.25));
} else {
tmp = (x * y) + ((z * t) * 0.0625);
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (x * y) <= -6.2e+153: tmp = c + (x * y) elif (x * y) <= 1.65e+24: tmp = c + (a * (b * -0.25)) else: tmp = (x * y) + ((z * t) * 0.0625) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(x * y) <= -6.2e+153) tmp = Float64(c + Float64(x * y)); elseif (Float64(x * y) <= 1.65e+24) tmp = Float64(c + Float64(a * Float64(b * -0.25))); else tmp = Float64(Float64(x * y) + Float64(Float64(z * t) * 0.0625)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if ((x * y) <= -6.2e+153) tmp = c + (x * y); elseif ((x * y) <= 1.65e+24) tmp = c + (a * (b * -0.25)); else tmp = (x * y) + ((z * t) * 0.0625); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(x * y), $MachinePrecision], -6.2e+153], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.65e+24], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -6.2 \cdot 10^{+153}:\\
\;\;\;\;c + x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 1.65 \cdot 10^{+24}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + \left(z \cdot t\right) \cdot 0.0625\\
\end{array}
\end{array}
if (*.f64 x y) < -6.2e153Initial program 91.2%
Taylor expanded in x around inf 78.0%
if -6.2e153 < (*.f64 x y) < 1.6499999999999999e24Initial program 99.3%
Taylor expanded in a around inf 66.5%
*-commutative66.5%
associate-*r*66.5%
Simplified66.5%
if 1.6499999999999999e24 < (*.f64 x y) Initial program 97.1%
Taylor expanded in a around 0 83.6%
Taylor expanded in c around 0 70.3%
Final simplification69.1%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -1.6e+162) (not (<= (* x y) 2.4e+96))) (+ c (* x y)) (+ c (* a (* b -0.25)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((x * y) <= -1.6e+162) || !((x * y) <= 2.4e+96)) {
tmp = c + (x * y);
} else {
tmp = c + (a * (b * -0.25));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (((x * y) <= (-1.6d+162)) .or. (.not. ((x * y) <= 2.4d+96))) then
tmp = c + (x * y)
else
tmp = c + (a * (b * (-0.25d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((x * y) <= -1.6e+162) || !((x * y) <= 2.4e+96)) {
tmp = c + (x * y);
} else {
tmp = c + (a * (b * -0.25));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((x * y) <= -1.6e+162) or not ((x * y) <= 2.4e+96): tmp = c + (x * y) else: tmp = c + (a * (b * -0.25)) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(x * y) <= -1.6e+162) || !(Float64(x * y) <= 2.4e+96)) tmp = Float64(c + Float64(x * y)); else tmp = Float64(c + Float64(a * Float64(b * -0.25))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (((x * y) <= -1.6e+162) || ~(((x * y) <= 2.4e+96))) tmp = c + (x * y); else tmp = c + (a * (b * -0.25)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1.6e+162], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2.4e+96]], $MachinePrecision]], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.6 \cdot 10^{+162} \lor \neg \left(x \cdot y \leq 2.4 \cdot 10^{+96}\right):\\
\;\;\;\;c + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.6000000000000001e162 or 2.39999999999999993e96 < (*.f64 x y) Initial program 94.4%
Taylor expanded in x around inf 72.1%
if -1.6000000000000001e162 < (*.f64 x y) < 2.39999999999999993e96Initial program 99.4%
Taylor expanded in a around inf 64.4%
*-commutative64.4%
associate-*r*64.4%
Simplified64.4%
Final simplification67.1%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= b -12500000.0) (not (<= b 1.35e+131))) (+ c (* a (* b -0.25))) (+ c (+ (* x y) (* (* z t) 0.0625)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((b <= -12500000.0) || !(b <= 1.35e+131)) {
tmp = c + (a * (b * -0.25));
} else {
tmp = c + ((x * y) + ((z * t) * 0.0625));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if ((b <= (-12500000.0d0)) .or. (.not. (b <= 1.35d+131))) then
tmp = c + (a * (b * (-0.25d0)))
else
tmp = c + ((x * y) + ((z * t) * 0.0625d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((b <= -12500000.0) || !(b <= 1.35e+131)) {
tmp = c + (a * (b * -0.25));
} else {
tmp = c + ((x * y) + ((z * t) * 0.0625));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (b <= -12500000.0) or not (b <= 1.35e+131): tmp = c + (a * (b * -0.25)) else: tmp = c + ((x * y) + ((z * t) * 0.0625)) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((b <= -12500000.0) || !(b <= 1.35e+131)) tmp = Float64(c + Float64(a * Float64(b * -0.25))); else tmp = Float64(c + Float64(Float64(x * y) + Float64(Float64(z * t) * 0.0625))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if ((b <= -12500000.0) || ~((b <= 1.35e+131))) tmp = c + (a * (b * -0.25)); else tmp = c + ((x * y) + ((z * t) * 0.0625)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[b, -12500000.0], N[Not[LessEqual[b, 1.35e+131]], $MachinePrecision]], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -12500000 \lor \neg \left(b \leq 1.35 \cdot 10^{+131}\right):\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + \left(z \cdot t\right) \cdot 0.0625\right)\\
\end{array}
\end{array}
if b < -1.25e7 or 1.35000000000000002e131 < b Initial program 94.9%
Taylor expanded in a around inf 71.3%
*-commutative71.3%
associate-*r*71.3%
Simplified71.3%
if -1.25e7 < b < 1.35000000000000002e131Initial program 99.4%
Taylor expanded in a around 0 86.7%
Final simplification80.7%
(FPCore (x y z t a b c) :precision binary64 (if (<= y -2.9e-107) (* x y) (if (<= y 6.6e-159) (* z (* t 0.0625)) (if (<= y 5.5e+92) c (* x y)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (y <= -2.9e-107) {
tmp = x * y;
} else if (y <= 6.6e-159) {
tmp = z * (t * 0.0625);
} else if (y <= 5.5e+92) {
tmp = c;
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (y <= (-2.9d-107)) then
tmp = x * y
else if (y <= 6.6d-159) then
tmp = z * (t * 0.0625d0)
else if (y <= 5.5d+92) then
tmp = c
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (y <= -2.9e-107) {
tmp = x * y;
} else if (y <= 6.6e-159) {
tmp = z * (t * 0.0625);
} else if (y <= 5.5e+92) {
tmp = c;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if y <= -2.9e-107: tmp = x * y elif y <= 6.6e-159: tmp = z * (t * 0.0625) elif y <= 5.5e+92: tmp = c else: tmp = x * y return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (y <= -2.9e-107) tmp = Float64(x * y); elseif (y <= 6.6e-159) tmp = Float64(z * Float64(t * 0.0625)); elseif (y <= 5.5e+92) tmp = c; else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (y <= -2.9e-107) tmp = x * y; elseif (y <= 6.6e-159) tmp = z * (t * 0.0625); elseif (y <= 5.5e+92) tmp = c; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[y, -2.9e-107], N[(x * y), $MachinePrecision], If[LessEqual[y, 6.6e-159], N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.5e+92], c, N[(x * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{-107}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{-159}:\\
\;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+92}:\\
\;\;\;\;c\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -2.8999999999999998e-107 or 5.50000000000000053e92 < y Initial program 96.3%
Taylor expanded in a around 0 72.0%
Taylor expanded in c around 0 60.7%
Taylor expanded in t around 0 40.8%
if -2.8999999999999998e-107 < y < 6.6000000000000003e-159Initial program 100.0%
Taylor expanded in z around inf 55.8%
*-commutative55.8%
associate-*r*55.8%
*-commutative55.8%
Simplified55.8%
Taylor expanded in t around inf 33.1%
*-commutative33.1%
*-commutative33.1%
associate-*r*33.1%
*-commutative33.1%
Simplified33.1%
if 6.6000000000000003e-159 < y < 5.50000000000000053e92Initial program 98.0%
Taylor expanded in x around inf 53.5%
Taylor expanded in x around 0 34.1%
Final simplification37.4%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= z -1.4e+214) (not (<= z 2.4e-30))) (* z (* t 0.0625)) (+ c (* x y))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z <= -1.4e+214) || !(z <= 2.4e-30)) {
tmp = z * (t * 0.0625);
} else {
tmp = c + (x * y);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if ((z <= (-1.4d+214)) .or. (.not. (z <= 2.4d-30))) then
tmp = z * (t * 0.0625d0)
else
tmp = c + (x * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z <= -1.4e+214) || !(z <= 2.4e-30)) {
tmp = z * (t * 0.0625);
} else {
tmp = c + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (z <= -1.4e+214) or not (z <= 2.4e-30): tmp = z * (t * 0.0625) else: tmp = c + (x * y) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((z <= -1.4e+214) || !(z <= 2.4e-30)) tmp = Float64(z * Float64(t * 0.0625)); else tmp = Float64(c + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if ((z <= -1.4e+214) || ~((z <= 2.4e-30))) tmp = z * (t * 0.0625); else tmp = c + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[z, -1.4e+214], N[Not[LessEqual[z, 2.4e-30]], $MachinePrecision]], N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+214} \lor \neg \left(z \leq 2.4 \cdot 10^{-30}\right):\\
\;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\
\mathbf{else}:\\
\;\;\;\;c + x \cdot y\\
\end{array}
\end{array}
if z < -1.3999999999999999e214 or 2.39999999999999985e-30 < z Initial program 97.6%
Taylor expanded in z around inf 64.1%
*-commutative64.1%
associate-*r*64.1%
*-commutative64.1%
Simplified64.1%
Taylor expanded in t around inf 48.1%
*-commutative48.1%
*-commutative48.1%
associate-*r*48.1%
*-commutative48.1%
Simplified48.1%
if -1.3999999999999999e214 < z < 2.39999999999999985e-30Initial program 97.6%
Taylor expanded in x around inf 52.6%
Final simplification51.1%
(FPCore (x y z t a b c) :precision binary64 (if (<= c -1.8e+74) c (if (<= c 2.35e-84) (* x y) c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (c <= -1.8e+74) {
tmp = c;
} else if (c <= 2.35e-84) {
tmp = x * y;
} else {
tmp = c;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (c <= (-1.8d+74)) then
tmp = c
else if (c <= 2.35d-84) then
tmp = x * y
else
tmp = c
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (c <= -1.8e+74) {
tmp = c;
} else if (c <= 2.35e-84) {
tmp = x * y;
} else {
tmp = c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if c <= -1.8e+74: tmp = c elif c <= 2.35e-84: tmp = x * y else: tmp = c return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (c <= -1.8e+74) tmp = c; elseif (c <= 2.35e-84) tmp = Float64(x * y); else tmp = c; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (c <= -1.8e+74) tmp = c; elseif (c <= 2.35e-84) tmp = x * y; else tmp = c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[c, -1.8e+74], c, If[LessEqual[c, 2.35e-84], N[(x * y), $MachinePrecision], c]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.8 \cdot 10^{+74}:\\
\;\;\;\;c\\
\mathbf{elif}\;c \leq 2.35 \cdot 10^{-84}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c\\
\end{array}
\end{array}
if c < -1.79999999999999994e74 or 2.35e-84 < c Initial program 98.2%
Taylor expanded in x around inf 52.6%
Taylor expanded in x around 0 40.4%
if -1.79999999999999994e74 < c < 2.35e-84Initial program 97.2%
Taylor expanded in a around 0 65.9%
Taylor expanded in c around 0 62.4%
Taylor expanded in t around 0 38.7%
Final simplification39.5%
(FPCore (x y z t a b c) :precision binary64 c)
double code(double x, double y, double z, double t, double a, double b, double c) {
return c;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return c;
}
def code(x, y, z, t, a, b, c): return c
function code(x, y, z, t, a, b, c) return c end
function tmp = code(x, y, z, t, a, b, c) tmp = c; end
code[x_, y_, z_, t_, a_, b_, c_] := c
\begin{array}{l}
\\
c
\end{array}
Initial program 97.6%
Taylor expanded in x around inf 46.7%
Taylor expanded in x around 0 20.9%
Final simplification20.9%
herbie shell --seed 2024039
(FPCore (x y z t a b c)
:name "Diagrams.Solve.Polynomial:quartForm from diagrams-solve-0.1, C"
:precision binary64
(+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))