
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x + (y * z)) + (t * a)) + ((a * z) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
def code(x, y, z, t, a, b): return ((x + (y * z)) + (t * a)) + ((a * z) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x + (y * z)) + (t * a)) + ((a * z) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x + (y * z)) + (t * a)) + ((a * z) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
def code(x, y, z, t, a, b): return ((x + (y * z)) + (t * a)) + ((a * z) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x + (y * z)) + (t * a)) + ((a * z) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\end{array}
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2e+30) (not (<= z 4.2e-18))) (* z (+ y (+ (/ x z) (* a (+ b (/ t z)))))) (+ (+ (* a (* z b)) (* t a)) (+ x (* y z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2e+30) || !(z <= 4.2e-18)) {
tmp = z * (y + ((x / z) + (a * (b + (t / z)))));
} else {
tmp = ((a * (z * b)) + (t * a)) + (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 ((z <= (-2d+30)) .or. (.not. (z <= 4.2d-18))) then
tmp = z * (y + ((x / z) + (a * (b + (t / z)))))
else
tmp = ((a * (z * b)) + (t * a)) + (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 ((z <= -2e+30) || !(z <= 4.2e-18)) {
tmp = z * (y + ((x / z) + (a * (b + (t / z)))));
} else {
tmp = ((a * (z * b)) + (t * a)) + (x + (y * z));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -2e+30) or not (z <= 4.2e-18): tmp = z * (y + ((x / z) + (a * (b + (t / z))))) else: tmp = ((a * (z * b)) + (t * a)) + (x + (y * z)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2e+30) || !(z <= 4.2e-18)) tmp = Float64(z * Float64(y + Float64(Float64(x / z) + Float64(a * Float64(b + Float64(t / z)))))); else tmp = Float64(Float64(Float64(a * Float64(z * b)) + Float64(t * a)) + Float64(x + Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -2e+30) || ~((z <= 4.2e-18))) tmp = z * (y + ((x / z) + (a * (b + (t / z))))); else tmp = ((a * (z * b)) + (t * a)) + (x + (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2e+30], N[Not[LessEqual[z, 4.2e-18]], $MachinePrecision]], N[(z * N[(y + N[(N[(x / z), $MachinePrecision] + N[(a * N[(b + N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+30} \lor \neg \left(z \leq 4.2 \cdot 10^{-18}\right):\\
\;\;\;\;z \cdot \left(y + \left(\frac{x}{z} + a \cdot \left(b + \frac{t}{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot \left(z \cdot b\right) + t \cdot a\right) + \left(x + y \cdot z\right)\\
\end{array}
\end{array}
if z < -2e30 or 4.19999999999999999e-18 < z Initial program 84.4%
associate-+l+84.4%
associate-*l*85.5%
Simplified85.5%
Taylor expanded in z around inf 98.3%
+-commutative98.3%
associate-+l+98.3%
+-commutative98.3%
associate-/l*99.9%
distribute-lft-out99.9%
Simplified99.9%
if -2e30 < z < 4.19999999999999999e-18Initial program 99.3%
associate-+l+99.3%
associate-*l*100.0%
Simplified100.0%
Final simplification99.9%
(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 (* z (+ y (+ (/ x z) (* a (+ b (/ t z)))))))))
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 = z * (y + ((x / z) + (a * (b + (t / z)))));
}
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 = z * (y + ((x / z) + (a * (b + (t / z)))));
}
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 = z * (y + ((x / z) + (a * (b + (t / z))))) 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(z * Float64(y + Float64(Float64(x / z) + Float64(a * Float64(b + Float64(t / z)))))); 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 = z * (y + ((x / z) + (a * (b + (t / z))))); 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[(z * N[(y + N[(N[(x / z), $MachinePrecision] + N[(a * N[(b + N[(t / z), $MachinePrecision]), $MachinePrecision]), $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}:\\
\;\;\;\;z \cdot \left(y + \left(\frac{x}{z} + a \cdot \left(b + \frac{t}{z}\right)\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < +inf.0Initial program 98.8%
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*47.1%
Simplified47.1%
Taylor expanded in z around inf 88.2%
+-commutative88.2%
associate-+l+88.2%
+-commutative88.2%
associate-/l*100.0%
distribute-lft-out100.0%
Simplified100.0%
Final simplification98.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -6.1e-43) (not (<= z 4.6e-170))) (* z (+ y (+ (/ x z) (* a (+ b (/ t z)))))) (+ x (+ (* y z) (* t a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -6.1e-43) || !(z <= 4.6e-170)) {
tmp = z * (y + ((x / z) + (a * (b + (t / z)))));
} 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 ((z <= (-6.1d-43)) .or. (.not. (z <= 4.6d-170))) then
tmp = z * (y + ((x / z) + (a * (b + (t / z)))))
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 ((z <= -6.1e-43) || !(z <= 4.6e-170)) {
tmp = z * (y + ((x / z) + (a * (b + (t / z)))));
} else {
tmp = x + ((y * z) + (t * a));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -6.1e-43) or not (z <= 4.6e-170): tmp = z * (y + ((x / z) + (a * (b + (t / z))))) else: tmp = x + ((y * z) + (t * a)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -6.1e-43) || !(z <= 4.6e-170)) tmp = Float64(z * Float64(y + Float64(Float64(x / z) + Float64(a * Float64(b + Float64(t / z)))))); 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 ((z <= -6.1e-43) || ~((z <= 4.6e-170))) tmp = z * (y + ((x / z) + (a * (b + (t / z))))); else tmp = x + ((y * z) + (t * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -6.1e-43], N[Not[LessEqual[z, 4.6e-170]], $MachinePrecision]], N[(z * N[(y + N[(N[(x / z), $MachinePrecision] + N[(a * N[(b + N[(t / z), $MachinePrecision]), $MachinePrecision]), $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}\;z \leq -6.1 \cdot 10^{-43} \lor \neg \left(z \leq 4.6 \cdot 10^{-170}\right):\\
\;\;\;\;z \cdot \left(y + \left(\frac{x}{z} + a \cdot \left(b + \frac{t}{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y \cdot z + t \cdot a\right)\\
\end{array}
\end{array}
if z < -6.10000000000000037e-43 or 4.59999999999999974e-170 < z Initial program 88.3%
associate-+l+88.3%
associate-*l*89.1%
Simplified89.1%
Taylor expanded in z around inf 95.7%
+-commutative95.7%
associate-+l+95.7%
+-commutative95.7%
associate-/l*96.9%
distribute-lft-out96.9%
Simplified96.9%
if -6.10000000000000037e-43 < z < 4.59999999999999974e-170Initial program 99.0%
associate-+l+99.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in b around 0 91.4%
Final simplification94.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -7.9e+59) (not (<= y 1.8e+16))) (+ x (+ (* y z) (* t a))) (+ x (* a (+ t (* z b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -7.9e+59) || !(y <= 1.8e+16)) {
tmp = x + ((y * z) + (t * a));
} else {
tmp = x + (a * (t + (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 ((y <= (-7.9d+59)) .or. (.not. (y <= 1.8d+16))) then
tmp = x + ((y * z) + (t * a))
else
tmp = x + (a * (t + (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 ((y <= -7.9e+59) || !(y <= 1.8e+16)) {
tmp = x + ((y * z) + (t * a));
} else {
tmp = x + (a * (t + (z * b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -7.9e+59) or not (y <= 1.8e+16): tmp = x + ((y * z) + (t * a)) else: tmp = x + (a * (t + (z * b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -7.9e+59) || !(y <= 1.8e+16)) tmp = Float64(x + Float64(Float64(y * z) + Float64(t * a))); 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) tmp = 0.0; if ((y <= -7.9e+59) || ~((y <= 1.8e+16))) tmp = x + ((y * z) + (t * a)); else tmp = x + (a * (t + (z * b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -7.9e+59], N[Not[LessEqual[y, 1.8e+16]], $MachinePrecision]], N[(x + N[(N[(y * z), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.9 \cdot 10^{+59} \lor \neg \left(y \leq 1.8 \cdot 10^{+16}\right):\\
\;\;\;\;x + \left(y \cdot z + t \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\end{array}
\end{array}
if y < -7.9000000000000001e59 or 1.8e16 < y Initial program 87.2%
associate-+l+87.2%
associate-*l*92.1%
Simplified92.1%
Taylor expanded in b around 0 92.9%
if -7.9000000000000001e59 < y < 1.8e16Initial program 95.5%
associate-+l+95.5%
+-commutative95.5%
fma-define95.5%
associate-*l*93.7%
*-commutative93.7%
*-commutative93.7%
distribute-rgt-out94.4%
*-commutative94.4%
Simplified94.4%
Taylor expanded in y around 0 88.4%
Final simplification90.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -1.15e-75) (not (<= a 2.65e-21))) (+ 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 <= -1.15e-75) || !(a <= 2.65e-21)) {
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 <= (-1.15d-75)) .or. (.not. (a <= 2.65d-21))) 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 <= -1.15e-75) || !(a <= 2.65e-21)) {
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 <= -1.15e-75) or not (a <= 2.65e-21): 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 <= -1.15e-75) || !(a <= 2.65e-21)) 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 <= -1.15e-75) || ~((a <= 2.65e-21))) 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, -1.15e-75], N[Not[LessEqual[a, 2.65e-21]], $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 -1.15 \cdot 10^{-75} \lor \neg \left(a \leq 2.65 \cdot 10^{-21}\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 < -1.15e-75 or 2.65e-21 < a Initial program 87.7%
associate-+l+87.7%
+-commutative87.7%
fma-define87.7%
associate-*l*94.5%
*-commutative94.5%
*-commutative94.5%
distribute-rgt-out95.1%
*-commutative95.1%
Simplified95.1%
Taylor expanded in y around 0 88.1%
if -1.15e-75 < a < 2.65e-21Initial program 98.2%
associate-+l+98.2%
associate-*l*91.2%
Simplified91.2%
Taylor expanded in t around 0 82.5%
associate-*r*90.3%
distribute-rgt-in91.2%
+-commutative91.2%
Simplified91.2%
Final simplification89.4%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1.8e+82) (+ (* y z) (* t a)) (if (<= y 2.2e+152) (+ 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 (y <= -1.8e+82) {
tmp = (y * z) + (t * a);
} else if (y <= 2.2e+152) {
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 (y <= (-1.8d+82)) then
tmp = (y * z) + (t * a)
else if (y <= 2.2d+152) 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 (y <= -1.8e+82) {
tmp = (y * z) + (t * a);
} else if (y <= 2.2e+152) {
tmp = x + (a * (t + (z * b)));
} else {
tmp = x + (y * z);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1.8e+82: tmp = (y * z) + (t * a) elif y <= 2.2e+152: 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 (y <= -1.8e+82) tmp = Float64(Float64(y * z) + Float64(t * a)); elseif (y <= 2.2e+152) 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 (y <= -1.8e+82) tmp = (y * z) + (t * a); elseif (y <= 2.2e+152) tmp = x + (a * (t + (z * b))); else tmp = x + (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.8e+82], N[(N[(y * z), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.2e+152], 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}\;y \leq -1.8 \cdot 10^{+82}:\\
\;\;\;\;y \cdot z + t \cdot a\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+152}:\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot z\\
\end{array}
\end{array}
if y < -1.80000000000000007e82Initial program 88.1%
associate-+l+88.1%
associate-*l*94.0%
Simplified94.0%
Taylor expanded in b around 0 92.1%
Taylor expanded in x around 0 80.4%
if -1.80000000000000007e82 < y < 2.1999999999999998e152Initial program 94.4%
associate-+l+94.4%
+-commutative94.4%
fma-define94.4%
associate-*l*93.4%
*-commutative93.4%
*-commutative93.4%
distribute-rgt-out94.0%
*-commutative94.0%
Simplified94.0%
Taylor expanded in y around 0 86.6%
if 2.1999999999999998e152 < y Initial program 85.7%
associate-+l+85.7%
associate-*l*89.3%
Simplified89.3%
Taylor expanded in b around 0 95.7%
Taylor expanded in a around 0 86.2%
*-commutative86.2%
Simplified86.2%
Final simplification85.4%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.1e+34) (* t a) (if (<= t 2.2e-136) (* a (* z b)) (if (<= t 1.95e+40) x (* t a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.1e+34) {
tmp = t * a;
} else if (t <= 2.2e-136) {
tmp = a * (z * b);
} else if (t <= 1.95e+40) {
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 (t <= (-1.1d+34)) then
tmp = t * a
else if (t <= 2.2d-136) then
tmp = a * (z * b)
else if (t <= 1.95d+40) 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 (t <= -1.1e+34) {
tmp = t * a;
} else if (t <= 2.2e-136) {
tmp = a * (z * b);
} else if (t <= 1.95e+40) {
tmp = x;
} else {
tmp = t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.1e+34: tmp = t * a elif t <= 2.2e-136: tmp = a * (z * b) elif t <= 1.95e+40: tmp = x else: tmp = t * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.1e+34) tmp = Float64(t * a); elseif (t <= 2.2e-136) tmp = Float64(a * Float64(z * b)); elseif (t <= 1.95e+40) 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 (t <= -1.1e+34) tmp = t * a; elseif (t <= 2.2e-136) tmp = a * (z * b); elseif (t <= 1.95e+40) tmp = x; else tmp = t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.1e+34], N[(t * a), $MachinePrecision], If[LessEqual[t, 2.2e-136], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.95e+40], x, N[(t * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{+34}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{-136}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{+40}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\end{array}
if t < -1.1000000000000001e34 or 1.95e40 < t Initial program 91.5%
associate-+l+91.5%
associate-*l*96.2%
Simplified96.2%
Taylor expanded in z around 0 74.8%
Taylor expanded in x around 0 55.2%
if -1.1000000000000001e34 < t < 2.2000000000000001e-136Initial program 91.6%
associate-+l+91.6%
+-commutative91.6%
fma-define91.6%
associate-*l*90.8%
*-commutative90.8%
*-commutative90.8%
distribute-rgt-out91.8%
*-commutative91.8%
Simplified91.8%
Taylor expanded in y around 0 69.1%
Taylor expanded in z around inf 41.9%
*-commutative41.9%
Simplified41.9%
if 2.2000000000000001e-136 < t < 1.95e40Initial program 95.3%
associate-+l+95.3%
associate-*l*90.9%
Simplified90.9%
Taylor expanded in z around 0 54.3%
Taylor expanded in x around inf 41.3%
Final simplification47.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -9.5e-63) (not (<= a 8e+24))) (* 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 <= -9.5e-63) || !(a <= 8e+24)) {
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 <= (-9.5d-63)) .or. (.not. (a <= 8d+24))) 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 <= -9.5e-63) || !(a <= 8e+24)) {
tmp = a * (t + (z * b));
} else {
tmp = x + (y * z);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -9.5e-63) or not (a <= 8e+24): 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 <= -9.5e-63) || !(a <= 8e+24)) 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 <= -9.5e-63) || ~((a <= 8e+24))) 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, -9.5e-63], N[Not[LessEqual[a, 8e+24]], $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 -9.5 \cdot 10^{-63} \lor \neg \left(a \leq 8 \cdot 10^{+24}\right):\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot z\\
\end{array}
\end{array}
if a < -9.50000000000000016e-63 or 7.9999999999999999e24 < a Initial program 87.0%
associate-+l+87.0%
+-commutative87.0%
fma-define87.0%
associate-*l*93.8%
*-commutative93.8%
*-commutative93.8%
distribute-rgt-out94.6%
*-commutative94.6%
Simplified94.6%
Taylor expanded in y around 0 88.8%
Taylor expanded in x around 0 79.4%
if -9.50000000000000016e-63 < a < 7.9999999999999999e24Initial program 97.6%
associate-+l+97.6%
associate-*l*92.3%
Simplified92.3%
Taylor expanded in b around 0 89.5%
Taylor expanded in a around 0 77.3%
*-commutative77.3%
Simplified77.3%
Final simplification78.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.65e+128) (not (<= t 4.8e-18))) (+ x (* t a)) (+ x (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.65e+128) || !(t <= 4.8e-18)) {
tmp = x + (t * a);
} 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 ((t <= (-1.65d+128)) .or. (.not. (t <= 4.8d-18))) then
tmp = x + (t * a)
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 ((t <= -1.65e+128) || !(t <= 4.8e-18)) {
tmp = x + (t * a);
} else {
tmp = x + (y * z);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.65e+128) or not (t <= 4.8e-18): tmp = x + (t * a) else: tmp = x + (y * z) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.65e+128) || !(t <= 4.8e-18)) tmp = Float64(x + Float64(t * a)); 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 ((t <= -1.65e+128) || ~((t <= 4.8e-18))) tmp = x + (t * a); else tmp = x + (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.65e+128], N[Not[LessEqual[t, 4.8e-18]], $MachinePrecision]], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.65 \cdot 10^{+128} \lor \neg \left(t \leq 4.8 \cdot 10^{-18}\right):\\
\;\;\;\;x + t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot z\\
\end{array}
\end{array}
if t < -1.65e128 or 4.79999999999999988e-18 < t Initial program 91.5%
associate-+l+91.5%
associate-*l*97.1%
Simplified97.1%
Taylor expanded in z around 0 74.8%
if -1.65e128 < t < 4.79999999999999988e-18Initial program 92.7%
associate-+l+92.7%
associate-*l*90.2%
Simplified90.2%
Taylor expanded in b around 0 66.2%
Taylor expanded in a around 0 59.1%
*-commutative59.1%
Simplified59.1%
Final simplification65.6%
(FPCore (x y z t a b) :precision binary64 (if (<= z -1.2e+124) (* z (* a b)) (if (<= z 1.32e-12) (+ x (* t a)) (* a (* z b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.2e+124) {
tmp = z * (a * b);
} else if (z <= 1.32e-12) {
tmp = x + (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 (z <= (-1.2d+124)) then
tmp = z * (a * b)
else if (z <= 1.32d-12) then
tmp = x + (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 (z <= -1.2e+124) {
tmp = z * (a * b);
} else if (z <= 1.32e-12) {
tmp = x + (t * a);
} else {
tmp = a * (z * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -1.2e+124: tmp = z * (a * b) elif z <= 1.32e-12: tmp = x + (t * a) else: tmp = a * (z * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.2e+124) tmp = Float64(z * Float64(a * b)); elseif (z <= 1.32e-12) tmp = Float64(x + 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 (z <= -1.2e+124) tmp = z * (a * b); elseif (z <= 1.32e-12) tmp = x + (t * a); else tmp = a * (z * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.2e+124], N[(z * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.32e-12], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+124}:\\
\;\;\;\;z \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;z \leq 1.32 \cdot 10^{-12}:\\
\;\;\;\;x + t \cdot a\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\end{array}
\end{array}
if z < -1.20000000000000003e124Initial program 78.8%
associate-+l+78.8%
associate-*l*82.1%
Simplified82.1%
Taylor expanded in z around inf 96.9%
+-commutative96.9%
associate-+l+96.9%
+-commutative96.9%
associate-/l*100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in z around inf 91.5%
+-commutative91.5%
Simplified91.5%
Taylor expanded in a around inf 64.5%
if -1.20000000000000003e124 < z < 1.32e-12Initial program 98.1%
associate-+l+98.1%
associate-*l*98.2%
Simplified98.2%
Taylor expanded in z around 0 68.4%
if 1.32e-12 < z Initial program 84.8%
associate-+l+84.8%
+-commutative84.8%
fma-define84.8%
associate-*l*86.4%
*-commutative86.4%
*-commutative86.4%
distribute-rgt-out86.4%
*-commutative86.4%
Simplified86.4%
Taylor expanded in y around 0 65.3%
Taylor expanded in z around inf 44.5%
*-commutative44.5%
Simplified44.5%
Final simplification61.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -9.2e-63) (not (<= a 2.5e-20))) (* t a) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -9.2e-63) || !(a <= 2.5e-20)) {
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 <= (-9.2d-63)) .or. (.not. (a <= 2.5d-20))) 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 <= -9.2e-63) || !(a <= 2.5e-20)) {
tmp = t * a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -9.2e-63) or not (a <= 2.5e-20): tmp = t * a else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -9.2e-63) || !(a <= 2.5e-20)) 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 <= -9.2e-63) || ~((a <= 2.5e-20))) tmp = t * a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -9.2e-63], N[Not[LessEqual[a, 2.5e-20]], $MachinePrecision]], N[(t * a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.2 \cdot 10^{-63} \lor \neg \left(a \leq 2.5 \cdot 10^{-20}\right):\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -9.2e-63 or 2.4999999999999999e-20 < a Initial program 87.3%
associate-+l+87.3%
associate-*l*94.3%
Simplified94.3%
Taylor expanded in z around 0 52.1%
Taylor expanded in x around 0 41.6%
if -9.2e-63 < a < 2.4999999999999999e-20Initial program 98.3%
associate-+l+98.3%
associate-*l*91.5%
Simplified91.5%
Taylor expanded in z around 0 52.7%
Taylor expanded in x around inf 43.3%
Final simplification42.3%
(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 92.2%
associate-+l+92.2%
associate-*l*93.1%
Simplified93.1%
Taylor expanded in z around 0 52.4%
Taylor expanded in x around inf 26.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 2024145
(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)))