
(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 (* a (+ t (* z b)))))
(if (<= (+ (+ (+ x (* y z)) (* t a)) (* (* z a) b)) INFINITY)
(+ (fma y z x) t_1)
t_1)))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (t + (z * b));
double tmp;
if ((((x + (y * z)) + (t * a)) + ((z * a) * b)) <= ((double) INFINITY)) {
tmp = fma(y, z, x) + t_1;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(t + Float64(z * b))) tmp = 0.0 if (Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(z * a) * b)) <= Inf) tmp = Float64(fma(y, z, x) + t_1); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(y * z + x), $MachinePrecision] + t$95$1), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(t + z \cdot b\right)\\
\mathbf{if}\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(z \cdot a\right) \cdot b \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(y, z, x\right) + t_1\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < +inf.0Initial program 96.9%
associate-+l+96.9%
+-commutative96.9%
fma-def96.9%
associate-*l*98.0%
*-commutative98.0%
*-commutative98.0%
distribute-rgt-out98.0%
*-commutative98.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%
associate-*l*30.0%
Simplified30.0%
Taylor expanded in a around inf 80.0%
Final simplification97.3%
(FPCore (x y z t a b)
:precision binary64
(if (<= x -9.8e+61)
x
(if (<= x -4.8e-305)
(* y z)
(if (<= x 1.65e-171)
(* t a)
(if (<= x 2.5e-101)
(* y z)
(if (<= x 9.5e-68)
(* t a)
(if (<= x 1.02e-35)
(* a (* z b))
(if (<= x 2.2e+55) (* t a) x))))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -9.8e+61) {
tmp = x;
} else if (x <= -4.8e-305) {
tmp = y * z;
} else if (x <= 1.65e-171) {
tmp = t * a;
} else if (x <= 2.5e-101) {
tmp = y * z;
} else if (x <= 9.5e-68) {
tmp = t * a;
} else if (x <= 1.02e-35) {
tmp = a * (z * b);
} else if (x <= 2.2e+55) {
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 <= (-9.8d+61)) then
tmp = x
else if (x <= (-4.8d-305)) then
tmp = y * z
else if (x <= 1.65d-171) then
tmp = t * a
else if (x <= 2.5d-101) then
tmp = y * z
else if (x <= 9.5d-68) then
tmp = t * a
else if (x <= 1.02d-35) then
tmp = a * (z * b)
else if (x <= 2.2d+55) 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 <= -9.8e+61) {
tmp = x;
} else if (x <= -4.8e-305) {
tmp = y * z;
} else if (x <= 1.65e-171) {
tmp = t * a;
} else if (x <= 2.5e-101) {
tmp = y * z;
} else if (x <= 9.5e-68) {
tmp = t * a;
} else if (x <= 1.02e-35) {
tmp = a * (z * b);
} else if (x <= 2.2e+55) {
tmp = t * a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -9.8e+61: tmp = x elif x <= -4.8e-305: tmp = y * z elif x <= 1.65e-171: tmp = t * a elif x <= 2.5e-101: tmp = y * z elif x <= 9.5e-68: tmp = t * a elif x <= 1.02e-35: tmp = a * (z * b) elif x <= 2.2e+55: tmp = t * a else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -9.8e+61) tmp = x; elseif (x <= -4.8e-305) tmp = Float64(y * z); elseif (x <= 1.65e-171) tmp = Float64(t * a); elseif (x <= 2.5e-101) tmp = Float64(y * z); elseif (x <= 9.5e-68) tmp = Float64(t * a); elseif (x <= 1.02e-35) tmp = Float64(a * Float64(z * b)); elseif (x <= 2.2e+55) 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 <= -9.8e+61) tmp = x; elseif (x <= -4.8e-305) tmp = y * z; elseif (x <= 1.65e-171) tmp = t * a; elseif (x <= 2.5e-101) tmp = y * z; elseif (x <= 9.5e-68) tmp = t * a; elseif (x <= 1.02e-35) tmp = a * (z * b); elseif (x <= 2.2e+55) tmp = t * a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -9.8e+61], x, If[LessEqual[x, -4.8e-305], N[(y * z), $MachinePrecision], If[LessEqual[x, 1.65e-171], N[(t * a), $MachinePrecision], If[LessEqual[x, 2.5e-101], N[(y * z), $MachinePrecision], If[LessEqual[x, 9.5e-68], N[(t * a), $MachinePrecision], If[LessEqual[x, 1.02e-35], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.2e+55], N[(t * a), $MachinePrecision], x]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.8 \cdot 10^{+61}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -4.8 \cdot 10^{-305}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-171}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-101}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-68}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq 1.02 \cdot 10^{-35}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+55}:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -9.8000000000000005e61 or 2.2000000000000001e55 < x Initial program 92.8%
associate-+l+92.8%
associate-*l*96.3%
Simplified96.3%
Taylor expanded in x around inf 56.9%
if -9.8000000000000005e61 < x < -4.80000000000000039e-305 or 1.6500000000000001e-171 < x < 2.5e-101Initial program 92.8%
associate-+l+92.8%
associate-*l*93.8%
Simplified93.8%
Taylor expanded in y around inf 49.0%
*-commutative49.0%
Simplified49.0%
if -4.80000000000000039e-305 < x < 1.6500000000000001e-171 or 2.5e-101 < x < 9.4999999999999997e-68 or 1.01999999999999995e-35 < x < 2.2000000000000001e55Initial program 95.6%
associate-+l+95.6%
associate-*l*95.6%
Simplified95.6%
Taylor expanded in t around inf 56.0%
if 9.4999999999999997e-68 < x < 1.01999999999999995e-35Initial program 88.0%
associate-+l+88.0%
associate-*l*99.6%
Simplified99.6%
Taylor expanded in z around inf 76.4%
Taylor expanded in y around 0 75.1%
Final simplification54.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 (+ (* a (* z b)) (* t a)))
(* a (+ t (* z 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 + ((a * (z * b)) + (t * a));
} 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);
double tmp;
if (((t_1 + (t * a)) + ((z * a) * b)) <= Double.POSITIVE_INFINITY) {
tmp = t_1 + ((a * (z * b)) + (t * a));
} else {
tmp = a * (t + (z * 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 + ((a * (z * b)) + (t * a)) else: tmp = a * (t + (z * 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(a * Float64(z * b)) + Float64(t * a))); 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); tmp = 0.0; if (((t_1 + (t * a)) + ((z * a) * b)) <= Inf) tmp = t_1 + ((a * (z * b)) + (t * a)); else tmp = a * (t + (z * 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[(a * N[(z * b), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(t + N[(z * 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(a \cdot \left(z \cdot b\right) + t \cdot a\right)\\
\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 96.9%
associate-+l+96.9%
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%
associate-*l*30.0%
Simplified30.0%
Taylor expanded in a around inf 80.0%
Final simplification97.3%
(FPCore (x y z t a b)
:precision binary64
(if (<= x -6.5e+61)
x
(if (<= x -7.4e-306)
(* y z)
(if (<= x 5.8e-166)
(* t a)
(if (<= x 2e-98) (* y z) (if (<= x 4.8e+53) (* t a) x))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -6.5e+61) {
tmp = x;
} else if (x <= -7.4e-306) {
tmp = y * z;
} else if (x <= 5.8e-166) {
tmp = t * a;
} else if (x <= 2e-98) {
tmp = y * z;
} else if (x <= 4.8e+53) {
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 <= (-6.5d+61)) then
tmp = x
else if (x <= (-7.4d-306)) then
tmp = y * z
else if (x <= 5.8d-166) then
tmp = t * a
else if (x <= 2d-98) then
tmp = y * z
else if (x <= 4.8d+53) 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 <= -6.5e+61) {
tmp = x;
} else if (x <= -7.4e-306) {
tmp = y * z;
} else if (x <= 5.8e-166) {
tmp = t * a;
} else if (x <= 2e-98) {
tmp = y * z;
} else if (x <= 4.8e+53) {
tmp = t * a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -6.5e+61: tmp = x elif x <= -7.4e-306: tmp = y * z elif x <= 5.8e-166: tmp = t * a elif x <= 2e-98: tmp = y * z elif x <= 4.8e+53: tmp = t * a else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -6.5e+61) tmp = x; elseif (x <= -7.4e-306) tmp = Float64(y * z); elseif (x <= 5.8e-166) tmp = Float64(t * a); elseif (x <= 2e-98) tmp = Float64(y * z); elseif (x <= 4.8e+53) 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 <= -6.5e+61) tmp = x; elseif (x <= -7.4e-306) tmp = y * z; elseif (x <= 5.8e-166) tmp = t * a; elseif (x <= 2e-98) tmp = y * z; elseif (x <= 4.8e+53) tmp = t * a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -6.5e+61], x, If[LessEqual[x, -7.4e-306], N[(y * z), $MachinePrecision], If[LessEqual[x, 5.8e-166], N[(t * a), $MachinePrecision], If[LessEqual[x, 2e-98], N[(y * z), $MachinePrecision], If[LessEqual[x, 4.8e+53], N[(t * a), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{+61}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -7.4 \cdot 10^{-306}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-166}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-98}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+53}:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.4999999999999996e61 or 4.8e53 < x Initial program 92.8%
associate-+l+92.8%
associate-*l*96.3%
Simplified96.3%
Taylor expanded in x around inf 56.9%
if -6.4999999999999996e61 < x < -7.400000000000001e-306 or 5.8e-166 < x < 1.99999999999999988e-98Initial program 92.8%
associate-+l+92.8%
associate-*l*93.8%
Simplified93.8%
Taylor expanded in y around inf 49.0%
*-commutative49.0%
Simplified49.0%
if -7.400000000000001e-306 < x < 5.8e-166 or 1.99999999999999988e-98 < x < 4.8e53Initial program 94.5%
associate-+l+94.5%
associate-*l*96.2%
Simplified96.2%
Taylor expanded in t around inf 48.1%
Final simplification52.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -2.6e-16) (not (<= t 3.4e+78))) (+ (+ x (* y z)) (/ a (/ 1.0 t))) (+ x (* z (+ y (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -2.6e-16) || !(t <= 3.4e+78)) {
tmp = (x + (y * z)) + (a / (1.0 / t));
} 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 ((t <= (-2.6d-16)) .or. (.not. (t <= 3.4d+78))) then
tmp = (x + (y * z)) + (a / (1.0d0 / t))
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 ((t <= -2.6e-16) || !(t <= 3.4e+78)) {
tmp = (x + (y * z)) + (a / (1.0 / t));
} else {
tmp = x + (z * (y + (a * b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -2.6e-16) or not (t <= 3.4e+78): tmp = (x + (y * z)) + (a / (1.0 / t)) else: tmp = x + (z * (y + (a * b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -2.6e-16) || !(t <= 3.4e+78)) tmp = Float64(Float64(x + Float64(y * z)) + Float64(a / Float64(1.0 / t))); 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 ((t <= -2.6e-16) || ~((t <= 3.4e+78))) tmp = (x + (y * z)) + (a / (1.0 / t)); else tmp = x + (z * (y + (a * b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -2.6e-16], N[Not[LessEqual[t, 3.4e+78]], $MachinePrecision]], N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(a / N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.6 \cdot 10^{-16} \lor \neg \left(t \leq 3.4 \cdot 10^{+78}\right):\\
\;\;\;\;\left(x + y \cdot z\right) + \frac{a}{\frac{1}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\end{array}
\end{array}
if t < -2.5999999999999998e-16 or 3.40000000000000007e78 < t Initial program 89.6%
associate-+l+89.6%
associate-*l*93.8%
Simplified93.8%
*-commutative93.8%
distribute-lft-in94.7%
flip3-+20.1%
associate-*r/16.0%
fma-def16.0%
distribute-rgt-out--16.0%
Applied egg-rr16.0%
associate-/l*20.2%
*-commutative20.2%
associate-*l*19.2%
*-commutative19.2%
*-commutative19.2%
Simplified19.2%
Taylor expanded in t around inf 88.4%
if -2.5999999999999998e-16 < t < 3.40000000000000007e78Initial program 95.9%
associate-+l+95.9%
associate-*l*96.5%
Simplified96.5%
Taylor expanded in t around 0 89.5%
+-commutative89.5%
+-commutative89.5%
associate-*r*90.8%
distribute-rgt-in92.2%
Simplified92.2%
Final simplification90.5%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -1.4e+35)
(* t a)
(if (<= a 3.2e+97)
(+ x (* y z))
(if (<= a 2.1e+249) (* t a) (* z (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -1.4e+35) {
tmp = t * a;
} else if (a <= 3.2e+97) {
tmp = x + (y * z);
} else if (a <= 2.1e+249) {
tmp = t * a;
} else {
tmp = z * (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 (a <= (-1.4d+35)) then
tmp = t * a
else if (a <= 3.2d+97) then
tmp = x + (y * z)
else if (a <= 2.1d+249) then
tmp = t * a
else
tmp = z * (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 (a <= -1.4e+35) {
tmp = t * a;
} else if (a <= 3.2e+97) {
tmp = x + (y * z);
} else if (a <= 2.1e+249) {
tmp = t * a;
} else {
tmp = z * (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -1.4e+35: tmp = t * a elif a <= 3.2e+97: tmp = x + (y * z) elif a <= 2.1e+249: tmp = t * a else: tmp = z * (a * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -1.4e+35) tmp = Float64(t * a); elseif (a <= 3.2e+97) tmp = Float64(x + Float64(y * z)); elseif (a <= 2.1e+249) tmp = Float64(t * a); else tmp = Float64(z * Float64(a * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -1.4e+35) tmp = t * a; elseif (a <= 3.2e+97) tmp = x + (y * z); elseif (a <= 2.1e+249) tmp = t * a; else tmp = z * (a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -1.4e+35], N[(t * a), $MachinePrecision], If[LessEqual[a, 3.2e+97], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.1e+249], N[(t * a), $MachinePrecision], N[(z * N[(a * b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.4 \cdot 10^{+35}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;a \leq 3.2 \cdot 10^{+97}:\\
\;\;\;\;x + y \cdot z\\
\mathbf{elif}\;a \leq 2.1 \cdot 10^{+249}:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if a < -1.39999999999999999e35 or 3.20000000000000016e97 < a < 2.0999999999999998e249Initial program 82.5%
associate-+l+82.5%
associate-*l*93.0%
Simplified93.0%
Taylor expanded in t around inf 54.5%
if -1.39999999999999999e35 < a < 3.20000000000000016e97Initial program 97.6%
associate-+l+97.6%
associate-*l*95.9%
Simplified95.9%
Taylor expanded in a around 0 75.2%
if 2.0999999999999998e249 < a Initial program 93.7%
associate-+l+93.7%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in z around inf 80.2%
Taylor expanded in y around 0 80.2%
Final simplification69.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* t a))))
(if (<= a -2.6e+29)
t_1
(if (<= a 6.2e+28)
(+ x (* y z))
(if (<= a 5.6e+250) t_1 (* z (* a 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 <= -2.6e+29) {
tmp = t_1;
} else if (a <= 6.2e+28) {
tmp = x + (y * z);
} else if (a <= 5.6e+250) {
tmp = t_1;
} else {
tmp = z * (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) :: t_1
real(8) :: tmp
t_1 = x + (t * a)
if (a <= (-2.6d+29)) then
tmp = t_1
else if (a <= 6.2d+28) then
tmp = x + (y * z)
else if (a <= 5.6d+250) then
tmp = t_1
else
tmp = z * (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 t_1 = x + (t * a);
double tmp;
if (a <= -2.6e+29) {
tmp = t_1;
} else if (a <= 6.2e+28) {
tmp = x + (y * z);
} else if (a <= 5.6e+250) {
tmp = t_1;
} else {
tmp = z * (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (t * a) tmp = 0 if a <= -2.6e+29: tmp = t_1 elif a <= 6.2e+28: tmp = x + (y * z) elif a <= 5.6e+250: tmp = t_1 else: tmp = z * (a * b) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(t * a)) tmp = 0.0 if (a <= -2.6e+29) tmp = t_1; elseif (a <= 6.2e+28) tmp = Float64(x + Float64(y * z)); elseif (a <= 5.6e+250) tmp = t_1; else tmp = Float64(z * Float64(a * 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 <= -2.6e+29) tmp = t_1; elseif (a <= 6.2e+28) tmp = x + (y * z); elseif (a <= 5.6e+250) tmp = t_1; else tmp = z * (a * 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, -2.6e+29], t$95$1, If[LessEqual[a, 6.2e+28], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5.6e+250], t$95$1, N[(z * N[(a * b), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + t \cdot a\\
\mathbf{if}\;a \leq -2.6 \cdot 10^{+29}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 6.2 \cdot 10^{+28}:\\
\;\;\;\;x + y \cdot z\\
\mathbf{elif}\;a \leq 5.6 \cdot 10^{+250}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if a < -2.6e29 or 6.2000000000000001e28 < a < 5.60000000000000019e250Initial program 84.9%
associate-+l+84.9%
associate-*l*94.4%
Simplified94.4%
Taylor expanded in z around 0 59.1%
+-commutative59.1%
Simplified59.1%
if -2.6e29 < a < 6.2000000000000001e28Initial program 98.0%
associate-+l+98.0%
associate-*l*95.4%
Simplified95.4%
Taylor expanded in a around 0 77.6%
if 5.60000000000000019e250 < a Initial program 93.7%
associate-+l+93.7%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in z around inf 80.2%
Taylor expanded in y around 0 80.2%
Final simplification71.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -1.6e+42) (not (<= a 2.2e+50))) (* a (+ t (* z b))) (+ x (* z (+ y (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1.6e+42) || !(a <= 2.2e+50)) {
tmp = a * (t + (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 ((a <= (-1.6d+42)) .or. (.not. (a <= 2.2d+50))) then
tmp = a * (t + (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 ((a <= -1.6e+42) || !(a <= 2.2e+50)) {
tmp = a * (t + (z * b));
} else {
tmp = x + (z * (y + (a * b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -1.6e+42) or not (a <= 2.2e+50): tmp = a * (t + (z * b)) else: tmp = x + (z * (y + (a * b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1.6e+42) || !(a <= 2.2e+50)) tmp = Float64(a * Float64(t + 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 ((a <= -1.6e+42) || ~((a <= 2.2e+50))) tmp = a * (t + (z * b)); else tmp = x + (z * (y + (a * b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1.6e+42], N[Not[LessEqual[a, 2.2e+50]], $MachinePrecision]], N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.6 \cdot 10^{+42} \lor \neg \left(a \leq 2.2 \cdot 10^{+50}\right):\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\end{array}
\end{array}
if a < -1.60000000000000001e42 or 2.20000000000000017e50 < a Initial program 85.2%
associate-+l+85.2%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in a around inf 87.5%
if -1.60000000000000001e42 < a < 2.20000000000000017e50Initial program 98.1%
associate-+l+98.1%
associate-*l*95.6%
Simplified95.6%
Taylor expanded in t around 0 85.7%
+-commutative85.7%
+-commutative85.7%
associate-*r*88.1%
distribute-rgt-in89.4%
Simplified89.4%
Final simplification88.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -1.1e+39) (not (<= a 1.1e+60))) (* 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 <= -1.1e+39) || !(a <= 1.1e+60)) {
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 <= (-1.1d+39)) .or. (.not. (a <= 1.1d+60))) 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 <= -1.1e+39) || !(a <= 1.1e+60)) {
tmp = a * (t + (z * b));
} else {
tmp = x + (y * z);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -1.1e+39) or not (a <= 1.1e+60): 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 <= -1.1e+39) || !(a <= 1.1e+60)) 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 <= -1.1e+39) || ~((a <= 1.1e+60))) 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, -1.1e+39], N[Not[LessEqual[a, 1.1e+60]], $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 -1.1 \cdot 10^{+39} \lor \neg \left(a \leq 1.1 \cdot 10^{+60}\right):\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot z\\
\end{array}
\end{array}
if a < -1.1000000000000001e39 or 1.09999999999999998e60 < a Initial program 85.2%
associate-+l+85.2%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in a around inf 87.5%
if -1.1000000000000001e39 < a < 1.09999999999999998e60Initial program 98.1%
associate-+l+98.1%
associate-*l*95.6%
Simplified95.6%
Taylor expanded in a around 0 77.7%
Final simplification81.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -8.2e+32) (not (<= a 8e+46))) (* t a) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -8.2e+32) || !(a <= 8e+46)) {
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 ((a <= (-8.2d+32)) .or. (.not. (a <= 8d+46))) 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 ((a <= -8.2e+32) || !(a <= 8e+46)) {
tmp = t * a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -8.2e+32) or not (a <= 8e+46): tmp = t * a else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -8.2e+32) || !(a <= 8e+46)) 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 ((a <= -8.2e+32) || ~((a <= 8e+46))) tmp = t * a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -8.2e+32], N[Not[LessEqual[a, 8e+46]], $MachinePrecision]], N[(t * a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.2 \cdot 10^{+32} \lor \neg \left(a \leq 8 \cdot 10^{+46}\right):\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -8.19999999999999961e32 or 7.9999999999999999e46 < a Initial program 85.2%
associate-+l+85.2%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in t around inf 47.6%
if -8.19999999999999961e32 < a < 7.9999999999999999e46Initial program 98.1%
associate-+l+98.1%
associate-*l*95.6%
Simplified95.6%
Taylor expanded in x around inf 43.1%
Final simplification44.8%
(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 93.1%
associate-+l+93.1%
associate-*l*95.3%
Simplified95.3%
Taylor expanded in x around inf 29.4%
Final simplification29.4%
(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 2024018
(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)))