
(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 10 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
(if (<= a -5e+109)
(+ x (* a (+ t (* z b))))
(if (or (<= a -1.35e-113) (not (<= a 1.75e-221)))
(+ (+ (* a (* z b)) (* t a)) (+ x (* y z)))
(+ x (* z (+ y (* a b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -5e+109) {
tmp = x + (a * (t + (z * b)));
} else if ((a <= -1.35e-113) || !(a <= 1.75e-221)) {
tmp = ((a * (z * b)) + (t * a)) + (x + (y * z));
} 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 <= (-5d+109)) then
tmp = x + (a * (t + (z * b)))
else if ((a <= (-1.35d-113)) .or. (.not. (a <= 1.75d-221))) then
tmp = ((a * (z * b)) + (t * a)) + (x + (y * z))
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 <= -5e+109) {
tmp = x + (a * (t + (z * b)));
} else if ((a <= -1.35e-113) || !(a <= 1.75e-221)) {
tmp = ((a * (z * b)) + (t * a)) + (x + (y * z));
} else {
tmp = x + (z * (y + (a * b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -5e+109: tmp = x + (a * (t + (z * b))) elif (a <= -1.35e-113) or not (a <= 1.75e-221): tmp = ((a * (z * b)) + (t * a)) + (x + (y * z)) else: tmp = x + (z * (y + (a * b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -5e+109) tmp = Float64(x + Float64(a * Float64(t + Float64(z * b)))); elseif ((a <= -1.35e-113) || !(a <= 1.75e-221)) tmp = Float64(Float64(Float64(a * Float64(z * b)) + Float64(t * a)) + Float64(x + Float64(y * z))); 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 <= -5e+109) tmp = x + (a * (t + (z * b))); elseif ((a <= -1.35e-113) || ~((a <= 1.75e-221))) tmp = ((a * (z * b)) + (t * a)) + (x + (y * z)); else tmp = x + (z * (y + (a * b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -5e+109], N[(x + N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[a, -1.35e-113], N[Not[LessEqual[a, 1.75e-221]], $MachinePrecision]], N[(N[(N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(x + N[(y * z), $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 -5 \cdot 10^{+109}:\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\mathbf{elif}\;a \leq -1.35 \cdot 10^{-113} \lor \neg \left(a \leq 1.75 \cdot 10^{-221}\right):\\
\;\;\;\;\left(a \cdot \left(z \cdot b\right) + t \cdot a\right) + \left(x + y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\end{array}
\end{array}
if a < -5.0000000000000001e109Initial program 66.8%
associate-+l+66.8%
+-commutative66.8%
fma-define66.8%
associate-*l*77.7%
*-commutative77.7%
*-commutative77.7%
distribute-rgt-out88.8%
remove-double-neg88.8%
*-commutative88.8%
distribute-lft-neg-out88.8%
sub-neg88.8%
sub-neg88.8%
distribute-lft-neg-out88.8%
*-commutative88.8%
remove-double-neg88.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in y around 0 94.4%
if -5.0000000000000001e109 < a < -1.34999999999999998e-113 or 1.7499999999999999e-221 < a Initial program 96.7%
associate-+l+96.7%
associate-*l*98.0%
Simplified98.0%
if -1.34999999999999998e-113 < a < 1.7499999999999999e-221Initial program 98.6%
associate-+l+98.6%
associate-*l*85.6%
Simplified85.6%
Taylor expanded in t around 0 84.2%
associate-*r*98.6%
distribute-rgt-in98.5%
+-commutative98.5%
Simplified98.5%
Final simplification97.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (+ (* t a) (+ x (* y z))) (* (* z a) b)))) (if (<= t_1 INFINITY) t_1 (+ x (* a (+ t (* z b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t * a) + (x + (y * z))) + ((z * a) * b);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = x + (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 = ((t * a) + (x + (y * z))) + ((z * a) * b);
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = x + (a * (t + (z * b)));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((t * a) + (x + (y * z))) + ((z * a) * b) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = x + (a * (t + (z * b))) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(t * a) + Float64(x + Float64(y * z))) + Float64(Float64(z * a) * b)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(x + Float64(a * Float64(t + Float64(z * b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((t * a) + (x + (y * z))) + ((z * a) * b); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = x + (a * (t + (z * b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t * a), $MachinePrecision] + N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(x + N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t \cdot a + \left(x + y \cdot z\right)\right) + \left(z \cdot a\right) \cdot b\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + 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 97.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%
+-commutative0.0%
fma-define0.0%
associate-*l*8.3%
*-commutative8.3%
*-commutative8.3%
distribute-rgt-out50.0%
remove-double-neg50.0%
*-commutative50.0%
distribute-lft-neg-out50.0%
sub-neg50.0%
sub-neg50.0%
distribute-lft-neg-out50.0%
*-commutative50.0%
remove-double-neg50.0%
*-commutative50.0%
Simplified50.0%
Taylor expanded in y around 0 83.3%
Final simplification96.9%
(FPCore (x y z t a b)
:precision binary64
(if (<= x -4.6e+121)
(+ x (+ (* t a) (* y z)))
(if (<= x 7.2e+128)
(+ (* a (+ t (* z b))) (* z (+ y (/ x z))))
(+ x (* z (+ y (* a b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -4.6e+121) {
tmp = x + ((t * a) + (y * z));
} else if (x <= 7.2e+128) {
tmp = (a * (t + (z * b))) + (z * (y + (x / z)));
} 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 (x <= (-4.6d+121)) then
tmp = x + ((t * a) + (y * z))
else if (x <= 7.2d+128) then
tmp = (a * (t + (z * b))) + (z * (y + (x / z)))
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 (x <= -4.6e+121) {
tmp = x + ((t * a) + (y * z));
} else if (x <= 7.2e+128) {
tmp = (a * (t + (z * b))) + (z * (y + (x / z)));
} else {
tmp = x + (z * (y + (a * b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -4.6e+121: tmp = x + ((t * a) + (y * z)) elif x <= 7.2e+128: tmp = (a * (t + (z * b))) + (z * (y + (x / z))) else: tmp = x + (z * (y + (a * b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -4.6e+121) tmp = Float64(x + Float64(Float64(t * a) + Float64(y * z))); elseif (x <= 7.2e+128) tmp = Float64(Float64(a * Float64(t + Float64(z * b))) + Float64(z * Float64(y + Float64(x / z)))); 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 (x <= -4.6e+121) tmp = x + ((t * a) + (y * z)); elseif (x <= 7.2e+128) tmp = (a * (t + (z * b))) + (z * (y + (x / z))); else tmp = x + (z * (y + (a * b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -4.6e+121], N[(x + N[(N[(t * a), $MachinePrecision] + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.2e+128], N[(N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z * N[(y + N[(x / z), $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}\;x \leq -4.6 \cdot 10^{+121}:\\
\;\;\;\;x + \left(t \cdot a + y \cdot z\right)\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{+128}:\\
\;\;\;\;a \cdot \left(t + z \cdot b\right) + z \cdot \left(y + \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\end{array}
\end{array}
if x < -4.5999999999999997e121Initial program 94.1%
associate-+l+94.1%
associate-*l*94.1%
Simplified94.1%
Taylor expanded in b around 0 91.5%
if -4.5999999999999997e121 < x < 7.20000000000000054e128Initial program 92.8%
associate-+l+92.8%
+-commutative92.8%
fma-define92.8%
associate-*l*93.3%
*-commutative93.3%
*-commutative93.3%
distribute-rgt-out96.1%
remove-double-neg96.1%
*-commutative96.1%
distribute-lft-neg-out96.1%
sub-neg96.1%
sub-neg96.1%
distribute-lft-neg-out96.1%
*-commutative96.1%
remove-double-neg96.1%
*-commutative96.1%
Simplified96.1%
Taylor expanded in z around inf 95.0%
if 7.20000000000000054e128 < x Initial program 93.0%
associate-+l+93.0%
associate-*l*84.0%
Simplified84.0%
Taylor expanded in t around 0 68.7%
associate-*r*77.9%
distribute-rgt-in82.6%
+-commutative82.6%
Simplified82.6%
Final simplification92.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* t a))))
(if (<= a -2.3e+30)
t_1
(if (<= a 8.2e+37)
(+ x (* y z))
(if (<= a 1.35e+239) t_1 (* z (+ y (* 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.3e+30) {
tmp = t_1;
} else if (a <= 8.2e+37) {
tmp = x + (y * z);
} else if (a <= 1.35e+239) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x + (t * a)
if (a <= (-2.3d+30)) then
tmp = t_1
else if (a <= 8.2d+37) then
tmp = x + (y * z)
else if (a <= 1.35d+239) then
tmp = t_1
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 t_1 = x + (t * a);
double tmp;
if (a <= -2.3e+30) {
tmp = t_1;
} else if (a <= 8.2e+37) {
tmp = x + (y * z);
} else if (a <= 1.35e+239) {
tmp = t_1;
} else {
tmp = z * (y + (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (t * a) tmp = 0 if a <= -2.3e+30: tmp = t_1 elif a <= 8.2e+37: tmp = x + (y * z) elif a <= 1.35e+239: tmp = t_1 else: tmp = z * (y + (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.3e+30) tmp = t_1; elseif (a <= 8.2e+37) tmp = Float64(x + Float64(y * z)); elseif (a <= 1.35e+239) tmp = t_1; 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 + (t * a); tmp = 0.0; if (a <= -2.3e+30) tmp = t_1; elseif (a <= 8.2e+37) tmp = x + (y * z); elseif (a <= 1.35e+239) tmp = t_1; 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[(t * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2.3e+30], t$95$1, If[LessEqual[a, 8.2e+37], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.35e+239], t$95$1, N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + t \cdot a\\
\mathbf{if}\;a \leq -2.3 \cdot 10^{+30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 8.2 \cdot 10^{+37}:\\
\;\;\;\;x + y \cdot z\\
\mathbf{elif}\;a \leq 1.35 \cdot 10^{+239}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\end{array}
\end{array}
if a < -2.3e30 or 8.1999999999999996e37 < a < 1.3499999999999999e239Initial program 84.1%
associate-+l+84.1%
associate-*l*89.3%
Simplified89.3%
Taylor expanded in z around 0 67.1%
if -2.3e30 < a < 8.1999999999999996e37Initial program 98.6%
associate-+l+98.6%
associate-*l*92.8%
Simplified92.8%
Taylor expanded in b around 0 88.5%
Taylor expanded in a around 0 80.2%
*-commutative80.2%
Simplified80.2%
if 1.3499999999999999e239 < a Initial program 92.9%
associate-+l+92.9%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in z around inf 75.2%
Final simplification75.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* t a))))
(if (<= a -2.25e+30)
t_1
(if (<= a 4.1e+37)
(+ x (* y z))
(if (<= a 1.8e+238) 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.25e+30) {
tmp = t_1;
} else if (a <= 4.1e+37) {
tmp = x + (y * z);
} else if (a <= 1.8e+238) {
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.25d+30)) then
tmp = t_1
else if (a <= 4.1d+37) then
tmp = x + (y * z)
else if (a <= 1.8d+238) 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.25e+30) {
tmp = t_1;
} else if (a <= 4.1e+37) {
tmp = x + (y * z);
} else if (a <= 1.8e+238) {
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.25e+30: tmp = t_1 elif a <= 4.1e+37: tmp = x + (y * z) elif a <= 1.8e+238: 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.25e+30) tmp = t_1; elseif (a <= 4.1e+37) tmp = Float64(x + Float64(y * z)); elseif (a <= 1.8e+238) 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.25e+30) tmp = t_1; elseif (a <= 4.1e+37) tmp = x + (y * z); elseif (a <= 1.8e+238) 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.25e+30], t$95$1, If[LessEqual[a, 4.1e+37], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.8e+238], 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.25 \cdot 10^{+30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 4.1 \cdot 10^{+37}:\\
\;\;\;\;x + y \cdot z\\
\mathbf{elif}\;a \leq 1.8 \cdot 10^{+238}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if a < -2.24999999999999997e30 or 4.0999999999999998e37 < a < 1.79999999999999986e238Initial program 84.1%
associate-+l+84.1%
associate-*l*89.3%
Simplified89.3%
Taylor expanded in z around 0 67.1%
if -2.24999999999999997e30 < a < 4.0999999999999998e37Initial program 98.6%
associate-+l+98.6%
associate-*l*92.8%
Simplified92.8%
Taylor expanded in b around 0 88.5%
Taylor expanded in a around 0 80.2%
*-commutative80.2%
Simplified80.2%
if 1.79999999999999986e238 < a Initial program 92.9%
associate-+l+92.9%
associate-*l*100.0%
Simplified100.0%
add-cube-cbrt100.0%
pow3100.0%
associate-*r*92.9%
*-commutative92.9%
associate-*l*100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 75.2%
+-commutative75.2%
Simplified75.2%
Taylor expanded in a around inf 60.3%
associate-*r*60.4%
*-commutative60.4%
Simplified60.4%
Final simplification74.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -7.6e+31) (not (<= a 3.5e+37))) (+ x (* 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 <= -7.6e+31) || !(a <= 3.5e+37)) {
tmp = x + (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 <= (-7.6d+31)) .or. (.not. (a <= 3.5d+37))) then
tmp = x + (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 <= -7.6e+31) || !(a <= 3.5e+37)) {
tmp = x + (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 <= -7.6e+31) or not (a <= 3.5e+37): tmp = x + (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 <= -7.6e+31) || !(a <= 3.5e+37)) tmp = Float64(x + 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 <= -7.6e+31) || ~((a <= 3.5e+37))) tmp = x + (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, -7.6e+31], N[Not[LessEqual[a, 3.5e+37]], $MachinePrecision]], N[(x + N[(a * N[(t + 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}\;a \leq -7.6 \cdot 10^{+31} \lor \neg \left(a \leq 3.5 \cdot 10^{+37}\right):\\
\;\;\;\;x + 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 < -7.6000000000000003e31 or 3.5e37 < a Initial program 85.2%
associate-+l+85.2%
+-commutative85.2%
fma-define85.2%
associate-*l*90.6%
*-commutative90.6%
*-commutative90.6%
distribute-rgt-out95.3%
remove-double-neg95.3%
*-commutative95.3%
distribute-lft-neg-out95.3%
sub-neg95.3%
sub-neg95.3%
distribute-lft-neg-out95.3%
*-commutative95.3%
remove-double-neg95.3%
*-commutative95.3%
Simplified95.3%
Taylor expanded in y around 0 91.8%
if -7.6000000000000003e31 < a < 3.5e37Initial program 98.6%
associate-+l+98.6%
associate-*l*92.8%
Simplified92.8%
Taylor expanded in t around 0 84.5%
associate-*r*91.0%
distribute-rgt-in91.6%
+-commutative91.6%
Simplified91.6%
Final simplification91.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -25000000000000.0) (not (<= a 3.8e+37))) (+ 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 <= -25000000000000.0) || !(a <= 3.8e+37)) {
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 <= (-25000000000000.0d0)) .or. (.not. (a <= 3.8d+37))) 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 <= -25000000000000.0) || !(a <= 3.8e+37)) {
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 <= -25000000000000.0) or not (a <= 3.8e+37): 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 <= -25000000000000.0) || !(a <= 3.8e+37)) 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 <= -25000000000000.0) || ~((a <= 3.8e+37))) 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, -25000000000000.0], N[Not[LessEqual[a, 3.8e+37]], $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 -25000000000000 \lor \neg \left(a \leq 3.8 \cdot 10^{+37}\right):\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot z\\
\end{array}
\end{array}
if a < -2.5e13 or 3.7999999999999999e37 < a Initial program 85.9%
associate-+l+85.9%
+-commutative85.9%
fma-define85.9%
associate-*l*91.0%
*-commutative91.0%
*-commutative91.0%
distribute-rgt-out95.5%
remove-double-neg95.5%
*-commutative95.5%
distribute-lft-neg-out95.5%
sub-neg95.5%
sub-neg95.5%
distribute-lft-neg-out95.5%
*-commutative95.5%
remove-double-neg95.5%
*-commutative95.5%
Simplified95.5%
Taylor expanded in y around 0 92.1%
if -2.5e13 < a < 3.7999999999999999e37Initial program 98.6%
associate-+l+98.6%
associate-*l*92.6%
Simplified92.6%
Taylor expanded in b around 0 89.5%
Taylor expanded in a around 0 80.9%
*-commutative80.9%
Simplified80.9%
Final simplification85.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.45e+54) (not (<= y 6.6e+21))) (* y z) (+ x (* t a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.45e+54) || !(y <= 6.6e+21)) {
tmp = 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 ((y <= (-2.45d+54)) .or. (.not. (y <= 6.6d+21))) then
tmp = 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 ((y <= -2.45e+54) || !(y <= 6.6e+21)) {
tmp = y * z;
} else {
tmp = x + (t * a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -2.45e+54) or not (y <= 6.6e+21): tmp = y * z else: tmp = x + (t * a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.45e+54) || !(y <= 6.6e+21)) tmp = 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 ((y <= -2.45e+54) || ~((y <= 6.6e+21))) tmp = y * z; else tmp = x + (t * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.45e+54], N[Not[LessEqual[y, 6.6e+21]], $MachinePrecision]], N[(y * z), $MachinePrecision], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.45 \cdot 10^{+54} \lor \neg \left(y \leq 6.6 \cdot 10^{+21}\right):\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot a\\
\end{array}
\end{array}
if y < -2.45e54 or 6.6e21 < y Initial program 92.6%
associate-+l+92.6%
associate-*l*89.3%
Simplified89.3%
add-cube-cbrt89.2%
pow389.2%
associate-*r*92.5%
*-commutative92.5%
associate-*l*91.8%
Applied egg-rr91.8%
Taylor expanded in z around inf 70.1%
+-commutative70.1%
Simplified70.1%
Taylor expanded in a around 0 58.4%
*-commutative58.4%
Simplified58.4%
if -2.45e54 < y < 6.6e21Initial program 93.4%
associate-+l+93.4%
associate-*l*94.3%
Simplified94.3%
Taylor expanded in z around 0 67.0%
Final simplification62.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1e+21) (not (<= y 19000000000000.0))) (* y z) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1e+21) || !(y <= 19000000000000.0)) {
tmp = y * z;
} 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 ((y <= (-1d+21)) .or. (.not. (y <= 19000000000000.0d0))) then
tmp = y * z
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 ((y <= -1e+21) || !(y <= 19000000000000.0)) {
tmp = y * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1e+21) or not (y <= 19000000000000.0): tmp = y * z else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1e+21) || !(y <= 19000000000000.0)) tmp = Float64(y * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1e+21) || ~((y <= 19000000000000.0))) tmp = y * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1e+21], N[Not[LessEqual[y, 19000000000000.0]], $MachinePrecision]], N[(y * z), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+21} \lor \neg \left(y \leq 19000000000000\right):\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1e21 or 1.9e13 < y Initial program 92.4%
associate-+l+92.4%
associate-*l*90.0%
Simplified90.0%
add-cube-cbrt90.0%
pow390.0%
associate-*r*92.3%
*-commutative92.3%
associate-*l*92.4%
Applied egg-rr92.4%
Taylor expanded in z around inf 69.2%
+-commutative69.2%
Simplified69.2%
Taylor expanded in a around 0 55.5%
*-commutative55.5%
Simplified55.5%
if -1e21 < y < 1.9e13Initial program 93.7%
associate-+l+93.7%
associate-*l*93.9%
Simplified93.9%
Taylor expanded in z around 0 68.5%
Taylor expanded in x around inf 33.7%
Final simplification44.7%
(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.0%
associate-+l+93.0%
associate-*l*91.9%
Simplified91.9%
Taylor expanded in z around 0 50.1%
Taylor expanded in x around inf 24.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 2024181
(FPCore (x y z t a b)
:name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
:precision binary64
:alt
(! :herbie-platform default (if (< z -11820553527347888000) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 47589743188364287/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a))))))
(+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))