
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
real(8) function code(x, y, z, t, a, b)
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
code = ((x + (y * z)) + (t * a)) + ((a * z) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
def code(x, y, z, t, a, b): return ((x + (y * z)) + (t * a)) + ((a * z) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x + (y * z)) + (t * a)) + ((a * z) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
real(8) function code(x, y, z, t, a, b)
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
code = ((x + (y * z)) + (t * a)) + ((a * z) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
def code(x, y, z, t, a, b): return ((x + (y * z)) + (t * a)) + ((a * z) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x + (y * z)) + (t * a)) + ((a * z) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\end{array}
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (+ (+ x (* y z)) (* t a)) (* (* z a) b)))) (if (<= t_1 INFINITY) t_1 (* a (+ t (* z b))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = a * (t + (z * b));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b);
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = a * (t + (z * b));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = a * (t + (z * b)) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(z * a) * b)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(a * Float64(t + Float64(z * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = a * (t + (z * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(z \cdot a\right) \cdot b\\
\mathbf{if}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < +inf.0Initial program 99.6%
if +inf.0 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 0.0%
associate-+l+0.0%
associate-*l*44.4%
Simplified44.4%
Taylor expanded in a around inf 66.7%
Final simplification98.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -1.85e-16)
(* y z)
(if (<= z -5e-150)
(* t a)
(if (<= z 7e-163) x (if (<= z 29000000000.0) (* t a) (* y z))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.85e-16) {
tmp = y * z;
} else if (z <= -5e-150) {
tmp = t * a;
} else if (z <= 7e-163) {
tmp = x;
} else if (z <= 29000000000.0) {
tmp = t * a;
} else {
tmp = y * z;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (z <= (-1.85d-16)) then
tmp = y * z
else if (z <= (-5d-150)) then
tmp = t * a
else if (z <= 7d-163) then
tmp = x
else if (z <= 29000000000.0d0) then
tmp = t * a
else
tmp = y * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.85e-16) {
tmp = y * z;
} else if (z <= -5e-150) {
tmp = t * a;
} else if (z <= 7e-163) {
tmp = x;
} else if (z <= 29000000000.0) {
tmp = t * a;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -1.85e-16: tmp = y * z elif z <= -5e-150: tmp = t * a elif z <= 7e-163: tmp = x elif z <= 29000000000.0: tmp = t * a else: tmp = y * z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.85e-16) tmp = Float64(y * z); elseif (z <= -5e-150) tmp = Float64(t * a); elseif (z <= 7e-163) tmp = x; elseif (z <= 29000000000.0) tmp = Float64(t * a); else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -1.85e-16) tmp = y * z; elseif (z <= -5e-150) tmp = t * a; elseif (z <= 7e-163) tmp = x; elseif (z <= 29000000000.0) tmp = t * a; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.85e-16], N[(y * z), $MachinePrecision], If[LessEqual[z, -5e-150], N[(t * a), $MachinePrecision], If[LessEqual[z, 7e-163], x, If[LessEqual[z, 29000000000.0], N[(t * a), $MachinePrecision], N[(y * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{-16}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -5 \cdot 10^{-150}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-163}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 29000000000:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1.85e-16 or 2.9e10 < z Initial program 93.4%
associate-+l+93.4%
associate-*l*91.1%
Simplified91.1%
Taylor expanded in y around inf 50.3%
*-commutative50.3%
Simplified50.3%
if -1.85e-16 < z < -4.9999999999999999e-150 or 7.00000000000000054e-163 < z < 2.9e10Initial program 98.7%
associate-+l+98.7%
associate-*l*98.7%
Simplified98.7%
Taylor expanded in t around inf 45.8%
if -4.9999999999999999e-150 < z < 7.00000000000000054e-163Initial program 98.3%
associate-+l+98.3%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in x around inf 58.2%
Final simplification50.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (* z b))))
(if (<= a -8.6e+41)
t_1
(if (<= a 1.85e+74) (+ x (* y z)) (if (<= a 7e+162) t_1 (* t a))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (z * b);
double tmp;
if (a <= -8.6e+41) {
tmp = t_1;
} else if (a <= 1.85e+74) {
tmp = x + (y * z);
} else if (a <= 7e+162) {
tmp = t_1;
} else {
tmp = t * a;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: t_1
real(8) :: tmp
t_1 = a * (z * b)
if (a <= (-8.6d+41)) then
tmp = t_1
else if (a <= 1.85d+74) then
tmp = x + (y * z)
else if (a <= 7d+162) then
tmp = t_1
else
tmp = t * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (z * b);
double tmp;
if (a <= -8.6e+41) {
tmp = t_1;
} else if (a <= 1.85e+74) {
tmp = x + (y * z);
} else if (a <= 7e+162) {
tmp = t_1;
} else {
tmp = t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a * (z * b) tmp = 0 if a <= -8.6e+41: tmp = t_1 elif a <= 1.85e+74: tmp = x + (y * z) elif a <= 7e+162: tmp = t_1 else: tmp = t * a return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(z * b)) tmp = 0.0 if (a <= -8.6e+41) tmp = t_1; elseif (a <= 1.85e+74) tmp = Float64(x + Float64(y * z)); elseif (a <= 7e+162) tmp = t_1; else tmp = Float64(t * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a * (z * b); tmp = 0.0; if (a <= -8.6e+41) tmp = t_1; elseif (a <= 1.85e+74) tmp = x + (y * z); elseif (a <= 7e+162) tmp = t_1; else tmp = t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -8.6e+41], t$95$1, If[LessEqual[a, 1.85e+74], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 7e+162], t$95$1, N[(t * a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(z \cdot b\right)\\
\mathbf{if}\;a \leq -8.6 \cdot 10^{+41}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 1.85 \cdot 10^{+74}:\\
\;\;\;\;x + y \cdot z\\
\mathbf{elif}\;a \leq 7 \cdot 10^{+162}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\end{array}
if a < -8.60000000000000048e41 or 1.8500000000000001e74 < a < 7.00000000000000036e162Initial program 93.6%
associate-+l+93.6%
associate-*l*96.8%
Simplified96.8%
Taylor expanded in a around inf 78.0%
Taylor expanded in t around 0 51.1%
if -8.60000000000000048e41 < a < 1.8500000000000001e74Initial program 97.6%
associate-+l+97.6%
associate-*l*94.7%
Simplified94.7%
Taylor expanded in a around 0 74.4%
if 7.00000000000000036e162 < a Initial program 92.5%
associate-+l+92.5%
associate-*l*96.2%
Simplified96.2%
Taylor expanded in t around inf 71.1%
Final simplification68.3%
(FPCore (x y z t a b) :precision binary64 (if (<= z 2.5e+143) (+ (+ x (* y z)) (+ (* t a) (* a (* z b)))) (+ x (* z (+ y (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 2.5e+143) {
tmp = (x + (y * z)) + ((t * a) + (a * (z * b)));
} else {
tmp = x + (z * (y + (a * b)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (z <= 2.5d+143) then
tmp = (x + (y * z)) + ((t * a) + (a * (z * b)))
else
tmp = x + (z * (y + (a * b)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 2.5e+143) {
tmp = (x + (y * z)) + ((t * a) + (a * (z * b)));
} else {
tmp = x + (z * (y + (a * b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= 2.5e+143: tmp = (x + (y * z)) + ((t * a) + (a * (z * b))) else: tmp = x + (z * (y + (a * b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 2.5e+143) tmp = Float64(Float64(x + Float64(y * z)) + Float64(Float64(t * a) + Float64(a * Float64(z * b)))); else tmp = Float64(x + Float64(z * Float64(y + Float64(a * b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= 2.5e+143) tmp = (x + (y * z)) + ((t * a) + (a * (z * b))); else tmp = x + (z * (y + (a * b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 2.5e+143], N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(N[(t * a), $MachinePrecision] + N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.5 \cdot 10^{+143}:\\
\;\;\;\;\left(x + y \cdot z\right) + \left(t \cdot a + a \cdot \left(z \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\end{array}
\end{array}
if z < 2.50000000000000006e143Initial program 97.2%
associate-+l+97.2%
associate-*l*96.9%
Simplified96.9%
if 2.50000000000000006e143 < z Initial program 88.9%
associate-+l+88.9%
associate-*l*86.1%
Simplified86.1%
Taylor expanded in t around 0 86.1%
+-commutative86.1%
+-commutative86.1%
associate-*r*97.2%
distribute-rgt-in100.0%
Simplified100.0%
Final simplification97.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -3.5e+92) (not (<= b 1.3e-70))) (+ x (* z (+ y (* a b)))) (+ x (+ (* y z) (* t a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -3.5e+92) || !(b <= 1.3e-70)) {
tmp = x + (z * (y + (a * b)));
} else {
tmp = x + ((y * z) + (t * a));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if ((b <= (-3.5d+92)) .or. (.not. (b <= 1.3d-70))) then
tmp = x + (z * (y + (a * b)))
else
tmp = x + ((y * z) + (t * a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -3.5e+92) || !(b <= 1.3e-70)) {
tmp = x + (z * (y + (a * b)));
} else {
tmp = x + ((y * z) + (t * a));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -3.5e+92) or not (b <= 1.3e-70): tmp = x + (z * (y + (a * b))) else: tmp = x + ((y * z) + (t * a)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -3.5e+92) || !(b <= 1.3e-70)) tmp = Float64(x + Float64(z * Float64(y + Float64(a * b)))); else tmp = Float64(x + Float64(Float64(y * z) + Float64(t * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -3.5e+92) || ~((b <= 1.3e-70))) tmp = x + (z * (y + (a * b))); else tmp = x + ((y * z) + (t * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -3.5e+92], N[Not[LessEqual[b, 1.3e-70]], $MachinePrecision]], N[(x + N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.5 \cdot 10^{+92} \lor \neg \left(b \leq 1.3 \cdot 10^{-70}\right):\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y \cdot z + t \cdot a\right)\\
\end{array}
\end{array}
if b < -3.49999999999999986e92 or 1.30000000000000001e-70 < b Initial program 95.6%
associate-+l+95.6%
associate-*l*91.4%
Simplified91.4%
Taylor expanded in t around 0 83.0%
+-commutative83.0%
+-commutative83.0%
associate-*r*83.9%
distribute-rgt-in85.7%
Simplified85.7%
if -3.49999999999999986e92 < b < 1.30000000000000001e-70Initial program 96.5%
associate-+l+96.5%
associate-*l*98.6%
Simplified98.6%
Taylor expanded in b around 0 96.1%
Final simplification91.4%
(FPCore (x y z t a b) :precision binary64 (if (<= b -1.7e+91) (* a (+ t (* z b))) (if (<= b 4.6e+200) (+ x (+ (* y z) (* t a))) (* z (+ y (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.7e+91) {
tmp = a * (t + (z * b));
} else if (b <= 4.6e+200) {
tmp = x + ((y * z) + (t * a));
} else {
tmp = z * (y + (a * b));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (b <= (-1.7d+91)) then
tmp = a * (t + (z * b))
else if (b <= 4.6d+200) then
tmp = x + ((y * z) + (t * a))
else
tmp = z * (y + (a * b))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.7e+91) {
tmp = a * (t + (z * b));
} else if (b <= 4.6e+200) {
tmp = x + ((y * z) + (t * a));
} else {
tmp = z * (y + (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -1.7e+91: tmp = a * (t + (z * b)) elif b <= 4.6e+200: tmp = x + ((y * z) + (t * a)) else: tmp = z * (y + (a * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.7e+91) tmp = Float64(a * Float64(t + Float64(z * b))); elseif (b <= 4.6e+200) tmp = Float64(x + Float64(Float64(y * z) + Float64(t * a))); else tmp = Float64(z * Float64(y + Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -1.7e+91) tmp = a * (t + (z * b)); elseif (b <= 4.6e+200) tmp = x + ((y * z) + (t * a)); else tmp = z * (y + (a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.7e+91], N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.6e+200], N[(x + N[(N[(y * z), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.7 \cdot 10^{+91}:\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\mathbf{elif}\;b \leq 4.6 \cdot 10^{+200}:\\
\;\;\;\;x + \left(y \cdot z + t \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\end{array}
\end{array}
if b < -1.7e91Initial program 92.7%
associate-+l+92.7%
associate-*l*90.3%
Simplified90.3%
Taylor expanded in a around inf 73.8%
if -1.7e91 < b < 4.60000000000000006e200Initial program 96.5%
associate-+l+96.5%
associate-*l*96.5%
Simplified96.5%
Taylor expanded in b around 0 89.3%
if 4.60000000000000006e200 < b Initial program 99.9%
associate-+l+99.9%
associate-*l*94.1%
Simplified94.1%
Taylor expanded in z around inf 88.2%
Final simplification86.8%
(FPCore (x y z t a b) :precision binary64 (if (<= b -5.8e+91) (+ (+ x (* y z)) (/ a (/ (/ 1.0 b) z))) (if (<= b 1.5e-66) (+ x (+ (* y z) (* t a))) (+ x (* z (+ y (* a b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -5.8e+91) {
tmp = (x + (y * z)) + (a / ((1.0 / b) / z));
} else if (b <= 1.5e-66) {
tmp = x + ((y * z) + (t * a));
} else {
tmp = x + (z * (y + (a * b)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (b <= (-5.8d+91)) then
tmp = (x + (y * z)) + (a / ((1.0d0 / b) / z))
else if (b <= 1.5d-66) then
tmp = x + ((y * z) + (t * a))
else
tmp = x + (z * (y + (a * b)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -5.8e+91) {
tmp = (x + (y * z)) + (a / ((1.0 / b) / z));
} else if (b <= 1.5e-66) {
tmp = x + ((y * z) + (t * a));
} else {
tmp = x + (z * (y + (a * b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -5.8e+91: tmp = (x + (y * z)) + (a / ((1.0 / b) / z)) elif b <= 1.5e-66: tmp = x + ((y * z) + (t * a)) else: tmp = x + (z * (y + (a * b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -5.8e+91) tmp = Float64(Float64(x + Float64(y * z)) + Float64(a / Float64(Float64(1.0 / b) / z))); elseif (b <= 1.5e-66) tmp = Float64(x + Float64(Float64(y * z) + Float64(t * a))); else tmp = Float64(x + Float64(z * Float64(y + Float64(a * b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -5.8e+91) tmp = (x + (y * z)) + (a / ((1.0 / b) / z)); elseif (b <= 1.5e-66) tmp = x + ((y * z) + (t * a)); else tmp = x + (z * (y + (a * b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -5.8e+91], N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(a / N[(N[(1.0 / b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.5e-66], N[(x + N[(N[(y * z), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.8 \cdot 10^{+91}:\\
\;\;\;\;\left(x + y \cdot z\right) + \frac{a}{\frac{\frac{1}{b}}{z}}\\
\mathbf{elif}\;b \leq 1.5 \cdot 10^{-66}:\\
\;\;\;\;x + \left(y \cdot z + t \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\end{array}
\end{array}
if b < -5.80000000000000028e91Initial program 92.7%
associate-+l+92.7%
associate-*l*90.3%
Simplified90.3%
*-commutative90.3%
distribute-lft-in92.8%
flip-+46.9%
associate-*r/46.8%
pow246.8%
pow246.8%
Applied egg-rr46.8%
associate-/l*46.9%
*-commutative46.9%
*-commutative46.9%
Simplified46.9%
Taylor expanded in t around 0 83.4%
associate-/r*83.4%
Simplified83.4%
if -5.80000000000000028e91 < b < 1.5000000000000001e-66Initial program 96.5%
associate-+l+96.5%
associate-*l*98.6%
Simplified98.6%
Taylor expanded in b around 0 96.1%
if 1.5000000000000001e-66 < b Initial program 97.2%
associate-+l+97.2%
associate-*l*92.0%
Simplified92.0%
Taylor expanded in t around 0 82.8%
+-commutative82.8%
+-commutative82.8%
associate-*r*86.9%
distribute-rgt-in88.2%
Simplified88.2%
Final simplification91.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -8e+41) (not (<= a 1.55e+74))) (* a (+ t (* z b))) (+ x (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -8e+41) || !(a <= 1.55e+74)) {
tmp = a * (t + (z * b));
} else {
tmp = x + (y * z);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if ((a <= (-8d+41)) .or. (.not. (a <= 1.55d+74))) then
tmp = a * (t + (z * b))
else
tmp = x + (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -8e+41) || !(a <= 1.55e+74)) {
tmp = a * (t + (z * b));
} else {
tmp = x + (y * z);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -8e+41) or not (a <= 1.55e+74): tmp = a * (t + (z * b)) else: tmp = x + (y * z) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -8e+41) || !(a <= 1.55e+74)) tmp = Float64(a * Float64(t + Float64(z * b))); else tmp = Float64(x + Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -8e+41) || ~((a <= 1.55e+74))) tmp = a * (t + (z * b)); else tmp = x + (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -8e+41], N[Not[LessEqual[a, 1.55e+74]], $MachinePrecision]], N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8 \cdot 10^{+41} \lor \neg \left(a \leq 1.55 \cdot 10^{+74}\right):\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot z\\
\end{array}
\end{array}
if a < -8.00000000000000005e41 or 1.55000000000000011e74 < a Initial program 93.3%
associate-+l+93.3%
associate-*l*96.6%
Simplified96.6%
Taylor expanded in a around inf 81.4%
if -8.00000000000000005e41 < a < 1.55000000000000011e74Initial program 97.6%
associate-+l+97.6%
associate-*l*94.7%
Simplified94.7%
Taylor expanded in a around 0 74.4%
Final simplification76.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1.1e-7) (not (<= z 11500000000000.0))) (* z (+ y (* a b))) (+ x (* t a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.1e-7) || !(z <= 11500000000000.0)) {
tmp = z * (y + (a * b));
} else {
tmp = x + (t * a);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if ((z <= (-1.1d-7)) .or. (.not. (z <= 11500000000000.0d0))) then
tmp = z * (y + (a * b))
else
tmp = x + (t * a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.1e-7) || !(z <= 11500000000000.0)) {
tmp = z * (y + (a * b));
} else {
tmp = x + (t * a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.1e-7) or not (z <= 11500000000000.0): tmp = z * (y + (a * b)) else: tmp = x + (t * a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1.1e-7) || !(z <= 11500000000000.0)) tmp = Float64(z * Float64(y + Float64(a * b))); else tmp = Float64(x + Float64(t * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -1.1e-7) || ~((z <= 11500000000000.0))) tmp = z * (y + (a * b)); else tmp = x + (t * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1.1e-7], N[Not[LessEqual[z, 11500000000000.0]], $MachinePrecision]], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{-7} \lor \neg \left(z \leq 11500000000000\right):\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot a\\
\end{array}
\end{array}
if z < -1.1000000000000001e-7 or 1.15e13 < z Initial program 93.1%
associate-+l+93.1%
associate-*l*90.7%
Simplified90.7%
Taylor expanded in z around inf 82.9%
if -1.1000000000000001e-7 < z < 1.15e13Initial program 98.6%
associate-+l+98.6%
associate-*l*99.2%
Simplified99.2%
Taylor expanded in z around 0 76.3%
+-commutative76.3%
Simplified76.3%
Final simplification79.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1.65e+19) (not (<= z 2020.0))) (+ x (* y z)) (+ x (* t a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.65e+19) || !(z <= 2020.0)) {
tmp = x + (y * z);
} else {
tmp = x + (t * a);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if ((z <= (-1.65d+19)) .or. (.not. (z <= 2020.0d0))) then
tmp = x + (y * z)
else
tmp = x + (t * a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.65e+19) || !(z <= 2020.0)) {
tmp = x + (y * z);
} else {
tmp = x + (t * a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.65e+19) or not (z <= 2020.0): tmp = x + (y * z) else: tmp = x + (t * a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1.65e+19) || !(z <= 2020.0)) tmp = Float64(x + Float64(y * z)); else tmp = Float64(x + Float64(t * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -1.65e+19) || ~((z <= 2020.0))) tmp = x + (y * z); else tmp = x + (t * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1.65e+19], N[Not[LessEqual[z, 2020.0]], $MachinePrecision]], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+19} \lor \neg \left(z \leq 2020\right):\\
\;\;\;\;x + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot a\\
\end{array}
\end{array}
if z < -1.65e19 or 2020 < z Initial program 93.1%
associate-+l+93.1%
associate-*l*90.7%
Simplified90.7%
Taylor expanded in a around 0 64.4%
if -1.65e19 < z < 2020Initial program 98.5%
associate-+l+98.5%
associate-*l*99.2%
Simplified99.2%
Taylor expanded in z around 0 76.1%
+-commutative76.1%
Simplified76.1%
Final simplification70.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -4.4e+85) (not (<= t 1.1e+86))) (* t a) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -4.4e+85) || !(t <= 1.1e+86)) {
tmp = t * a;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if ((t <= (-4.4d+85)) .or. (.not. (t <= 1.1d+86))) then
tmp = t * a
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -4.4e+85) || !(t <= 1.1e+86)) {
tmp = t * a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -4.4e+85) or not (t <= 1.1e+86): tmp = t * a else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -4.4e+85) || !(t <= 1.1e+86)) tmp = Float64(t * a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -4.4e+85) || ~((t <= 1.1e+86))) tmp = t * a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -4.4e+85], N[Not[LessEqual[t, 1.1e+86]], $MachinePrecision]], N[(t * a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.4 \cdot 10^{+85} \lor \neg \left(t \leq 1.1 \cdot 10^{+86}\right):\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -4.4000000000000003e85 or 1.10000000000000002e86 < t Initial program 93.7%
associate-+l+93.7%
associate-*l*96.3%
Simplified96.3%
Taylor expanded in t around inf 63.0%
if -4.4000000000000003e85 < t < 1.10000000000000002e86Initial program 97.1%
associate-+l+97.1%
associate-*l*95.0%
Simplified95.0%
Taylor expanded in x around inf 37.7%
Final simplification45.6%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return x;
}
real(8) function code(x, y, z, t, a, b)
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
code = x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 96.1%
associate-+l+96.1%
associate-*l*95.4%
Simplified95.4%
Taylor expanded in x around inf 29.2%
Final simplification29.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* z (+ (* b a) y)) (+ x (* t a)))))
(if (< z -11820553527347888000.0)
t_1
(if (< z 4.7589743188364287e-122)
(+ (* (+ (* b z) t) a) (+ (* z y) x))
t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z * ((b * a) + y)) + (x + (t * a));
double tmp;
if (z < -11820553527347888000.0) {
tmp = t_1;
} else if (z < 4.7589743188364287e-122) {
tmp = (((b * z) + t) * a) + ((z * y) + x);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: t_1
real(8) :: tmp
t_1 = (z * ((b * a) + y)) + (x + (t * a))
if (z < (-11820553527347888000.0d0)) then
tmp = t_1
else if (z < 4.7589743188364287d-122) then
tmp = (((b * z) + t) * a) + ((z * y) + x)
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 t_1 = (z * ((b * a) + y)) + (x + (t * a));
double tmp;
if (z < -11820553527347888000.0) {
tmp = t_1;
} else if (z < 4.7589743188364287e-122) {
tmp = (((b * z) + t) * a) + ((z * y) + x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (z * ((b * a) + y)) + (x + (t * a)) tmp = 0 if z < -11820553527347888000.0: tmp = t_1 elif z < 4.7589743188364287e-122: tmp = (((b * z) + t) * a) + ((z * y) + x) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(z * Float64(Float64(b * a) + y)) + Float64(x + Float64(t * a))) tmp = 0.0 if (z < -11820553527347888000.0) tmp = t_1; elseif (z < 4.7589743188364287e-122) tmp = Float64(Float64(Float64(Float64(b * z) + t) * a) + Float64(Float64(z * y) + x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (z * ((b * a) + y)) + (x + (t * a)); tmp = 0.0; if (z < -11820553527347888000.0) tmp = t_1; elseif (z < 4.7589743188364287e-122) tmp = (((b * z) + t) * a) + ((z * y) + x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z * N[(N[(b * a), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] + N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -11820553527347888000.0], t$95$1, If[Less[z, 4.7589743188364287e-122], N[(N[(N[(N[(b * z), $MachinePrecision] + t), $MachinePrecision] * a), $MachinePrecision] + N[(N[(z * y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\
\mathbf{if}\;z < -11820553527347888000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z < 4.7589743188364287 \cdot 10^{-122}:\\
\;\;\;\;\left(b \cdot z + t\right) \cdot a + \left(z \cdot y + x\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2024019
(FPCore (x y z t a b)
:name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
:precision binary64
:herbie-target
(if (< z -11820553527347888000.0) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 4.7589743188364287e-122) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a)))))
(+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))