
(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 (if (<= (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) INFINITY) (+ c (- (+ (* x y) (* z (* t 0.0625))) (* a (/ b 4.0)))) (* (* 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) + ((z * t) / 16.0)) - ((a * b) / 4.0)) <= ((double) INFINITY)) {
tmp = c + (((x * y) + (z * (t * 0.0625))) - (a * (b / 4.0)));
} else {
tmp = (z * t) * 0.0625;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) <= Double.POSITIVE_INFINITY) {
tmp = c + (((x * y) + (z * (t * 0.0625))) - (a * (b / 4.0)));
} else {
tmp = (z * t) * 0.0625;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) <= math.inf: tmp = c + (((x * y) + (z * (t * 0.0625))) - (a * (b / 4.0))) else: tmp = (z * t) * 0.0625 return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) <= Inf) tmp = Float64(c + Float64(Float64(Float64(x * y) + Float64(z * Float64(t * 0.0625))) - Float64(a * Float64(b / 4.0)))); else tmp = 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) + ((z * t) / 16.0)) - ((a * b) / 4.0)) <= Inf) tmp = c + (((x * y) + (z * (t * 0.0625))) - (a * (b / 4.0))); else tmp = (z * t) * 0.0625; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision], Infinity], N[(c + N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * N[(b / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4} \leq \infty:\\
\;\;\;\;c + \left(\left(x \cdot y + z \cdot \left(t \cdot 0.0625\right)\right) - a \cdot \frac{b}{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot t\right) \cdot 0.0625\\
\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%
associate-+l-99.7%
*-commutative99.7%
associate-+l-99.7%
fma-define99.7%
*-commutative99.7%
associate-/l*100.0%
associate-/l*100.0%
Simplified100.0%
fma-undefine100.0%
associate-*r/99.7%
+-commutative99.7%
associate-*r/100.0%
div-inv100.0%
metadata-eval100.0%
Applied egg-rr100.0%
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 80.1%
*-commutative80.1%
*-commutative80.1%
associate-*r*80.1%
*-commutative80.1%
Simplified80.1%
Taylor expanded in z around inf 80.6%
Final simplification99.6%
(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.7%
associate--l+97.7%
fma-define98.9%
associate-/l*99.2%
fma-neg99.2%
distribute-neg-frac299.2%
metadata-eval99.2%
Simplified99.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 97.7%
associate-+l-97.7%
*-commutative97.7%
associate-+l-97.7%
fma-define98.5%
*-commutative98.5%
associate-/l*98.8%
associate-/l*98.8%
Simplified98.8%
Final simplification98.8%
(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) (* (* z t) 0.0625))))
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 = (z * t) * 0.0625;
}
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 = (z * t) * 0.0625;
}
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 = (z * t) * 0.0625 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(Float64(z * t) * 0.0625); 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 = (z * t) * 0.0625; 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[(N[(z * t), $MachinePrecision] * 0.0625), $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}:\\
\;\;\;\;\left(z \cdot t\right) \cdot 0.0625\\
\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 80.1%
*-commutative80.1%
*-commutative80.1%
associate-*r*80.1%
*-commutative80.1%
Simplified80.1%
Taylor expanded in z around inf 80.6%
Final simplification99.3%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (+ c (* x y))))
(if (<= (* x y) -2.76e+17)
t_1
(if (<= (* x y) 2.8e-254)
(+ c (* z (* t 0.0625)))
(if (<= (* x y) 4.7e+95) (+ c (* a (* b -0.25))) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = c + (x * y);
double tmp;
if ((x * y) <= -2.76e+17) {
tmp = t_1;
} else if ((x * y) <= 2.8e-254) {
tmp = c + (z * (t * 0.0625));
} else if ((x * y) <= 4.7e+95) {
tmp = c + (a * (b * -0.25));
} else {
tmp = 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 = c + (x * y)
if ((x * y) <= (-2.76d+17)) then
tmp = t_1
else if ((x * y) <= 2.8d-254) then
tmp = c + (z * (t * 0.0625d0))
else if ((x * y) <= 4.7d+95) then
tmp = c + (a * (b * (-0.25d0)))
else
tmp = 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 = c + (x * y);
double tmp;
if ((x * y) <= -2.76e+17) {
tmp = t_1;
} else if ((x * y) <= 2.8e-254) {
tmp = c + (z * (t * 0.0625));
} else if ((x * y) <= 4.7e+95) {
tmp = c + (a * (b * -0.25));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = c + (x * y) tmp = 0 if (x * y) <= -2.76e+17: tmp = t_1 elif (x * y) <= 2.8e-254: tmp = c + (z * (t * 0.0625)) elif (x * y) <= 4.7e+95: tmp = c + (a * (b * -0.25)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(c + Float64(x * y)) tmp = 0.0 if (Float64(x * y) <= -2.76e+17) tmp = t_1; elseif (Float64(x * y) <= 2.8e-254) tmp = Float64(c + Float64(z * Float64(t * 0.0625))); elseif (Float64(x * y) <= 4.7e+95) tmp = Float64(c + Float64(a * Float64(b * -0.25))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = c + (x * y); tmp = 0.0; if ((x * y) <= -2.76e+17) tmp = t_1; elseif ((x * y) <= 2.8e-254) tmp = c + (z * (t * 0.0625)); elseif ((x * y) <= 4.7e+95) tmp = c + (a * (b * -0.25)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2.76e+17], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2.8e-254], N[(c + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4.7e+95], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c + x \cdot y\\
\mathbf{if}\;x \cdot y \leq -2.76 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 2.8 \cdot 10^{-254}:\\
\;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\
\mathbf{elif}\;x \cdot y \leq 4.7 \cdot 10^{+95}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -2.76e17 or 4.69999999999999972e95 < (*.f64 x y) Initial program 96.8%
Taylor expanded in x around inf 74.3%
if -2.76e17 < (*.f64 x y) < 2.79999999999999983e-254Initial program 100.0%
Taylor expanded in z around inf 65.4%
*-commutative65.4%
*-commutative65.4%
associate-*r*65.4%
*-commutative65.4%
Simplified65.4%
if 2.79999999999999983e-254 < (*.f64 x y) < 4.69999999999999972e95Initial program 96.9%
Taylor expanded in a around inf 66.6%
*-commutative66.6%
associate-*r*66.6%
Simplified66.6%
Final simplification70.0%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* a b) -2e+149) (not (<= (* a b) 4e-63))) (+ 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) <= -2e+149) || !((a * b) <= 4e-63)) {
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) <= (-2d+149)) .or. (.not. ((a * b) <= 4d-63))) 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) <= -2e+149) || !((a * b) <= 4e-63)) {
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) <= -2e+149) or not ((a * b) <= 4e-63): 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) <= -2e+149) || !(Float64(a * b) <= 4e-63)) 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) <= -2e+149) || ~(((a * b) <= 4e-63))) 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], -2e+149], N[Not[LessEqual[N[(a * b), $MachinePrecision], 4e-63]], $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 -2 \cdot 10^{+149} \lor \neg \left(a \cdot b \leq 4 \cdot 10^{-63}\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) < -2.0000000000000001e149 or 4.00000000000000027e-63 < (*.f64 a b) Initial program 96.7%
Taylor expanded in z around 0 87.4%
if -2.0000000000000001e149 < (*.f64 a b) < 4.00000000000000027e-63Initial program 98.6%
Taylor expanded in a around 0 95.1%
Final simplification91.6%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* a b) -4e+123)
(+ c (+ (* z (* t 0.0625)) (* a (* b -0.25))))
(if (<= (* a b) 4e-63)
(+ c (+ (* x y) (* (* z t) 0.0625)))
(+ c (- (* x y) (* (* a b) 0.25))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((a * b) <= -4e+123) {
tmp = c + ((z * (t * 0.0625)) + (a * (b * -0.25)));
} else if ((a * b) <= 4e-63) {
tmp = c + ((x * y) + ((z * t) * 0.0625));
} else {
tmp = c + ((x * y) - ((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 ((a * b) <= (-4d+123)) then
tmp = c + ((z * (t * 0.0625d0)) + (a * (b * (-0.25d0))))
else if ((a * b) <= 4d-63) then
tmp = c + ((x * y) + ((z * t) * 0.0625d0))
else
tmp = c + ((x * y) - ((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 ((a * b) <= -4e+123) {
tmp = c + ((z * (t * 0.0625)) + (a * (b * -0.25)));
} else if ((a * b) <= 4e-63) {
tmp = c + ((x * y) + ((z * t) * 0.0625));
} else {
tmp = c + ((x * y) - ((a * b) * 0.25));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (a * b) <= -4e+123: tmp = c + ((z * (t * 0.0625)) + (a * (b * -0.25))) elif (a * b) <= 4e-63: tmp = c + ((x * y) + ((z * t) * 0.0625)) else: tmp = c + ((x * y) - ((a * b) * 0.25)) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(a * b) <= -4e+123) tmp = Float64(c + Float64(Float64(z * Float64(t * 0.0625)) + Float64(a * Float64(b * -0.25)))); elseif (Float64(a * b) <= 4e-63) tmp = Float64(c + Float64(Float64(x * y) + Float64(Float64(z * t) * 0.0625))); else tmp = Float64(c + Float64(Float64(x * y) - Float64(Float64(a * b) * 0.25))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if ((a * b) <= -4e+123) tmp = c + ((z * (t * 0.0625)) + (a * (b * -0.25))); elseif ((a * b) <= 4e-63) tmp = c + ((x * y) + ((z * t) * 0.0625)); else tmp = c + ((x * y) - ((a * b) * 0.25)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(a * b), $MachinePrecision], -4e+123], N[(c + N[(N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision] + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 4e-63], N[(c + N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -4 \cdot 10^{+123}:\\
\;\;\;\;c + \left(z \cdot \left(t \cdot 0.0625\right) + a \cdot \left(b \cdot -0.25\right)\right)\\
\mathbf{elif}\;a \cdot b \leq 4 \cdot 10^{-63}:\\
\;\;\;\;c + \left(x \cdot y + \left(z \cdot t\right) \cdot 0.0625\right)\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y - \left(a \cdot b\right) \cdot 0.25\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -3.99999999999999991e123Initial program 93.5%
Taylor expanded in x around 0 89.0%
sub-neg89.0%
associate-*r*90.8%
*-commutative90.8%
*-commutative90.8%
*-commutative90.8%
distribute-rgt-neg-in90.8%
metadata-eval90.8%
associate-*r*90.8%
Applied egg-rr90.8%
if -3.99999999999999991e123 < (*.f64 a b) < 4.00000000000000027e-63Initial program 99.3%
Taylor expanded in a around 0 95.8%
if 4.00000000000000027e-63 < (*.f64 a b) Initial program 97.3%
Taylor expanded in z around 0 89.6%
Final simplification93.1%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= b -4e-23) (not (<= b 3.8e+188))) (+ 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 <= -4e-23) || !(b <= 3.8e+188)) {
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 <= (-4d-23)) .or. (.not. (b <= 3.8d+188))) 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 <= -4e-23) || !(b <= 3.8e+188)) {
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 <= -4e-23) or not (b <= 3.8e+188): 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 <= -4e-23) || !(b <= 3.8e+188)) 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 <= -4e-23) || ~((b <= 3.8e+188))) 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, -4e-23], N[Not[LessEqual[b, 3.8e+188]], $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 -4 \cdot 10^{-23} \lor \neg \left(b \leq 3.8 \cdot 10^{+188}\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 < -3.99999999999999984e-23 or 3.7999999999999998e188 < b Initial program 98.2%
Taylor expanded in a around inf 60.4%
*-commutative60.4%
associate-*r*60.4%
Simplified60.4%
if -3.99999999999999984e-23 < b < 3.7999999999999998e188Initial program 97.4%
Taylor expanded in a around 0 89.0%
Final simplification77.7%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -1.5e+56) (not (<= (* x y) 1e+95))) (+ 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.5e+56) || !((x * y) <= 1e+95)) {
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.5d+56)) .or. (.not. ((x * y) <= 1d+95))) 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.5e+56) || !((x * y) <= 1e+95)) {
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.5e+56) or not ((x * y) <= 1e+95): 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.5e+56) || !(Float64(x * y) <= 1e+95)) 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.5e+56) || ~(((x * y) <= 1e+95))) 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.5e+56], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1e+95]], $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.5 \cdot 10^{+56} \lor \neg \left(x \cdot y \leq 10^{+95}\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.50000000000000003e56 or 1.00000000000000002e95 < (*.f64 x y) Initial program 96.6%
Taylor expanded in x around inf 76.1%
if -1.50000000000000003e56 < (*.f64 x y) < 1.00000000000000002e95Initial program 98.7%
Taylor expanded in a around inf 60.9%
*-commutative60.9%
associate-*r*60.9%
Simplified60.9%
Final simplification67.9%
(FPCore (x y z t a b c) :precision binary64 (if (<= c -1.82e+96) c (if (<= c 2.8e+107) (* (* z t) 0.0625) c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (c <= -1.82e+96) {
tmp = c;
} else if (c <= 2.8e+107) {
tmp = (z * t) * 0.0625;
} 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.82d+96)) then
tmp = c
else if (c <= 2.8d+107) then
tmp = (z * t) * 0.0625d0
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.82e+96) {
tmp = c;
} else if (c <= 2.8e+107) {
tmp = (z * t) * 0.0625;
} else {
tmp = c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if c <= -1.82e+96: tmp = c elif c <= 2.8e+107: tmp = (z * t) * 0.0625 else: tmp = c return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (c <= -1.82e+96) tmp = c; elseif (c <= 2.8e+107) tmp = Float64(Float64(z * t) * 0.0625); else tmp = c; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (c <= -1.82e+96) tmp = c; elseif (c <= 2.8e+107) tmp = (z * t) * 0.0625; else tmp = c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[c, -1.82e+96], c, If[LessEqual[c, 2.8e+107], N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision], c]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.82 \cdot 10^{+96}:\\
\;\;\;\;c\\
\mathbf{elif}\;c \leq 2.8 \cdot 10^{+107}:\\
\;\;\;\;\left(z \cdot t\right) \cdot 0.0625\\
\mathbf{else}:\\
\;\;\;\;c\\
\end{array}
\end{array}
if c < -1.82000000000000002e96 or 2.79999999999999985e107 < c Initial program 97.7%
associate--l+97.7%
fma-define99.0%
associate-/l*100.0%
fma-neg100.0%
distribute-neg-frac2100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in c around inf 52.4%
if -1.82000000000000002e96 < c < 2.79999999999999985e107Initial program 97.7%
Taylor expanded in z around inf 36.7%
*-commutative36.7%
*-commutative36.7%
associate-*r*36.7%
*-commutative36.7%
Simplified36.7%
Taylor expanded in z around inf 33.2%
Final simplification39.1%
(FPCore (x y z t a b c) :precision binary64 (if (<= t 2.25e+154) (+ 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 (t <= 2.25e+154) {
tmp = c + (x * y);
} else {
tmp = 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 (t <= 2.25d+154) then
tmp = c + (x * y)
else
tmp = 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 (t <= 2.25e+154) {
tmp = c + (x * y);
} else {
tmp = z * (t * 0.0625);
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if t <= 2.25e+154: tmp = c + (x * y) else: tmp = z * (t * 0.0625) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (t <= 2.25e+154) tmp = Float64(c + Float64(x * y)); else tmp = Float64(z * Float64(t * 0.0625)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (t <= 2.25e+154) tmp = c + (x * y); else tmp = z * (t * 0.0625); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[t, 2.25e+154], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.25 \cdot 10^{+154}:\\
\;\;\;\;c + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\
\end{array}
\end{array}
if t < 2.25000000000000005e154Initial program 97.9%
Taylor expanded in x around inf 55.5%
if 2.25000000000000005e154 < t Initial program 96.3%
Taylor expanded in z around inf 70.8%
*-commutative70.8%
*-commutative70.8%
associate-*r*70.8%
*-commutative70.8%
Simplified70.8%
Taylor expanded in c around inf 64.4%
associate-/l*64.2%
Simplified64.2%
Taylor expanded in c around 0 68.2%
associate-*r*68.2%
*-commutative68.2%
Simplified68.2%
Final simplification56.9%
(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.7%
associate--l+97.7%
fma-define98.9%
associate-/l*99.2%
fma-neg99.2%
distribute-neg-frac299.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in c around inf 19.8%
herbie shell --seed 2024118
(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))