
(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 t (/ z 16.0) (fma x y (- c (* b (/ a 4.0))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(t, (z / 16.0), fma(x, y, (c - (b * (a / 4.0)))));
}
function code(x, y, z, t, a, b, c) return fma(t, Float64(z / 16.0), fma(x, y, Float64(c - Float64(b * Float64(a / 4.0))))) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(t * N[(z / 16.0), $MachinePrecision] + N[(x * y + N[(c - N[(b * N[(a / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(t, \frac{z}{16}, \mathsf{fma}\left(x, y, c - b \cdot \frac{a}{4}\right)\right)
\end{array}
Initial program 96.9%
associate-+l-96.9%
+-commutative96.9%
associate--l+96.9%
associate-*l/97.2%
*-commutative97.2%
fma-def99.2%
fma-neg99.2%
neg-sub099.2%
associate-+l-99.2%
neg-sub099.2%
+-commutative99.2%
unsub-neg99.2%
*-commutative99.2%
associate-*r/99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t a b c) :precision binary64 (if (<= (- (+ (/ (* t z) 16.0) (* x y)) (/ (* b a) 4.0)) INFINITY) (+ (+ (* z (* t 0.0625)) (* x y)) (- c (/ a (/ 4.0 b)))) (+ c (fma y x (* b (* a -0.25))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((((t * z) / 16.0) + (x * y)) - ((b * a) / 4.0)) <= ((double) INFINITY)) {
tmp = ((z * (t * 0.0625)) + (x * y)) + (c - (a / (4.0 / b)));
} else {
tmp = c + fma(y, x, (b * (a * -0.25)));
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(Float64(Float64(Float64(t * z) / 16.0) + Float64(x * y)) - Float64(Float64(b * a) / 4.0)) <= Inf) tmp = Float64(Float64(Float64(z * Float64(t * 0.0625)) + Float64(x * y)) + Float64(c - Float64(a / Float64(4.0 / b)))); else tmp = Float64(c + fma(y, x, Float64(b * Float64(a * -0.25)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(N[(N[(N[(t * z), $MachinePrecision] / 16.0), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(N[(b * a), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(c - N[(a / N[(4.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(y * x + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\frac{t \cdot z}{16} + x \cdot y\right) - \frac{b \cdot a}{4} \leq \infty:\\
\;\;\;\;\left(z \cdot \left(t \cdot 0.0625\right) + x \cdot y\right) + \left(c - \frac{a}{\frac{4}{b}}\right)\\
\mathbf{else}:\\
\;\;\;\;c + \mathsf{fma}\left(y, x, b \cdot \left(a \cdot -0.25\right)\right)\\
\end{array}
\end{array}
if (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) 16)) (/.f64 (*.f64 a b) 4)) < +inf.0Initial program 99.7%
associate-+l-99.7%
sub-neg99.7%
neg-mul-199.7%
metadata-eval99.7%
metadata-eval99.7%
cancel-sign-sub-inv99.7%
fma-def99.7%
associate-/l*99.9%
metadata-eval99.9%
*-lft-identity99.9%
associate-/l*99.8%
Simplified99.8%
fma-udef99.8%
associate-/l*99.6%
+-commutative99.6%
associate-/l*99.8%
div-inv99.9%
clear-num99.9%
div-inv99.9%
metadata-eval99.9%
Applied egg-rr99.9%
if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) 16)) (/.f64 (*.f64 a b) 4)) Initial program 0.0%
Taylor expanded in z around 0 71.4%
fma-neg71.4%
distribute-lft-neg-in71.4%
metadata-eval71.4%
*-commutative71.4%
*-commutative71.4%
associate-*r*71.4%
Simplified71.4%
Final simplification99.1%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* 0.0625 (* t z))))
(if (or (<= (* b a) -2e+158) (not (<= (* b a) 1e+93)))
(- (+ c t_1) (* (* b a) 0.25))
(+ c (+ t_1 (* x y))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = 0.0625 * (t * z);
double tmp;
if (((b * a) <= -2e+158) || !((b * a) <= 1e+93)) {
tmp = (c + t_1) - ((b * a) * 0.25);
} else {
tmp = c + (t_1 + (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) :: t_1
real(8) :: tmp
t_1 = 0.0625d0 * (t * z)
if (((b * a) <= (-2d+158)) .or. (.not. ((b * a) <= 1d+93))) then
tmp = (c + t_1) - ((b * a) * 0.25d0)
else
tmp = c + (t_1 + (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 t_1 = 0.0625 * (t * z);
double tmp;
if (((b * a) <= -2e+158) || !((b * a) <= 1e+93)) {
tmp = (c + t_1) - ((b * a) * 0.25);
} else {
tmp = c + (t_1 + (x * y));
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = 0.0625 * (t * z) tmp = 0 if ((b * a) <= -2e+158) or not ((b * a) <= 1e+93): tmp = (c + t_1) - ((b * a) * 0.25) else: tmp = c + (t_1 + (x * y)) return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(0.0625 * Float64(t * z)) tmp = 0.0 if ((Float64(b * a) <= -2e+158) || !(Float64(b * a) <= 1e+93)) tmp = Float64(Float64(c + t_1) - Float64(Float64(b * a) * 0.25)); else tmp = Float64(c + Float64(t_1 + Float64(x * y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = 0.0625 * (t * z); tmp = 0.0; if (((b * a) <= -2e+158) || ~(((b * a) <= 1e+93))) tmp = (c + t_1) - ((b * a) * 0.25); else tmp = c + (t_1 + (x * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[(b * a), $MachinePrecision], -2e+158], N[Not[LessEqual[N[(b * a), $MachinePrecision], 1e+93]], $MachinePrecision]], N[(N[(c + t$95$1), $MachinePrecision] - N[(N[(b * a), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision], N[(c + N[(t$95$1 + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.0625 \cdot \left(t \cdot z\right)\\
\mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+158} \lor \neg \left(b \cdot a \leq 10^{+93}\right):\\
\;\;\;\;\left(c + t_1\right) - \left(b \cdot a\right) \cdot 0.25\\
\mathbf{else}:\\
\;\;\;\;c + \left(t_1 + x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -1.99999999999999991e158 or 1.00000000000000004e93 < (*.f64 a b) Initial program 94.6%
Taylor expanded in x around 0 86.2%
if -1.99999999999999991e158 < (*.f64 a b) < 1.00000000000000004e93Initial program 98.3%
Taylor expanded in a around 0 90.2%
Final simplification88.8%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* b a) -2e+158) (not (<= (* b a) 2e+141))) (+ c (* b (* a -0.25))) (+ c (+ (* 0.0625 (* t z)) (* x y)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((b * a) <= -2e+158) || !((b * a) <= 2e+141)) {
tmp = c + (b * (a * -0.25));
} else {
tmp = c + ((0.0625 * (t * z)) + (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 * a) <= (-2d+158)) .or. (.not. ((b * a) <= 2d+141))) then
tmp = c + (b * (a * (-0.25d0)))
else
tmp = c + ((0.0625d0 * (t * z)) + (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 * a) <= -2e+158) || !((b * a) <= 2e+141)) {
tmp = c + (b * (a * -0.25));
} else {
tmp = c + ((0.0625 * (t * z)) + (x * y));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((b * a) <= -2e+158) or not ((b * a) <= 2e+141): tmp = c + (b * (a * -0.25)) else: tmp = c + ((0.0625 * (t * z)) + (x * y)) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(b * a) <= -2e+158) || !(Float64(b * a) <= 2e+141)) tmp = Float64(c + Float64(b * Float64(a * -0.25))); else tmp = Float64(c + Float64(Float64(0.0625 * Float64(t * z)) + Float64(x * y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (((b * a) <= -2e+158) || ~(((b * a) <= 2e+141))) tmp = c + (b * (a * -0.25)); else tmp = c + ((0.0625 * (t * z)) + (x * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(b * a), $MachinePrecision], -2e+158], N[Not[LessEqual[N[(b * a), $MachinePrecision], 2e+141]], $MachinePrecision]], N[(c + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+158} \lor \neg \left(b \cdot a \leq 2 \cdot 10^{+141}\right):\\
\;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c + \left(0.0625 \cdot \left(t \cdot z\right) + x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -1.99999999999999991e158 or 2.00000000000000003e141 < (*.f64 a b) Initial program 94.0%
Taylor expanded in a around inf 83.8%
*-commutative83.8%
*-commutative83.8%
associate-*r*83.8%
Simplified83.8%
if -1.99999999999999991e158 < (*.f64 a b) < 2.00000000000000003e141Initial program 98.4%
Taylor expanded in a around 0 89.6%
Final simplification87.7%
(FPCore (x y z t a b c) :precision binary64 (+ c (- (+ (/ (* t z) 16.0) (* x y)) (/ (* b a) 4.0))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return c + ((((t * z) / 16.0) + (x * y)) - ((b * a) / 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 + ((((t * z) / 16.0d0) + (x * y)) - ((b * a) / 4.0d0))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return c + ((((t * z) / 16.0) + (x * y)) - ((b * a) / 4.0));
}
def code(x, y, z, t, a, b, c): return c + ((((t * z) / 16.0) + (x * y)) - ((b * a) / 4.0))
function code(x, y, z, t, a, b, c) return Float64(c + Float64(Float64(Float64(Float64(t * z) / 16.0) + Float64(x * y)) - Float64(Float64(b * a) / 4.0))) end
function tmp = code(x, y, z, t, a, b, c) tmp = c + ((((t * z) / 16.0) + (x * y)) - ((b * a) / 4.0)); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(c + N[(N[(N[(N[(t * z), $MachinePrecision] / 16.0), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(N[(b * a), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c + \left(\left(\frac{t \cdot z}{16} + x \cdot y\right) - \frac{b \cdot a}{4}\right)
\end{array}
Initial program 96.9%
Final simplification96.9%
(FPCore (x y z t a b c) :precision binary64 (+ (+ (* z (* t 0.0625)) (* x y)) (- c (/ a (/ 4.0 b)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return ((z * (t * 0.0625)) + (x * y)) + (c - (a / (4.0 / b)));
}
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 = ((z * (t * 0.0625d0)) + (x * y)) + (c - (a / (4.0d0 / b)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return ((z * (t * 0.0625)) + (x * y)) + (c - (a / (4.0 / b)));
}
def code(x, y, z, t, a, b, c): return ((z * (t * 0.0625)) + (x * y)) + (c - (a / (4.0 / b)))
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(z * Float64(t * 0.0625)) + Float64(x * y)) + Float64(c - Float64(a / Float64(4.0 / b)))) end
function tmp = code(x, y, z, t, a, b, c) tmp = ((z * (t * 0.0625)) + (x * y)) + (c - (a / (4.0 / b))); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(c - N[(a / N[(4.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(z \cdot \left(t \cdot 0.0625\right) + x \cdot y\right) + \left(c - \frac{a}{\frac{4}{b}}\right)
\end{array}
Initial program 96.9%
associate-+l-96.9%
sub-neg96.9%
neg-mul-196.9%
metadata-eval96.9%
metadata-eval96.9%
cancel-sign-sub-inv96.9%
fma-def97.3%
associate-/l*97.6%
metadata-eval97.6%
*-lft-identity97.6%
associate-/l*97.5%
Simplified97.5%
fma-udef97.1%
associate-/l*96.9%
+-commutative96.9%
associate-/l*97.1%
div-inv97.2%
clear-num97.2%
div-inv97.2%
metadata-eval97.2%
Applied egg-rr97.2%
Final simplification97.2%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* a (* b -0.25))))
(if (<= b -3.25e-118)
t_1
(if (<= b 1.12e-256)
c
(if (<= b 1.2e-109)
(* x y)
(if (<= b 0.5) c (if (<= b 8.5e+96) (* x y) t_1)))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = a * (b * -0.25);
double tmp;
if (b <= -3.25e-118) {
tmp = t_1;
} else if (b <= 1.12e-256) {
tmp = c;
} else if (b <= 1.2e-109) {
tmp = x * y;
} else if (b <= 0.5) {
tmp = c;
} else if (b <= 8.5e+96) {
tmp = x * y;
} 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 = a * (b * (-0.25d0))
if (b <= (-3.25d-118)) then
tmp = t_1
else if (b <= 1.12d-256) then
tmp = c
else if (b <= 1.2d-109) then
tmp = x * y
else if (b <= 0.5d0) then
tmp = c
else if (b <= 8.5d+96) then
tmp = x * y
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 = a * (b * -0.25);
double tmp;
if (b <= -3.25e-118) {
tmp = t_1;
} else if (b <= 1.12e-256) {
tmp = c;
} else if (b <= 1.2e-109) {
tmp = x * y;
} else if (b <= 0.5) {
tmp = c;
} else if (b <= 8.5e+96) {
tmp = x * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = a * (b * -0.25) tmp = 0 if b <= -3.25e-118: tmp = t_1 elif b <= 1.12e-256: tmp = c elif b <= 1.2e-109: tmp = x * y elif b <= 0.5: tmp = c elif b <= 8.5e+96: tmp = x * y else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(a * Float64(b * -0.25)) tmp = 0.0 if (b <= -3.25e-118) tmp = t_1; elseif (b <= 1.12e-256) tmp = c; elseif (b <= 1.2e-109) tmp = Float64(x * y); elseif (b <= 0.5) tmp = c; elseif (b <= 8.5e+96) tmp = Float64(x * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = a * (b * -0.25); tmp = 0.0; if (b <= -3.25e-118) tmp = t_1; elseif (b <= 1.12e-256) tmp = c; elseif (b <= 1.2e-109) tmp = x * y; elseif (b <= 0.5) tmp = c; elseif (b <= 8.5e+96) tmp = x * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -3.25e-118], t$95$1, If[LessEqual[b, 1.12e-256], c, If[LessEqual[b, 1.2e-109], N[(x * y), $MachinePrecision], If[LessEqual[b, 0.5], c, If[LessEqual[b, 8.5e+96], N[(x * y), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(b \cdot -0.25\right)\\
\mathbf{if}\;b \leq -3.25 \cdot 10^{-118}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq 1.12 \cdot 10^{-256}:\\
\;\;\;\;c\\
\mathbf{elif}\;b \leq 1.2 \cdot 10^{-109}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;b \leq 0.5:\\
\;\;\;\;c\\
\mathbf{elif}\;b \leq 8.5 \cdot 10^{+96}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if b < -3.24999999999999979e-118 or 8.50000000000000025e96 < b Initial program 95.7%
associate-+l-95.7%
sub-neg95.7%
neg-mul-195.7%
metadata-eval95.7%
metadata-eval95.7%
cancel-sign-sub-inv95.7%
fma-def96.4%
associate-/l*96.3%
metadata-eval96.3%
*-lft-identity96.3%
associate-/l*96.2%
Simplified96.2%
fma-udef95.5%
associate-/l*95.6%
+-commutative95.6%
associate-/l*95.5%
div-inv95.5%
clear-num95.6%
div-inv95.6%
metadata-eval95.6%
Applied egg-rr95.6%
Taylor expanded in a around inf 49.3%
*-commutative49.3%
associate-*l*49.3%
Simplified49.3%
if -3.24999999999999979e-118 < b < 1.12e-256 or 1.19999999999999994e-109 < b < 0.5Initial program 97.1%
Taylor expanded in c around inf 40.1%
if 1.12e-256 < b < 1.19999999999999994e-109 or 0.5 < b < 8.50000000000000025e96Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
neg-mul-1100.0%
metadata-eval100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
fma-def100.0%
associate-/l*99.8%
metadata-eval99.8%
*-lft-identity99.8%
associate-/l*99.8%
Simplified99.8%
fma-udef99.8%
associate-/l*100.0%
+-commutative100.0%
associate-/l*99.8%
div-inv100.0%
clear-num100.0%
div-inv100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 41.0%
Final simplification45.3%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (+ c (* b (* a -0.25)))))
(if (<= b -1.08e-35)
t_1
(if (<= b 1.3e-257)
(+ c (* 0.0625 (* t z)))
(if (<= b 5e+97) (+ c (* x y)) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = c + (b * (a * -0.25));
double tmp;
if (b <= -1.08e-35) {
tmp = t_1;
} else if (b <= 1.3e-257) {
tmp = c + (0.0625 * (t * z));
} else if (b <= 5e+97) {
tmp = c + (x * y);
} 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 + (b * (a * (-0.25d0)))
if (b <= (-1.08d-35)) then
tmp = t_1
else if (b <= 1.3d-257) then
tmp = c + (0.0625d0 * (t * z))
else if (b <= 5d+97) then
tmp = c + (x * y)
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 + (b * (a * -0.25));
double tmp;
if (b <= -1.08e-35) {
tmp = t_1;
} else if (b <= 1.3e-257) {
tmp = c + (0.0625 * (t * z));
} else if (b <= 5e+97) {
tmp = c + (x * y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = c + (b * (a * -0.25)) tmp = 0 if b <= -1.08e-35: tmp = t_1 elif b <= 1.3e-257: tmp = c + (0.0625 * (t * z)) elif b <= 5e+97: tmp = c + (x * y) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(c + Float64(b * Float64(a * -0.25))) tmp = 0.0 if (b <= -1.08e-35) tmp = t_1; elseif (b <= 1.3e-257) tmp = Float64(c + Float64(0.0625 * Float64(t * z))); elseif (b <= 5e+97) tmp = Float64(c + Float64(x * y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = c + (b * (a * -0.25)); tmp = 0.0; if (b <= -1.08e-35) tmp = t_1; elseif (b <= 1.3e-257) tmp = c + (0.0625 * (t * z)); elseif (b <= 5e+97) tmp = c + (x * y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.08e-35], t$95$1, If[LessEqual[b, 1.3e-257], N[(c + N[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5e+97], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c + b \cdot \left(a \cdot -0.25\right)\\
\mathbf{if}\;b \leq -1.08 \cdot 10^{-35}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq 1.3 \cdot 10^{-257}:\\
\;\;\;\;c + 0.0625 \cdot \left(t \cdot z\right)\\
\mathbf{elif}\;b \leq 5 \cdot 10^{+97}:\\
\;\;\;\;c + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if b < -1.08000000000000003e-35 or 4.99999999999999999e97 < b Initial program 94.8%
Taylor expanded in a around inf 65.4%
*-commutative65.4%
*-commutative65.4%
associate-*r*65.4%
Simplified65.4%
if -1.08000000000000003e-35 < b < 1.3e-257Initial program 98.5%
Taylor expanded in z around inf 66.7%
if 1.3e-257 < b < 4.99999999999999999e97Initial program 98.8%
Taylor expanded in x around inf 63.8%
Final simplification65.3%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* a (* b -0.25))))
(if (<= b -4.5e+22)
t_1
(if (<= b 4.4e-257)
(+ c (* 0.0625 (* t z)))
(if (<= b 9.4e+122) (+ c (* x y)) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = a * (b * -0.25);
double tmp;
if (b <= -4.5e+22) {
tmp = t_1;
} else if (b <= 4.4e-257) {
tmp = c + (0.0625 * (t * z));
} else if (b <= 9.4e+122) {
tmp = c + (x * y);
} 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 = a * (b * (-0.25d0))
if (b <= (-4.5d+22)) then
tmp = t_1
else if (b <= 4.4d-257) then
tmp = c + (0.0625d0 * (t * z))
else if (b <= 9.4d+122) then
tmp = c + (x * y)
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 = a * (b * -0.25);
double tmp;
if (b <= -4.5e+22) {
tmp = t_1;
} else if (b <= 4.4e-257) {
tmp = c + (0.0625 * (t * z));
} else if (b <= 9.4e+122) {
tmp = c + (x * y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = a * (b * -0.25) tmp = 0 if b <= -4.5e+22: tmp = t_1 elif b <= 4.4e-257: tmp = c + (0.0625 * (t * z)) elif b <= 9.4e+122: tmp = c + (x * y) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(a * Float64(b * -0.25)) tmp = 0.0 if (b <= -4.5e+22) tmp = t_1; elseif (b <= 4.4e-257) tmp = Float64(c + Float64(0.0625 * Float64(t * z))); elseif (b <= 9.4e+122) tmp = Float64(c + Float64(x * y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = a * (b * -0.25); tmp = 0.0; if (b <= -4.5e+22) tmp = t_1; elseif (b <= 4.4e-257) tmp = c + (0.0625 * (t * z)); elseif (b <= 9.4e+122) tmp = c + (x * y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -4.5e+22], t$95$1, If[LessEqual[b, 4.4e-257], N[(c + N[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9.4e+122], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(b \cdot -0.25\right)\\
\mathbf{if}\;b \leq -4.5 \cdot 10^{+22}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq 4.4 \cdot 10^{-257}:\\
\;\;\;\;c + 0.0625 \cdot \left(t \cdot z\right)\\
\mathbf{elif}\;b \leq 9.4 \cdot 10^{+122}:\\
\;\;\;\;c + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if b < -4.4999999999999998e22 or 9.40000000000000047e122 < b Initial program 94.8%
associate-+l-94.8%
sub-neg94.8%
neg-mul-194.8%
metadata-eval94.8%
metadata-eval94.8%
cancel-sign-sub-inv94.8%
fma-def95.8%
associate-/l*95.8%
metadata-eval95.8%
*-lft-identity95.8%
associate-/l*95.6%
Simplified95.6%
fma-udef94.6%
associate-/l*94.6%
+-commutative94.6%
associate-/l*94.6%
div-inv94.6%
clear-num94.6%
div-inv94.6%
metadata-eval94.6%
Applied egg-rr94.6%
Taylor expanded in a around inf 63.3%
*-commutative63.3%
associate-*l*63.3%
Simplified63.3%
if -4.4999999999999998e22 < b < 4.39999999999999975e-257Initial program 98.7%
Taylor expanded in z around inf 62.9%
if 4.39999999999999975e-257 < b < 9.40000000000000047e122Initial program 97.7%
Taylor expanded in x around inf 63.1%
Final simplification63.1%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= b -2.5e+38) (not (<= b 1.28e+123))) (* 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 ((b <= -2.5e+38) || !(b <= 1.28e+123)) {
tmp = 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 ((b <= (-2.5d+38)) .or. (.not. (b <= 1.28d+123))) then
tmp = 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 ((b <= -2.5e+38) || !(b <= 1.28e+123)) {
tmp = a * (b * -0.25);
} else {
tmp = c + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (b <= -2.5e+38) or not (b <= 1.28e+123): tmp = a * (b * -0.25) else: tmp = c + (x * y) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((b <= -2.5e+38) || !(b <= 1.28e+123)) tmp = 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 ((b <= -2.5e+38) || ~((b <= 1.28e+123))) tmp = 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[b, -2.5e+38], N[Not[LessEqual[b, 1.28e+123]], $MachinePrecision]], N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.5 \cdot 10^{+38} \lor \neg \left(b \leq 1.28 \cdot 10^{+123}\right):\\
\;\;\;\;a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c + x \cdot y\\
\end{array}
\end{array}
if b < -2.49999999999999985e38 or 1.28000000000000005e123 < b Initial program 94.7%
associate-+l-94.7%
sub-neg94.7%
neg-mul-194.7%
metadata-eval94.7%
metadata-eval94.7%
cancel-sign-sub-inv94.7%
fma-def95.8%
associate-/l*95.7%
metadata-eval95.7%
*-lft-identity95.7%
associate-/l*95.6%
Simplified95.6%
fma-udef94.5%
associate-/l*94.6%
+-commutative94.6%
associate-/l*94.5%
div-inv94.6%
clear-num94.6%
div-inv94.6%
metadata-eval94.6%
Applied egg-rr94.6%
Taylor expanded in a around inf 63.9%
*-commutative63.9%
associate-*l*63.9%
Simplified63.9%
if -2.49999999999999985e38 < b < 1.28000000000000005e123Initial program 98.2%
Taylor expanded in x around inf 60.8%
Final simplification61.9%
(FPCore (x y z t a b c) :precision binary64 (if (<= c -2.05e+67) c (if (<= c 8.5e+27) (* x y) c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (c <= -2.05e+67) {
tmp = c;
} else if (c <= 8.5e+27) {
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 (c <= (-2.05d+67)) then
tmp = c
else if (c <= 8.5d+27) 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 (c <= -2.05e+67) {
tmp = c;
} else if (c <= 8.5e+27) {
tmp = x * y;
} else {
tmp = c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if c <= -2.05e+67: tmp = c elif c <= 8.5e+27: tmp = x * y else: tmp = c return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (c <= -2.05e+67) tmp = c; elseif (c <= 8.5e+27) 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 (c <= -2.05e+67) tmp = c; elseif (c <= 8.5e+27) tmp = x * y; else tmp = c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[c, -2.05e+67], c, If[LessEqual[c, 8.5e+27], N[(x * y), $MachinePrecision], c]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -2.05 \cdot 10^{+67}:\\
\;\;\;\;c\\
\mathbf{elif}\;c \leq 8.5 \cdot 10^{+27}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c\\
\end{array}
\end{array}
if c < -2.0499999999999999e67 or 8.5e27 < c Initial program 96.9%
Taylor expanded in c around inf 49.0%
if -2.0499999999999999e67 < c < 8.5e27Initial program 97.0%
associate-+l-97.0%
sub-neg97.0%
neg-mul-197.0%
metadata-eval97.0%
metadata-eval97.0%
cancel-sign-sub-inv97.0%
fma-def97.0%
associate-/l*97.4%
metadata-eval97.4%
*-lft-identity97.4%
associate-/l*97.3%
Simplified97.3%
fma-udef97.3%
associate-/l*96.9%
+-commutative96.9%
associate-/l*97.3%
div-inv97.4%
clear-num97.4%
div-inv97.4%
metadata-eval97.4%
Applied egg-rr97.4%
Taylor expanded in x around inf 33.8%
Final simplification39.5%
(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%
Taylor expanded in c around inf 22.5%
Final simplification22.5%
herbie shell --seed 2023200
(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))