
(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 (+ (fma x y (fma z (/ t 16.0) (/ (* a b) -4.0))) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(x, y, fma(z, (t / 16.0), ((a * b) / -4.0))) + c;
}
function code(x, y, z, t, a, b, c) return Float64(fma(x, y, fma(z, Float64(t / 16.0), Float64(Float64(a * b) / -4.0))) + c) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(x * y + N[(z * N[(t / 16.0), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] / -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c
\end{array}
Initial program 96.9%
associate--l+96.9%
fma-define97.7%
associate-/l*98.0%
fmm-def99.2%
distribute-neg-frac299.2%
metadata-eval99.2%
Simplified99.2%
(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)))) (+ c (* z (+ (* -0.25 (/ (* a b) 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 = c + (z * ((-0.25 * ((a * b) / 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 = c + (z * ((-0.25 * ((a * b) / 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 = c + (z * ((-0.25 * ((a * b) / 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(c + Float64(z * Float64(Float64(-0.25 * Float64(Float64(a * b) / z)) + Float64(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 = c + (z * ((-0.25 * ((a * b) / 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[(c + N[(z * N[(N[(-0.25 * N[(N[(a * b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}:\\
\;\;\;\;c + z \cdot \left(-0.25 \cdot \frac{a \cdot b}{z} + t \cdot 0.0625\right)\\
\end{array}
\end{array}
if (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64))) < +inf.0Initial program 99.7%
associate-+l-99.7%
+-commutative99.7%
*-commutative99.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 x around 0 28.6%
Taylor expanded in z around inf 71.4%
Final simplification99.2%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0))))
(if (<= t_1 INFINITY)
(+ c t_1)
(+ c (* z (+ (* -0.25 (/ (* a b) 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 = c + (z * ((-0.25 * ((a * b) / 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 = c + (z * ((-0.25 * ((a * b) / 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 = c + (z * ((-0.25 * ((a * b) / 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(c + Float64(z * Float64(Float64(-0.25 * Float64(Float64(a * b) / z)) + Float64(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 = c + (z * ((-0.25 * ((a * b) / 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[(c + N[(z * N[(N[(-0.25 * N[(N[(a * b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;c + t\_1\\
\mathbf{else}:\\
\;\;\;\;c + z \cdot \left(-0.25 \cdot \frac{a \cdot b}{z} + t \cdot 0.0625\right)\\
\end{array}
\end{array}
if (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64))) < +inf.0Initial program 99.7%
if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64))) Initial program 0.0%
Taylor expanded in x around 0 28.6%
Taylor expanded in z around inf 71.4%
Final simplification98.9%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* 0.0625 (* z t))))
(if (<= (* a b) -7.6e+253)
(+ c (- (* x y) (* a (/ b 4.0))))
(if (or (<= (* a b) -2e+95) (not (<= (* a b) 2e+155)))
(+ 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) <= -7.6e+253) {
tmp = c + ((x * y) - (a * (b / 4.0)));
} else if (((a * b) <= -2e+95) || !((a * b) <= 2e+155)) {
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) <= (-7.6d+253)) then
tmp = c + ((x * y) - (a * (b / 4.0d0)))
else if (((a * b) <= (-2d+95)) .or. (.not. ((a * b) <= 2d+155))) 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) <= -7.6e+253) {
tmp = c + ((x * y) - (a * (b / 4.0)));
} else if (((a * b) <= -2e+95) || !((a * b) <= 2e+155)) {
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) <= -7.6e+253: tmp = c + ((x * y) - (a * (b / 4.0))) elif ((a * b) <= -2e+95) or not ((a * b) <= 2e+155): 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) <= -7.6e+253) tmp = Float64(c + Float64(Float64(x * y) - Float64(a * Float64(b / 4.0)))); elseif ((Float64(a * b) <= -2e+95) || !(Float64(a * b) <= 2e+155)) 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) <= -7.6e+253) tmp = c + ((x * y) - (a * (b / 4.0))); elseif (((a * b) <= -2e+95) || ~(((a * b) <= 2e+155))) 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[LessEqual[N[(a * b), $MachinePrecision], -7.6e+253], N[(c + N[(N[(x * y), $MachinePrecision] - N[(a * N[(b / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(a * b), $MachinePrecision], -2e+95], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2e+155]], $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 -7.6 \cdot 10^{+253}:\\
\;\;\;\;c + \left(x \cdot y - a \cdot \frac{b}{4}\right)\\
\mathbf{elif}\;a \cdot b \leq -2 \cdot 10^{+95} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{+155}\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) < -7.59999999999999978e253Initial program 86.7%
associate-+l-86.7%
+-commutative86.7%
*-commutative86.7%
+-commutative86.7%
associate-+l-86.7%
fma-define86.7%
*-commutative86.7%
associate-/l*86.7%
associate-/l*86.7%
Simplified86.7%
Taylor expanded in x around inf 94.7%
if -7.59999999999999978e253 < (*.f64 a b) < -2.00000000000000004e95 or 2.00000000000000001e155 < (*.f64 a b) Initial program 96.6%
Taylor expanded in x around 0 93.5%
if -2.00000000000000004e95 < (*.f64 a b) < 2.00000000000000001e155Initial program 98.9%
associate--l+98.9%
fma-define99.5%
associate-/l*100.0%
fmm-def100.0%
distribute-neg-frac2100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in a around 0 92.6%
Final simplification93.1%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* a b) -5e+97)
(+ c (- (* x y) (* a (/ b 4.0))))
(if (<= (* a b) 2e+103)
(+ c (+ (* x y) (* 0.0625 (* z t))))
(+ c (* y (+ x (/ (* b (* a -0.25)) y)))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((a * b) <= -5e+97) {
tmp = c + ((x * y) - (a * (b / 4.0)));
} else if ((a * b) <= 2e+103) {
tmp = c + ((x * y) + (0.0625 * (z * t)));
} else {
tmp = c + (y * (x + ((b * (a * -0.25)) / 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 ((a * b) <= (-5d+97)) then
tmp = c + ((x * y) - (a * (b / 4.0d0)))
else if ((a * b) <= 2d+103) then
tmp = c + ((x * y) + (0.0625d0 * (z * t)))
else
tmp = c + (y * (x + ((b * (a * (-0.25d0))) / 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 ((a * b) <= -5e+97) {
tmp = c + ((x * y) - (a * (b / 4.0)));
} else if ((a * b) <= 2e+103) {
tmp = c + ((x * y) + (0.0625 * (z * t)));
} else {
tmp = c + (y * (x + ((b * (a * -0.25)) / y)));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (a * b) <= -5e+97: tmp = c + ((x * y) - (a * (b / 4.0))) elif (a * b) <= 2e+103: tmp = c + ((x * y) + (0.0625 * (z * t))) else: tmp = c + (y * (x + ((b * (a * -0.25)) / y))) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(a * b) <= -5e+97) tmp = Float64(c + Float64(Float64(x * y) - Float64(a * Float64(b / 4.0)))); elseif (Float64(a * b) <= 2e+103) tmp = Float64(c + Float64(Float64(x * y) + Float64(0.0625 * Float64(z * t)))); else tmp = Float64(c + Float64(y * Float64(x + Float64(Float64(b * Float64(a * -0.25)) / y)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if ((a * b) <= -5e+97) tmp = c + ((x * y) - (a * (b / 4.0))); elseif ((a * b) <= 2e+103) tmp = c + ((x * y) + (0.0625 * (z * t))); else tmp = c + (y * (x + ((b * (a * -0.25)) / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(a * b), $MachinePrecision], -5e+97], N[(c + N[(N[(x * y), $MachinePrecision] - N[(a * N[(b / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2e+103], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(y * N[(x + N[(N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+97}:\\
\;\;\;\;c + \left(x \cdot y - a \cdot \frac{b}{4}\right)\\
\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{+103}:\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;c + y \cdot \left(x + \frac{b \cdot \left(a \cdot -0.25\right)}{y}\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -4.99999999999999999e97Initial program 92.1%
associate-+l-92.1%
+-commutative92.1%
*-commutative92.1%
+-commutative92.1%
associate-+l-92.1%
fma-define92.1%
*-commutative92.1%
associate-/l*92.1%
associate-/l*92.1%
Simplified92.1%
Taylor expanded in x around inf 86.1%
if -4.99999999999999999e97 < (*.f64 a b) < 2e103Initial program 98.8%
associate--l+98.8%
fma-define99.5%
associate-/l*100.0%
fmm-def100.0%
distribute-neg-frac2100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in a around 0 93.1%
if 2e103 < (*.f64 a b) Initial program 95.7%
associate-+l-95.7%
+-commutative95.7%
*-commutative95.7%
+-commutative95.7%
associate-+l-95.7%
fma-define95.7%
*-commutative95.7%
associate-/l*95.7%
associate-/l*95.7%
Simplified95.7%
Taylor expanded in x around inf 75.4%
Taylor expanded in y around inf 81.6%
associate-*r/81.6%
associate-*r*81.6%
*-commutative81.6%
*-commutative81.6%
Simplified81.6%
Final simplification89.6%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= z -1.9e+122) (not (<= z 4.8e-58))) (+ 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.9e+122) || !(z <= 4.8e-58)) {
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.9d+122)) .or. (.not. (z <= 4.8d-58))) 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.9e+122) || !(z <= 4.8e-58)) {
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.9e+122) or not (z <= 4.8e-58): 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.9e+122) || !(z <= 4.8e-58)) 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.9e+122) || ~((z <= 4.8e-58))) 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.9e+122], N[Not[LessEqual[z, 4.8e-58]], $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.9 \cdot 10^{+122} \lor \neg \left(z \leq 4.8 \cdot 10^{-58}\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.8999999999999999e122 or 4.8000000000000001e-58 < z Initial program 94.3%
associate--l+94.3%
fma-define95.2%
associate-/l*95.9%
fmm-def98.3%
distribute-neg-frac298.3%
metadata-eval98.3%
Simplified98.3%
Taylor expanded in a around 0 83.6%
if -1.8999999999999999e122 < z < 4.8000000000000001e-58Initial program 99.2%
associate-+l-99.2%
+-commutative99.2%
*-commutative99.2%
+-commutative99.2%
associate-+l-99.2%
fma-define99.2%
*-commutative99.2%
associate-/l*99.2%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in x around inf 90.5%
Final simplification87.2%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= b -7.8e-19) (not (<= b 4.8e+250))) (+ 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 <= -7.8e-19) || !(b <= 4.8e+250)) {
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 <= (-7.8d-19)) .or. (.not. (b <= 4.8d+250))) 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 <= -7.8e-19) || !(b <= 4.8e+250)) {
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 <= -7.8e-19) or not (b <= 4.8e+250): 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 <= -7.8e-19) || !(b <= 4.8e+250)) 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 <= -7.8e-19) || ~((b <= 4.8e+250))) 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, -7.8e-19], N[Not[LessEqual[b, 4.8e+250]], $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 -7.8 \cdot 10^{-19} \lor \neg \left(b \leq 4.8 \cdot 10^{+250}\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 < -7.7999999999999999e-19 or 4.80000000000000026e250 < b Initial program 95.8%
associate--l+95.8%
fma-define96.8%
associate-/l*96.8%
fmm-def100.0%
distribute-neg-frac2100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in a around inf 65.5%
*-commutative65.5%
associate-*r*65.5%
Simplified65.5%
if -7.7999999999999999e-19 < b < 4.80000000000000026e250Initial program 97.6%
associate--l+97.6%
fma-define98.2%
associate-/l*98.7%
fmm-def98.7%
distribute-neg-frac298.7%
metadata-eval98.7%
Simplified98.7%
Taylor expanded in a around 0 85.9%
Final simplification78.3%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= z -2.4e+121) (not (<= z 1.5e-60))) (+ c (* z (* t 0.0625))) (+ c (* a (* b -0.25)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z <= -2.4e+121) || !(z <= 1.5e-60)) {
tmp = c + (z * (t * 0.0625));
} 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 ((z <= (-2.4d+121)) .or. (.not. (z <= 1.5d-60))) then
tmp = c + (z * (t * 0.0625d0))
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 ((z <= -2.4e+121) || !(z <= 1.5e-60)) {
tmp = c + (z * (t * 0.0625));
} else {
tmp = c + (a * (b * -0.25));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (z <= -2.4e+121) or not (z <= 1.5e-60): tmp = c + (z * (t * 0.0625)) else: tmp = c + (a * (b * -0.25)) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((z <= -2.4e+121) || !(z <= 1.5e-60)) tmp = Float64(c + Float64(z * Float64(t * 0.0625))); 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 ((z <= -2.4e+121) || ~((z <= 1.5e-60))) tmp = c + (z * (t * 0.0625)); else tmp = c + (a * (b * -0.25)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[z, -2.4e+121], N[Not[LessEqual[z, 1.5e-60]], $MachinePrecision]], N[(c + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+121} \lor \neg \left(z \leq 1.5 \cdot 10^{-60}\right):\\
\;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\
\mathbf{else}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\end{array}
\end{array}
if z < -2.4e121 or 1.50000000000000009e-60 < z Initial program 94.4%
Taylor expanded in x around inf 87.4%
Taylor expanded in t around inf 64.1%
associate-*r/64.1%
*-commutative64.1%
*-commutative64.1%
associate-*r*64.8%
*-commutative64.8%
Simplified64.8%
Taylor expanded in x around 0 69.5%
associate-*r*70.2%
Simplified70.2%
if -2.4e121 < z < 1.50000000000000009e-60Initial program 99.2%
associate--l+99.2%
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 60.4%
*-commutative60.4%
associate-*r*60.4%
Simplified60.4%
Final simplification65.1%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= a -2.4e+97) (not (<= a 48000000.0))) (+ c (* a (* b -0.25))) (+ c (* x y))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((a <= -2.4e+97) || !(a <= 48000000.0)) {
tmp = c + (a * (b * -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 ((a <= (-2.4d+97)) .or. (.not. (a <= 48000000.0d0))) then
tmp = c + (a * (b * (-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 ((a <= -2.4e+97) || !(a <= 48000000.0)) {
tmp = c + (a * (b * -0.25));
} else {
tmp = c + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (a <= -2.4e+97) or not (a <= 48000000.0): tmp = c + (a * (b * -0.25)) else: tmp = c + (x * y) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((a <= -2.4e+97) || !(a <= 48000000.0)) tmp = Float64(c + Float64(a * Float64(b * -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 ((a <= -2.4e+97) || ~((a <= 48000000.0))) tmp = c + (a * (b * -0.25)); else tmp = c + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[a, -2.4e+97], N[Not[LessEqual[a, 48000000.0]], $MachinePrecision]], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{+97} \lor \neg \left(a \leq 48000000\right):\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c + x \cdot y\\
\end{array}
\end{array}
if a < -2.4e97 or 4.8e7 < a Initial program 93.4%
associate--l+93.4%
fma-define95.1%
associate-/l*95.8%
fmm-def98.3%
distribute-neg-frac298.3%
metadata-eval98.3%
Simplified98.3%
Taylor expanded in a around inf 57.6%
*-commutative57.6%
associate-*r*57.6%
Simplified57.6%
if -2.4e97 < a < 4.8e7Initial program 100.0%
Taylor expanded in x around inf 94.5%
Taylor expanded in y around inf 54.7%
Final simplification56.1%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -3.8e+194) (not (<= (* x y) 3650.0))) (* x y) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((x * y) <= -3.8e+194) || !((x * y) <= 3650.0)) {
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) <= (-3.8d+194)) .or. (.not. ((x * y) <= 3650.0d0))) 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) <= -3.8e+194) || !((x * y) <= 3650.0)) {
tmp = x * y;
} else {
tmp = c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((x * y) <= -3.8e+194) or not ((x * y) <= 3650.0): tmp = x * y else: tmp = c return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(x * y) <= -3.8e+194) || !(Float64(x * y) <= 3650.0)) 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) <= -3.8e+194) || ~(((x * y) <= 3650.0))) 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], -3.8e+194], N[Not[LessEqual[N[(x * y), $MachinePrecision], 3650.0]], $MachinePrecision]], N[(x * y), $MachinePrecision], c]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -3.8 \cdot 10^{+194} \lor \neg \left(x \cdot y \leq 3650\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c\\
\end{array}
\end{array}
if (*.f64 x y) < -3.7999999999999999e194 or 3650 < (*.f64 x y) Initial program 95.0%
Taylor expanded in x around inf 93.2%
Taylor expanded in y around inf 61.4%
Taylor expanded in x around inf 55.4%
if -3.7999999999999999e194 < (*.f64 x y) < 3650Initial program 98.1%
associate--l+98.1%
fma-define98.1%
associate-/l*98.1%
fmm-def100.0%
distribute-neg-frac2100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in c around inf 28.1%
Final simplification38.3%
(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 96.9%
Taylor expanded in x around inf 91.8%
Taylor expanded in y around inf 44.4%
Final simplification44.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 96.9%
associate--l+96.9%
fma-define97.7%
associate-/l*98.0%
fmm-def99.2%
distribute-neg-frac299.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in c around inf 20.8%
herbie shell --seed 2024172
(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))