
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x + (y * z)) + (t * a)) + ((a * z) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
def code(x, y, z, t, a, b): return ((x + (y * z)) + (t * a)) + ((a * z) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x + (y * z)) + (t * a)) + ((a * z) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x + (y * z)) + (t * a)) + ((a * z) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
def code(x, y, z, t, a, b): return ((x + (y * z)) + (t * a)) + ((a * z) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x + (y * z)) + (t * a)) + ((a * z) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\end{array}
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (+ (+ x (* y z)) (* t a)) (* (* z a) b)))) (if (<= t_1 INFINITY) t_1 (* z (+ y (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = z * (y + (a * b));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b);
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = z * (y + (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = z * (y + (a * b)) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(z * a) * b)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(z * Float64(y + Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b); tmp = 0.0; if (t_1 <= Inf) 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[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(z \cdot a\right) \cdot b\\
\mathbf{if}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < +inf.0Initial program 99.2%
if +inf.0 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 0.0%
*-commutative0.0%
associate-*l*20.0%
Simplified20.0%
Taylor expanded in z around inf 70.6%
Final simplification98.1%
(FPCore (x y z t a b) :precision binary64 (if (<= a 5e+172) (+ (+ (+ x (* y z)) (* t a)) (* z (* a b))) (* a (+ t (* z b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= 5e+172) {
tmp = ((x + (y * z)) + (t * a)) + (z * (a * b));
} else {
tmp = 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 (a <= 5d+172) then
tmp = ((x + (y * z)) + (t * a)) + (z * (a * b))
else
tmp = 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 (a <= 5e+172) {
tmp = ((x + (y * z)) + (t * a)) + (z * (a * b));
} else {
tmp = a * (t + (z * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= 5e+172: tmp = ((x + (y * z)) + (t * a)) + (z * (a * b)) else: tmp = a * (t + (z * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= 5e+172) tmp = Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(z * Float64(a * b))); else tmp = 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 (a <= 5e+172) tmp = ((x + (y * z)) + (t * a)) + (z * (a * b)); else tmp = a * (t + (z * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, 5e+172], N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(z * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 5 \cdot 10^{+172}:\\
\;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\end{array}
\end{array}
if a < 5.0000000000000001e172Initial program 96.2%
*-commutative96.2%
associate-*l*96.5%
Simplified96.5%
if 5.0000000000000001e172 < a Initial program 86.9%
*-commutative86.9%
associate-*l*74.2%
Simplified74.2%
Taylor expanded in a around inf 93.5%
Final simplification96.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -1.45e+148)
(* a (* z b))
(if (<= z -5.6e-54)
(* y z)
(if (<= z -1.02e-169)
(* t a)
(if (<= z -4e-288) x (if (<= z 340000000000.0) (* t a) (* y z)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.45e+148) {
tmp = a * (z * b);
} else if (z <= -5.6e-54) {
tmp = y * z;
} else if (z <= -1.02e-169) {
tmp = t * a;
} else if (z <= -4e-288) {
tmp = x;
} else if (z <= 340000000000.0) {
tmp = t * a;
} else {
tmp = y * z;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-1.45d+148)) then
tmp = a * (z * b)
else if (z <= (-5.6d-54)) then
tmp = y * z
else if (z <= (-1.02d-169)) then
tmp = t * a
else if (z <= (-4d-288)) then
tmp = x
else if (z <= 340000000000.0d0) then
tmp = t * a
else
tmp = y * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.45e+148) {
tmp = a * (z * b);
} else if (z <= -5.6e-54) {
tmp = y * z;
} else if (z <= -1.02e-169) {
tmp = t * a;
} else if (z <= -4e-288) {
tmp = x;
} else if (z <= 340000000000.0) {
tmp = t * a;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -1.45e+148: tmp = a * (z * b) elif z <= -5.6e-54: tmp = y * z elif z <= -1.02e-169: tmp = t * a elif z <= -4e-288: tmp = x elif z <= 340000000000.0: tmp = t * a else: tmp = y * z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.45e+148) tmp = Float64(a * Float64(z * b)); elseif (z <= -5.6e-54) tmp = Float64(y * z); elseif (z <= -1.02e-169) tmp = Float64(t * a); elseif (z <= -4e-288) tmp = x; elseif (z <= 340000000000.0) tmp = Float64(t * a); else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -1.45e+148) tmp = a * (z * b); elseif (z <= -5.6e-54) tmp = y * z; elseif (z <= -1.02e-169) tmp = t * a; elseif (z <= -4e-288) tmp = x; elseif (z <= 340000000000.0) tmp = t * a; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.45e+148], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -5.6e-54], N[(y * z), $MachinePrecision], If[LessEqual[z, -1.02e-169], N[(t * a), $MachinePrecision], If[LessEqual[z, -4e-288], x, If[LessEqual[z, 340000000000.0], N[(t * a), $MachinePrecision], N[(y * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+148}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{-54}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1.02 \cdot 10^{-169}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;z \leq -4 \cdot 10^{-288}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 340000000000:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1.45e148Initial program 76.2%
*-commutative76.2%
associate-*l*86.4%
Simplified86.4%
Taylor expanded in a around inf 68.7%
Taylor expanded in t around 0 63.0%
if -1.45e148 < z < -5.6000000000000004e-54 or 3.4e11 < z Initial program 96.8%
*-commutative96.8%
associate-*l*96.8%
Simplified96.8%
Taylor expanded in y around inf 46.1%
*-commutative46.1%
Simplified46.1%
if -5.6000000000000004e-54 < z < -1.01999999999999996e-169 or -4.00000000000000023e-288 < z < 3.4e11Initial program 100.0%
*-commutative100.0%
associate-*l*94.2%
Simplified94.2%
Taylor expanded in t around inf 52.7%
if -1.01999999999999996e-169 < z < -4.00000000000000023e-288Initial program 99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in x around inf 53.7%
Final simplification51.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (+ t (* z b)))))
(if (<= a -2.8e-40)
t_1
(if (<= a 1.45e-61)
(+ x (* y z))
(if (<= a 4.1e+42) (+ x (* t a)) 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 (a <= -2.8e-40) {
tmp = t_1;
} else if (a <= 1.45e-61) {
tmp = x + (y * z);
} else if (a <= 4.1e+42) {
tmp = x + (t * a);
} 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 = a * (t + (z * b))
if (a <= (-2.8d-40)) then
tmp = t_1
else if (a <= 1.45d-61) then
tmp = x + (y * z)
else if (a <= 4.1d+42) then
tmp = x + (t * a)
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 = a * (t + (z * b));
double tmp;
if (a <= -2.8e-40) {
tmp = t_1;
} else if (a <= 1.45e-61) {
tmp = x + (y * z);
} else if (a <= 4.1e+42) {
tmp = x + (t * a);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a * (t + (z * b)) tmp = 0 if a <= -2.8e-40: tmp = t_1 elif a <= 1.45e-61: tmp = x + (y * z) elif a <= 4.1e+42: tmp = x + (t * a) 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 (a <= -2.8e-40) tmp = t_1; elseif (a <= 1.45e-61) tmp = Float64(x + Float64(y * z)); elseif (a <= 4.1e+42) tmp = Float64(x + Float64(t * a)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a * (t + (z * b)); tmp = 0.0; if (a <= -2.8e-40) tmp = t_1; elseif (a <= 1.45e-61) tmp = x + (y * z); elseif (a <= 4.1e+42) tmp = x + (t * a); else tmp = t_1; end tmp_2 = 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[a, -2.8e-40], t$95$1, If[LessEqual[a, 1.45e-61], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 4.1e+42], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(t + z \cdot b\right)\\
\mathbf{if}\;a \leq -2.8 \cdot 10^{-40}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 1.45 \cdot 10^{-61}:\\
\;\;\;\;x + y \cdot z\\
\mathbf{elif}\;a \leq 4.1 \cdot 10^{+42}:\\
\;\;\;\;x + t \cdot a\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if a < -2.8e-40 or 4.1e42 < a Initial program 90.9%
*-commutative90.9%
associate-*l*89.2%
Simplified89.2%
Taylor expanded in a around inf 81.9%
if -2.8e-40 < a < 1.45e-61Initial program 99.1%
*-commutative99.1%
associate-*l*99.1%
Simplified99.1%
Taylor expanded in a around 0 78.1%
if 1.45e-61 < a < 4.1e42Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in z around 0 81.7%
Final simplification80.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -2.05e+22) (not (<= a 1.5e+47))) (* a (+ t (* z b))) (+ x (+ (* t a) (* y z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -2.05e+22) || !(a <= 1.5e+47)) {
tmp = a * (t + (z * b));
} else {
tmp = x + ((t * a) + (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 <= (-2.05d+22)) .or. (.not. (a <= 1.5d+47))) then
tmp = a * (t + (z * b))
else
tmp = x + ((t * a) + (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 <= -2.05e+22) || !(a <= 1.5e+47)) {
tmp = a * (t + (z * b));
} else {
tmp = x + ((t * a) + (y * z));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -2.05e+22) or not (a <= 1.5e+47): tmp = a * (t + (z * b)) else: tmp = x + ((t * a) + (y * z)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -2.05e+22) || !(a <= 1.5e+47)) tmp = Float64(a * Float64(t + Float64(z * b))); else tmp = Float64(x + Float64(Float64(t * a) + Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -2.05e+22) || ~((a <= 1.5e+47))) tmp = a * (t + (z * b)); else tmp = x + ((t * a) + (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -2.05e+22], N[Not[LessEqual[a, 1.5e+47]], $MachinePrecision]], N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t * a), $MachinePrecision] + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.05 \cdot 10^{+22} \lor \neg \left(a \leq 1.5 \cdot 10^{+47}\right):\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(t \cdot a + y \cdot z\right)\\
\end{array}
\end{array}
if a < -2.0499999999999999e22 or 1.5000000000000001e47 < a Initial program 89.6%
*-commutative89.6%
associate-*l*87.6%
Simplified87.6%
Taylor expanded in a around inf 85.3%
if -2.0499999999999999e22 < a < 1.5000000000000001e47Initial program 99.3%
*-commutative99.3%
associate-*l*99.3%
Simplified99.3%
Taylor expanded in b around 0 89.2%
Final simplification87.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -5.6e-54) (not (<= z 2.55e-8))) (+ x (* z (+ y (* a b)))) (+ x (+ (* t a) (* y z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -5.6e-54) || !(z <= 2.55e-8)) {
tmp = x + (z * (y + (a * b)));
} else {
tmp = x + ((t * a) + (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 <= (-5.6d-54)) .or. (.not. (z <= 2.55d-8))) then
tmp = x + (z * (y + (a * b)))
else
tmp = x + ((t * a) + (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 <= -5.6e-54) || !(z <= 2.55e-8)) {
tmp = x + (z * (y + (a * b)));
} else {
tmp = x + ((t * a) + (y * z));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -5.6e-54) or not (z <= 2.55e-8): tmp = x + (z * (y + (a * b))) else: tmp = x + ((t * a) + (y * z)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -5.6e-54) || !(z <= 2.55e-8)) tmp = Float64(x + Float64(z * Float64(y + Float64(a * b)))); else tmp = Float64(x + Float64(Float64(t * a) + Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -5.6e-54) || ~((z <= 2.55e-8))) tmp = x + (z * (y + (a * b))); else tmp = x + ((t * a) + (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -5.6e-54], N[Not[LessEqual[z, 2.55e-8]], $MachinePrecision]], N[(x + N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t * a), $MachinePrecision] + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.6 \cdot 10^{-54} \lor \neg \left(z \leq 2.55 \cdot 10^{-8}\right):\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(t \cdot a + y \cdot z\right)\\
\end{array}
\end{array}
if z < -5.6000000000000004e-54 or 2.55e-8 < z Initial program 91.4%
*-commutative91.4%
associate-*l*94.1%
Simplified94.1%
Taylor expanded in t around 0 81.4%
+-commutative81.4%
+-commutative81.4%
associate-*r*84.2%
distribute-rgt-in88.6%
Simplified88.6%
if -5.6000000000000004e-54 < z < 2.55e-8Initial program 100.0%
*-commutative100.0%
associate-*l*95.0%
Simplified95.0%
Taylor expanded in b around 0 91.9%
Final simplification90.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -1.22e-54)
(* y z)
(if (<= z -4.6e-169)
(* t a)
(if (<= z -2.2e-288) x (if (<= z 230000000000.0) (* t a) (* y z))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.22e-54) {
tmp = y * z;
} else if (z <= -4.6e-169) {
tmp = t * a;
} else if (z <= -2.2e-288) {
tmp = x;
} else if (z <= 230000000000.0) {
tmp = t * a;
} else {
tmp = y * z;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-1.22d-54)) then
tmp = y * z
else if (z <= (-4.6d-169)) then
tmp = t * a
else if (z <= (-2.2d-288)) then
tmp = x
else if (z <= 230000000000.0d0) then
tmp = t * a
else
tmp = y * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.22e-54) {
tmp = y * z;
} else if (z <= -4.6e-169) {
tmp = t * a;
} else if (z <= -2.2e-288) {
tmp = x;
} else if (z <= 230000000000.0) {
tmp = t * a;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -1.22e-54: tmp = y * z elif z <= -4.6e-169: tmp = t * a elif z <= -2.2e-288: tmp = x elif z <= 230000000000.0: tmp = t * a else: tmp = y * z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.22e-54) tmp = Float64(y * z); elseif (z <= -4.6e-169) tmp = Float64(t * a); elseif (z <= -2.2e-288) tmp = x; elseif (z <= 230000000000.0) tmp = Float64(t * a); else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -1.22e-54) tmp = y * z; elseif (z <= -4.6e-169) tmp = t * a; elseif (z <= -2.2e-288) tmp = x; elseif (z <= 230000000000.0) tmp = t * a; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.22e-54], N[(y * z), $MachinePrecision], If[LessEqual[z, -4.6e-169], N[(t * a), $MachinePrecision], If[LessEqual[z, -2.2e-288], x, If[LessEqual[z, 230000000000.0], N[(t * a), $MachinePrecision], N[(y * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.22 \cdot 10^{-54}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -4.6 \cdot 10^{-169}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;z \leq -2.2 \cdot 10^{-288}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 230000000000:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1.22e-54 or 2.3e11 < z Initial program 91.1%
*-commutative91.1%
associate-*l*93.9%
Simplified93.9%
Taylor expanded in y around inf 42.6%
*-commutative42.6%
Simplified42.6%
if -1.22e-54 < z < -4.6000000000000002e-169 or -2.2000000000000002e-288 < z < 2.3e11Initial program 100.0%
*-commutative100.0%
associate-*l*94.2%
Simplified94.2%
Taylor expanded in t around inf 52.7%
if -4.6000000000000002e-169 < z < -2.2000000000000002e-288Initial program 99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in x around inf 53.7%
Final simplification47.5%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -1.55e+253)
(* a (* z b))
(if (or (<= z -1.32e-52) (not (<= z 1.4e+15)))
(+ x (* y z))
(+ x (* t a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.55e+253) {
tmp = a * (z * b);
} else if ((z <= -1.32e-52) || !(z <= 1.4e+15)) {
tmp = x + (y * z);
} else {
tmp = x + (t * a);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-1.55d+253)) then
tmp = a * (z * b)
else if ((z <= (-1.32d-52)) .or. (.not. (z <= 1.4d+15))) then
tmp = x + (y * z)
else
tmp = x + (t * a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.55e+253) {
tmp = a * (z * b);
} else if ((z <= -1.32e-52) || !(z <= 1.4e+15)) {
tmp = x + (y * z);
} else {
tmp = x + (t * a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -1.55e+253: tmp = a * (z * b) elif (z <= -1.32e-52) or not (z <= 1.4e+15): tmp = x + (y * z) else: tmp = x + (t * a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.55e+253) tmp = Float64(a * Float64(z * b)); elseif ((z <= -1.32e-52) || !(z <= 1.4e+15)) tmp = Float64(x + Float64(y * z)); else tmp = Float64(x + Float64(t * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -1.55e+253) tmp = a * (z * b); elseif ((z <= -1.32e-52) || ~((z <= 1.4e+15))) tmp = x + (y * z); else tmp = x + (t * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.55e+253], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.32e-52], N[Not[LessEqual[z, 1.4e+15]], $MachinePrecision]], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+253}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\mathbf{elif}\;z \leq -1.32 \cdot 10^{-52} \lor \neg \left(z \leq 1.4 \cdot 10^{+15}\right):\\
\;\;\;\;x + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot a\\
\end{array}
\end{array}
if z < -1.55000000000000003e253Initial program 74.1%
*-commutative74.1%
associate-*l*79.9%
Simplified79.9%
Taylor expanded in a around inf 87.1%
Taylor expanded in t around 0 87.2%
if -1.55000000000000003e253 < z < -1.32000000000000002e-52 or 1.4e15 < z Initial program 93.2%
*-commutative93.2%
associate-*l*95.7%
Simplified95.7%
Taylor expanded in a around 0 59.0%
if -1.32000000000000002e-52 < z < 1.4e15Initial program 100.0%
*-commutative100.0%
associate-*l*95.2%
Simplified95.2%
Taylor expanded in z around 0 77.6%
Final simplification69.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1.45e-40) (not (<= z 3.5e-10))) (* z (+ y (* a b))) (+ x (* t a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.45e-40) || !(z <= 3.5e-10)) {
tmp = z * (y + (a * b));
} else {
tmp = x + (t * a);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((z <= (-1.45d-40)) .or. (.not. (z <= 3.5d-10))) then
tmp = z * (y + (a * b))
else
tmp = x + (t * a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.45e-40) || !(z <= 3.5e-10)) {
tmp = z * (y + (a * b));
} else {
tmp = x + (t * a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.45e-40) or not (z <= 3.5e-10): tmp = z * (y + (a * b)) else: tmp = x + (t * a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1.45e-40) || !(z <= 3.5e-10)) tmp = Float64(z * Float64(y + Float64(a * b))); else tmp = Float64(x + Float64(t * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -1.45e-40) || ~((z <= 3.5e-10))) tmp = z * (y + (a * b)); else tmp = x + (t * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1.45e-40], N[Not[LessEqual[z, 3.5e-10]], $MachinePrecision]], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-40} \lor \neg \left(z \leq 3.5 \cdot 10^{-10}\right):\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot a\\
\end{array}
\end{array}
if z < -1.4499999999999999e-40 or 3.4999999999999998e-10 < z Initial program 91.1%
*-commutative91.1%
associate-*l*93.9%
Simplified93.9%
Taylor expanded in z around inf 76.8%
if -1.4499999999999999e-40 < z < 3.4999999999999998e-10Initial program 100.0%
*-commutative100.0%
associate-*l*95.1%
Simplified95.1%
Taylor expanded in z around 0 79.0%
Final simplification77.8%
(FPCore (x y z t a b) :precision binary64 (if (<= z -2.25e+145) (* a (* z b)) (if (<= z 1.06e+92) (+ x (* t a)) (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.25e+145) {
tmp = a * (z * b);
} else if (z <= 1.06e+92) {
tmp = x + (t * a);
} else {
tmp = y * z;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-2.25d+145)) then
tmp = a * (z * b)
else if (z <= 1.06d+92) then
tmp = x + (t * a)
else
tmp = y * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.25e+145) {
tmp = a * (z * b);
} else if (z <= 1.06e+92) {
tmp = x + (t * a);
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -2.25e+145: tmp = a * (z * b) elif z <= 1.06e+92: tmp = x + (t * a) else: tmp = y * z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2.25e+145) tmp = Float64(a * Float64(z * b)); elseif (z <= 1.06e+92) tmp = Float64(x + Float64(t * a)); else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -2.25e+145) tmp = a * (z * b); elseif (z <= 1.06e+92) tmp = x + (t * a); else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2.25e+145], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.06e+92], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision], N[(y * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.25 \cdot 10^{+145}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{+92}:\\
\;\;\;\;x + t \cdot a\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -2.2499999999999999e145Initial program 77.4%
*-commutative77.4%
associate-*l*87.1%
Simplified87.1%
Taylor expanded in a around inf 67.8%
Taylor expanded in t around 0 62.3%
if -2.2499999999999999e145 < z < 1.05999999999999999e92Initial program 99.4%
*-commutative99.4%
associate-*l*96.1%
Simplified96.1%
Taylor expanded in z around 0 66.8%
if 1.05999999999999999e92 < z Initial program 94.8%
*-commutative94.8%
associate-*l*94.9%
Simplified94.9%
Taylor expanded in y around inf 54.9%
*-commutative54.9%
Simplified54.9%
Final simplification64.3%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.22e+27) (* t a) (if (<= t 175000.0) x (* t a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.22e+27) {
tmp = t * a;
} else if (t <= 175000.0) {
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.22d+27)) then
tmp = t * a
else if (t <= 175000.0d0) 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.22e+27) {
tmp = t * a;
} else if (t <= 175000.0) {
tmp = x;
} else {
tmp = t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.22e+27: tmp = t * a elif t <= 175000.0: tmp = x else: tmp = t * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.22e+27) tmp = Float64(t * a); elseif (t <= 175000.0) 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.22e+27) tmp = t * a; elseif (t <= 175000.0) tmp = x; else tmp = t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.22e+27], N[(t * a), $MachinePrecision], If[LessEqual[t, 175000.0], x, N[(t * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.22 \cdot 10^{+27}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;t \leq 175000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\end{array}
if t < -1.2200000000000001e27 or 175000 < t Initial program 94.5%
*-commutative94.5%
associate-*l*92.9%
Simplified92.9%
Taylor expanded in t around inf 54.1%
if -1.2200000000000001e27 < t < 175000Initial program 96.1%
*-commutative96.1%
associate-*l*96.1%
Simplified96.1%
Taylor expanded in x around inf 31.7%
Final simplification42.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 95.3%
*-commutative95.3%
associate-*l*94.5%
Simplified94.5%
Taylor expanded in x around inf 22.3%
Final simplification22.3%
(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 2023293
(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)))