
(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 (+ (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 99.2%
associate--l+99.2%
fma-define99.2%
associate-/l*99.2%
fma-neg99.2%
distribute-neg-frac299.2%
metadata-eval99.2%
Simplified99.2%
Final simplification99.2%
(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 99.2%
associate-+l-99.2%
*-commutative99.2%
associate-+l-99.2%
fma-define99.2%
*-commutative99.2%
associate-/l*99.2%
associate-/l*99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* t (* z 0.0625))))
(if (<= (* x y) -6e+188)
(* x y)
(if (<= (* x y) -8.5e+36)
c
(if (<= (* x y) -9e-309)
t_1
(if (<= (* x y) 5.2e-297)
c
(if (<= (* x y) 2.1e-225)
t_1
(if (<= (* x y) 1.02e-22)
c
(if (<= (* x y) 2.8e+179) 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) <= -6e+188) {
tmp = x * y;
} else if ((x * y) <= -8.5e+36) {
tmp = c;
} else if ((x * y) <= -9e-309) {
tmp = t_1;
} else if ((x * y) <= 5.2e-297) {
tmp = c;
} else if ((x * y) <= 2.1e-225) {
tmp = t_1;
} else if ((x * y) <= 1.02e-22) {
tmp = c;
} else if ((x * y) <= 2.8e+179) {
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) <= (-6d+188)) then
tmp = x * y
else if ((x * y) <= (-8.5d+36)) then
tmp = c
else if ((x * y) <= (-9d-309)) then
tmp = t_1
else if ((x * y) <= 5.2d-297) then
tmp = c
else if ((x * y) <= 2.1d-225) then
tmp = t_1
else if ((x * y) <= 1.02d-22) then
tmp = c
else if ((x * y) <= 2.8d+179) 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) <= -6e+188) {
tmp = x * y;
} else if ((x * y) <= -8.5e+36) {
tmp = c;
} else if ((x * y) <= -9e-309) {
tmp = t_1;
} else if ((x * y) <= 5.2e-297) {
tmp = c;
} else if ((x * y) <= 2.1e-225) {
tmp = t_1;
} else if ((x * y) <= 1.02e-22) {
tmp = c;
} else if ((x * y) <= 2.8e+179) {
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) <= -6e+188: tmp = x * y elif (x * y) <= -8.5e+36: tmp = c elif (x * y) <= -9e-309: tmp = t_1 elif (x * y) <= 5.2e-297: tmp = c elif (x * y) <= 2.1e-225: tmp = t_1 elif (x * y) <= 1.02e-22: tmp = c elif (x * y) <= 2.8e+179: 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) <= -6e+188) tmp = Float64(x * y); elseif (Float64(x * y) <= -8.5e+36) tmp = c; elseif (Float64(x * y) <= -9e-309) tmp = t_1; elseif (Float64(x * y) <= 5.2e-297) tmp = c; elseif (Float64(x * y) <= 2.1e-225) tmp = t_1; elseif (Float64(x * y) <= 1.02e-22) tmp = c; elseif (Float64(x * y) <= 2.8e+179) 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) <= -6e+188) tmp = x * y; elseif ((x * y) <= -8.5e+36) tmp = c; elseif ((x * y) <= -9e-309) tmp = t_1; elseif ((x * y) <= 5.2e-297) tmp = c; elseif ((x * y) <= 2.1e-225) tmp = t_1; elseif ((x * y) <= 1.02e-22) tmp = c; elseif ((x * y) <= 2.8e+179) 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], -6e+188], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -8.5e+36], c, If[LessEqual[N[(x * y), $MachinePrecision], -9e-309], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5.2e-297], c, If[LessEqual[N[(x * y), $MachinePrecision], 2.1e-225], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1.02e-22], c, If[LessEqual[N[(x * y), $MachinePrecision], 2.8e+179], 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 \cdot 10^{+188}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq -8.5 \cdot 10^{+36}:\\
\;\;\;\;c\\
\mathbf{elif}\;x \cdot y \leq -9 \cdot 10^{-309}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 5.2 \cdot 10^{-297}:\\
\;\;\;\;c\\
\mathbf{elif}\;x \cdot y \leq 2.1 \cdot 10^{-225}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 1.02 \cdot 10^{-22}:\\
\;\;\;\;c\\
\mathbf{elif}\;x \cdot y \leq 2.8 \cdot 10^{+179}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -6.0000000000000001e188 or 2.8e179 < (*.f64 x y) Initial program 98.3%
Taylor expanded in a around 0 93.3%
Taylor expanded in c around 0 90.1%
Taylor expanded in t around 0 84.3%
if -6.0000000000000001e188 < (*.f64 x y) < -8.50000000000000014e36 or -9.0000000000000021e-309 < (*.f64 x y) < 5.2000000000000001e-297 or 2.1e-225 < (*.f64 x y) < 1.02000000000000002e-22Initial program 99.0%
Taylor expanded in c around inf 42.6%
if -8.50000000000000014e36 < (*.f64 x y) < -9.0000000000000021e-309 or 5.2000000000000001e-297 < (*.f64 x y) < 2.1e-225 or 1.02000000000000002e-22 < (*.f64 x y) < 2.8e179Initial program 100.0%
Taylor expanded in a around 0 72.6%
Taylor expanded in c around 0 54.6%
Taylor expanded in t around inf 45.8%
*-commutative45.8%
associate-*r*45.8%
Simplified45.8%
Final simplification53.6%
(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) -3.35e+62)
t_2
(if (<= (* x y) 3.4e-224)
t_1
(if (<= (* x y) 7.3e+62)
(+ c (* b (* a -0.25)))
(if (<= (* x y) 1.02e+183) 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) <= -3.35e+62) {
tmp = t_2;
} else if ((x * y) <= 3.4e-224) {
tmp = t_1;
} else if ((x * y) <= 7.3e+62) {
tmp = c + (b * (a * -0.25));
} else if ((x * y) <= 1.02e+183) {
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) <= (-3.35d+62)) then
tmp = t_2
else if ((x * y) <= 3.4d-224) then
tmp = t_1
else if ((x * y) <= 7.3d+62) then
tmp = c + (b * (a * (-0.25d0)))
else if ((x * y) <= 1.02d+183) 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) <= -3.35e+62) {
tmp = t_2;
} else if ((x * y) <= 3.4e-224) {
tmp = t_1;
} else if ((x * y) <= 7.3e+62) {
tmp = c + (b * (a * -0.25));
} else if ((x * y) <= 1.02e+183) {
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) <= -3.35e+62: tmp = t_2 elif (x * y) <= 3.4e-224: tmp = t_1 elif (x * y) <= 7.3e+62: tmp = c + (b * (a * -0.25)) elif (x * y) <= 1.02e+183: 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) <= -3.35e+62) tmp = t_2; elseif (Float64(x * y) <= 3.4e-224) tmp = t_1; elseif (Float64(x * y) <= 7.3e+62) tmp = Float64(c + Float64(b * Float64(a * -0.25))); elseif (Float64(x * y) <= 1.02e+183) 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) <= -3.35e+62) tmp = t_2; elseif ((x * y) <= 3.4e-224) tmp = t_1; elseif ((x * y) <= 7.3e+62) tmp = c + (b * (a * -0.25)); elseif ((x * y) <= 1.02e+183) 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], -3.35e+62], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 3.4e-224], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 7.3e+62], N[(c + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.02e+183], 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 -3.35 \cdot 10^{+62}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \cdot y \leq 3.4 \cdot 10^{-224}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 7.3 \cdot 10^{+62}:\\
\;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\
\mathbf{elif}\;x \cdot y \leq 1.02 \cdot 10^{+183}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 x y) < -3.3499999999999998e62 or 1.02000000000000002e183 < (*.f64 x y) Initial program 97.5%
Taylor expanded in x around inf 83.0%
if -3.3499999999999998e62 < (*.f64 x y) < 3.39999999999999992e-224 or 7.2999999999999997e62 < (*.f64 x y) < 1.02000000000000002e183Initial program 100.0%
Taylor expanded in z around inf 67.2%
if 3.39999999999999992e-224 < (*.f64 x y) < 7.2999999999999997e62Initial program 100.0%
Taylor expanded in a around inf 73.8%
associate-*r*73.8%
Simplified73.8%
Final simplification73.3%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* 0.0625 (* z t))))
(if (<= (* x y) -2.65e+62)
(+ c (* x y))
(if (<= (* x y) 2.25e-228)
(+ c t_1)
(if (<= (* x y) 7.7e+62) (+ c (* b (* a -0.25))) (+ (* x y) t_1))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = 0.0625 * (z * t);
double tmp;
if ((x * y) <= -2.65e+62) {
tmp = c + (x * y);
} else if ((x * y) <= 2.25e-228) {
tmp = c + t_1;
} else if ((x * y) <= 7.7e+62) {
tmp = c + (b * (a * -0.25));
} else {
tmp = (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) :: tmp
t_1 = 0.0625d0 * (z * t)
if ((x * y) <= (-2.65d+62)) then
tmp = c + (x * y)
else if ((x * y) <= 2.25d-228) then
tmp = c + t_1
else if ((x * y) <= 7.7d+62) then
tmp = c + (b * (a * (-0.25d0)))
else
tmp = (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 = 0.0625 * (z * t);
double tmp;
if ((x * y) <= -2.65e+62) {
tmp = c + (x * y);
} else if ((x * y) <= 2.25e-228) {
tmp = c + t_1;
} else if ((x * y) <= 7.7e+62) {
tmp = c + (b * (a * -0.25));
} else {
tmp = (x * y) + t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = 0.0625 * (z * t) tmp = 0 if (x * y) <= -2.65e+62: tmp = c + (x * y) elif (x * y) <= 2.25e-228: tmp = c + t_1 elif (x * y) <= 7.7e+62: tmp = c + (b * (a * -0.25)) else: tmp = (x * y) + t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(0.0625 * Float64(z * t)) tmp = 0.0 if (Float64(x * y) <= -2.65e+62) tmp = Float64(c + Float64(x * y)); elseif (Float64(x * y) <= 2.25e-228) tmp = Float64(c + t_1); elseif (Float64(x * y) <= 7.7e+62) tmp = Float64(c + Float64(b * Float64(a * -0.25))); else tmp = Float64(Float64(x * y) + t_1); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = 0.0625 * (z * t); tmp = 0.0; if ((x * y) <= -2.65e+62) tmp = c + (x * y); elseif ((x * y) <= 2.25e-228) tmp = c + t_1; elseif ((x * y) <= 7.7e+62) tmp = c + (b * (a * -0.25)); else tmp = (x * y) + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2.65e+62], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.25e-228], N[(c + t$95$1), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 7.7e+62], N[(c + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.0625 \cdot \left(z \cdot t\right)\\
\mathbf{if}\;x \cdot y \leq -2.65 \cdot 10^{+62}:\\
\;\;\;\;c + x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 2.25 \cdot 10^{-228}:\\
\;\;\;\;c + t\_1\\
\mathbf{elif}\;x \cdot y \leq 7.7 \cdot 10^{+62}:\\
\;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -2.6500000000000001e62Initial program 95.9%
Taylor expanded in x around inf 78.3%
if -2.6500000000000001e62 < (*.f64 x y) < 2.25e-228Initial program 100.0%
Taylor expanded in z around inf 68.2%
if 2.25e-228 < (*.f64 x y) < 7.7000000000000003e62Initial program 100.0%
Taylor expanded in a around inf 73.8%
associate-*r*73.8%
Simplified73.8%
if 7.7000000000000003e62 < (*.f64 x y) Initial program 100.0%
Taylor expanded in a around 0 89.6%
Taylor expanded in c around 0 80.1%
Final simplification73.8%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -3.8e+61) (not (<= (* x y) 4e+179))) (+ 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) <= -3.8e+61) || !((x * y) <= 4e+179)) {
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) <= (-3.8d+61)) .or. (.not. ((x * y) <= 4d+179))) 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) <= -3.8e+61) || !((x * y) <= 4e+179)) {
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) <= -3.8e+61) or not ((x * y) <= 4e+179): 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) <= -3.8e+61) || !(Float64(x * y) <= 4e+179)) 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) <= -3.8e+61) || ~(((x * y) <= 4e+179))) 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], -3.8e+61], N[Not[LessEqual[N[(x * y), $MachinePrecision], 4e+179]], $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 -3.8 \cdot 10^{+61} \lor \neg \left(x \cdot y \leq 4 \cdot 10^{+179}\right):\\
\;\;\;\;c + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -3.79999999999999995e61 or 3.99999999999999992e179 < (*.f64 x y) Initial program 97.5%
Taylor expanded in x around inf 83.0%
if -3.79999999999999995e61 < (*.f64 x y) < 3.99999999999999992e179Initial program 100.0%
Taylor expanded in z around inf 63.3%
Final simplification69.5%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= b -4.4e+58) (not (<= b 5.4e+165))) (+ 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 <= -4.4e+58) || !(b <= 5.4e+165)) {
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 <= (-4.4d+58)) .or. (.not. (b <= 5.4d+165))) 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 <= -4.4e+58) || !(b <= 5.4e+165)) {
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 <= -4.4e+58) or not (b <= 5.4e+165): 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 <= -4.4e+58) || !(b <= 5.4e+165)) 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 <= -4.4e+58) || ~((b <= 5.4e+165))) 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, -4.4e+58], N[Not[LessEqual[b, 5.4e+165]], $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 -4.4 \cdot 10^{+58} \lor \neg \left(b \leq 5.4 \cdot 10^{+165}\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 < -4.4000000000000001e58 or 5.3999999999999999e165 < b Initial program 97.3%
Taylor expanded in a around inf 64.7%
associate-*r*64.7%
Simplified64.7%
if -4.4000000000000001e58 < b < 5.3999999999999999e165Initial program 100.0%
Taylor expanded in a around 0 85.3%
Final simplification79.2%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -6e+188) (not (<= (* x y) 6.4e-49))) (* x y) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((x * y) <= -6e+188) || !((x * y) <= 6.4e-49)) {
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) <= (-6d+188)) .or. (.not. ((x * y) <= 6.4d-49))) 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) <= -6e+188) || !((x * y) <= 6.4e-49)) {
tmp = x * y;
} else {
tmp = c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((x * y) <= -6e+188) or not ((x * y) <= 6.4e-49): tmp = x * y else: tmp = c return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(x * y) <= -6e+188) || !(Float64(x * y) <= 6.4e-49)) 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) <= -6e+188) || ~(((x * y) <= 6.4e-49))) 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], -6e+188], N[Not[LessEqual[N[(x * y), $MachinePrecision], 6.4e-49]], $MachinePrecision]], N[(x * y), $MachinePrecision], c]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -6 \cdot 10^{+188} \lor \neg \left(x \cdot y \leq 6.4 \cdot 10^{-49}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c\\
\end{array}
\end{array}
if (*.f64 x y) < -6.0000000000000001e188 or 6.40000000000000005e-49 < (*.f64 x y) Initial program 99.0%
Taylor expanded in a around 0 85.8%
Taylor expanded in c around 0 76.6%
Taylor expanded in t around 0 57.9%
if -6.0000000000000001e188 < (*.f64 x y) < 6.40000000000000005e-49Initial program 99.3%
Taylor expanded in c around inf 34.5%
Final simplification44.0%
(FPCore (x y z t a b c) :precision binary64 (+ c (- (+ (* 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 + (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0));
}
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 + (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return c + (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0));
}
def code(x, y, z, t, a, b, c): return c + (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0))
function code(x, y, z, t, a, b, c) return Float64(c + Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0))) end
function tmp = code(x, y, z, t, a, b, c) tmp = c + (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(c + N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c + \left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right)
\end{array}
Initial program 99.2%
Final simplification99.2%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= z -8.8e+151) (not (<= z 2.05e-13))) (* 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 <= -8.8e+151) || !(z <= 2.05e-13)) {
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 <= (-8.8d+151)) .or. (.not. (z <= 2.05d-13))) 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 <= -8.8e+151) || !(z <= 2.05e-13)) {
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 <= -8.8e+151) or not (z <= 2.05e-13): 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 <= -8.8e+151) || !(z <= 2.05e-13)) 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 <= -8.8e+151) || ~((z <= 2.05e-13))) 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, -8.8e+151], N[Not[LessEqual[z, 2.05e-13]], $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 -8.8 \cdot 10^{+151} \lor \neg \left(z \leq 2.05 \cdot 10^{-13}\right):\\
\;\;\;\;t \cdot \left(z \cdot 0.0625\right)\\
\mathbf{else}:\\
\;\;\;\;c + x \cdot y\\
\end{array}
\end{array}
if z < -8.80000000000000027e151 or 2.0500000000000001e-13 < z Initial program 97.9%
Taylor expanded in a around 0 80.1%
Taylor expanded in c around 0 66.4%
Taylor expanded in t around inf 52.0%
*-commutative52.0%
associate-*r*52.0%
Simplified52.0%
if -8.80000000000000027e151 < z < 2.0500000000000001e-13Initial program 100.0%
Taylor expanded in x around inf 62.5%
Final simplification58.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 99.2%
Taylor expanded in c around inf 24.5%
Final simplification24.5%
herbie shell --seed 2024062
(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))