
(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 11 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))))
(if (<= (+ (+ t_1 (* t a)) (* (* z a) b)) INFINITY)
(+ t_1 (fma t a (* z (* a b))))
(* z (+ y (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y * z);
double tmp;
if (((t_1 + (t * a)) + ((z * a) * b)) <= ((double) INFINITY)) {
tmp = t_1 + fma(t, a, (z * (a * b)));
} else {
tmp = z * (y + (a * b));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(y * z)) tmp = 0.0 if (Float64(Float64(t_1 + Float64(t * a)) + Float64(Float64(z * a) * b)) <= Inf) tmp = Float64(t_1 + fma(t, a, Float64(z * Float64(a * b)))); else tmp = Float64(z * Float64(y + Float64(a * b))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$1 + N[(t * a + N[(z * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot z\\
\mathbf{if}\;\left(t_1 + t \cdot a\right) + \left(z \cdot a\right) \cdot b \leq \infty:\\
\;\;\;\;t_1 + \mathsf{fma}\left(t, a, z \cdot \left(a \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y + a \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 97.1%
associate-+l+97.1%
*-commutative97.1%
associate-*l*98.0%
Simplified98.0%
fma-def98.0%
Applied egg-rr98.0%
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%
*-commutative0.0%
associate-*l*6.3%
Simplified6.3%
Taylor expanded in z around inf 87.5%
Final simplification97.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* y z))))
(if (<= (+ (+ t_1 (* t a)) (* (* z a) b)) INFINITY)
(+ t_1 (+ (* z (* a b)) (* t a)))
(* z (+ y (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y * z);
double tmp;
if (((t_1 + (t * a)) + ((z * a) * b)) <= ((double) INFINITY)) {
tmp = t_1 + ((z * (a * b)) + (t * a));
} else {
tmp = z * (y + (a * 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);
double tmp;
if (((t_1 + (t * a)) + ((z * a) * b)) <= Double.POSITIVE_INFINITY) {
tmp = t_1 + ((z * (a * b)) + (t * a));
} else {
tmp = z * (y + (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (y * z) tmp = 0 if ((t_1 + (t * a)) + ((z * a) * b)) <= math.inf: tmp = t_1 + ((z * (a * b)) + (t * a)) else: tmp = z * (y + (a * b)) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(y * z)) tmp = 0.0 if (Float64(Float64(t_1 + Float64(t * a)) + Float64(Float64(z * a) * b)) <= Inf) tmp = Float64(t_1 + Float64(Float64(z * Float64(a * b)) + 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) t_1 = x + (y * z); tmp = 0.0; if (((t_1 + (t * a)) + ((z * a) * b)) <= Inf) tmp = t_1 + ((z * (a * b)) + (t * a)); else tmp = z * (y + (a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$1 + N[(N[(z * N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot z\\
\mathbf{if}\;\left(t_1 + t \cdot a\right) + \left(z \cdot a\right) \cdot b \leq \infty:\\
\;\;\;\;t_1 + \left(z \cdot \left(a \cdot b\right) + t \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y + a \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 97.1%
associate-+l+97.1%
*-commutative97.1%
associate-*l*98.0%
Simplified98.0%
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%
*-commutative0.0%
associate-*l*6.3%
Simplified6.3%
Taylor expanded in z around inf 87.5%
Final simplification97.3%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -3.8e+52)
(* t a)
(if (<= a -1.25e-162)
x
(if (<= a 3.4e-15)
(* y z)
(if (<= a 9.2e+52)
x
(if (or (<= a 7.2e+79) (and (not (<= a 2.75e+156)) (<= a 1.08e+250)))
(* t a)
(* a (* z b))))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -3.8e+52) {
tmp = t * a;
} else if (a <= -1.25e-162) {
tmp = x;
} else if (a <= 3.4e-15) {
tmp = y * z;
} else if (a <= 9.2e+52) {
tmp = x;
} else if ((a <= 7.2e+79) || (!(a <= 2.75e+156) && (a <= 1.08e+250))) {
tmp = t * a;
} else {
tmp = a * (z * 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 (a <= (-3.8d+52)) then
tmp = t * a
else if (a <= (-1.25d-162)) then
tmp = x
else if (a <= 3.4d-15) then
tmp = y * z
else if (a <= 9.2d+52) then
tmp = x
else if ((a <= 7.2d+79) .or. (.not. (a <= 2.75d+156)) .and. (a <= 1.08d+250)) then
tmp = t * a
else
tmp = a * (z * 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 (a <= -3.8e+52) {
tmp = t * a;
} else if (a <= -1.25e-162) {
tmp = x;
} else if (a <= 3.4e-15) {
tmp = y * z;
} else if (a <= 9.2e+52) {
tmp = x;
} else if ((a <= 7.2e+79) || (!(a <= 2.75e+156) && (a <= 1.08e+250))) {
tmp = t * a;
} else {
tmp = a * (z * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -3.8e+52: tmp = t * a elif a <= -1.25e-162: tmp = x elif a <= 3.4e-15: tmp = y * z elif a <= 9.2e+52: tmp = x elif (a <= 7.2e+79) or (not (a <= 2.75e+156) and (a <= 1.08e+250)): tmp = t * a else: tmp = a * (z * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -3.8e+52) tmp = Float64(t * a); elseif (a <= -1.25e-162) tmp = x; elseif (a <= 3.4e-15) tmp = Float64(y * z); elseif (a <= 9.2e+52) tmp = x; elseif ((a <= 7.2e+79) || (!(a <= 2.75e+156) && (a <= 1.08e+250))) tmp = Float64(t * a); else tmp = Float64(a * Float64(z * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -3.8e+52) tmp = t * a; elseif (a <= -1.25e-162) tmp = x; elseif (a <= 3.4e-15) tmp = y * z; elseif (a <= 9.2e+52) tmp = x; elseif ((a <= 7.2e+79) || (~((a <= 2.75e+156)) && (a <= 1.08e+250))) tmp = t * a; else tmp = a * (z * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -3.8e+52], N[(t * a), $MachinePrecision], If[LessEqual[a, -1.25e-162], x, If[LessEqual[a, 3.4e-15], N[(y * z), $MachinePrecision], If[LessEqual[a, 9.2e+52], x, If[Or[LessEqual[a, 7.2e+79], And[N[Not[LessEqual[a, 2.75e+156]], $MachinePrecision], LessEqual[a, 1.08e+250]]], N[(t * a), $MachinePrecision], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.8 \cdot 10^{+52}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;a \leq -1.25 \cdot 10^{-162}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 3.4 \cdot 10^{-15}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;a \leq 9.2 \cdot 10^{+52}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 7.2 \cdot 10^{+79} \lor \neg \left(a \leq 2.75 \cdot 10^{+156}\right) \land a \leq 1.08 \cdot 10^{+250}:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\end{array}
\end{array}
if a < -3.8e52 or 9.1999999999999999e52 < a < 7.1999999999999999e79 or 2.7500000000000001e156 < a < 1.08000000000000007e250Initial program 83.8%
associate-+l+83.8%
*-commutative83.8%
associate-*l*86.7%
Simplified86.7%
Taylor expanded in t around inf 61.3%
if -3.8e52 < a < -1.25000000000000004e-162 or 3.4e-15 < a < 9.1999999999999999e52Initial program 95.3%
associate-+l+95.3%
*-commutative95.3%
associate-*l*95.2%
Simplified95.2%
Taylor expanded in x around inf 45.6%
if -1.25000000000000004e-162 < a < 3.4e-15Initial program 98.9%
associate-+l+98.9%
*-commutative98.9%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in y around inf 61.0%
*-commutative61.0%
Simplified61.0%
if 7.1999999999999999e79 < a < 2.7500000000000001e156 or 1.08000000000000007e250 < a Initial program 80.7%
associate-+l+80.7%
*-commutative80.7%
associate-*l*80.7%
Simplified80.7%
fma-def86.2%
Applied egg-rr86.2%
Taylor expanded in b around inf 57.3%
Final simplification56.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -7.5e-112) (not (<= a 3.2e-15))) (+ x (* 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 <= -7.5e-112) || !(a <= 3.2e-15)) {
tmp = x + (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 <= (-7.5d-112)) .or. (.not. (a <= 3.2d-15))) then
tmp = x + (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 <= -7.5e-112) || !(a <= 3.2e-15)) {
tmp = x + (a * (t + (z * b)));
} else {
tmp = x + (y * z);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -7.5e-112) or not (a <= 3.2e-15): tmp = x + (a * (t + (z * b))) else: tmp = x + (y * z) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -7.5e-112) || !(a <= 3.2e-15)) tmp = Float64(x + 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 <= -7.5e-112) || ~((a <= 3.2e-15))) tmp = x + (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, -7.5e-112], N[Not[LessEqual[a, 3.2e-15]], $MachinePrecision]], N[(x + N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.5 \cdot 10^{-112} \lor \neg \left(a \leq 3.2 \cdot 10^{-15}\right):\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot z\\
\end{array}
\end{array}
if a < -7.5000000000000002e-112 or 3.1999999999999999e-15 < a Initial program 86.7%
associate-+l+86.7%
+-commutative86.7%
fma-def86.7%
associate-*l*91.0%
*-commutative91.0%
*-commutative91.0%
distribute-rgt-out94.2%
*-commutative94.2%
Simplified94.2%
Taylor expanded in y around 0 89.1%
if -7.5000000000000002e-112 < a < 3.1999999999999999e-15Initial program 98.0%
associate-+l+98.0%
*-commutative98.0%
associate-*l*98.9%
Simplified98.9%
Taylor expanded in a around 0 84.8%
Final simplification87.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -4.4e+31) (not (<= a 1.26e-14))) (+ x (* a (+ t (* z b)))) (+ x (+ (* y z) (* t a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -4.4e+31) || !(a <= 1.26e-14)) {
tmp = x + (a * (t + (z * 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 ((a <= (-4.4d+31)) .or. (.not. (a <= 1.26d-14))) then
tmp = x + (a * (t + (z * 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 ((a <= -4.4e+31) || !(a <= 1.26e-14)) {
tmp = x + (a * (t + (z * b)));
} else {
tmp = x + ((y * z) + (t * a));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -4.4e+31) or not (a <= 1.26e-14): tmp = x + (a * (t + (z * b))) else: tmp = x + ((y * z) + (t * a)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -4.4e+31) || !(a <= 1.26e-14)) tmp = Float64(x + Float64(a * Float64(t + Float64(z * 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 ((a <= -4.4e+31) || ~((a <= 1.26e-14))) tmp = x + (a * (t + (z * b))); else tmp = x + ((y * z) + (t * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -4.4e+31], N[Not[LessEqual[a, 1.26e-14]], $MachinePrecision]], N[(x + N[(a * N[(t + N[(z * 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}\;a \leq -4.4 \cdot 10^{+31} \lor \neg \left(a \leq 1.26 \cdot 10^{-14}\right):\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y \cdot z + t \cdot a\right)\\
\end{array}
\end{array}
if a < -4.4000000000000002e31 or 1.25999999999999996e-14 < a Initial program 84.7%
associate-+l+84.7%
+-commutative84.7%
fma-def84.7%
associate-*l*89.9%
*-commutative89.9%
*-commutative89.9%
distribute-rgt-out93.8%
*-commutative93.8%
Simplified93.8%
Taylor expanded in y around 0 90.7%
if -4.4000000000000002e31 < a < 1.25999999999999996e-14Initial program 97.7%
associate-+l+97.7%
*-commutative97.7%
associate-*l*98.4%
Simplified98.4%
Taylor expanded in b around 0 90.0%
Final simplification90.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -4.5e+52)
(* t a)
(if (<= a -9.2e-163)
x
(if (<= a 6.6e-15) (* y z) (if (<= a 6.5e+57) x (* t a))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -4.5e+52) {
tmp = t * a;
} else if (a <= -9.2e-163) {
tmp = x;
} else if (a <= 6.6e-15) {
tmp = y * z;
} else if (a <= 6.5e+57) {
tmp = x;
} 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) :: tmp
if (a <= (-4.5d+52)) then
tmp = t * a
else if (a <= (-9.2d-163)) then
tmp = x
else if (a <= 6.6d-15) then
tmp = y * z
else if (a <= 6.5d+57) then
tmp = x
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 tmp;
if (a <= -4.5e+52) {
tmp = t * a;
} else if (a <= -9.2e-163) {
tmp = x;
} else if (a <= 6.6e-15) {
tmp = y * z;
} else if (a <= 6.5e+57) {
tmp = x;
} else {
tmp = t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -4.5e+52: tmp = t * a elif a <= -9.2e-163: tmp = x elif a <= 6.6e-15: tmp = y * z elif a <= 6.5e+57: tmp = x else: tmp = t * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -4.5e+52) tmp = Float64(t * a); elseif (a <= -9.2e-163) tmp = x; elseif (a <= 6.6e-15) tmp = Float64(y * z); elseif (a <= 6.5e+57) tmp = x; else tmp = Float64(t * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -4.5e+52) tmp = t * a; elseif (a <= -9.2e-163) tmp = x; elseif (a <= 6.6e-15) tmp = y * z; elseif (a <= 6.5e+57) tmp = x; else tmp = t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -4.5e+52], N[(t * a), $MachinePrecision], If[LessEqual[a, -9.2e-163], x, If[LessEqual[a, 6.6e-15], N[(y * z), $MachinePrecision], If[LessEqual[a, 6.5e+57], x, N[(t * a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.5 \cdot 10^{+52}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;a \leq -9.2 \cdot 10^{-163}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 6.6 \cdot 10^{-15}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;a \leq 6.5 \cdot 10^{+57}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\end{array}
if a < -4.5e52 or 6.4999999999999997e57 < a Initial program 82.8%
associate-+l+82.8%
*-commutative82.8%
associate-*l*84.7%
Simplified84.7%
Taylor expanded in t around inf 49.0%
if -4.5e52 < a < -9.1999999999999997e-163 or 6.6e-15 < a < 6.4999999999999997e57Initial program 95.3%
associate-+l+95.3%
*-commutative95.3%
associate-*l*95.2%
Simplified95.2%
Taylor expanded in x around inf 45.6%
if -9.1999999999999997e-163 < a < 6.6e-15Initial program 98.9%
associate-+l+98.9%
*-commutative98.9%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in y around inf 61.0%
*-commutative61.0%
Simplified61.0%
Final simplification52.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -1.32e+54)
(* t a)
(if (<= a 1.6e+135)
(+ x (* y z))
(if (<= a 2.4e+250) (* t a) (* a (* z b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -1.32e+54) {
tmp = t * a;
} else if (a <= 1.6e+135) {
tmp = x + (y * z);
} else if (a <= 2.4e+250) {
tmp = t * a;
} else {
tmp = a * (z * 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 (a <= (-1.32d+54)) then
tmp = t * a
else if (a <= 1.6d+135) then
tmp = x + (y * z)
else if (a <= 2.4d+250) then
tmp = t * a
else
tmp = a * (z * 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 (a <= -1.32e+54) {
tmp = t * a;
} else if (a <= 1.6e+135) {
tmp = x + (y * z);
} else if (a <= 2.4e+250) {
tmp = t * a;
} else {
tmp = a * (z * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -1.32e+54: tmp = t * a elif a <= 1.6e+135: tmp = x + (y * z) elif a <= 2.4e+250: tmp = t * a else: tmp = a * (z * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -1.32e+54) tmp = Float64(t * a); elseif (a <= 1.6e+135) tmp = Float64(x + Float64(y * z)); elseif (a <= 2.4e+250) tmp = Float64(t * a); else tmp = Float64(a * Float64(z * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -1.32e+54) tmp = t * a; elseif (a <= 1.6e+135) tmp = x + (y * z); elseif (a <= 2.4e+250) tmp = t * a; else tmp = a * (z * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -1.32e+54], N[(t * a), $MachinePrecision], If[LessEqual[a, 1.6e+135], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.4e+250], N[(t * a), $MachinePrecision], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.32 \cdot 10^{+54}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;a \leq 1.6 \cdot 10^{+135}:\\
\;\;\;\;x + y \cdot z\\
\mathbf{elif}\;a \leq 2.4 \cdot 10^{+250}:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\end{array}
\end{array}
if a < -1.3200000000000001e54 or 1.59999999999999987e135 < a < 2.40000000000000013e250Initial program 84.3%
associate-+l+84.3%
*-commutative84.3%
associate-*l*87.0%
Simplified87.0%
Taylor expanded in t around inf 58.4%
if -1.3200000000000001e54 < a < 1.59999999999999987e135Initial program 96.4%
associate-+l+96.4%
*-commutative96.4%
associate-*l*96.9%
Simplified96.9%
Taylor expanded in a around 0 73.7%
if 2.40000000000000013e250 < a Initial program 69.0%
associate-+l+69.0%
*-commutative69.0%
associate-*l*69.0%
Simplified69.0%
fma-def75.2%
Applied egg-rr75.2%
Taylor expanded in b around inf 69.9%
Final simplification68.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* t a))))
(if (<= a -5.2e-111)
t_1
(if (<= a 4.3e+67)
(+ x (* y z))
(if (<= a 1.1e+261) t_1 (* a (* z b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (t * a);
double tmp;
if (a <= -5.2e-111) {
tmp = t_1;
} else if (a <= 4.3e+67) {
tmp = x + (y * z);
} else if (a <= 1.1e+261) {
tmp = t_1;
} else {
tmp = a * (z * 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) :: t_1
real(8) :: tmp
t_1 = x + (t * a)
if (a <= (-5.2d-111)) then
tmp = t_1
else if (a <= 4.3d+67) then
tmp = x + (y * z)
else if (a <= 1.1d+261) then
tmp = t_1
else
tmp = a * (z * b)
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 = x + (t * a);
double tmp;
if (a <= -5.2e-111) {
tmp = t_1;
} else if (a <= 4.3e+67) {
tmp = x + (y * z);
} else if (a <= 1.1e+261) {
tmp = t_1;
} else {
tmp = a * (z * b);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (t * a) tmp = 0 if a <= -5.2e-111: tmp = t_1 elif a <= 4.3e+67: tmp = x + (y * z) elif a <= 1.1e+261: tmp = t_1 else: tmp = a * (z * b) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(t * a)) tmp = 0.0 if (a <= -5.2e-111) tmp = t_1; elseif (a <= 4.3e+67) tmp = Float64(x + Float64(y * z)); elseif (a <= 1.1e+261) tmp = t_1; else tmp = Float64(a * Float64(z * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (t * a); tmp = 0.0; if (a <= -5.2e-111) tmp = t_1; elseif (a <= 4.3e+67) tmp = x + (y * z); elseif (a <= 1.1e+261) tmp = t_1; else tmp = a * (z * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -5.2e-111], t$95$1, If[LessEqual[a, 4.3e+67], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.1e+261], t$95$1, N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + t \cdot a\\
\mathbf{if}\;a \leq -5.2 \cdot 10^{-111}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 4.3 \cdot 10^{+67}:\\
\;\;\;\;x + y \cdot z\\
\mathbf{elif}\;a \leq 1.1 \cdot 10^{+261}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\end{array}
\end{array}
if a < -5.19999999999999965e-111 or 4.3000000000000001e67 < a < 1.09999999999999992e261Initial program 86.8%
associate-+l+86.8%
*-commutative86.8%
associate-*l*89.2%
Simplified89.2%
Taylor expanded in z around 0 64.6%
+-commutative64.6%
Simplified64.6%
if -5.19999999999999965e-111 < a < 4.3000000000000001e67Initial program 98.3%
associate-+l+98.3%
*-commutative98.3%
associate-*l*99.1%
Simplified99.1%
Taylor expanded in a around 0 82.0%
if 1.09999999999999992e261 < a Initial program 69.5%
associate-+l+69.5%
*-commutative69.5%
associate-*l*61.8%
Simplified61.8%
fma-def69.5%
Applied egg-rr69.5%
Taylor expanded in b around inf 78.1%
Final simplification73.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -4.2e+30) (not (<= a 5.2e+52))) (* 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 <= -4.2e+30) || !(a <= 5.2e+52)) {
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 <= (-4.2d+30)) .or. (.not. (a <= 5.2d+52))) 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 <= -4.2e+30) || !(a <= 5.2e+52)) {
tmp = a * (t + (z * b));
} else {
tmp = x + (y * z);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -4.2e+30) or not (a <= 5.2e+52): 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 <= -4.2e+30) || !(a <= 5.2e+52)) 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 <= -4.2e+30) || ~((a <= 5.2e+52))) 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, -4.2e+30], N[Not[LessEqual[a, 5.2e+52]], $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 -4.2 \cdot 10^{+30} \lor \neg \left(a \leq 5.2 \cdot 10^{+52}\right):\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot z\\
\end{array}
\end{array}
if a < -4.2e30 or 5.2e52 < a Initial program 82.7%
associate-+l+82.7%
*-commutative82.7%
associate-*l*84.5%
Simplified84.5%
Taylor expanded in a around inf 81.2%
if -4.2e30 < a < 5.2e52Initial program 97.9%
associate-+l+97.9%
*-commutative97.9%
associate-*l*98.5%
Simplified98.5%
Taylor expanded in a around 0 78.5%
Final simplification79.7%
(FPCore (x y z t a b) :precision binary64 (if (<= x -1.05e+133) x (if (<= x 3.8e-69) (* t a) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.05e+133) {
tmp = x;
} else if (x <= 3.8e-69) {
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 (x <= (-1.05d+133)) then
tmp = x
else if (x <= 3.8d-69) 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 (x <= -1.05e+133) {
tmp = x;
} else if (x <= 3.8e-69) {
tmp = t * a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -1.05e+133: tmp = x elif x <= 3.8e-69: tmp = t * a else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -1.05e+133) tmp = x; elseif (x <= 3.8e-69) 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 (x <= -1.05e+133) tmp = x; elseif (x <= 3.8e-69) tmp = t * a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.05e+133], x, If[LessEqual[x, 3.8e-69], N[(t * a), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{+133}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-69}:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.05e133 or 3.7999999999999998e-69 < x Initial program 91.1%
associate-+l+91.1%
*-commutative91.1%
associate-*l*92.1%
Simplified92.1%
Taylor expanded in x around inf 49.0%
if -1.05e133 < x < 3.7999999999999998e-69Initial program 91.0%
associate-+l+91.0%
*-commutative91.0%
associate-*l*92.3%
Simplified92.3%
Taylor expanded in t around inf 35.8%
Final simplification41.0%
(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 91.1%
associate-+l+91.1%
*-commutative91.1%
associate-*l*92.2%
Simplified92.2%
Taylor expanded in x around inf 24.1%
Final simplification24.1%
(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 2023308
(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)))