
(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 9 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 16.0) t (fma (/ a -4.0) b c))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(x, y, fma((z / 16.0), t, fma((a / -4.0), b, c)));
}
function code(x, y, z, t, a, b, c) return fma(x, y, fma(Float64(z / 16.0), t, fma(Float64(a / -4.0), b, c))) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(x * y + N[(N[(z / 16.0), $MachinePrecision] * t + N[(N[(a / -4.0), $MachinePrecision] * b + c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(\frac{z}{16}, t, \mathsf{fma}\left(\frac{a}{-4}, b, c\right)\right)\right)
\end{array}
Initial program 97.6%
associate-+l-97.6%
associate--l+97.6%
fma-def98.4%
associate-*l/98.4%
fma-neg98.8%
sub-neg98.8%
distribute-neg-in98.8%
remove-double-neg98.8%
associate-/l*98.8%
distribute-frac-neg98.8%
associate-/r/98.8%
fma-def98.8%
neg-mul-198.8%
*-commutative98.8%
associate-/l*98.8%
metadata-eval98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t a b c)
:precision binary64
(if (or (<= (* a b) -5e+135)
(and (not (<= (* a b) -5e+87))
(or (<= (* a b) -2e+36) (not (<= (* a b) 5e+257)))))
(+ 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 (((a * b) <= -5e+135) || (!((a * b) <= -5e+87) && (((a * b) <= -2e+36) || !((a * b) <= 5e+257)))) {
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 (((a * b) <= (-5d+135)) .or. (.not. ((a * b) <= (-5d+87))) .and. ((a * b) <= (-2d+36)) .or. (.not. ((a * b) <= 5d+257))) 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 (((a * b) <= -5e+135) || (!((a * b) <= -5e+87) && (((a * b) <= -2e+36) || !((a * b) <= 5e+257)))) {
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 ((a * b) <= -5e+135) or (not ((a * b) <= -5e+87) and (((a * b) <= -2e+36) or not ((a * b) <= 5e+257))): 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 ((Float64(a * b) <= -5e+135) || (!(Float64(a * b) <= -5e+87) && ((Float64(a * b) <= -2e+36) || !(Float64(a * b) <= 5e+257)))) 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 (((a * b) <= -5e+135) || (~(((a * b) <= -5e+87)) && (((a * b) <= -2e+36) || ~(((a * b) <= 5e+257))))) 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[N[(a * b), $MachinePrecision], -5e+135], And[N[Not[LessEqual[N[(a * b), $MachinePrecision], -5e+87]], $MachinePrecision], Or[LessEqual[N[(a * b), $MachinePrecision], -2e+36], N[Not[LessEqual[N[(a * b), $MachinePrecision], 5e+257]], $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}\;a \cdot b \leq -5 \cdot 10^{+135} \lor \neg \left(a \cdot b \leq -5 \cdot 10^{+87}\right) \land \left(a \cdot b \leq -2 \cdot 10^{+36} \lor \neg \left(a \cdot b \leq 5 \cdot 10^{+257}\right)\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 (*.f64 a b) < -5.00000000000000029e135 or -4.9999999999999998e87 < (*.f64 a b) < -2.00000000000000008e36 or 5.00000000000000028e257 < (*.f64 a b) Initial program 92.1%
Taylor expanded in a around inf 82.5%
*-commutative82.5%
associate-*r*82.5%
Simplified82.5%
if -5.00000000000000029e135 < (*.f64 a b) < -4.9999999999999998e87 or -2.00000000000000008e36 < (*.f64 a b) < 5.00000000000000028e257Initial program 100.0%
Taylor expanded in a around 0 91.0%
Final simplification88.5%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* a b) 0.25)) (t_2 (* (* z t) 0.0625)))
(if (<= (* x y) -1.15e+151)
(+ c (- (* x y) t_1))
(if (<= (* x y) 1.4e+16) (+ c (- t_2 t_1)) (+ c (+ (* x y) t_2))))))
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 = (z * t) * 0.0625;
double tmp;
if ((x * y) <= -1.15e+151) {
tmp = c + ((x * y) - t_1);
} else if ((x * y) <= 1.4e+16) {
tmp = c + (t_2 - t_1);
} else {
tmp = c + ((x * y) + 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 = (a * b) * 0.25d0
t_2 = (z * t) * 0.0625d0
if ((x * y) <= (-1.15d+151)) then
tmp = c + ((x * y) - t_1)
else if ((x * y) <= 1.4d+16) then
tmp = c + (t_2 - t_1)
else
tmp = c + ((x * y) + 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 = (a * b) * 0.25;
double t_2 = (z * t) * 0.0625;
double tmp;
if ((x * y) <= -1.15e+151) {
tmp = c + ((x * y) - t_1);
} else if ((x * y) <= 1.4e+16) {
tmp = c + (t_2 - t_1);
} else {
tmp = c + ((x * y) + t_2);
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = (a * b) * 0.25 t_2 = (z * t) * 0.0625 tmp = 0 if (x * y) <= -1.15e+151: tmp = c + ((x * y) - t_1) elif (x * y) <= 1.4e+16: tmp = c + (t_2 - t_1) else: tmp = c + ((x * y) + t_2) return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(a * b) * 0.25) t_2 = Float64(Float64(z * t) * 0.0625) tmp = 0.0 if (Float64(x * y) <= -1.15e+151) tmp = Float64(c + Float64(Float64(x * y) - t_1)); elseif (Float64(x * y) <= 1.4e+16) tmp = Float64(c + Float64(t_2 - t_1)); else tmp = Float64(c + Float64(Float64(x * y) + t_2)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = (a * b) * 0.25; t_2 = (z * t) * 0.0625; tmp = 0.0; if ((x * y) <= -1.15e+151) tmp = c + ((x * y) - t_1); elseif ((x * y) <= 1.4e+16) tmp = c + (t_2 - t_1); else tmp = c + ((x * y) + t_2); 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[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1.15e+151], N[(c + N[(N[(x * y), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.4e+16], N[(c + N[(t$95$2 - t$95$1), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot b\right) \cdot 0.25\\
t_2 := \left(z \cdot t\right) \cdot 0.0625\\
\mathbf{if}\;x \cdot y \leq -1.15 \cdot 10^{+151}:\\
\;\;\;\;c + \left(x \cdot y - t_1\right)\\
\mathbf{elif}\;x \cdot y \leq 1.4 \cdot 10^{+16}:\\
\;\;\;\;c + \left(t_2 - t_1\right)\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + t_2\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.15e151Initial program 94.3%
Taylor expanded in z around 0 94.3%
if -1.15e151 < (*.f64 x y) < 1.4e16Initial program 99.4%
Taylor expanded in x around 0 94.1%
if 1.4e16 < (*.f64 x y) Initial program 94.4%
Taylor expanded in a around 0 89.0%
Final simplification93.1%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* a b) -1e+17) (not (<= (* a b) 1e+143))) (+ 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) <= -1e+17) || !((a * b) <= 1e+143)) {
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) <= (-1d+17)) .or. (.not. ((a * b) <= 1d+143))) 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) <= -1e+17) || !((a * b) <= 1e+143)) {
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) <= -1e+17) or not ((a * b) <= 1e+143): 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) <= -1e+17) || !(Float64(a * b) <= 1e+143)) 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) <= -1e+17) || ~(((a * b) <= 1e+143))) 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], -1e+17], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1e+143]], $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 -1 \cdot 10^{+17} \lor \neg \left(a \cdot b \leq 10^{+143}\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) < -1e17 or 1e143 < (*.f64 a b) Initial program 93.9%
Taylor expanded in z around 0 85.8%
if -1e17 < (*.f64 a b) < 1e143Initial program 100.0%
Taylor expanded in a around 0 94.0%
Final simplification90.8%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -7.2e+33) (not (<= (* x y) 1.36e+16))) (+ 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+33) || !((x * y) <= 1.36e+16)) {
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+33)) .or. (.not. ((x * y) <= 1.36d+16))) 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+33) || !((x * y) <= 1.36e+16)) {
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+33) or not ((x * y) <= 1.36e+16): 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+33) || !(Float64(x * y) <= 1.36e+16)) 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+33) || ~(((x * y) <= 1.36e+16))) 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+33], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.36e+16]], $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^{+33} \lor \neg \left(x \cdot y \leq 1.36 \cdot 10^{+16}\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.2000000000000005e33 or 1.36e16 < (*.f64 x y) Initial program 95.4%
Taylor expanded in x around inf 70.9%
if -7.2000000000000005e33 < (*.f64 x y) < 1.36e16Initial program 99.3%
Taylor expanded in a around inf 61.9%
*-commutative61.9%
associate-*r*61.9%
Simplified61.9%
Final simplification65.7%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* a b) -1e+17) (not (<= (* a b) 1e+143))) (+ c (* a (* b -0.25))) (+ c (* t (* z 0.0625)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((a * b) <= -1e+17) || !((a * b) <= 1e+143)) {
tmp = c + (a * (b * -0.25));
} else {
tmp = c + (t * (z * 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) <= (-1d+17)) .or. (.not. ((a * b) <= 1d+143))) then
tmp = c + (a * (b * (-0.25d0)))
else
tmp = c + (t * (z * 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) <= -1e+17) || !((a * b) <= 1e+143)) {
tmp = c + (a * (b * -0.25));
} else {
tmp = c + (t * (z * 0.0625));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((a * b) <= -1e+17) or not ((a * b) <= 1e+143): tmp = c + (a * (b * -0.25)) else: tmp = c + (t * (z * 0.0625)) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(a * b) <= -1e+17) || !(Float64(a * b) <= 1e+143)) tmp = Float64(c + Float64(a * Float64(b * -0.25))); else tmp = Float64(c + Float64(t * Float64(z * 0.0625))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (((a * b) <= -1e+17) || ~(((a * b) <= 1e+143))) tmp = c + (a * (b * -0.25)); else tmp = c + (t * (z * 0.0625)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -1e+17], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1e+143]], $MachinePrecision]], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(t * N[(z * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+17} \lor \neg \left(a \cdot b \leq 10^{+143}\right):\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c + t \cdot \left(z \cdot 0.0625\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -1e17 or 1e143 < (*.f64 a b) Initial program 93.9%
Taylor expanded in a around inf 74.2%
*-commutative74.2%
associate-*r*74.2%
Simplified74.2%
if -1e17 < (*.f64 a b) < 1e143Initial program 100.0%
Taylor expanded in z around inf 66.0%
*-commutative66.0%
associate-*r*66.0%
*-commutative66.0%
Simplified66.0%
Final simplification69.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 97.6%
Final simplification97.6%
(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 97.6%
Taylor expanded in x around inf 46.6%
Final simplification46.6%
(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.6%
associate-+l-97.6%
associate--l+97.6%
fma-def98.4%
associate-*l/98.4%
fma-neg98.8%
sub-neg98.8%
distribute-neg-in98.8%
remove-double-neg98.8%
associate-/l*98.8%
distribute-frac-neg98.8%
associate-/r/98.8%
fma-def98.8%
neg-mul-198.8%
*-commutative98.8%
associate-/l*98.8%
metadata-eval98.8%
Simplified98.8%
Taylor expanded in c around inf 21.2%
Final simplification21.2%
herbie shell --seed 2024021
(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))