
(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 98.4%
associate--l+98.4%
fma-define98.4%
associate-/l*98.4%
fmm-def98.4%
distribute-neg-frac298.4%
metadata-eval98.4%
Simplified98.4%
(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 98.4%
associate-+l-98.4%
+-commutative98.4%
*-commutative98.4%
+-commutative98.4%
associate-+l-98.4%
fma-define98.4%
*-commutative98.4%
associate-/l*98.4%
associate-/l*98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (+ c (* x y))))
(if (<= (* x y) -7.8e+136)
t_1
(if (<= (* x y) 0.0)
(+ c (* z (* t 0.0625)))
(if (<= (* x y) 2.3e+153) (+ 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) <= -7.8e+136) {
tmp = t_1;
} else if ((x * y) <= 0.0) {
tmp = c + (z * (t * 0.0625));
} else if ((x * y) <= 2.3e+153) {
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) <= (-7.8d+136)) then
tmp = t_1
else if ((x * y) <= 0.0d0) then
tmp = c + (z * (t * 0.0625d0))
else if ((x * y) <= 2.3d+153) 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) <= -7.8e+136) {
tmp = t_1;
} else if ((x * y) <= 0.0) {
tmp = c + (z * (t * 0.0625));
} else if ((x * y) <= 2.3e+153) {
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) <= -7.8e+136: tmp = t_1 elif (x * y) <= 0.0: tmp = c + (z * (t * 0.0625)) elif (x * y) <= 2.3e+153: 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) <= -7.8e+136) tmp = t_1; elseif (Float64(x * y) <= 0.0) tmp = Float64(c + Float64(z * Float64(t * 0.0625))); elseif (Float64(x * y) <= 2.3e+153) 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) <= -7.8e+136) tmp = t_1; elseif ((x * y) <= 0.0) tmp = c + (z * (t * 0.0625)); elseif ((x * y) <= 2.3e+153) 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], -7.8e+136], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 0.0], N[(c + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.3e+153], 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 -7.8 \cdot 10^{+136}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 0:\\
\;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\
\mathbf{elif}\;x \cdot y \leq 2.3 \cdot 10^{+153}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -7.80000000000000038e136 or 2.3000000000000001e153 < (*.f64 x y) Initial program 94.1%
associate-+l-94.1%
+-commutative94.1%
*-commutative94.1%
+-commutative94.1%
associate-+l-94.1%
fma-define94.1%
*-commutative94.1%
associate-/l*94.1%
associate-/l*94.1%
Simplified94.1%
Taylor expanded in x around inf 88.1%
Taylor expanded in x around inf 86.0%
if -7.80000000000000038e136 < (*.f64 x y) < -0.0Initial program 100.0%
Taylor expanded in z around inf 92.1%
Taylor expanded in t around inf 69.2%
if -0.0 < (*.f64 x y) < 2.3000000000000001e153Initial program 100.0%
associate--l+100.0%
fma-define100.0%
associate-/l*100.0%
fmm-def100.0%
distribute-neg-frac2100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in a around inf 67.8%
*-commutative67.8%
associate-*r*67.8%
Simplified67.8%
Final simplification73.2%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* 0.0625 (* z t))))
(if (or (<= (* a b) -2e+78) (not (<= (* a b) 5e+88)))
(+ c (- t_1 (* (* a b) 0.25)))
(+ c (+ (* 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 (((a * b) <= -2e+78) || !((a * b) <= 5e+88)) {
tmp = c + (t_1 - ((a * b) * 0.25));
} else {
tmp = c + ((x * y) + t_1);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = 0.0625d0 * (z * t)
if (((a * b) <= (-2d+78)) .or. (.not. ((a * b) <= 5d+88))) then
tmp = c + (t_1 - ((a * b) * 0.25d0))
else
tmp = c + ((x * y) + t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = 0.0625 * (z * t);
double tmp;
if (((a * b) <= -2e+78) || !((a * b) <= 5e+88)) {
tmp = c + (t_1 - ((a * b) * 0.25));
} else {
tmp = c + ((x * y) + t_1);
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = 0.0625 * (z * t) tmp = 0 if ((a * b) <= -2e+78) or not ((a * b) <= 5e+88): tmp = c + (t_1 - ((a * b) * 0.25)) else: tmp = c + ((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(a * b) <= -2e+78) || !(Float64(a * b) <= 5e+88)) tmp = Float64(c + Float64(t_1 - Float64(Float64(a * b) * 0.25))); else tmp = Float64(c + Float64(Float64(x * y) + t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = 0.0625 * (z * t); tmp = 0.0; if (((a * b) <= -2e+78) || ~(((a * b) <= 5e+88))) tmp = c + (t_1 - ((a * b) * 0.25)); else tmp = c + ((x * y) + t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[(a * b), $MachinePrecision], -2e+78], N[Not[LessEqual[N[(a * b), $MachinePrecision], 5e+88]], $MachinePrecision]], N[(c + N[(t$95$1 - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.0625 \cdot \left(z \cdot t\right)\\
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+78} \lor \neg \left(a \cdot b \leq 5 \cdot 10^{+88}\right):\\
\;\;\;\;c + \left(t\_1 - \left(a \cdot b\right) \cdot 0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + t\_1\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -2.00000000000000002e78 or 4.99999999999999997e88 < (*.f64 a b) Initial program 96.4%
Taylor expanded in x around 0 92.8%
if -2.00000000000000002e78 < (*.f64 a b) < 4.99999999999999997e88Initial program 99.4%
add-sqr-sqrt61.6%
sqrt-unprod98.1%
frac-times98.1%
metadata-eval98.1%
metadata-eval98.1%
frac-times98.1%
sqrt-unprod57.4%
add-sqr-sqrt96.3%
associate-/l*96.3%
*-commutative96.3%
div-inv96.3%
metadata-eval96.3%
Applied egg-rr96.3%
Taylor expanded in b around 0 96.4%
Final simplification95.2%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= z -1.25e+79) (not (<= z 1.9e-144))) (+ c (+ (* x y) (* 0.0625 (* z t)))) (+ c (- (* x y) (* a (/ b 4.0))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z <= -1.25e+79) || !(z <= 1.9e-144)) {
tmp = c + ((x * y) + (0.0625 * (z * t)));
} else {
tmp = c + ((x * y) - (a * (b / 4.0)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if ((z <= (-1.25d+79)) .or. (.not. (z <= 1.9d-144))) then
tmp = c + ((x * y) + (0.0625d0 * (z * t)))
else
tmp = c + ((x * y) - (a * (b / 4.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z <= -1.25e+79) || !(z <= 1.9e-144)) {
tmp = c + ((x * y) + (0.0625 * (z * t)));
} else {
tmp = c + ((x * y) - (a * (b / 4.0)));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (z <= -1.25e+79) or not (z <= 1.9e-144): tmp = c + ((x * y) + (0.0625 * (z * t))) else: tmp = c + ((x * y) - (a * (b / 4.0))) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((z <= -1.25e+79) || !(z <= 1.9e-144)) tmp = Float64(c + Float64(Float64(x * y) + Float64(0.0625 * Float64(z * t)))); else tmp = Float64(c + Float64(Float64(x * y) - Float64(a * Float64(b / 4.0)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if ((z <= -1.25e+79) || ~((z <= 1.9e-144))) tmp = c + ((x * y) + (0.0625 * (z * t))); else tmp = c + ((x * y) - (a * (b / 4.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[z, -1.25e+79], N[Not[LessEqual[z, 1.9e-144]], $MachinePrecision]], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] - N[(a * N[(b / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+79} \lor \neg \left(z \leq 1.9 \cdot 10^{-144}\right):\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y - a \cdot \frac{b}{4}\right)\\
\end{array}
\end{array}
if z < -1.25e79 or 1.89999999999999996e-144 < z Initial program 98.7%
add-sqr-sqrt55.5%
sqrt-unprod80.2%
frac-times80.2%
metadata-eval80.2%
metadata-eval80.2%
frac-times80.2%
sqrt-unprod49.8%
add-sqr-sqrt81.4%
associate-/l*81.4%
*-commutative81.4%
div-inv81.4%
metadata-eval81.4%
Applied egg-rr81.4%
Taylor expanded in b around 0 82.6%
if -1.25e79 < z < 1.89999999999999996e-144Initial program 98.0%
associate-+l-98.0%
+-commutative98.0%
*-commutative98.0%
+-commutative98.0%
associate-+l-98.0%
fma-define98.0%
*-commutative98.0%
associate-/l*98.0%
associate-/l*98.0%
Simplified98.0%
Taylor expanded in x around inf 89.0%
Final simplification85.2%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= b -1e-42) (not (<= b 5.6e+194))) (+ 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 ((b <= -1e-42) || !(b <= 5.6e+194)) {
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 ((b <= (-1d-42)) .or. (.not. (b <= 5.6d+194))) 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 ((b <= -1e-42) || !(b <= 5.6e+194)) {
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 (b <= -1e-42) or not (b <= 5.6e+194): 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 ((b <= -1e-42) || !(b <= 5.6e+194)) 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 ((b <= -1e-42) || ~((b <= 5.6e+194))) 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[Or[LessEqual[b, -1e-42], N[Not[LessEqual[b, 5.6e+194]], $MachinePrecision]], 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}\;b \leq -1 \cdot 10^{-42} \lor \neg \left(b \leq 5.6 \cdot 10^{+194}\right):\\
\;\;\;\;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 b < -1.00000000000000004e-42 or 5.60000000000000021e194 < b Initial program 97.8%
associate--l+97.8%
fma-define97.8%
associate-/l*97.8%
fmm-def97.8%
distribute-neg-frac297.8%
metadata-eval97.8%
Simplified97.8%
Taylor expanded in a around inf 63.5%
*-commutative63.5%
associate-*r*63.5%
Simplified63.5%
if -1.00000000000000004e-42 < b < 5.60000000000000021e194Initial program 98.8%
add-sqr-sqrt65.6%
sqrt-unprod88.5%
frac-times88.5%
metadata-eval88.5%
metadata-eval88.5%
frac-times88.5%
sqrt-unprod48.8%
add-sqr-sqrt87.3%
associate-/l*87.3%
*-commutative87.3%
div-inv87.3%
metadata-eval87.3%
Applied egg-rr87.3%
Taylor expanded in b around 0 88.2%
Final simplification79.2%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -7.2e+51) (not (<= (* x y) 3.6e+153))) (+ 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) <= -7.2e+51) || !((x * y) <= 3.6e+153)) {
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) <= (-7.2d+51)) .or. (.not. ((x * y) <= 3.6d+153))) 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) <= -7.2e+51) || !((x * y) <= 3.6e+153)) {
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) <= -7.2e+51) or not ((x * y) <= 3.6e+153): 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) <= -7.2e+51) || !(Float64(x * y) <= 3.6e+153)) 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) <= -7.2e+51) || ~(((x * y) <= 3.6e+153))) 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], -7.2e+51], N[Not[LessEqual[N[(x * y), $MachinePrecision], 3.6e+153]], $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 -7.2 \cdot 10^{+51} \lor \neg \left(x \cdot y \leq 3.6 \cdot 10^{+153}\right):\\
\;\;\;\;c + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -7.20000000000000022e51 or 3.6000000000000001e153 < (*.f64 x y) Initial program 95.2%
associate-+l-95.2%
+-commutative95.2%
*-commutative95.2%
+-commutative95.2%
associate-+l-95.2%
fma-define95.2%
*-commutative95.2%
associate-/l*95.2%
associate-/l*95.2%
Simplified95.2%
Taylor expanded in x around inf 83.3%
Taylor expanded in x around inf 80.5%
if -7.20000000000000022e51 < (*.f64 x y) < 3.6000000000000001e153Initial program 100.0%
associate--l+100.0%
fma-define100.0%
associate-/l*100.0%
fmm-def100.0%
distribute-neg-frac2100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in a around inf 62.2%
*-commutative62.2%
associate-*r*62.2%
Simplified62.2%
Final simplification68.2%
(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 98.4%
Final simplification98.4%
(FPCore (x y z t a b c) :precision binary64 (+ c (* x y)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return c + (x * y);
}
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)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return c + (x * y);
}
def code(x, y, z, t, a, b, c): return c + (x * y)
function code(x, y, z, t, a, b, c) return Float64(c + Float64(x * y)) end
function tmp = code(x, y, z, t, a, b, c) tmp = c + (x * y); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c + x \cdot y
\end{array}
Initial program 98.4%
associate-+l-98.4%
+-commutative98.4%
*-commutative98.4%
+-commutative98.4%
associate-+l-98.4%
fma-define98.4%
*-commutative98.4%
associate-/l*98.4%
associate-/l*98.4%
Simplified98.4%
Taylor expanded in x around inf 71.8%
Taylor expanded in x around inf 49.4%
Final simplification49.4%
(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 98.4%
associate--l+98.4%
fma-define98.4%
associate-/l*98.4%
fmm-def98.4%
distribute-neg-frac298.4%
metadata-eval98.4%
Simplified98.4%
Taylor expanded in a around inf 50.3%
*-commutative50.3%
associate-*r*50.3%
Simplified50.3%
Taylor expanded in a around 0 26.6%
herbie shell --seed 2024170
(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))