
(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 11 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
(let* ((t_1 (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0))))
(if (<= t_1 INFINITY)
(+ c t_1)
(+ c (* z (+ (* t 0.0625) (/ (* x y) z)))))))
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 + (z * ((t * 0.0625) + ((x * y) / z)));
}
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 + (z * ((t * 0.0625) + ((x * y) / z)));
}
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 + (z * ((t * 0.0625) + ((x * y) / z))) 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(z * Float64(Float64(t * 0.0625) + Float64(Float64(x * y) / z)))); 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 + (z * ((t * 0.0625) + ((x * y) / z))); 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[(z * N[(N[(t * 0.0625), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $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 + z \cdot \left(t \cdot 0.0625 + \frac{x \cdot y}{z}\right)\\
\end{array}
\end{array}
if (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64))) < +inf.0Initial program 99.7%
if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64))) Initial program 0.0%
Taylor expanded in z around inf 37.5%
Taylor expanded in a around 0 62.5%
Final simplification98.5%
(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 96.5%
associate--l+96.5%
fma-define96.9%
associate-/l*96.9%
fma-neg97.7%
distribute-neg-frac297.7%
metadata-eval97.7%
Simplified97.7%
(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 96.5%
associate-+l-96.5%
*-commutative96.5%
associate-+l-96.5%
fma-define96.9%
*-commutative96.9%
associate-/l*96.9%
associate-/l*97.3%
Simplified97.3%
Final simplification97.3%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (+ c (* 0.0625 (* z t)))) (t_2 (+ c (* x y))))
(if (<= (* x y) -2e+57)
t_2
(if (<= (* x y) 2e-282)
t_1
(if (<= (* x y) 1e-141)
(+ c (* b (* a -0.25)))
(if (<= (* x y) 4e+74) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = c + (0.0625 * (z * t));
double t_2 = c + (x * y);
double tmp;
if ((x * y) <= -2e+57) {
tmp = t_2;
} else if ((x * y) <= 2e-282) {
tmp = t_1;
} else if ((x * y) <= 1e-141) {
tmp = c + (b * (a * -0.25));
} else if ((x * y) <= 4e+74) {
tmp = t_1;
} else {
tmp = t_2;
}
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 = c + (0.0625d0 * (z * t))
t_2 = c + (x * y)
if ((x * y) <= (-2d+57)) then
tmp = t_2
else if ((x * y) <= 2d-282) then
tmp = t_1
else if ((x * y) <= 1d-141) then
tmp = c + (b * (a * (-0.25d0)))
else if ((x * y) <= 4d+74) then
tmp = t_1
else
tmp = t_2
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 = c + (0.0625 * (z * t));
double t_2 = c + (x * y);
double tmp;
if ((x * y) <= -2e+57) {
tmp = t_2;
} else if ((x * y) <= 2e-282) {
tmp = t_1;
} else if ((x * y) <= 1e-141) {
tmp = c + (b * (a * -0.25));
} else if ((x * y) <= 4e+74) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = c + (0.0625 * (z * t)) t_2 = c + (x * y) tmp = 0 if (x * y) <= -2e+57: tmp = t_2 elif (x * y) <= 2e-282: tmp = t_1 elif (x * y) <= 1e-141: tmp = c + (b * (a * -0.25)) elif (x * y) <= 4e+74: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(c + Float64(0.0625 * Float64(z * t))) t_2 = Float64(c + Float64(x * y)) tmp = 0.0 if (Float64(x * y) <= -2e+57) tmp = t_2; elseif (Float64(x * y) <= 2e-282) tmp = t_1; elseif (Float64(x * y) <= 1e-141) tmp = Float64(c + Float64(b * Float64(a * -0.25))); elseif (Float64(x * y) <= 4e+74) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = c + (0.0625 * (z * t)); t_2 = c + (x * y); tmp = 0.0; if ((x * y) <= -2e+57) tmp = t_2; elseif ((x * y) <= 2e-282) tmp = t_1; elseif ((x * y) <= 1e-141) tmp = c + (b * (a * -0.25)); elseif ((x * y) <= 4e+74) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+57], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 2e-282], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1e-141], N[(c + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4e+74], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c + 0.0625 \cdot \left(z \cdot t\right)\\
t_2 := c + x \cdot y\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+57}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-282}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 10^{-141}:\\
\;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{+74}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 x y) < -2.0000000000000001e57 or 3.99999999999999981e74 < (*.f64 x y) Initial program 94.8%
Taylor expanded in x around inf 85.0%
Taylor expanded in a around 0 71.9%
+-commutative71.9%
Simplified71.9%
if -2.0000000000000001e57 < (*.f64 x y) < 2e-282 or 1e-141 < (*.f64 x y) < 3.99999999999999981e74Initial program 98.4%
Taylor expanded in x around 0 93.8%
Taylor expanded in a around 0 69.3%
+-commutative69.3%
Simplified69.3%
if 2e-282 < (*.f64 x y) < 1e-141Initial program 95.2%
Taylor expanded in a around inf 83.7%
associate-*r*83.7%
*-commutative83.7%
*-commutative83.7%
Simplified83.7%
Final simplification71.6%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* t (* z 0.0625))))
(if (<= (* x y) -6.6e+53)
(* x y)
(if (<= (* x y) 1.6e-281)
t_1
(if (<= (* x y) 4.3e-153) c (if (<= (* x y) 1.5e+76) t_1 (* x y)))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = t * (z * 0.0625);
double tmp;
if ((x * y) <= -6.6e+53) {
tmp = x * y;
} else if ((x * y) <= 1.6e-281) {
tmp = t_1;
} else if ((x * y) <= 4.3e-153) {
tmp = c;
} else if ((x * y) <= 1.5e+76) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = t * (z * 0.0625d0)
if ((x * y) <= (-6.6d+53)) then
tmp = x * y
else if ((x * y) <= 1.6d-281) then
tmp = t_1
else if ((x * y) <= 4.3d-153) then
tmp = c
else if ((x * y) <= 1.5d+76) then
tmp = t_1
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 t_1 = t * (z * 0.0625);
double tmp;
if ((x * y) <= -6.6e+53) {
tmp = x * y;
} else if ((x * y) <= 1.6e-281) {
tmp = t_1;
} else if ((x * y) <= 4.3e-153) {
tmp = c;
} else if ((x * y) <= 1.5e+76) {
tmp = t_1;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = t * (z * 0.0625) tmp = 0 if (x * y) <= -6.6e+53: tmp = x * y elif (x * y) <= 1.6e-281: tmp = t_1 elif (x * y) <= 4.3e-153: tmp = c elif (x * y) <= 1.5e+76: tmp = t_1 else: tmp = x * y return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(t * Float64(z * 0.0625)) tmp = 0.0 if (Float64(x * y) <= -6.6e+53) tmp = Float64(x * y); elseif (Float64(x * y) <= 1.6e-281) tmp = t_1; elseif (Float64(x * y) <= 4.3e-153) tmp = c; elseif (Float64(x * y) <= 1.5e+76) tmp = t_1; else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = t * (z * 0.0625); tmp = 0.0; if ((x * y) <= -6.6e+53) tmp = x * y; elseif ((x * y) <= 1.6e-281) tmp = t_1; elseif ((x * y) <= 4.3e-153) tmp = c; elseif ((x * y) <= 1.5e+76) tmp = t_1; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(t * N[(z * 0.0625), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -6.6e+53], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.6e-281], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 4.3e-153], c, If[LessEqual[N[(x * y), $MachinePrecision], 1.5e+76], t$95$1, N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(z \cdot 0.0625\right)\\
\mathbf{if}\;x \cdot y \leq -6.6 \cdot 10^{+53}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 1.6 \cdot 10^{-281}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 4.3 \cdot 10^{-153}:\\
\;\;\;\;c\\
\mathbf{elif}\;x \cdot y \leq 1.5 \cdot 10^{+76}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -6.6000000000000004e53 or 1.4999999999999999e76 < (*.f64 x y) Initial program 94.8%
Taylor expanded in x around inf 85.0%
Taylor expanded in a around 0 71.9%
+-commutative71.9%
Simplified71.9%
Taylor expanded in x around inf 58.2%
if -6.6000000000000004e53 < (*.f64 x y) < 1.6e-281 or 4.3e-153 < (*.f64 x y) < 1.4999999999999999e76Initial program 98.4%
Taylor expanded in x around 0 93.9%
Taylor expanded in a around 0 69.0%
+-commutative69.0%
Simplified69.0%
Taylor expanded in t around inf 44.7%
*-commutative44.7%
associate-*r*44.7%
Simplified44.7%
if 1.6e-281 < (*.f64 x y) < 4.3e-153Initial program 94.7%
Taylor expanded in a around inf 87.2%
associate-*r*87.2%
*-commutative87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in b around 0 39.7%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* a b) -2e+115) (not (<= (* a b) 1e+90))) (+ c (- (* x y) (/ (* a b) 4.0))) (+ c (+ (* x y) (* 0.0625 (* z t))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((a * b) <= -2e+115) || !((a * b) <= 1e+90)) {
tmp = c + ((x * y) - ((a * b) / 4.0));
} else {
tmp = c + ((x * y) + (0.0625 * (z * t)));
}
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) <= (-2d+115)) .or. (.not. ((a * b) <= 1d+90))) then
tmp = c + ((x * y) - ((a * b) / 4.0d0))
else
tmp = c + ((x * y) + (0.0625d0 * (z * t)))
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) <= -2e+115) || !((a * b) <= 1e+90)) {
tmp = c + ((x * y) - ((a * b) / 4.0));
} else {
tmp = c + ((x * y) + (0.0625 * (z * t)));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((a * b) <= -2e+115) or not ((a * b) <= 1e+90): tmp = c + ((x * y) - ((a * b) / 4.0)) else: tmp = c + ((x * y) + (0.0625 * (z * t))) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(a * b) <= -2e+115) || !(Float64(a * b) <= 1e+90)) tmp = Float64(c + Float64(Float64(x * y) - Float64(Float64(a * b) / 4.0))); else tmp = Float64(c + Float64(Float64(x * y) + Float64(0.0625 * Float64(z * t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (((a * b) <= -2e+115) || ~(((a * b) <= 1e+90))) tmp = c + ((x * y) - ((a * b) / 4.0)); else tmp = c + ((x * y) + (0.0625 * (z * t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -2e+115], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1e+90]], $MachinePrecision]], N[(c + N[(N[(x * y), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+115} \lor \neg \left(a \cdot b \leq 10^{+90}\right):\\
\;\;\;\;c + \left(x \cdot y - \frac{a \cdot b}{4}\right)\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -2e115 or 9.99999999999999966e89 < (*.f64 a b) Initial program 91.6%
Taylor expanded in x around inf 88.1%
if -2e115 < (*.f64 a b) < 9.99999999999999966e89Initial program 98.8%
Taylor expanded in z around inf 89.3%
Taylor expanded in a around 0 86.7%
Taylor expanded in z around 0 96.3%
Final simplification93.7%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= b -1.02e+67) (not (<= b 3e+225))) (+ c (* b (* a -0.25))) (+ c (+ (* x y) (* 0.0625 (* z t))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((b <= -1.02e+67) || !(b <= 3e+225)) {
tmp = c + (b * (a * -0.25));
} else {
tmp = c + ((x * y) + (0.0625 * (z * t)));
}
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 <= (-1.02d+67)) .or. (.not. (b <= 3d+225))) then
tmp = c + (b * (a * (-0.25d0)))
else
tmp = c + ((x * y) + (0.0625d0 * (z * t)))
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 <= -1.02e+67) || !(b <= 3e+225)) {
tmp = c + (b * (a * -0.25));
} else {
tmp = c + ((x * y) + (0.0625 * (z * t)));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (b <= -1.02e+67) or not (b <= 3e+225): tmp = c + (b * (a * -0.25)) else: tmp = c + ((x * y) + (0.0625 * (z * t))) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((b <= -1.02e+67) || !(b <= 3e+225)) tmp = Float64(c + Float64(b * Float64(a * -0.25))); else tmp = Float64(c + Float64(Float64(x * y) + Float64(0.0625 * Float64(z * t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if ((b <= -1.02e+67) || ~((b <= 3e+225))) tmp = c + (b * (a * -0.25)); else tmp = c + ((x * y) + (0.0625 * (z * t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[b, -1.02e+67], N[Not[LessEqual[b, 3e+225]], $MachinePrecision]], N[(c + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.02 \cdot 10^{+67} \lor \neg \left(b \leq 3 \cdot 10^{+225}\right):\\
\;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if b < -1.02000000000000002e67 or 3e225 < b Initial program 98.5%
Taylor expanded in a around inf 65.5%
associate-*r*65.5%
*-commutative65.5%
*-commutative65.5%
Simplified65.5%
if -1.02000000000000002e67 < b < 3e225Initial program 95.9%
Taylor expanded in z around inf 87.5%
Taylor expanded in a around 0 75.5%
Taylor expanded in z around 0 82.8%
Final simplification78.3%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -2.1e+57) (not (<= (* x y) 2.2e+75))) (+ c (* x y)) (+ c (* 0.0625 (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((x * y) <= -2.1e+57) || !((x * y) <= 2.2e+75)) {
tmp = c + (x * y);
} else {
tmp = c + (0.0625 * (z * t));
}
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) <= (-2.1d+57)) .or. (.not. ((x * y) <= 2.2d+75))) then
tmp = c + (x * y)
else
tmp = c + (0.0625d0 * (z * t))
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) <= -2.1e+57) || !((x * y) <= 2.2e+75)) {
tmp = c + (x * y);
} else {
tmp = c + (0.0625 * (z * t));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((x * y) <= -2.1e+57) or not ((x * y) <= 2.2e+75): tmp = c + (x * y) else: tmp = c + (0.0625 * (z * t)) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(x * y) <= -2.1e+57) || !(Float64(x * y) <= 2.2e+75)) tmp = Float64(c + Float64(x * y)); else tmp = Float64(c + Float64(0.0625 * Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (((x * y) <= -2.1e+57) || ~(((x * y) <= 2.2e+75))) tmp = c + (x * y); else tmp = c + (0.0625 * (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -2.1e+57], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2.2e+75]], $MachinePrecision]], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(c + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.1 \cdot 10^{+57} \lor \neg \left(x \cdot y \leq 2.2 \cdot 10^{+75}\right):\\
\;\;\;\;c + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -2.09999999999999991e57 or 2.20000000000000012e75 < (*.f64 x y) Initial program 94.8%
Taylor expanded in x around inf 85.0%
Taylor expanded in a around 0 71.9%
+-commutative71.9%
Simplified71.9%
if -2.09999999999999991e57 < (*.f64 x y) < 2.20000000000000012e75Initial program 97.9%
Taylor expanded in x around 0 94.1%
Taylor expanded in a around 0 66.8%
+-commutative66.8%
Simplified66.8%
Final simplification69.1%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -55000.0) (not (<= (* x y) 9.5e+84))) (* x y) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((x * y) <= -55000.0) || !((x * y) <= 9.5e+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 (((x * y) <= (-55000.0d0)) .or. (.not. ((x * y) <= 9.5d+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 (((x * y) <= -55000.0) || !((x * y) <= 9.5e+84)) {
tmp = x * y;
} else {
tmp = c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((x * y) <= -55000.0) or not ((x * y) <= 9.5e+84): tmp = x * y else: tmp = c return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(x * y) <= -55000.0) || !(Float64(x * y) <= 9.5e+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 (((x * y) <= -55000.0) || ~(((x * y) <= 9.5e+84))) tmp = x * y; else tmp = c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -55000.0], N[Not[LessEqual[N[(x * y), $MachinePrecision], 9.5e+84]], $MachinePrecision]], N[(x * y), $MachinePrecision], c]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -55000 \lor \neg \left(x \cdot y \leq 9.5 \cdot 10^{+84}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c\\
\end{array}
\end{array}
if (*.f64 x y) < -55000 or 9.49999999999999979e84 < (*.f64 x y) Initial program 95.0%
Taylor expanded in x around inf 83.2%
Taylor expanded in a around 0 70.7%
+-commutative70.7%
Simplified70.7%
Taylor expanded in x around inf 57.5%
if -55000 < (*.f64 x y) < 9.49999999999999979e84Initial program 97.8%
Taylor expanded in a around inf 60.9%
associate-*r*60.9%
*-commutative60.9%
*-commutative60.9%
Simplified60.9%
Taylor expanded in b around 0 29.4%
Final simplification42.4%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= z -3e+161) (not (<= z 5.5e+67))) (* t (* z 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 <= -3e+161) || !(z <= 5.5e+67)) {
tmp = t * (z * 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 <= (-3d+161)) .or. (.not. (z <= 5.5d+67))) then
tmp = t * (z * 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 <= -3e+161) || !(z <= 5.5e+67)) {
tmp = t * (z * 0.0625);
} else {
tmp = c + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (z <= -3e+161) or not (z <= 5.5e+67): tmp = t * (z * 0.0625) else: tmp = c + (x * y) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((z <= -3e+161) || !(z <= 5.5e+67)) tmp = Float64(t * Float64(z * 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 <= -3e+161) || ~((z <= 5.5e+67))) tmp = t * (z * 0.0625); else tmp = c + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[z, -3e+161], N[Not[LessEqual[z, 5.5e+67]], $MachinePrecision]], N[(t * N[(z * 0.0625), $MachinePrecision]), $MachinePrecision], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+161} \lor \neg \left(z \leq 5.5 \cdot 10^{+67}\right):\\
\;\;\;\;t \cdot \left(z \cdot 0.0625\right)\\
\mathbf{else}:\\
\;\;\;\;c + x \cdot y\\
\end{array}
\end{array}
if z < -3.00000000000000011e161 or 5.49999999999999968e67 < z Initial program 93.6%
Taylor expanded in x around 0 78.3%
Taylor expanded in a around 0 65.9%
+-commutative65.9%
Simplified65.9%
Taylor expanded in t around inf 55.6%
*-commutative55.6%
associate-*r*55.6%
Simplified55.6%
if -3.00000000000000011e161 < z < 5.49999999999999968e67Initial program 97.9%
Taylor expanded in x around inf 82.9%
Taylor expanded in a around 0 57.3%
+-commutative57.3%
Simplified57.3%
Final simplification56.8%
(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 96.5%
Taylor expanded in a around inf 46.4%
associate-*r*46.8%
*-commutative46.8%
*-commutative46.8%
Simplified46.8%
Taylor expanded in b around 0 22.9%
herbie shell --seed 2024091
(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))