
(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 10 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.6%
associate-/l*99.6%
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
(let* ((t_1 (+ c (* a (* b -0.25)))) (t_2 (+ c (* x y))))
(if (<= (* x y) -5e+73)
t_2
(if (<= (* x y) -5e-115)
t_1
(if (<= (* x y) -2e-318)
(+ c (* z (* t 0.0625)))
(if (<= (* x y) 5e+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 + (a * (b * -0.25));
double t_2 = c + (x * y);
double tmp;
if ((x * y) <= -5e+73) {
tmp = t_2;
} else if ((x * y) <= -5e-115) {
tmp = t_1;
} else if ((x * y) <= -2e-318) {
tmp = c + (z * (t * 0.0625));
} else if ((x * y) <= 5e+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 + (a * (b * (-0.25d0)))
t_2 = c + (x * y)
if ((x * y) <= (-5d+73)) then
tmp = t_2
else if ((x * y) <= (-5d-115)) then
tmp = t_1
else if ((x * y) <= (-2d-318)) then
tmp = c + (z * (t * 0.0625d0))
else if ((x * y) <= 5d+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 + (a * (b * -0.25));
double t_2 = c + (x * y);
double tmp;
if ((x * y) <= -5e+73) {
tmp = t_2;
} else if ((x * y) <= -5e-115) {
tmp = t_1;
} else if ((x * y) <= -2e-318) {
tmp = c + (z * (t * 0.0625));
} else if ((x * y) <= 5e+183) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = c + (a * (b * -0.25)) t_2 = c + (x * y) tmp = 0 if (x * y) <= -5e+73: tmp = t_2 elif (x * y) <= -5e-115: tmp = t_1 elif (x * y) <= -2e-318: tmp = c + (z * (t * 0.0625)) elif (x * y) <= 5e+183: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(c + Float64(a * Float64(b * -0.25))) t_2 = Float64(c + Float64(x * y)) tmp = 0.0 if (Float64(x * y) <= -5e+73) tmp = t_2; elseif (Float64(x * y) <= -5e-115) tmp = t_1; elseif (Float64(x * y) <= -2e-318) tmp = Float64(c + Float64(z * Float64(t * 0.0625))); elseif (Float64(x * y) <= 5e+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 + (a * (b * -0.25)); t_2 = c + (x * y); tmp = 0.0; if ((x * y) <= -5e+73) tmp = t_2; elseif ((x * y) <= -5e-115) tmp = t_1; elseif ((x * y) <= -2e-318) tmp = c + (z * (t * 0.0625)); elseif ((x * y) <= 5e+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[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -5e+73], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -5e-115], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -2e-318], N[(c + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+183], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c + a \cdot \left(b \cdot -0.25\right)\\
t_2 := c + x \cdot y\\
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+73}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-115}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-318}:\\
\;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+183}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999976e73 or 5.00000000000000009e183 < (*.f64 x y) Initial program 97.7%
Taylor expanded in x around inf 82.4%
if -4.99999999999999976e73 < (*.f64 x y) < -5.0000000000000003e-115 or -2.0000024e-318 < (*.f64 x y) < 5.00000000000000009e183Initial program 99.9%
Taylor expanded in a around inf 64.0%
*-commutative64.0%
associate-*r*64.0%
Simplified64.0%
if -5.0000000000000003e-115 < (*.f64 x y) < -2.0000024e-318Initial program 100.0%
Taylor expanded in z around inf 72.1%
associate-*r*72.1%
*-commutative72.1%
*-commutative72.1%
*-commutative72.1%
Simplified72.1%
Final simplification71.1%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* a b) 0.25)) (t_2 (* 0.0625 (* z t))))
(if (<= (* a b) -2e+79)
(+ c (- (* x y) t_1))
(if (<= (* a b) 1e+92) (+ c (+ (* x y) t_2)) (+ c (- t_2 t_1))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (a * b) * 0.25;
double t_2 = 0.0625 * (z * t);
double tmp;
if ((a * b) <= -2e+79) {
tmp = c + ((x * y) - t_1);
} else if ((a * b) <= 1e+92) {
tmp = c + ((x * y) + t_2);
} else {
tmp = c + (t_2 - 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 = (a * b) * 0.25d0
t_2 = 0.0625d0 * (z * t)
if ((a * b) <= (-2d+79)) then
tmp = c + ((x * y) - t_1)
else if ((a * b) <= 1d+92) then
tmp = c + ((x * y) + t_2)
else
tmp = c + (t_2 - 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 = (a * b) * 0.25;
double t_2 = 0.0625 * (z * t);
double tmp;
if ((a * b) <= -2e+79) {
tmp = c + ((x * y) - t_1);
} else if ((a * b) <= 1e+92) {
tmp = c + ((x * y) + t_2);
} else {
tmp = c + (t_2 - t_1);
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = (a * b) * 0.25 t_2 = 0.0625 * (z * t) tmp = 0 if (a * b) <= -2e+79: tmp = c + ((x * y) - t_1) elif (a * b) <= 1e+92: tmp = c + ((x * y) + t_2) else: tmp = c + (t_2 - t_1) return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(a * b) * 0.25) t_2 = Float64(0.0625 * Float64(z * t)) tmp = 0.0 if (Float64(a * b) <= -2e+79) tmp = Float64(c + Float64(Float64(x * y) - t_1)); elseif (Float64(a * b) <= 1e+92) tmp = Float64(c + Float64(Float64(x * y) + t_2)); else tmp = Float64(c + Float64(t_2 - t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = (a * b) * 0.25; t_2 = 0.0625 * (z * t); tmp = 0.0; if ((a * b) <= -2e+79) tmp = c + ((x * y) - t_1); elseif ((a * b) <= 1e+92) tmp = c + ((x * y) + t_2); else tmp = c + (t_2 - t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]}, Block[{t$95$2 = N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -2e+79], N[(c + N[(N[(x * y), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+92], N[(c + N[(N[(x * y), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(c + N[(t$95$2 - t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot b\right) \cdot 0.25\\
t_2 := 0.0625 \cdot \left(z \cdot t\right)\\
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+79}:\\
\;\;\;\;c + \left(x \cdot y - t\_1\right)\\
\mathbf{elif}\;a \cdot b \leq 10^{+92}:\\
\;\;\;\;c + \left(x \cdot y + t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;c + \left(t\_2 - t\_1\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -1.99999999999999993e79Initial program 98.1%
Taylor expanded in z around 0 89.1%
if -1.99999999999999993e79 < (*.f64 a b) < 1e92Initial program 100.0%
Taylor expanded in a around 0 96.8%
if 1e92 < (*.f64 a b) Initial program 97.4%
Taylor expanded in x around 0 87.9%
Final simplification93.9%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* a b) -2e+79) (not (<= (* a b) 5e+106))) (+ c (- (* x y) (* (* a b) 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 (((a * b) <= -2e+79) || !((a * b) <= 5e+106)) {
tmp = c + ((x * y) - ((a * b) * 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 (((a * b) <= (-2d+79)) .or. (.not. ((a * b) <= 5d+106))) then
tmp = c + ((x * y) - ((a * b) * 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 (((a * b) <= -2e+79) || !((a * b) <= 5e+106)) {
tmp = c + ((x * y) - ((a * b) * 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 ((a * b) <= -2e+79) or not ((a * b) <= 5e+106): tmp = c + ((x * y) - ((a * b) * 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 ((Float64(a * b) <= -2e+79) || !(Float64(a * b) <= 5e+106)) tmp = Float64(c + Float64(Float64(x * y) - Float64(Float64(a * b) * 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 (((a * b) <= -2e+79) || ~(((a * b) <= 5e+106))) tmp = c + ((x * y) - ((a * b) * 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[N[(a * b), $MachinePrecision], -2e+79], N[Not[LessEqual[N[(a * b), $MachinePrecision], 5e+106]], $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[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+79} \lor \neg \left(a \cdot b \leq 5 \cdot 10^{+106}\right):\\
\;\;\;\;c + \left(x \cdot y - \left(a \cdot b\right) \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 (*.f64 a b) < -1.99999999999999993e79 or 4.9999999999999998e106 < (*.f64 a b) Initial program 97.7%
Taylor expanded in z around 0 88.1%
if -1.99999999999999993e79 < (*.f64 a b) < 4.9999999999999998e106Initial program 100.0%
Taylor expanded in a around 0 96.3%
Final simplification93.5%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -3.8e+72) (not (<= (* x y) 3.8e+183))) (+ 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) <= -3.8e+72) || !((x * y) <= 3.8e+183)) {
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) <= (-3.8d+72)) .or. (.not. ((x * y) <= 3.8d+183))) 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) <= -3.8e+72) || !((x * y) <= 3.8e+183)) {
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) <= -3.8e+72) or not ((x * y) <= 3.8e+183): 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) <= -3.8e+72) || !(Float64(x * y) <= 3.8e+183)) 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) <= -3.8e+72) || ~(((x * y) <= 3.8e+183))) 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], -3.8e+72], N[Not[LessEqual[N[(x * y), $MachinePrecision], 3.8e+183]], $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 -3.8 \cdot 10^{+72} \lor \neg \left(x \cdot y \leq 3.8 \cdot 10^{+183}\right):\\
\;\;\;\;c + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -3.80000000000000006e72 or 3.80000000000000001e183 < (*.f64 x y) Initial program 97.7%
Taylor expanded in x around inf 82.4%
if -3.80000000000000006e72 < (*.f64 x y) < 3.80000000000000001e183Initial program 100.0%
Taylor expanded in a around inf 61.0%
*-commutative61.0%
associate-*r*61.0%
Simplified61.0%
Final simplification68.4%
(FPCore (x y z t a b c) :precision binary64 (+ c (+ (+ (* x y) (* b (* a -0.25))) (* z (* t 0.0625)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return c + (((x * y) + (b * (a * -0.25))) + (z * (t * 0.0625)));
}
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) + (b * (a * (-0.25d0)))) + (z * (t * 0.0625d0)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return c + (((x * y) + (b * (a * -0.25))) + (z * (t * 0.0625)));
}
def code(x, y, z, t, a, b, c): return c + (((x * y) + (b * (a * -0.25))) + (z * (t * 0.0625)))
function code(x, y, z, t, a, b, c) return Float64(c + Float64(Float64(Float64(x * y) + Float64(b * Float64(a * -0.25))) + Float64(z * Float64(t * 0.0625)))) end
function tmp = code(x, y, z, t, a, b, c) tmp = c + (((x * y) + (b * (a * -0.25))) + (z * (t * 0.0625))); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(c + N[(N[(N[(x * y), $MachinePrecision] + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c + \left(\left(x \cdot y + b \cdot \left(a \cdot -0.25\right)\right) + z \cdot \left(t \cdot 0.0625\right)\right)
\end{array}
Initial program 99.2%
div-inv99.2%
cancel-sign-sub-inv99.2%
+-commutative99.2%
div-inv99.2%
metadata-eval99.2%
frac-2neg99.2%
add-sqr-sqrt58.1%
sqrt-unprod79.4%
frac-times79.4%
metadata-eval79.4%
metadata-eval79.4%
frac-times79.4%
sqrt-unprod43.4%
add-sqr-sqrt73.7%
associate-+l+73.7%
associate-/l*73.7%
div-inv73.7%
metadata-eval73.7%
add-sqr-sqrt43.4%
sqrt-unprod79.4%
Applied egg-rr99.2%
Final simplification99.2%
(FPCore (x y z t a b c) :precision binary64 (if (<= a -1.46e+234) (+ c (* a (* b -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 (a <= -1.46e+234) {
tmp = c + (a * (b * -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 (a <= (-1.46d+234)) then
tmp = c + (a * (b * (-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 (a <= -1.46e+234) {
tmp = c + (a * (b * -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 a <= -1.46e+234: tmp = c + (a * (b * -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 (a <= -1.46e+234) tmp = Float64(c + Float64(a * Float64(b * -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 (a <= -1.46e+234) tmp = c + (a * (b * -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[LessEqual[a, -1.46e+234], N[(c + N[(a * N[(b * -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}\;a \leq -1.46 \cdot 10^{+234}:\\
\;\;\;\;c + a \cdot \left(b \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 a < -1.46e234Initial program 100.0%
Taylor expanded in a around inf 89.2%
*-commutative89.2%
associate-*r*89.2%
Simplified89.2%
if -1.46e234 < a Initial program 99.1%
Taylor expanded in a around 0 79.6%
Final simplification80.2%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= b -48000000.0) (not (<= b 6.2e+134))) (* b (* a -0.25)) (+ c (* x y))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((b <= -48000000.0) || !(b <= 6.2e+134)) {
tmp = b * (a * -0.25);
} 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 ((b <= (-48000000.0d0)) .or. (.not. (b <= 6.2d+134))) then
tmp = b * (a * (-0.25d0))
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 ((b <= -48000000.0) || !(b <= 6.2e+134)) {
tmp = b * (a * -0.25);
} else {
tmp = c + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (b <= -48000000.0) or not (b <= 6.2e+134): tmp = b * (a * -0.25) else: tmp = c + (x * y) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((b <= -48000000.0) || !(b <= 6.2e+134)) tmp = Float64(b * Float64(a * -0.25)); 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 ((b <= -48000000.0) || ~((b <= 6.2e+134))) tmp = b * (a * -0.25); else tmp = c + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[b, -48000000.0], N[Not[LessEqual[b, 6.2e+134]], $MachinePrecision]], N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -48000000 \lor \neg \left(b \leq 6.2 \cdot 10^{+134}\right):\\
\;\;\;\;b \cdot \left(a \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c + x \cdot y\\
\end{array}
\end{array}
if b < -4.8e7 or 6.19999999999999963e134 < b Initial program 97.8%
Taylor expanded in z around inf 82.2%
Taylor expanded in a around inf 63.7%
associate-*r*63.7%
*-commutative63.7%
Simplified63.7%
Taylor expanded in a around inf 50.6%
associate-*r*50.6%
Simplified50.6%
if -4.8e7 < b < 6.19999999999999963e134Initial program 100.0%
Taylor expanded in x around inf 59.3%
Final simplification56.2%
(FPCore (x y z t a b c) :precision binary64 (if (<= c -1.62e+73) c (if (<= c 2.2e+184) (* b (* a -0.25)) c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (c <= -1.62e+73) {
tmp = c;
} else if (c <= 2.2e+184) {
tmp = b * (a * -0.25);
} 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.62d+73)) then
tmp = c
else if (c <= 2.2d+184) then
tmp = b * (a * (-0.25d0))
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.62e+73) {
tmp = c;
} else if (c <= 2.2e+184) {
tmp = b * (a * -0.25);
} else {
tmp = c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if c <= -1.62e+73: tmp = c elif c <= 2.2e+184: tmp = b * (a * -0.25) else: tmp = c return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (c <= -1.62e+73) tmp = c; elseif (c <= 2.2e+184) tmp = Float64(b * Float64(a * -0.25)); else tmp = c; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (c <= -1.62e+73) tmp = c; elseif (c <= 2.2e+184) tmp = b * (a * -0.25); else tmp = c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[c, -1.62e+73], c, If[LessEqual[c, 2.2e+184], N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision], c]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.62 \cdot 10^{+73}:\\
\;\;\;\;c\\
\mathbf{elif}\;c \leq 2.2 \cdot 10^{+184}:\\
\;\;\;\;b \cdot \left(a \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c\\
\end{array}
\end{array}
if c < -1.61999999999999988e73 or 2.2e184 < c Initial program 100.0%
Taylor expanded in x around inf 70.9%
Taylor expanded in x around 0 51.4%
if -1.61999999999999988e73 < c < 2.2e184Initial program 98.8%
Taylor expanded in z around inf 84.5%
Taylor expanded in a around inf 37.9%
associate-*r*37.9%
*-commutative37.9%
Simplified37.9%
Taylor expanded in a around inf 32.4%
associate-*r*32.4%
Simplified32.4%
Final simplification38.1%
(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 x around inf 49.6%
Taylor expanded in x around 0 20.5%
Final simplification20.5%
herbie shell --seed 2024078
(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))