
(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 (let* ((t_1 (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)))) (if (<= t_1 INFINITY) (+ c t_1) (* y (+ x (/ c y))))))
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 = y * (x + (c / y));
}
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 = y * (x + (c / y));
}
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 = y * (x + (c / y)) 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(y * Float64(x + Float64(c / y))); 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 = y * (x + (c / y)); 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[(y * N[(x + N[(c / y), $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}:\\
\;\;\;\;y \cdot \left(x + \frac{c}{y}\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 100.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 0 33.3%
Taylor expanded in y around inf 33.3%
Taylor expanded in a around 0 67.0%
+-commutative67.0%
Simplified67.0%
Final simplification99.2%
(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.6%
associate--l+97.6%
fma-define98.0%
associate-/l*98.0%
fmm-def98.4%
distribute-neg-frac298.4%
metadata-eval98.4%
Simplified98.4%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (+ c (* x y))))
(if (<= (* x y) -4e+46)
t_1
(if (<= (* x y) -5e-69)
(+ c (* t (* z 0.0625)))
(if (<= (* x y) 2e+159) (+ 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) <= -4e+46) {
tmp = t_1;
} else if ((x * y) <= -5e-69) {
tmp = c + (t * (z * 0.0625));
} else if ((x * y) <= 2e+159) {
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) <= (-4d+46)) then
tmp = t_1
else if ((x * y) <= (-5d-69)) then
tmp = c + (t * (z * 0.0625d0))
else if ((x * y) <= 2d+159) 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) <= -4e+46) {
tmp = t_1;
} else if ((x * y) <= -5e-69) {
tmp = c + (t * (z * 0.0625));
} else if ((x * y) <= 2e+159) {
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) <= -4e+46: tmp = t_1 elif (x * y) <= -5e-69: tmp = c + (t * (z * 0.0625)) elif (x * y) <= 2e+159: 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) <= -4e+46) tmp = t_1; elseif (Float64(x * y) <= -5e-69) tmp = Float64(c + Float64(t * Float64(z * 0.0625))); elseif (Float64(x * y) <= 2e+159) 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) <= -4e+46) tmp = t_1; elseif ((x * y) <= -5e-69) tmp = c + (t * (z * 0.0625)); elseif ((x * y) <= 2e+159) 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], -4e+46], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -5e-69], N[(c + N[(t * N[(z * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+159], 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 -4 \cdot 10^{+46}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-69}:\\
\;\;\;\;c + t \cdot \left(z \cdot 0.0625\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+159}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -4e46 or 1.9999999999999999e159 < (*.f64 x y) Initial program 96.1%
Taylor expanded in z around 0 90.2%
Taylor expanded in a around 0 85.1%
if -4e46 < (*.f64 x y) < -5.00000000000000033e-69Initial program 95.5%
Taylor expanded in a around 0 82.5%
Taylor expanded in t around inf 69.4%
*-commutative69.4%
associate-*r*69.4%
*-commutative69.4%
Simplified69.4%
if -5.00000000000000033e-69 < (*.f64 x y) < 1.9999999999999999e159Initial program 99.2%
associate--l+99.2%
fma-define99.2%
associate-/l*99.2%
fmm-def100.0%
distribute-neg-frac2100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in a around inf 73.0%
*-commutative73.0%
associate-*r*73.0%
Simplified73.0%
Final simplification77.6%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* 0.0625 (* z t))))
(if (or (<= (* x y) -5e+131) (not (<= (* x y) 2e+148)))
(+ c (+ (* x y) t_1))
(- (+ c t_1) (* (* a b) 0.25)))))
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 (((x * y) <= -5e+131) || !((x * y) <= 2e+148)) {
tmp = c + ((x * y) + t_1);
} else {
tmp = (c + t_1) - ((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) :: t_1
real(8) :: tmp
t_1 = 0.0625d0 * (z * t)
if (((x * y) <= (-5d+131)) .or. (.not. ((x * y) <= 2d+148))) then
tmp = c + ((x * y) + t_1)
else
tmp = (c + t_1) - ((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 t_1 = 0.0625 * (z * t);
double tmp;
if (((x * y) <= -5e+131) || !((x * y) <= 2e+148)) {
tmp = c + ((x * y) + t_1);
} else {
tmp = (c + t_1) - ((a * b) * 0.25);
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = 0.0625 * (z * t) tmp = 0 if ((x * y) <= -5e+131) or not ((x * y) <= 2e+148): tmp = c + ((x * y) + t_1) else: tmp = (c + t_1) - ((a * b) * 0.25) return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(0.0625 * Float64(z * t)) tmp = 0.0 if ((Float64(x * y) <= -5e+131) || !(Float64(x * y) <= 2e+148)) tmp = Float64(c + Float64(Float64(x * y) + t_1)); else tmp = Float64(Float64(c + t_1) - Float64(Float64(a * b) * 0.25)); 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 (((x * y) <= -5e+131) || ~(((x * y) <= 2e+148))) tmp = c + ((x * y) + t_1); else tmp = (c + t_1) - ((a * b) * 0.25); 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[(x * y), $MachinePrecision], -5e+131], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e+148]], $MachinePrecision]], N[(c + N[(N[(x * y), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(c + t$95$1), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.0625 \cdot \left(z \cdot t\right)\\
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+131} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+148}\right):\\
\;\;\;\;c + \left(x \cdot y + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(c + t\_1\right) - \left(a \cdot b\right) \cdot 0.25\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999995e131 or 2.0000000000000001e148 < (*.f64 x y) Initial program 95.7%
Taylor expanded in a around 0 93.3%
if -4.99999999999999995e131 < (*.f64 x y) < 2.0000000000000001e148Initial program 98.8%
Taylor expanded in x around 0 91.8%
Final simplification92.3%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* a b) -5e+42) (not (<= (* a b) 5e+97))) (- (+ c (* x y)) (* (* a b) 0.25)) (+ c (+ (* x y) (* 0.0625 (* z t))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((a * b) <= -5e+42) || !((a * b) <= 5e+97)) {
tmp = (c + (x * y)) - ((a * b) * 0.25);
} else {
tmp = c + ((x * y) + (0.0625 * (z * t)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (((a * b) <= (-5d+42)) .or. (.not. ((a * b) <= 5d+97))) then
tmp = (c + (x * y)) - ((a * b) * 0.25d0)
else
tmp = c + ((x * y) + (0.0625d0 * (z * t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((a * b) <= -5e+42) || !((a * b) <= 5e+97)) {
tmp = (c + (x * y)) - ((a * b) * 0.25);
} else {
tmp = c + ((x * y) + (0.0625 * (z * t)));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((a * b) <= -5e+42) or not ((a * b) <= 5e+97): tmp = (c + (x * y)) - ((a * b) * 0.25) else: tmp = c + ((x * y) + (0.0625 * (z * t))) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(a * b) <= -5e+42) || !(Float64(a * b) <= 5e+97)) tmp = Float64(Float64(c + Float64(x * y)) - Float64(Float64(a * b) * 0.25)); else tmp = Float64(c + Float64(Float64(x * y) + Float64(0.0625 * Float64(z * t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (((a * b) <= -5e+42) || ~(((a * b) <= 5e+97))) tmp = (c + (x * y)) - ((a * b) * 0.25); else tmp = c + ((x * y) + (0.0625 * (z * t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -5e+42], N[Not[LessEqual[N[(a * b), $MachinePrecision], 5e+97]], $MachinePrecision]], N[(N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+42} \lor \neg \left(a \cdot b \leq 5 \cdot 10^{+97}\right):\\
\;\;\;\;\left(c + x \cdot y\right) - \left(a \cdot b\right) \cdot 0.25\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -5.00000000000000007e42 or 4.99999999999999999e97 < (*.f64 a b) Initial program 95.0%
Taylor expanded in z around 0 87.3%
if -5.00000000000000007e42 < (*.f64 a b) < 4.99999999999999999e97Initial program 99.3%
Taylor expanded in a around 0 94.7%
Final simplification91.8%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* a b) -5e+232)
(+ c (* a (* b -0.25)))
(if (<= (* a b) 1e+206)
(+ c (+ (* x y) (* 0.0625 (* z t))))
(* b (+ (* a -0.25) (/ c b))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((a * b) <= -5e+232) {
tmp = c + (a * (b * -0.25));
} else if ((a * b) <= 1e+206) {
tmp = c + ((x * y) + (0.0625 * (z * t)));
} else {
tmp = b * ((a * -0.25) + (c / b));
}
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+232)) then
tmp = c + (a * (b * (-0.25d0)))
else if ((a * b) <= 1d+206) then
tmp = c + ((x * y) + (0.0625d0 * (z * t)))
else
tmp = b * ((a * (-0.25d0)) + (c / b))
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+232) {
tmp = c + (a * (b * -0.25));
} else if ((a * b) <= 1e+206) {
tmp = c + ((x * y) + (0.0625 * (z * t)));
} else {
tmp = b * ((a * -0.25) + (c / b));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (a * b) <= -5e+232: tmp = c + (a * (b * -0.25)) elif (a * b) <= 1e+206: tmp = c + ((x * y) + (0.0625 * (z * t))) else: tmp = b * ((a * -0.25) + (c / b)) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(a * b) <= -5e+232) tmp = Float64(c + Float64(a * Float64(b * -0.25))); elseif (Float64(a * b) <= 1e+206) tmp = Float64(c + Float64(Float64(x * y) + Float64(0.0625 * Float64(z * t)))); else tmp = Float64(b * Float64(Float64(a * -0.25) + Float64(c / b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if ((a * b) <= -5e+232) tmp = c + (a * (b * -0.25)); elseif ((a * b) <= 1e+206) tmp = c + ((x * y) + (0.0625 * (z * t))); else tmp = b * ((a * -0.25) + (c / b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(a * b), $MachinePrecision], -5e+232], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+206], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * N[(N[(a * -0.25), $MachinePrecision] + N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+232}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{elif}\;a \cdot b \leq 10^{+206}:\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot -0.25 + \frac{c}{b}\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -4.99999999999999987e232Initial program 86.4%
associate--l+86.4%
fma-define86.4%
associate-/l*86.4%
fmm-def86.4%
distribute-neg-frac286.4%
metadata-eval86.4%
Simplified86.4%
Taylor expanded in a around inf 77.7%
*-commutative77.7%
associate-*r*77.7%
Simplified77.7%
if -4.99999999999999987e232 < (*.f64 a b) < 1e206Initial program 99.5%
Taylor expanded in a around 0 87.0%
if 1e206 < (*.f64 a b) Initial program 91.7%
associate--l+91.7%
fma-define95.8%
associate-/l*95.8%
fmm-def100.0%
distribute-neg-frac2100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in a around inf 79.6%
*-commutative79.6%
associate-*r*79.6%
Simplified79.6%
Taylor expanded in b around inf 83.3%
Final simplification85.8%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -4e+46) (not (<= (* x y) 4e+56))) (+ c (* x y)) (+ c (* t (* z 0.0625)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((x * y) <= -4e+46) || !((x * y) <= 4e+56)) {
tmp = c + (x * y);
} 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 (((x * y) <= (-4d+46)) .or. (.not. ((x * y) <= 4d+56))) then
tmp = c + (x * y)
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 (((x * y) <= -4e+46) || !((x * y) <= 4e+56)) {
tmp = c + (x * y);
} else {
tmp = c + (t * (z * 0.0625));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((x * y) <= -4e+46) or not ((x * y) <= 4e+56): tmp = c + (x * y) else: tmp = c + (t * (z * 0.0625)) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(x * y) <= -4e+46) || !(Float64(x * y) <= 4e+56)) tmp = Float64(c + Float64(x * y)); 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 (((x * y) <= -4e+46) || ~(((x * y) <= 4e+56))) tmp = c + (x * y); else tmp = c + (t * (z * 0.0625)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -4e+46], N[Not[LessEqual[N[(x * y), $MachinePrecision], 4e+56]], $MachinePrecision]], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(c + N[(t * N[(z * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+46} \lor \neg \left(x \cdot y \leq 4 \cdot 10^{+56}\right):\\
\;\;\;\;c + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c + t \cdot \left(z \cdot 0.0625\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -4e46 or 4.00000000000000037e56 < (*.f64 x y) Initial program 96.4%
Taylor expanded in z around 0 90.1%
Taylor expanded in a around 0 81.1%
if -4e46 < (*.f64 x y) < 4.00000000000000037e56Initial program 98.6%
Taylor expanded in a around 0 67.5%
Taylor expanded in t around inf 62.3%
*-commutative62.3%
associate-*r*62.3%
*-commutative62.3%
Simplified62.3%
Final simplification70.5%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -1e+190) (not (<= (* x y) 2e+94))) (* x y) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((x * y) <= -1e+190) || !((x * y) <= 2e+94)) {
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) <= (-1d+190)) .or. (.not. ((x * y) <= 2d+94))) 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) <= -1e+190) || !((x * y) <= 2e+94)) {
tmp = x * y;
} else {
tmp = c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((x * y) <= -1e+190) or not ((x * y) <= 2e+94): tmp = x * y else: tmp = c return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(x * y) <= -1e+190) || !(Float64(x * y) <= 2e+94)) 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) <= -1e+190) || ~(((x * y) <= 2e+94))) 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], -1e+190], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e+94]], $MachinePrecision]], N[(x * y), $MachinePrecision], c]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+190} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+94}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c\\
\end{array}
\end{array}
if (*.f64 x y) < -1.0000000000000001e190 or 2e94 < (*.f64 x y) Initial program 95.5%
Taylor expanded in z around 0 91.3%
Taylor expanded in a around 0 86.7%
Taylor expanded in c around 0 80.6%
if -1.0000000000000001e190 < (*.f64 x y) < 2e94Initial program 98.8%
Taylor expanded in c around inf 37.3%
Final simplification52.5%
(FPCore (x y z t a b c) :precision binary64 (if (<= b -1.75e+19) (* b (* a -0.25)) (+ c (* x y))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (b <= -1.75e+19) {
tmp = b * (a * -0.25);
} else {
tmp = c + (x * y);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1.75d+19)) then
tmp = b * (a * (-0.25d0))
else
tmp = c + (x * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (b <= -1.75e+19) {
tmp = b * (a * -0.25);
} else {
tmp = c + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if b <= -1.75e+19: tmp = b * (a * -0.25) else: tmp = c + (x * y) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (b <= -1.75e+19) tmp = Float64(b * Float64(a * -0.25)); else tmp = Float64(c + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (b <= -1.75e+19) tmp = b * (a * -0.25); else tmp = c + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[b, -1.75e+19], N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.75 \cdot 10^{+19}:\\
\;\;\;\;b \cdot \left(a \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c + x \cdot y\\
\end{array}
\end{array}
if b < -1.75e19Initial program 95.6%
associate--l+95.6%
fma-define95.6%
associate-/l*95.6%
fmm-def97.0%
distribute-neg-frac297.0%
metadata-eval97.0%
Simplified97.0%
Taylor expanded in a around inf 64.7%
*-commutative64.7%
associate-*r*64.7%
Simplified64.7%
Taylor expanded in a around inf 56.6%
Taylor expanded in a around inf 45.9%
associate-*r*45.9%
Simplified45.9%
if -1.75e19 < b Initial program 98.4%
Taylor expanded in z around 0 80.8%
Taylor expanded in a around 0 66.5%
Final simplification61.0%
(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%
Taylor expanded in c around inf 27.1%
herbie shell --seed 2024165
(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))